/* Reset de estilos y box-sizing */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}


/* Variables globales para fuentes, colores y efectos */
:root {
  --font-sans: "Space Grotesk", "Segoe UI", sans-serif;
  --font-mono: "IBM Plex Mono", "Courier New", monospace;
  --font-display: "Oxanium", "Space Grotesk", sans-serif;
  --radius: 4px;
  --radius-soft: 10px;
  --shadow-strong: 0 20px 60px rgba(0, 0, 0, 0.6);
  --shadow-soft: 0 12px 30px rgba(0, 0, 0, 0.35);
  --glow: 0 0 18px rgba(92, 255, 157, 0.35);
  --card-padding: 1.25rem;
  --section-gap: 1.5rem;
}


/* Tema oscuro */
body[data-theme="dark"] {
  --bg: #040908;
  --bg-soft: #0a1210;
  --surface: rgba(8, 18, 15, 0.85);
  --surface-strong: rgba(10, 24, 20, 0.95);
  --text: #d8ffe6;
  --muted: #7db79a;
  --accent: #5cff9d;
  --accent-soft: rgba(92, 255, 157, 0.18);
  --line: rgba(92, 255, 157, 0.16);
  --input-bg: rgba(4, 9, 8, 0.6);
}


/* Tema claro (contraste WCAG AA: texto ≥4.5:1, grandes ≥3:1) */
body[data-theme="light"] {
  --bg: #f7f6f0;
  --bg-soft: #e8e6df;
  --surface: rgba(255, 255, 255, 0.95);
  --surface-strong: rgba(255, 255, 255, 0.98);
  --text: #0f1a16;
  --muted: #3d5046;
  --accent: #1a7d4a;
  --accent-soft: rgba(26, 125, 74, 0.18);
  --line: rgba(26, 125, 74, 0.28);
  --input-bg: rgba(0, 0, 0, 0.04);
}


/* Fondo de acción en tema claro */
body[data-theme="light"] .nav-action {
  background: var(--surface);
}

.nav-action--theme {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.6rem;
}

.theme-icon {
  display: none;
  width: 18px;
  height: 18px;
  color: inherit;
}

.theme-icon svg {
  width: 100%;
  height: 100%;
}

body[data-theme="dark"] .theme-icon--moon {
  display: block;
}

body[data-theme="light"] .theme-icon--sun {
  display: block;
}

#language-toggle .side-nav__label {
  max-width: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-width 0.25s ease, opacity 0.2s ease;
}

#language-toggle:hover .side-nav__label,
#language-toggle:focus-within .side-nav__label {
  max-width: 4em;
  opacity: 1;
}

.side-nav__item.nav-action {
  background: transparent;
  border: none;
  box-shadow: none;
}

.side-nav__item.nav-action:hover {
  background: transparent;
  border: none;
}


/* Estilos generales del body */
body {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-sans);
  color: var(--text);
  background:
    radial-gradient(circle at 10% 20%, rgba(92, 255, 157, 0.32), transparent 45%),
    radial-gradient(circle at 80% 0%, rgba(42, 192, 113, 0.22), transparent 40%),
    linear-gradient(160deg, var(--bg), var(--bg-soft));
  background-attachment: fixed;
  line-height: 1.6;
  padding-bottom: env(safe-area-inset-bottom, 0);
}


/* Bloqueo de scroll durante la pantalla de arranque */
body.boot-locked {
  overflow: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at center, rgba(92, 255, 157, 0.16), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

canvas#bg-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.crt-noise,
.crt-scanlines,
.hud-frame {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.crt-noise {
  background-image:
    radial-gradient(rgba(255, 255, 255, 0.06) 1px, transparent 1px),
    radial-gradient(rgba(0, 0, 0, 0.07) 1px, transparent 1px);
  background-size: 3px 3px, 4px 4px;
  mix-blend-mode: soft-light;
  opacity: 0.4;
}

.crt-scanlines {
  background: repeating-linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.25) 0,
    rgba(0, 0, 0, 0.25) 1px,
    rgba(0, 0, 0, 0) 2px,
    rgba(0, 0, 0, 0) 4px
  );
  opacity: 0.35;
}

.hud-frame {
  border: 1px solid rgba(92, 255, 157, 0.25);
  box-shadow: inset 0 0 0 1px rgba(92, 255, 157, 0.08);
  border-radius: 8px;
  margin: 12px;
}

