/* More spacing between experience pointers */
.exp-list ul li {
  margin-bottom: 1.1em !important;
}
.theme-text {
  color: #222 !important;
}
body.dark .theme-text {
  color: #fff !important;
}
/* Tech stack pill styles for experience section */
.tech-pill {
  display: inline-block;
  background: var(--pill-bg, #f3f4f6);
  color: var(--pill-fg, #222);
  border-radius: 1em;
  padding: 0.32em 1em;
  font-size: 0.97em;
  font-weight: 600;
  margin: 0.1em 0.18em 0.1em 0;
  box-shadow: 0 1px 6px rgba(0,0,0,0.04);
  border: 1px solid #e5e7eb;
  letter-spacing: 0.01em;
  transition: background 0.2s, color 0.2s;
}
body.dark .tech-pill {
  background: #222c37;
  color: #eaf6ff;
  border: 1px solid #2a3547;
}
/* Hide portfolio images in each portfolio card */
.portfolio-image {
  display: none !important;
}
@media (max-width: 700px) {
  .portfolio-card {
    padding: 1em !important;
    padding-bottom: 1.2em !important;
  }
  .exp-item {
    padding: 0 !important;
  }
  header .wrap {
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
  }

  .portfolio-header-line,
  .portfolio-header-line-container {
    display: none !important;
  }
  div[style*="flex:1;display:flex;align-items:center;align-self: center;"] {
    display: none !important;
  }
  .portfolio-card-6 {
    display: none !important;
  }
  .footer-bar-sep,
  .footer-left span[style*="© 2024 Mayank Madan"] {
    display: none !important;
  }
  /* 1. Header: first line - logo/name left, theme switch right; second line - nav items */
  header .wrap {
    flex-direction: column;
    align-items: stretch;
    padding: 0.7em 0.7em 0 0.7em;
    height: auto;
    gap: 1em;
  }
  /* First line: logo/name left, theme switch right */
  header .wrap > div:first-child {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin-bottom: 0.5em;
    gap: 0.7em;
  }
  header .header-title {
    flex: 1 1 auto;
    min-width: 0;
  }
  header .mode-toggle {
    flex: 0 0 auto;
    margin-left: 0.7em;
    margin-right: 0;
    justify-content: flex-end;
    align-items: center;
    display: flex;
  }
  header .header-title {
    justify-content: center;
    display: flex;
    align-items: center;
    font-size: 1.2em;
    font-weight: 800;
    margin-bottom: 0;
    flex: 1;
  }
  header .mode-toggle {
    margin-left: auto;
    margin-right: 0;
    justify-content: flex-end;
    align-items: center;
    display: flex;
  }
  header nav {
    width: 100%;
    margin-top: 0.2em;
  }
  header nav ul {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 1em;
    justify-content: space-evenly;
    width: 100%;
    font-size: 1.1em;
    padding-bottom: 0.5em;
  }
  /* 2b. Hero greeting font size */
  .hero h1 {
    font-size: 2em !important;
    line-height: 1.2 !important;
  }
  /* 2. Main container padding */
  main {
    padding-left: 3em !important;
    padding-right: 3em !important;
  }
  /* 3. Hide hero-right image section */
  .hero-content > div:last-child,
  .hero-img {
    display: none !important;
  }
  /* 4. Portfolio grid: one card per row */
  .portfolio-grid {
    grid-template-columns: 1fr !important;
    gap: 1.2em 0 !important;
  }
  /* 5. Hide images in writings section */
  .writing-image {
    display: none !important;
  }
}
/* Modern Experience Timeline Styles */
.exp-timeline {
  position: relative;
  margin: 0 auto;
  max-width: 820px;
  padding: 2.5em 0 2.5em 0;
  display: flex;
  flex-direction: column;
  gap: 2.7em;
}
.exp-timeline-item {
  display: flex;
  align-items: flex-start;
  gap: 2.2em;
  position: relative;
  padding: 0.2em 0.2em 0.2em 0.2em;
}
.exp-timeline-dot {
  width: 16px;
  height: 16px;
  background: var(--accent);
  border-radius: 50%;
  margin-top: 0.3em;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  flex-shrink: 0;
  border: 3px solid var(--bg);
  position: relative;
}
.exp-timeline-content {
  background: var(--bg);
  border-radius: 1.1em;
  border: 1px solid var(--border, #e5e7eb);
  box-shadow: 0 2px 12px rgba(0,0,0,0.04);
  padding: 1.7em 1.7em 1.3em 1.7em;
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.7em;
}
.exp-timeline-role {
  font-size: 1.13em;
  font-weight: 800;
  color: var(--fg);
  margin-bottom: 0.18em;
  letter-spacing: 0.01em;
}
.exp-timeline-meta {
  font-size: 0.97em;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 0.18em;
  letter-spacing: 0.01em;
  margin: 0.2em 0 0 0;
  padding-left: 1.2em;
  font-size: 0.99em;
  color: var(--fg);
  line-height: 1.7;
}
.exp-timeline-dates {
  font-size: 0.95em;
  color: var(--accent);
  font-weight: 600;
  margin-left: 0.5em;
}
.exp-timeline-desc {
  font-size: 0.97em;
  color: var(--fg);
  margin-top: 0.1em;
  line-height: 1.6;
  letter-spacing: 0.01em;
}
body.dark .exp-timeline-content {
  background: #19293b;
  border: 1px solid #263040;
  box-shadow: 0 2px 12px rgba(0,0,0,0.13);
}
body.dark .exp-timeline-dot {
  border: 3px solid #19293b;
}
body.dark .exp-timeline-role {
  color: #fff;
}
body.dark .exp-timeline-meta {
  color: #a0aec0;
}
body.dark .exp-timeline-desc {
  color: #e2e8f0;
}
.writings-section {
  flex: 1 0 auto;
}
.footer-bar {
  margin-top: auto !important;
}
.writings-section {
  flex: 1 0 auto;
  margin-top: 0 !important;
}
.footer-bar {
  margin-top: auto !important;
}
/* Experience section improved styles */
.exp-item {
  background: var(--bg);
  box-shadow: none;
  padding: 1.3em 1.1em 1.1em 1.1em;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5em;
  border: none;
  transition: background 0.2s;
}
  /* No hover effect for exp-item */
.exp-role {
  font-size: 1.07em;
  font-weight: 700;
  color: var(--fg);
  margin-bottom: 0.05em;
  letter-spacing: 0.01em;
}
.exp-meta {
  font-size: 0.96em;
  color: var(--muted);
  font-weight: 500;
  margin-bottom: 0.05em;
}
.exp-dates {
  font-size: 0.95em;
  color: var(--accent);
  font-weight: 600;
  margin-left: 0.5em;
}
.exp-desc {
  font-size: 0.97em;
  color: var(--fg);
  margin-top: 0.1em;
  line-height: 1.6;
  letter-spacing: 0.01em;
}
body.dark .exp-item {
  background: #19293b;
  box-shadow: none;
  border: none;
}
/* Divider for experience items */
.exp-divider {
  width: 100%;
  height: 1.5px;
  background: linear-gradient(90deg, var(--border, #e5e7eb) 0%, rgba(0,0,0,0.04) 100%);
  margin: 2.2em 0;
}
body.dark .exp-divider {
  background: linear-gradient(90deg, #263040 0%, #19293b 100%);
}
body.dark .exp-role {
  color: #fff;
}
body.dark .exp-meta {
  color: #a0aec0;
}
body.dark .exp-desc {
  color: #e2e8f0;
}
/* Writings Section Styles */
.writings-section {
  margin-top: 10em;
  margin-bottom: 4em;
}
.writings-header {
  margin-bottom: 2.2em;
  border-bottom: 1px solid #ececec;
  padding-bottom: 1.2em;
}
.writings-title {
  font-size: 1.3em;
  font-weight: 800;
  margin-bottom: 0.3em;
  color: var(--fg);
}
.writings-desc {
  font-size: 1em;
  color: var(--muted);
  margin: 0;
}
.writings-list {
  display: flex;
  flex-direction: column;
  gap: 2.2em;
}
.writing-item {
  display: flex;
  align-items: flex-start;
  gap: 2em;
  border-bottom: 1px solid #ececec;
  padding-bottom: 2em;
}
.writing-info {
  flex: 1;
}
.writing-title {
  font-size: 1em;
  font-weight: 800;
  margin-bottom: 0.3em;
  color: var(--fg);
  margin-top: 0;
}
.writing-summary {
  font-size: 0.97em;
  color: var(--muted);
  margin-bottom: 0.7em;
}
.writing-date {
  font-size: 0.97em;
  color: #888;
}
.writing-image {
  flex-shrink: 0;
  width: 120px;
  height: 120px;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #e0e7ef 0%, #f8fafc 100%);
}
.writing-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 16px;
}
.writings-footer {
  text-align: center;
  margin-top: 2.5em;
}
.writings-btn {
  background: #181818;
  color: #fff;
  border-radius: 2em;
  padding: 0.7em 2em;
  font-weight: 600;
  font-size: 1em;
  box-shadow: none;
  text-decoration: none;
  transition: background 0.2s;
  display: inline-block;
}
.writings-btn:hover {
  background: #232323;
}
@media (max-width: 700px) {
  .writings-section {
    padding: 0 0.5em;
  }
  .writing-item {
    flex-direction: column;
    gap: 1em;
    padding-bottom: 1.2em;
  }
  .writing-image {
    width: 100%;
    height: 160px;
    border-radius: 12px;
  }
  .writing-image img {
    border-radius: 12px;
  }
}
body.dark .footer-logo img {
  filter: invert(1) brightness(1.2) contrast(1.1);
}
body.dark .footer-logo img[alt="X"] {
  filter: unset !important;
}
/* Footer bar styles based on attachment */
/* Footer bar styles - compact, header icon, Google icons */
/* Footer bar styles - compact, header icon, LinkedIn & GitHub circle logos */
.footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5em 0 1.2em 0;
  width: 100%;
  font-size: 0.97em;
  background: none;
  border-top: 1.5px solid #e0e7ef;
  margin-top: 3em;
}
.footer-left {
  display: flex;
  align-items: center;
  gap: 0.5em;
}
.footer-bar-sep {
  font-weight: 400;
  color: var(--muted);
  font-size: 1.1em;
  margin: 0 0.7em;
}
.footer-right {
  display: flex;
  align-items: center;
  gap: 0.7em;
}
.footer-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1em;
  height: 2.1em;
  border-radius: 50%;
  transition: box-shadow 0.2s, background 0.2s;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
  overflow: hidden;
  background-repeat: no-repeat;
  background-size: cover;
}
.footer-logo img {
  width: 1.45em;
  height: 1.45em;
  object-fit: cover;
  display: block;
  border-radius: 50%;
  background-repeat: no-repeat;
  background-size: cover;
}
.footer-logo:hover {
  background: #e0e7ef;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}
body.dark .footer-logo:hover {
  background: #23272f;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18);
}
body.dark .footer-logo:hover img[alt="X"],
body.dark .footer-logo:hover img[alt="GitHub"] {
  filter: invert(1) brightness(1.2) contrast(1.1);
}
body.dark .portfolio-header-line {
  background: linear-gradient(
    90deg,
    rgba(230, 238, 246, 0.18) 0%,
    rgba(230, 238, 246, 0.09) 60%,
    rgba(230, 238, 246, 0) 100%
  ) !important;
}
body.dark .sticky-header {
  background: rgba(18, 18, 22, 0.6);
  border-bottom: 1px solid rgba(80, 80, 80, 0.4);
}
.nav-link.selected {
  color: var(--fg);
  font-weight: 700;
  border-radius: 8px;
  transition: color 0.2s, background 0.2s;
}
body.dark .nav-link.selected {
  color: #fff;
}
.mode-toggle {
  appearance: none;
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--muted);
  font-size: 14px;
  padding: 0;
}
.mode-toggle .toggle-track {
  width: 40px;
  height: 22px;
  background: linear-gradient(90deg, #e0e7ef 0%, #f8fafc 100%);
  border-radius: 11px;
  position: relative;
  transition: background 0.2s, box-shadow 0.2s;
  border: 1px solid #d1d5db;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.07);
}
.mode-toggle .toggle-thumb {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: linear-gradient(135deg, #fff 60%, #e0e7ef 100%);
  border-radius: 50%;
  border: 2px solid #cbd5e1;
  transition: left 0.2s, background 0.2s, border 0.2s;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}
.mode-toggle .toggle-icon {
  font-size: 16px;
  transition: color 0.2s, opacity 0.2s;
}
.mode-toggle .toggle-sun {
  color: #facc15;
  opacity: 1;
}
.mode-toggle .toggle-moon {
  color: #64748b;
  opacity: 0.5;
}
body.dark .mode-toggle .toggle-track {
  background: linear-gradient(90deg, #222e3a 0%, #334155 100%);
  border: 1px solid #334155;
}
body.dark .mode-toggle .toggle-thumb {
  left: 21px;
  background: linear-gradient(135deg, #334155 60%, #0ea5e9 100%);
  border: 2px solid #0ea5e9;
}
body.dark .mode-toggle .toggle-sun {
  opacity: 0.5;
}
body.dark .mode-toggle .toggle-moon {
  color: #f5f3ff;
  opacity: 1;
}
/* Externalized styles from index.html */
:root {
  --bg: #ffffff;
  --fg: #0b0b0b;
  --muted: #6b7280;
  --accent: #0ea5e9;
  --glass: rgba(2, 6, 23, 0.03);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial;
}
/* Header title styling */
.header-title {
  font-size: 1em;
  font-weight: 800;
  color: var(--fg);
  letter-spacing: 0.02em;
  transition: color 0.3s;
}
body.dark .header-title {
  color: #fff;
}
* {
  box-sizing: border-box;
}
html,
body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  -webkit-font-smoothing: antialiased;
}
a {
  color: inherit;
  text-decoration: none;
}
header {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.8);
  /* border-bottom: 1px solid rgba(204, 204, 204, 0.5); */
  border-left: none;
  border-right: none;
  border-radius: 0 0 1rem 1rem;
  /* box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04); */
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  max-width: 80rem;
  margin: 0 auto;
  padding-left: 1.5rem;
  padding-right: 1rem;
  user-select: none;
}
body.dark header {
  background-color: rgba(6, 16, 24, 0.6);
}
.wrap {
  /* gap: 10rem; */
  width: 100%;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
nav ul {
  display: flex;
  gap: 28px;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
}
nav a {
  font-weight: 600;
  color: var(--muted);
  font-size: 14px;
}
main {
  min-height: 93vh;
  display: flex;
  flex-direction: column;
  padding-top: 110px;
  max-width: 1100px;
  margin: 0 auto;
  padding-left: 3em;
  padding-right: 3em;
}

.page {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.footer-bar {
  margin-top: auto;
}
.hero {
  display: flex;
  gap: 36px;
  align-items: flex-start;
}
.hero-left {
  flex: 1;
}
.hero h1 {
  font-size: 2.2em;
  line-height: 1.1;
  margin: 0;
  font-weight: 800;
}
.hero p.lead {
  margin-top: 1.1em;
  color: var(--muted);
  font-size: 1.125em;
  max-width: 42em;
}
.cta-row {
  margin-top: 1.3em;
  display: flex;
  gap: 0.75em;
  align-items: center;
}
.btn {
  padding: 0.625em 0.875em;
  border-radius: 0.625em;
  font-weight: 700;
}
.btn-primary {
  background: var(--fg);
  color: var(--bg);
}
/* Toggle switch for mode */
.mode-toggle {
  appearance: none;
  border: none;
  background: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--muted);
  font-size: 14px;
  padding: 0;
}
.mode-toggle .toggle-track {
  width: 38px;
  height: 20px;
  background: var(--glass);
  border-radius: 10px;
  position: relative;
  transition: background 0.2s;
  border: 1px solid rgba(0, 0, 0, 0.08);
}
.mode-toggle .toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: var(--fg);
  border-radius: 50%;
  transition: left 0.2s, background 0.2s;
}
body.dark .mode-toggle .toggle-track {
  background: #222e3a;
}
body.dark .mode-toggle .toggle-thumb {
  left: 20px;
  background: var(--accent);
}
.projects {
  margin-top: 36px;
}
.projects .grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
.card {
  padding: 1.125em;
  border-radius: 0.75em;
  border: 1px solid rgba(15, 15, 15, 0.04);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), #fff);
}
.projects h3 {
  margin: 0 0 0.375em 0;
  font-size: 1em;
}
.section {
  margin-top: 3em;
}
.two-col {
  display: grid;
  grid-template-columns: 1fr 22.5em;
  gap: 1.25em;
}
.side {
  padding: 1.125em;
  border-radius: 0.75em;
  border: 1px solid rgba(15, 15, 15, 0.04);
  background: #fafafa;
}
footer {
  margin: 3.75em 0 0;
  padding-bottom: 1em;
  color: var(--muted);
  font-size: 0.8125em;
  text-align: center;
}
.muted {
  color: var(--muted);
}
@media (max-width: 900px) {
  .wrap {
    flex-direction: column;
    align-items: flex-start;
    padding: 0 12px;
    height: auto;
  }
  header {
    height: auto;
    padding: 10px 0;
    position: static;
  }
  nav ul {
    gap: 16px;
    flex-wrap: wrap;
    font-size: 15px;
    padding-bottom: 8px;
  }
  .hero {
    flex-direction: column;
    gap: 18px;
  }
  .hero h1 {
    font-size: 32px;
    line-height: 1.1;
  }
  .hero p.lead {
    font-size: 16px;
  }
  main {
    padding-left: 10px;
    padding-right: 10px;
    padding-top: 80px;
  }
  .projects .grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .card {
    padding: 12px;
    font-size: 15px;
  }
  .section {
    margin-top: 32px;
  }
  .two-col {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .side {
    padding: 12px;
    font-size: 15px;
  }
  footer {
    margin: 40px 0 80px;
    font-size: 12px;
  }
}

@media (max-width: 600px) {
  .wrap {
    padding: 0 6px;
  }
  nav ul {
    gap: 10px;
    font-size: 13px;
  }
  .hero h1 {
    font-size: 22px;
  }
  .hero p.lead {
    font-size: 16px;
  }
  .card {
    font-size: 13px;
    padding: 8px;
  }
  .side {
    font-size: 13px;
    padding: 8px;
  }
  main {
    padding-left: 4px;
    padding-right: 4px;
    padding-top: 50px;
  }
  .section {
    margin-top: 18px;
  }
  footer {
    margin: 24px 0 40px;
    font-size: 11px;
  }
}
body.dark {
  --bg: #061018;
  --fg: #e6eef6;
  --muted: #9aa0a6;
}
body.dark,
body.dark html {
  background: #061018 !important;
  min-height: 100vh;
}
body.dark .portfolio-card-1 {
  background: #0a1824 !important;
}
body.dark .portfolio-card-2 {
  background: #0d1c29 !important;
}
body.dark .portfolio-card-3 {
  background: #11202e !important;
}
body.dark .portfolio-card-4 {
  background: #152535 !important;
}
body.dark .portfolio-card-5 {
  background: #19293b !important;
}
body.dark .portfolio-card-6 {
  background: #1d2e41 !important;
}
/* Header icon style and animation */
.header-icon {
  display: inline-block;
  color: var(--fg);
  transition: color 0.3s;
  vertical-align: middle;
}
body.dark .header-icon {
  color: #fff;
}
.header-title:hover .header-icon {
  animation: icon-tilt 0.9s cubic-bezier(0.4, 2, 0.3, 1);
  cursor: pointer;
}
@keyframes icon-tilt {
  0% {
    transform: none;
  }
  40% {
    transform: rotate(-18deg) scale(1.15);
  }
  60% {
    transform: rotate(-18deg) scale(1.15);
  }
  100% {
    transform: none;
  }
}
.highlight-link {
  color: var(--fg);
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1.5px;
  background: none;
  padding: 0 1px;
  border-radius: 2px;
  font-weight: 600;
  transition: color 0.2s;
}
body.dark .highlight-link {
  color: #fff;
}
body.dark .hero-img {
  filter: invert(1) hue-rotate(180deg) contrast(1.05) brightness(0.85);
}
/* Skills grid background and layout */
.skills-category {
  font-size: 1.15em;
  font-weight: 800;
  color: var(--accent);
  margin: 2.2em 0 1.1em 0;
  text-align: left;
  letter-spacing: 0.01em;
}
.skills-grid-bg {
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: center;
  padding-bottom: 3em;
}
.skills-grid {
  background: linear-gradient(135deg, #f8fafc 60%, #e0e7ef 100%);
  border-radius: 1.5em;
  box-shadow: 0 6px 32px rgba(0,0,0,0.07);
  padding: 1.2em 0.7em;
  margin-bottom: 0.5em;
  margin-top: 0;
}
.skill-cell {
  background: rgba(255,255,255,0.85);
  border-radius: 1.2em;
  box-shadow: 0 2px 16px rgba(0,0,0,0.09);
  padding: 0.8em 0.7em 0.4em 0.7em;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: box-shadow 0.18s, transform 0.18s;
  width: 90px;
  height: 100px;
  border: 1.5px solid #e0e7ef;
  position: relative;
  overflow: hidden;
}
.skill-cell img {
  width: 48px;
  height: 48px;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.09));
  transition: transform 0.18s, filter 0.18s;
}
.skill-cell-name {
  margin-top: 0.5em;
  font-size: 0.82em;
  font-weight: 500;
  color: var(--muted);
  text-align: center;
  letter-spacing: 0.01em;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
.skill-cell:hover {
  /* No animation or transform on hover */
}
@media (max-width: 900px) {
  .skills-grid {
    grid-template-columns: repeat(4, 1fr) !important;
    grid-template-rows: auto;
    gap: 1.2em 1em;
    padding: 0.7em 0.3em;
  }
  .skill-cell {
    width: 70px;
    height: 80px;
    padding: 0.5em 0.5em 0.2em 0.5em;
  }
  .skill-cell img {
    width: 32px;
    height: 32px;
  }
  .skill-cell-name {
    font-size: 0.72em;
    margin-top: 0.3em;
  }
}
@media (max-width: 600px) {
  .skills-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    grid-template-rows: auto;
    gap: 0.7em 0.7em;
    padding: 0.3em 0.1em;
  }
  .skill-cell {
    width: 54px;
    height: 60px;
    padding: 0.2em 0.2em 0.1em 0.2em;
  }
  .skill-cell img {
    width: 22px;
    height: 22px;
  }
  .skill-cell-name {
    font-size: 0.62em;
    margin-top: 0.15em;
  }
}
body.dark .skills-category {
  color: #0ea5e9;
}
body.dark .skills-grid {
  background: linear-gradient(135deg, #19293b 60%, #061018 100%);
  box-shadow: 0 6px 32px rgba(0,0,0,0.22);
}
body.dark .skill-cell {
  background: rgba(18, 24, 34, 0.92);
  box-shadow: 0 2px 16px rgba(0,0,0,0.22);
  border: 1.5px solid #19293b;
}
/* Horizontal skills grid styles */
.skills-grid-horizontal {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  border-left: none;   /* remove outer left */
  border-right: none;  /* remove outer right */
  gap: 0;
  justify-content: center;
  align-items: center;
  width: 100%;
  max-width: 100%;
  padding: 2em 0.5em;
  margin: 0;
  position: relative;
  /* Use a lighter theme-compliant grid color, hide outermost lines */
  background-size: calc(100% / 6) 100%, 100% calc(100% / 3);
  background-position: top left;
  background-repeat: no-repeat;
}
body.dark .skills-grid-horizontal {
  background-size: calc(100% / 6) 100%, 100% calc(100% / 3);
  background-position: top left;
  background-repeat: no-repeat;
}
.skill-cell {
  padding: 1em;
  background: none;
  border-radius: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  position: relative;
  overflow: visible;
}
.skill-cell img {
  width: 60px;
  height: 60px;
  object-fit: contain;
  margin-top: 24px;
}
.skill-cell-name {
  margin-top: 0.5em;
  font-size: 0.82em;
  font-weight: 500;
  color: var(--muted);
  text-align: center;
  letter-spacing: 0.01em;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}
@media (max-width: 900px) {
  .skills-grid-horizontal {
    grid-template-columns: repeat(3, 1fr);
    background-size: calc(100% / 3) 100%, 100% calc(100% / 4);
  }
  .skill-cell img {
    width: 38px;
    height: 38px;
    margin-top: 12px;
  }
}
@media (max-width: 600px) {
  .skills-grid-horizontal {
    grid-template-columns: repeat(2, 1fr);
    background-size: calc(100% / 2) 100%, 100% calc(100% / 7);
  }
  .skill-cell img {
    width: 22px;
    height: 22px;
    margin-top: 6px;
  }
}