.boot-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at center, rgba(4, 9, 8, 0.9), rgba(2, 4, 3, 0.98));
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-family: var(--font-display);
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.boot-screen.is-hidden {
  opacity: 0;
  visibility: hidden;
}

.boot-screen__inner {
  display: grid;
  gap: 1.2rem;
  text-align: center;
}

.boot-logo {
  width: clamp(70px, 22vw, 110px);
  height: clamp(70px, 22vw, 110px);
  margin: 0 auto;
  background-color: var(--accent);
    -webkit-mask: url("public/images/tetra-logo.png") center/contain no-repeat;
    mask: url("public/images/tetra-logo.png") center/contain no-repeat;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-filter: drop-shadow(0 0 18px rgba(92, 255, 157, 0.6));
  filter: drop-shadow(0 0 18px rgba(92, 255, 157, 0.6));
  transform-origin: 50% 50%;
  transform-style: preserve-3d;
  will-change: transform;
  animation: boot-spin 4s linear infinite;
}

.boot-screen__label {
  font-size: 1.1rem;
  text-shadow: var(--glow);
}

.boot-screen__bar {
  width: min(320px, 70vw);
  height: 8px;
  border: 1px solid var(--accent);
  box-shadow: var(--glow);
  overflow: hidden;
}

.boot-screen__bar span {
  display: block;
  height: 100%;
  width: 30%;
  background: var(--accent);
  animation: boot-sweep 1.8s linear infinite;
}

.boot-screen__hint {
  font-size: 0.7rem;
  color: var(--muted);
}

@keyframes boot-sweep {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(320%);
  }
}

@keyframes boot-spin {
  0% {
    transform: perspective(600px) rotateY(0deg);
  }
  100% {
    transform: perspective(600px) rotateY(360deg);
  }
}

a {
  color: inherit;
  text-decoration: none;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  letter-spacing: 0.04em;
  line-height: 1.1;
}

h1 {
  font-size: clamp(2.8rem, 5vw, 4.6rem);
}

h2 {
  font-size: clamp(2rem, 3.6vw, 3.2rem);
}

p {
  color: var(--muted);
  font-size: 1.05rem;
}

.muted {
  color: var(--muted);
  font-size: 0.95rem;
}

p + p {
  margin-top: 0.9rem;
}

.page {
  position: relative;
  z-index: 3;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  -webkit-overflow-scrolling: touch;
}

.rail {
  display: flex;
  width: max-content;
  height: 100%;
  will-change: transform;
}

.ghost-button,
.primary-button {
  border: 1px solid var(--line);
  background: var(--surface);
  padding: 0.7rem 1.1rem;
  border-radius: var(--radius);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.ghost-button:hover,
.primary-button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-soft);
  border-color: var(--accent);
}

.primary-button {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
  box-shadow: var(--glow);
}

.mono {
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 12;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 0.5rem;
  padding-bottom: calc(1.75rem + env(safe-area-inset-bottom, 0));
  pointer-events: none;
}

.bottom-nav > * {
  pointer-events: auto;
}

.side-nav {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  flex-shrink: 1;
  min-width: 0;
  padding: 0.5rem 0.75rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  transition: opacity 0.25s ease, max-width 0.3s ease;
  max-width: calc(100vw - 4rem);
}

.side-nav:not(.is-open) {
  opacity: 0;
  pointer-events: none;
  max-width: 0;
  padding-left: 0;
  padding-right: 0;
  overflow: hidden;
}

body.nav-overlay-open {
  overflow: hidden;
}

.nav-toggle {
  flex-shrink: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--accent);
  border-radius: 999px;
  width: 40px;
  height: 40px;
  min-width: 40px;
  min-height: 40px;
  display: grid;
  place-items: center;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  transition: transform 0.2s ease, box-shadow 0.2s ease, border 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.nav-toggle:hover {
  border-color: var(--accent);
  box-shadow: var(--glow);
}

.nav-toggle svg {
  transition: transform 0.25s ease;
}

.nav-toggle.is-open svg {
  transform: rotate(180deg);
}

.side-nav__list {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}

.side-nav__item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  padding: 0.35rem 0.5rem;
  font-weight: 600;
  font-size: 0.8rem;
  transition: color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}

.side-nav__item:hover {
  color: var(--accent);
}

.side-nav__item.is-active {
  color: var(--accent);
}

.side-nav__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: inherit;
}

.side-nav__icon svg {
  width: 100%;
  height: 100%;
}

.side-nav__label {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.68rem;
  white-space: nowrap;
  max-width: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-width 0.25s ease, opacity 0.2s ease;
}

.side-nav__item:hover .side-nav__label,
.side-nav__item.is-active .side-nav__label {
  max-width: 12em;
  opacity: 1;
}

.side-nav__divider {
  width: 1px;
  height: 16px;
  background: var(--line);
  opacity: 0.7;
  margin: 0 0.15rem;
  flex-shrink: 0;
}

.nav-action {
  border: 1px solid var(--line);
  background: rgba(8, 14, 12, 0.8);
  color: var(--text);
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font-weight: 600;
  transition: border 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.nav-action:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  box-shadow: var(--shadow-soft);
}

.section {
  padding: clamp(2rem, 6vw, 7rem) clamp(1rem, 5vw, 7rem);
  padding-bottom: clamp(5.5rem, 12vw, 8rem);
  min-height: 100vh;
  min-height: 100dvh;
  height: 100vh;
  height: 100dvh;
  width: 100vw;
  flex: 0 0 100vw;
  display: flex;
  align-items: center;
  overflow-y: auto;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
  scroll-margin-top: 120px;
  transform-style: preserve-3d;
  transform: perspective(1100px) rotateY(var(--tilt, 0deg)) translateZ(var(--depth, 0px)) scale(var(--scale, 1));
  opacity: var(--fade, 1);
  -webkit-filter: blur(var(--blur, 0px));
  filter: blur(var(--blur, 0px));
  transition: transform 0.4s ease, opacity 0.4s ease, filter 0.4s ease;
}

#experience.section {
  padding-top: clamp(1.5rem, 4vw, 3.5rem);
  padding-bottom: clamp(2.5rem, 6vw, 5rem);
  align-items: flex-start;
}

#experience .section__content {
  gap: var(--section-gap);
  display: flex;
  flex-direction: column;
  max-width: 100%;
}

#experience .timeline {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  gap: var(--section-gap);
  width: 100%;
  min-width: 0;
}

#experience .timeline-card {
  flex: 1 1 0;
  min-width: 0;
  padding: var(--card-padding);
}

.section__content {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  display: grid;
  gap: var(--section-gap);
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  align-items: start;
}

.section__header {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.eyebrow {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.3em;
  font-size: 0.75rem;
  color: var(--accent);
}

.hero {
  padding-top: clamp(2rem, 6vw, 4rem);
}

.hero__intro {
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
}

.hero__cta {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.hero__cta .primary-button {
  color: #0a1612;
  background: rgba(180, 255, 215, 0.95);
  box-shadow: 0 0 20px rgba(92, 255, 157, 0.4);
}

.hero__cta .primary-button:hover {
  background: rgba(160, 255, 205, 0.98);
}

@supports (background: color-mix(in srgb, red, blue)) {
  .hero__cta .primary-button {
    background: color-mix(in srgb, var(--accent) 78%, #ffffff 22%);
  }
  .hero__cta .primary-button:hover {
    background: color-mix(in srgb, var(--accent) 68%, #ffffff 32%);
  }
}

#home .section__content {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: var(--section-gap);
  align-items: center;
  max-width: 1200px;
  width: 100%;
}

.hero__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  gap: 1rem;
  min-height: 0;
  align-items: stretch;
}

.stat-card {
  padding: var(--card-padding);
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  transition: transform 0.2s ease;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  min-height: 0;
}

.stat-card::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px dashed rgba(92, 255, 157, 0.2);
  border-radius: calc(var(--radius) - 2px);
  pointer-events: none;
}

.stat-card:hover {
  transform: translateY(-4px);
}

.stat-title {
  font-size: 1.1rem;
  color: var(--text);
  font-weight: 600;
}

.stat-desc {
  font-size: 0.95rem;
}

.two-col {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.about-content {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto;
  gap: var(--section-gap);
  align-items: start;
  width: 100%;
  max-width: 100%;
  min-width: 0;
}

.about-content .about-text {
  min-width: 0;
  overflow-wrap: break-word;
  word-break: break-word;
}

.about-content .about-aside {
  display: block;
  min-width: 0;
}

.about-content .stack-panel {
  grid-column: 1 / -1;
  margin-top: 0.5rem;
  min-width: 0;
  width: 100%;
}

.about-aside {
  display: grid;
  gap: 1.6rem;
}

.profile-card {
  border-radius: var(--radius-soft);
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-strong);
  position: relative;
  max-width: 300px;
  width: 100%;
  justify-self: center;
}

.profile-card::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, 0.45));
  pointer-events: none;
}

.profile-image {
  display: block;
  width: 100%;
  height: auto;
  max-height: 100%;
  object-fit: cover;
  object-position: center top;
}

@supports (aspect-ratio: 4 / 5) {
  .profile-image {
    aspect-ratio: 4 / 5;
    height: 100%;
  }
}

.stack-panel {
  padding: var(--card-padding);
  border-radius: var(--radius);
  background: var(--surface-strong);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  min-width: 0;
}

.panel-title {
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--text);
}

.pill-group {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(6rem, 1fr));
  gap: 0.5rem;
  align-items: center;
}

.stack-panel .pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.stack-panel .pill {
  overflow: visible;
  text-overflow: unset;
  white-space: nowrap;
  width: max-content;
  min-width: 0;
}

.pill {
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
  box-sizing: border-box;
}

.timeline {
  display: grid;
  gap: var(--section-gap);
}

.timeline-card {
  padding: var(--card-padding);
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  display: grid;
  gap: 0.75rem;
  position: relative;
}

.timeline-card::before {
  content: "";
  position: absolute;
  top: 12px;
  right: 12px;
  width: 10px;
  height: 10px;
  border: 1px solid var(--accent);
  box-shadow: var(--glow);
}

.tag {
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 0.8rem;
  font-weight: 600;
  width: fit-content;
}

.grid-4,
.grid-3 {
  display: grid;
  gap: 1.2rem;
}

.grid-4 {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.grid-3 {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.soft-skill {
  padding: var(--card-padding);
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  font-weight: 600;
  text-align: center;
}

.language-list {
  display: grid;
  gap: var(--section-gap);
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.language-item {
  padding: var(--card-padding);
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
}

.language-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
  color: var(--text);
  font-weight: 600;
}

.language-row .tag {
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
}


.project-card {
  padding: var(--card-padding);
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: 0.75rem;
  cursor: pointer;
  transition: transform 0.2s ease, border 0.2s ease;
  max-width: 400px;
  min-width: 0;
  width: 100%;
}

.project-card:hover {
  box-shadow: 0 0 24px rgba(92, 255, 157, 0.25);
  transform: translateY(-6px);
  border-color: var(--accent);
}

.project-title {
  font-weight: 700;
  color: var(--text);
  font-size: 0.95rem;
}

.project-desc {
  flex-grow: 1;
}

.project-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.project-meta {
  display: grid;
  gap: 0.6rem;
  margin-top: auto;
}

#projects.section {
  padding-top: clamp(1.5rem, 4vw, 3.5rem);
  padding-bottom: clamp(2.5rem, 6vw, 5rem);
  align-items: flex-start;
}

#projects .section__content {
  gap: var(--section-gap);
  display: flex;
  flex-direction: column;
  max-width: 100%;
  width: 100%;
}

#projects .section__header {
  flex-shrink: 0;
}

#projects .timeline {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  gap: var(--section-gap);
  width: 100%;
  min-width: 0;
}

#projects .timeline-card {
  flex: 1 1 calc(33.333% - var(--section-gap) * 2 / 3);
  min-width: min(100%, 280px);
  padding: var(--card-padding);
  cursor: pointer;
  transition: transform 0.2s ease, border 0.2s ease, box-shadow 0.2s ease;
}

#projects .timeline-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 24px rgba(92, 255, 157, 0.25);
  transform: translateY(-4px);
}

.timeline-card.project-card {
  display: grid;
  max-width: none;
}

.contact-form {
  display: grid;
  gap: 1rem;
  padding: var(--card-padding);
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  position: relative;
}

.contact-form::after {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px dashed rgba(92, 255, 157, 0.2);
  border-radius: calc(var(--radius) - 2px);
  pointer-events: none;
}

.field {
  display: grid;
  gap: 0.4rem;
  grid-template-columns: 1fr;
}

.field label {
  font-weight: 600;
  color: var(--text);
}

.field input,
.field textarea {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
  padding: 0.8rem 1rem;
  padding-right: 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--input-bg);
  color: var(--text);
  font-family: var(--font-sans);
  min-width: 0;
}

.field input[type="email"] {
  padding-right: 2.5rem;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.field-error {
  color: #ff7a7a;
  font-size: 0.85rem;
  min-height: 1rem;
}

.form-status {
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.modal.is-open {
  display: flex;
}

.modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.modal__content {
  position: relative;
  background: var(--surface-strong);
  border-radius: var(--radius-soft);
  border: 1px solid var(--line);
  padding: 1.5rem;
  max-width: 680px;
  width: 90vw;
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  z-index: 1;
  box-shadow: var(--shadow-strong);
  margin: 1rem;
}

.modal__close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  border: none;
  background: var(--accent-soft);
  color: var(--text);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
}

.modal__body {
  display: grid;
  gap: 1rem;
}

.modal__actions {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

[data-reveal] {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

[data-reveal].is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 900px) {
  .section__content {
    grid-template-columns: 1fr;
    gap: 1.8rem;
    max-width: 100%;
  }
  .section {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
    padding-bottom: 6rem;
  }
  .side-nav__list {
    flex-wrap: wrap;
    max-height: 50vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  .bottom-nav {
    flex-wrap: wrap;
    justify-content: center;
  }
  .side-nav {
    max-width: calc(100vw - 3.5rem);
  }
  .grid-3 {
    grid-template-columns: 1fr;
    min-width: 0;
  }
  #projects .section__content {
    gap: var(--section-gap);
  }
  #projects .timeline-card {
    flex: 1 1 calc(50% - var(--section-gap) / 2);
    min-width: min(100%, 260px);
  }
  #projects .section__header .eyebrow {
    font-size: 0.7rem;
  }
  #projects .section__header h2 {
    font-size: clamp(1.4rem, 4vw, 2rem);
  }
  #experience .timeline {
    flex-wrap: wrap;
    flex-direction: row;
  }
  #experience .timeline-card {
    flex: 1 1 min(100%, 280px);
  }
  #projects .timeline-card {
    flex: 1 1 calc(50% - var(--section-gap) / 2);
    min-width: min(100%, 260px);
  }
  .grid-4 {
    grid-template-columns: repeat(2, 1fr);
    min-width: 0;
  }
  #home .section__content {
    grid-template-columns: 1fr;
    gap: var(--section-gap);
  }
  .hero {
    padding-top: clamp(4rem, 10vw, 6rem);
  }
  .hero__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    min-height: 200px;
  }
  .stat-card {
    padding: var(--card-padding);
  }
  .two-col {
    grid-template-columns: 1fr;
  }
  .about-content {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    gap: 1.25rem;
  }
  .about-content .about-aside {
    justify-self: center;
  }
  .about-content .stack-panel {
    grid-column: 1;
    margin-top: 0;
  }
  .profile-card {
    max-width: 280px;
    width: 100%;
  }
  .stack-panel {
    padding: var(--card-padding);
  }
  .stack-panel .pill {
    font-size: 0.82rem;
  }
  .contact-form {
    padding: var(--card-padding);
  }
  .hud-frame {
    margin: 8px;
  }
}

@media (max-width: 768px) {
  .side-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    height: 100vh;
    height: 100dvh;
    max-width: none;
    padding: 2rem 1.5rem;
    padding-bottom: calc(5rem + env(safe-area-inset-bottom, 0));
    border-radius: 0;
    z-index: 14;
    background: var(--surface-strong);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    align-items: center;
    justify-content: center;
    opacity: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .side-nav:not(.is-open) {
    visibility: hidden;
    opacity: 0;
    pointer-events: none;
    max-width: none;
    padding: 0;
    transition: opacity 0.3s ease, visibility 0.3s ease;
  }

  .side-nav.is-open {
    visibility: visible;
    pointer-events: auto;
  }

  .side-nav__list {
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    max-height: none;
  }

  .side-nav__item {
    width: 100%;
    max-width: 280px;
    justify-content: center;
    padding: 0.75rem 1rem;
    font-size: 0.95rem;
  }

  .side-nav__item .side-nav__label {
    max-width: 12em;
    opacity: 1;
  }

  .side-nav__divider {
    width: 100%;
    max-width: 280px;
    height: 1px;
    margin: 0.5rem 0;
  }

  .bottom-nav .nav-toggle {
    position: relative;
    z-index: 16;
  }
}

@media (max-width: 700px) {
  .hero__cta {
    flex-direction: column;
    align-items: flex-start;
  }
  .side-nav {
    padding: 0.5rem 0.6rem;
    max-width: calc(100vw - 3.5rem);
  }
  .side-nav__list {
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.35rem;
  }
  .side-nav__item {
    padding: 0.35rem 0.45rem;
    font-size: 0.75rem;
  }
  .side-nav__label {
    font-size: 0.62rem;
    letter-spacing: 0.06em;
  }
  .side-nav__divider {
    width: 100%;
    height: 1px;
    margin: 0.15rem 0;
  }
  .nav-action {
    padding: 0.3rem 0.5rem;
    font-size: 0.75rem;
    min-height: 44px;
  }
  .nav-toggle {
    width: 44px;
    height: 44px;
    min-width: 44px;
    min-height: 44px;
  }
  .side-nav__item {
    min-height: 44px;
  }
  .section {
    padding: 1.5rem 1rem;
    padding-bottom: 5.5rem;
  }
  .section__content {
    gap: 1.4rem;
  }
  #experience .timeline {
    flex-direction: column;
    flex-wrap: nowrap;
  }
  #experience .timeline-card {
    flex: 1 1 auto;
  }
  .timeline-card {
    padding: var(--card-padding);
  }
  #projects .timeline {
    flex-direction: column;
    flex-wrap: nowrap;
  }
  #projects .timeline-card {
    flex: 1 1 auto;
    min-width: 0;
  }
  .boot-screen__bar {
    width: min(280px, 85vw);
  }
  .about-content {
    gap: 1rem;
  }
  .about-content .about-text h2 {
    font-size: clamp(1.5rem, 5vw, 2.2rem);
  }
  .about-content .about-text p {
    font-size: 0.95rem;
  }
  .profile-card {
    max-width: 100%;
  }
  .stack-panel .panel-title {
    font-size: 0.95rem;
  }
  .stack-panel .pill {
    font-size: 0.78rem;
    padding: 0.35rem 0.7rem;
  }
}

@media (max-width: 500px) {
  .section__content {
    gap: 1.2rem;
  }
  .side-nav {
    padding: 0.45rem 0.5rem;
  }
  .side-nav__item {
    padding: 0.3rem 0.4rem;
    font-size: 0.7rem;
  }
  .side-nav__label {
    font-size: 0.58rem;
  }
  .side-nav__icon {
    width: 16px;
    height: 16px;
  }
  .side-nav__icon svg {
    width: 16px;
    height: 16px;
  }
  .grid-4 {
    grid-template-columns: 1fr;
  }
  .hero__grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
    min-height: 0;
  }
  .stat-card {
    padding: var(--card-padding);
  }
  .stat-title {
    font-size: 1rem;
  }
  .stat-desc {
    font-size: 0.9rem;
  }
  #projects .timeline-card {
    flex: 1 1 auto;
    min-width: 0;
  }
  .contact-form {
    padding: 1rem;
  }
  .modal__content {
    padding: 1.25rem;
    margin: 0.75rem;
    width: calc(100vw - 1.5rem);
  }
  .pill {
    padding: 0.35rem 0.6rem;
    font-size: 0.78rem;
  }
  .about-content {
    gap: 0.9rem;
  }
  .about-content .about-text p {
    font-size: 0.92rem;
  }
  .stack-panel {
    padding: 1rem;
  }
  .stack-panel .pill-group {
    gap: 0.4rem;
  }
  .stack-panel .pill {
    font-size: 0.75rem;
    padding: 0.3rem 0.6rem;
  }
  h1 {
    font-size: clamp(2rem, 8vw, 3rem);
  }
  h2 {
    font-size: clamp(1.6rem, 6vw, 2.5rem);
  }
  p {
    font-size: 0.98rem;
  }
}

@media (max-width: 380px) {
  .side-nav__list {
    gap: 0.25rem;
  }
  .side-nav__label {
    max-width: 10em;
    overflow: visible;
    white-space: nowrap;
  }
}
