@font-face {
  font-family: "Geist";
  src: url("/assets/fonts/Geist-Variable.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: "Geist";
  src: url("/assets/fonts/Geist-Italic-Variable.woff2") format("woff2");
  font-style: italic;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  color-scheme: light;

  --color-cobalt-deep: #1b3fcc;
  --color-cobalt-core: #2e55ee;
  --color-cobalt-light: #7eadff;
  --color-cobalt-mist: #eef2ff;

  --color-canvas: #fbfaf8;
  --color-surface: #ffffff;
  --color-text-primary: #0a0a0b;
  --color-text-strong: #27272a;
  --color-text-secondary: #52525b;
  --color-text-muted: #71717a;
  --color-border: #ececf0;
  --color-success: #168858;

  --radius-sm: 10px;
  --radius-md: 18px;
  --radius-lg: 28px;
  --shadow-card: 0 18px 48px rgb(20 24 40 / 7%);

  --container-width: 1200px;
  --header-offset: 92px;

  --font-sans: "Geist", system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,
    "Liberation Mono", "Courier New", monospace;

  /* Compatibility aliases used by the existing HTML and page styles. */
  --bg: var(--color-canvas);
  --text: var(--color-text-primary);
  --muted: var(--color-text-muted);
  --line: var(--color-border);
  --blue2: var(--color-cobalt-core);
  --green: var(--color-success);
  --font: var(--font-sans);
  --r1: var(--radius-sm);
  --r2: var(--radius-md);
  --r3: var(--radius-lg);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  width: 100%;
  max-width: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-offset);
  overflow-x: hidden;
}

body {
  width: 100%;
  min-width: 0px;
  max-width: 100%;
  margin: 0;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 10% 4%, rgb(102 118 255 / 10%), transparent 28rem),
    radial-gradient(circle at 88% 18%, rgb(79 215 210 / 10%), transparent 25rem),
    var(--color-canvas);
  color: var(--color-text-primary);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

img,
picture,
svg {
  display: block;
  max-width: 100%;
}

button,
input,
textarea,
select {
  font: inherit;
}

a {
  color: inherit;
}

h1,
h2,
h3,
p,
figure {
  margin-top: 0;
}

h1,
h2,
h3 {
  color: var(--color-text-primary);
  line-height: 1.06;
  letter-spacing: -0.04em;
}

h1 {
  max-width: 760px;
  margin-bottom: 24px;
  font-size: clamp(3rem, 6vw, 5.8rem);
}

h2 {
  max-width: 780px;
  margin: 0;
  font-size: clamp(2.25rem, 4vw, 4.1rem);
}

h3 {
  font-size: clamp(1.7rem, 2.5vw, 2.5rem);
}

.shell {
  width: min(calc(100% - 40px), var(--container-width));
  max-width: 100%;
  margin-inline: auto;
}

.skip {
  position: fixed;
  z-index: 999;
  top: 10px;
  left: 10px;
  padding: 10px 14px;
  transform: translateY(-160%);
  border-radius: var(--radius-sm);
  background: var(--color-text-primary);
  color: #ffffff;
  font-weight: 700;
  text-decoration: none;
}

.skip:focus {
  transform: none;
}

/* Header and navigation */
.header {
  position: sticky;
  z-index: 100;
  top: 0;
  padding-block: 12px;
  transition: background-color 180ms ease, box-shadow 180ms ease;
}

.header.scrolled {
  background: rgb(251 250 248 / 88%);
  box-shadow: 0 1px var(--color-border);
  backdrop-filter: blur(18px);
}

.nav {
  display: flex;
  min-height: 60px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  color: var(--color-text-primary);
  font-weight: 800;
  text-decoration: none;
}

.navlinks {
  display: flex;
  align-items: center;
  gap: 28px;
}

.navlinks a {
  padding: 6px 4px;
  border-radius: 8px;
  color: var(--color-text-muted);
  font-size: 0.92rem;
  font-weight: 700;
  text-decoration: none;
}

.navlinks a:hover {
  color: var(--color-text-primary);
}

.menu {
  display: none;
  min-width: 44px;
  min-height: 44px;
  padding: 10px 13px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: var(--color-surface);
  color: var(--color-text-primary);
  font-size: 0.9rem;
  font-weight: 700;
}

.brand:focus-visible,
.navlinks a:focus-visible,
.menu:focus-visible,
a:focus-visible,
button:focus-visible {
  outline: 3px solid rgb(46 85 238 / 24%);
  outline-offset: 4px;
}

/* Shared text and actions */
.eyebrow {
  margin-bottom: 18px;
  color: var(--color-cobalt-core);
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.lead {
  max-width: 710px;
  margin-bottom: 28px;
  color: var(--color-text-muted);
  font-size: clamp(1.14rem, 1.7vw, 1.42rem);
}

.actions,
.contact-actions,
.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.inline-actions {
  margin-top: 20px;
}

.btn {
  display: inline-flex;
  min-height: 50px;
  align-items: center;
  justify-content: center;
  padding: 0 20px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  font-weight: 800;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease,
    background-color 160ms ease;
}

.btn:hover {
  transform: translateY(-2px);
}

.btn.primary,
.primary {
  background: var(--color-cobalt-core);
  color: #ffffff;
  box-shadow: 0 14px 30px rgb(27 63 204 / 18%);
}

.btn.secondary,
.secondary {
  border-color: rgb(24 24 27 / 18%);
  background: rgb(255 255 255 / 76%);
  color: var(--color-text-primary);
}

.btn-disabled {
  opacity: 0.62;
  cursor: not-allowed;
  pointer-events: none;
}

/* Home hero */
.hero {
  display: grid;
  min-height: calc(100vh - 84px);
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  align-items: center;
  gap: clamp(48px, 7vw, 96px);
  padding-block: clamp(60px, 8vw, 96px);
}

.hero-copy {
  min-width: 0;
  position: relative;
  z-index: 2;
  padding-right: clamp(24px, 4vw, 48px);
}

.hero-copy h1 {
  max-width: 680px;
  margin: 0;
  padding-right: clamp(24px, 4vw, 48px);
}

.hero > * {
  min-width: 0;
}

.status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
  color: var(--color-text-muted);
  font-size: 0.92rem;
}

.status i {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--color-success);
  box-shadow: 0 0 0 5px rgb(22 136 88 / 10%);
}

.hero-art {
  position: relative;
  display: grid;
  min-width: 0;
  z-index: 1;
  place-items: center;
}

.hero-profile {
  position: relative;
  width: min(100%, 460px);
  aspect-ratio: 4 / 5;
  margin: 0;
  overflow: hidden;
  border: 1px solid rgb(46 85 238 / 16%);
  border-radius: clamp(24px, 3vw, 32px);
  background: var(--color-cobalt-mist);
  box-shadow:
    0 24px 70px rgb(27 63 204 / 12%),
    0 8px 24px rgb(10 10 11 / 6%);
}

.hero-profile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

.hero-profile-card {
  position: absolute;
  right: 16px;
  bottom: 16px;
  left: 16px;
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 16px 18px;
  border: 1px solid rgb(255 255 255 / 72%);
  border-radius: 16px;
  background: rgb(255 255 255 / 88%);
  box-shadow: 0 12px 32px rgb(10 10 11 / 10%);
  backdrop-filter: blur(16px);
}

.hero-profile-card strong {
  font-size: 0.95rem;
  line-height: 1.3;
}

.hero-profile-card span {
  color: var(--color-text-secondary);
  font-size: 0.72rem;
  line-height: 1.45;
  letter-spacing: 0.02em;
}

/* Home sections */
.block {
  padding-block: clamp(80px, 10vw, 132px);
}

.section-title {
  display: grid;
  gap: 22px;
  margin-bottom: clamp(36px, 5vw, 56px);
}

.projects {
  display: grid;
  gap: 32px;
}

.project {
  display: grid;
  min-width: 0;
  overflow: hidden;
  grid-template-columns: minmax(0, 1.08fr) minmax(360px, 0.92fr);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: rgb(255 255 255 / 68%);
  box-shadow: var(--shadow-card);
}

.project > * {
  min-width: 0;
}

.project-cover {
  position: relative;
  min-width: 0;
  min-height: 600px;
  overflow: hidden;
}

.project-cover img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.project-cover.forumgo {
  background: #f3f0ff;
}

.project-cover.pago {
  background: #e9fbf4;
}

.project-cover.subtrack {
  background: #edf4ff;
}

.copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: space-between;
  gap: 30px;
  padding: clamp(32px, 4.5vw, 64px);
}

.project-category {
  margin-bottom: 16px;
  color: var(--color-cobalt-core);
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1.45;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.copy h3 {
  margin-bottom: 16px;
}

.summary {
  max-width: 56ch;
  margin-bottom: 0;
  color: var(--color-text-secondary);
  font-size: 1.06rem;
}

.project-meta,
.project-outcome {
  display: grid;
  gap: 16px;
}

.meta-row {
  display: grid;
  grid-template-columns: minmax(92px, 0.55fr) minmax(0, 1.45fr);
  align-items: start;
  gap: 16px;
}

.meta-row .label,
.project-outcome .label {
  color: var(--color-text-muted);
  font-family: var(--font-sans);
  font-size: 0.72rem;
  font-weight: 650;
  line-height: 1.5;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.meta-row span:last-child {
  color: var(--color-text-primary);
  font-size: 0.96rem;
  line-height: 1.6;
}

.project-outcome p {
  margin: 0;
  color: var(--color-text-secondary);
  line-height: 1.7;
}

.project-outcome .label {
  display: block;
  margin-bottom: 6px;
  color: var(--color-text-primary);
}

.copy > .btn,
.copy > button {
  width: max-content;
}

.skills {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.skills article {
  min-width: 0;
  min-height: 272px;
  padding: 28px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: rgb(255 255 255 / 68%);
}

.skills span {
  display: block;
  margin-bottom: 52px;
  color: var(--color-cobalt-core);
  font-size: 0.76rem;
  font-weight: 800;
}

.skills h3 {
  margin-bottom: 14px;
  font-size: 1.35rem;
}

.skills p {
  margin: 0;
  color: var(--color-text-secondary);
}

.about {
  display: grid;
  grid-template-columns: minmax(240px, 0.85fr) minmax(0, 1.15fr);
  gap: clamp(48px, 8vw, 112px);
}

.about .section-title {
  margin: 0;
}

.about-copy {
  max-width: 680px;
}

.about-copy > p {
  color: var(--color-text-secondary);
  font-size: 1.1rem;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 32px;
}

.tags span {
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: rgb(255 255 255 / 68%);
  font-size: 0.88rem;
  font-weight: 700;
}

.resume-panel,
.contact {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 280px);
  align-items: center;
  gap: clamp(32px, 5vw, 64px);
  padding: clamp(32px, 5vw, 64px);
  border: 1px solid rgb(255 255 255 / 72%);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 86% 8%, rgb(79 215 210 / 38%), transparent 24rem),
    radial-gradient(circle at 14% 100%, rgb(168 121 255 / 32%), transparent 24rem),
    rgb(255 255 255 / 72%);
  box-shadow: 0 25px 80px rgb(35 36 46 / 10%);
}

.resume-copy {
  max-width: 640px;
}

.resume-copy h2,
.contact h2 {
  margin: 12px 0 16px;
}

.resume-copy p:last-child,
.contact p:not(.eyebrow) {
  margin-bottom: 0;
  color: var(--color-text-secondary);
  font-size: 1.06rem;
}

.resume-actions,
.contact-actions {
  display: grid;
  width: 100%;
  max-width: 280px;
  justify-self: end;
  gap: 12px;
}

.resume-actions .btn,
.contact-actions .btn {
  width: 100%;
  min-height: 52px;
}

/* Footer and reveal */
footer,
.footer {
  padding-block: 28px 24px;
  border-top: 1px solid var(--color-border);
}

.foot,
.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px;
  color: var(--color-text-muted);
  font-size: 0.85rem;
}

.foot p,
.footer-inner p {
  margin: 0;
}

.foot a,
.footer-inner a {
  font-weight: 800;
  text-decoration: none;
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 500ms ease, transform 500ms ease;
}

.reveal.show {
  opacity: 1;
  transform: none;
}

/* Responsive */
@media (min-width: 1281px) {
  .nav {
    min-height: 72px;
  }

  .navlinks {
    gap: 34px;
  }
}

@media (max-width: 1040px) {
  .hero {
    min-height: auto;
    grid-template-columns: 1fr;
    align-items: start;
    gap: 48px;
  }

  .hero-copy {
    padding-right: 0;
  }

  .hero-copy h1 {
    max-width: 720px;
    padding-right: 0;
  }
  .project {
    grid-template-columns: 1fr;
  }

  .project-cover { 
    width: min(500px, calc(100% - 40px));
    min-height: 0;
    height: auto;
    aspect-ratio: 4 / 5;
    margin:32px auto 0;
  }

  .project-cover img {
    object-fit: cover;
  }

  .project-card {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .skills {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .about {
    grid-template-columns: 1fr;
  }
}


@media (max-width: 760px) {
  .menu {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .project-cover { 
    width: min(500px, calc(100% - 40px));
    min-height: 0;
    height: auto;
    aspect-ratio: 4 / 5;
    margin-top: 24px;
  }

  .project-card {
    grid-template-columns: 1fr;
  }

  .navlinks {
    position: fixed;
    top: 72px;
    right: 18px;
    left: 18px;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 14px;
    border: 1px solid var(--color-border);
    border-radius: 14px;
    background: rgb(255 255 255 / 96%);
    box-shadow: 0 20px 60px rgb(12 18 40 / 10%);
    backdrop-filter: blur(12px);
  }

  .navlinks.open {
    display: flex;
  }

  .navlinks a {
    padding: 12px 14px;
    border-radius: 10px;
  }

  .skills {
    grid-template-columns: 1fr;
  }

  .skills article {
    min-height: auto;
  }

  .skills span {
    margin-bottom: 36px;
  }

  .foot,
  .footer-inner {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 600px) {
  .hero {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 40px;
    padding-top: 52px;
  }

  .hero-copy h1 {
    font-size: clamp(2.75rem, 13vw, 4rem);
    line-height: 0.94;
  }

  .hero-art {
    width: min(100%, 620px);
    margin-top: 8px auto 0;
    margin-inline: auto;
    justify-items: center;
  }

  .hero-profile {
    width: min(100%, 420px);
  }

  .copy {
    padding: 30px 24px 36px;
  }

  .meta-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }

  .resume-panel,
  .contact {
    grid-template-columns: 1fr;
    padding: 32px;
  }

  .resume-actions,
  .contact-actions {
    max-width: none;
    justify-self: stretch;
  }
}

@media (max-width: 480px) {
  .shell {
    width: min(calc(100% - 24px), var(--container-width));
  }

  h1 {
    font-size: clamp(2.7rem, 13vw, 4rem);
  }

  .actions,
  .actions .btn,
  .inline-actions,
  .inline-actions .btn,
  .contact-actions,
  .contact-actions .btn,
  .resume-actions,
  .resume-actions .btn {
    width: 100%;
  }

  .hero-profile-card {
    right: 12px;
    bottom: 12px;
    left: 12px;
    padding: 14px;
  }

  .project {
    border-radius: 22px;
  }


  .copy {
    padding: 26px 18px 30px;
  }

  .copy > .btn,
  .copy > button {
    width: 100%;
  }

  .resume-panel,
  .contact {
    padding: 24px;
    border-radius: 22px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}

/* Bilingual navigation and HTML cover copy */
.nav-main {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 22px;
}

.language-switcher {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: rgb(255 255 255 / 78%);
}

.language-switcher a {
  display: grid;
  min-width: 36px;
  min-height: 32px;
  place-items: center;
  border-radius: 999px;
  color: var(--color-text-muted);
  font-size: 0.75rem;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  transition: background-color 160ms ease, color 160ms ease;
}

.language-switcher a:hover {
  color: var(--color-text-primary);
}

.language-switcher a[aria-current="page"] {
  background: var(--color-text-primary);
  color: #ffffff;
  cursor: default;
}

.project-cover,
.case-hero-visual {
  position: relative;
}

.cover-copy {
  position: absolute;
  z-index: 2;
  top: 8%;
  left: 7.5%;
  display: grid;
  width: 43%;
  max-width: 300px;
  gap: 14px;
  color: var(--color-text-primary);
  pointer-events: none;
}

.cover-copy p {
  margin: 0;
}

.cover-project {
  font-size: 0.92rem;
  font-weight: 820;
  letter-spacing: -0.02em;
}

.cover-headline {
  font-size: clamp(1.7rem, 2.55vw, 2.8rem);
  font-weight: 760;
  line-height: 1.02;
  letter-spacing: -0.055em;
}

.cover-headline span {
  display: block;
}

.cover-discipline {
  max-width: 28ch;
  color: var(--color-text-secondary);
  font-size: 0.66rem;
  font-weight: 750;
  line-height: 1.45;
  letter-spacing: 0.075em;
  text-transform: uppercase;
}

@media (max-width: 1040px) {
  .cover-headline {
    font-size: 1.7rem;
  }
}

@media (max-width: 760px) {
  .nav-main {
    gap: 8px;
  }

  .language-switcher {
    padding: 2px;
  }

  .language-switcher a {
    min-width: 34px;
    min-height: 32px;
  }
}

@media (max-width: 480px) {
  .nav {
    gap: 12px;
  }

  .brand {
    font-size: 0.92rem;
  }

  .language-switcher a {
    min-width: 31px;
    min-height: 30px;
    font-size: 0.7rem;
  }

  .menu {
    min-width: 42px;
    padding-inline: 10px;
  }

  .cover-copy {
    top: 7%;
    left: 7%;
    width: 44%;
    gap: 9px;
  }

  .cover-project {
    font-size: 0.72rem;
  }

  .cover-headline {
    font-size: 1.14rem;
    line-height: 1.05;
  }

  .cover-discipline {
    font-size: 0.48rem;
    letter-spacing: 0.055em;
  }
}

@media (max-width: 880px) {
  .nav-main {
    gap: 8px;
  }

  .menu {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .navlinks {
    position: fixed;
    top: 72px;
    right: 18px;
    left: 18px;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 14px;
    border: 1px solid var(--color-border);
    border-radius: 14px;
    background: rgb(255 255 255 / 96%);
    box-shadow: 0 20px 60px rgb(12 18 40 / 10%);
    backdrop-filter: blur(12px);
  }

  .navlinks.open {
    display: flex;
  }

  .navlinks a {
    padding: 12px 14px;
    border-radius: 10px;
  }
}

/* Iteration 3: full-hitbox bilingual toggle with footer avoidance */
.language-switcher {
  --switcher-edge-offset: max(16px, env(safe-area-inset-bottom));
  --footer-avoidance: 0px;

  position: fixed;
  top: auto;
  bottom: calc(
    var(--switcher-edge-offset) + var(--footer-avoidance)
  );

  z-index: 240;
  inset-inline-start: max(16px, env(safe-area-inset-left));
  display: block;
  width: 108px;
  height: 48px;
  gap: 0;
  padding: 0;
  overflow: hidden;
  border: 1px solid rgb(10 10 11 / 12%);
  border-radius: 999px;
  background: rgb(255 255 255 / 64%);
  box-shadow: 0 12px 32px rgb(20 24 40 / 12%);
  opacity: 0.62;
  isolation: isolate;
  backdrop-filter: blur(16px) saturate(135%);
  -webkit-backdrop-filter: blur(16px) saturate(135%);
  transition:
    opacity 180ms ease,
    transform 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease;
}

.language-switcher:hover {
  opacity: 1;
}

.language-switcher:focus-within,
.language-switcher.is-changing {
  background: rgb(255 255 255 / 88%);
  box-shadow: 0 16px 42px rgb(20 24 40 / 17%);
  opacity: 1;
}

.language-switcher__toggle {
  position: absolute;
  inset: 0;
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 4px;
  border-radius: inherit;
  color: inherit;
  cursor: pointer;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}

.language-switcher__slider {
  position: absolute;
  z-index: 0;
  top: 4px;
  bottom: 4px;
  left: 4px;
  width: calc(50% - 4px);
  border-radius: 999px;
  background: var(--color-text-primary);
  box-shadow: 0 5px 14px rgb(10 10 11 / 20%);
  transform: translateX(0);
  transform-origin: center;
  transition:
    transform 190ms cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 160ms ease;
}

.language-switcher[data-active-language="es"]
  .language-switcher__slider {
  transform: translateX(100%);
}

.language-switcher.is-pressing .language-switcher__slider {
  transform: translateX(0) scale(0.94);
}

.language-switcher[data-active-language="es"].is-pressing .language-switcher__slider {
  transform: translateX(100%) scale(0.94);
}

.language-switcher__option {
  position: relative;
  z-index: 1;
  display: grid;
  min-width: 0;
  min-height: 40px;
  place-items: center;
  border-radius: 999px;
  color: var(--color-text-muted);
  font-size: 0.74rem;
  font-weight: 820;
  line-height: 1;
  letter-spacing: 0.02em;
  transition: color 170ms ease;
}

.language-switcher[data-active-language="en"]
  [data-language-option="en"],
.language-switcher[data-active-language="es"]
  [data-language-option="es"] {
  color: #ffffff;
}

.language-switcher__toggle:focus-visible {
  outline: 3px solid rgb(46 85 238 / 30%);
  outline-offset: -3px;
}

/* Subtrack's devices enter the composition earlier than in the other covers.
   A narrower text measure reduces collision while preserving useful type size. */
.project-cover.subtrack .cover-copy,
body[data-page-id="subtrack"] .case-hero-visual .cover-copy {
  top: 7%;
  left: 6%;
  width: 36%;
  max-width: 250px;
  gap: 12px;
}

.project-cover.subtrack .cover-headline,
body[data-page-id="subtrack"] .case-hero-visual .cover-headline {
  font-size: clamp(1.5rem, 2.15vw, 2.38rem);
  line-height: 1.01;
}

@media (max-width: 1040px) {
  .project-cover.subtrack .cover-copy,
  body[data-page-id="subtrack"] .case-hero-visual .cover-copy {
    width: 38%;
    max-width: 190px;
  }

  .project-cover.subtrack .cover-headline,
  body[data-page-id="subtrack"] .case-hero-visual .cover-headline {
    font-size: 1.48rem;
  }
}

@media (max-width: 480px) {
  .language-switcher {
    --switcher-edge-offset: max(12px, env(safe-area-inset-bottom));
    inset-inline-start: max(12px, env(safe-area-inset-left));
    width: 100px;
    height: 44px;
  }

  .language-switcher__option {
    min-height: 36px;
    font-size: 0.7rem;
  }

  .project-cover.subtrack .cover-copy,
  body[data-page-id="subtrack"] .case-hero-visual .cover-copy {
    top: 6%;
    left: 5.5%;
    width: 39%;
    max-width: 150px;
    gap: 8px;
  }

  .project-cover.subtrack .cover-headline,
  body[data-page-id="subtrack"] .case-hero-visual .cover-headline {
    font-size: 1rem;
    line-height: 1.04;
  }
}

@media (prefers-reduced-motion: reduce) {
  .language-switcher,
  .language-switcher__toggle,
  .language-switcher__slider,
  .language-switcher__option {
    transition-duration: 0.01ms !important;
  }
}


/* Iteration 6: contextual navigation, section awareness, and footer divider avoidance */
:root {
  --context-menu-edge: 16px;
}

.header {
  will-change: transform;
  transition:
    transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1),
    background-color 180ms ease,
    box-shadow 180ms ease;
}

.header.is-context-hidden {
  transform: translateY(calc(-100% - 12px));
  pointer-events: none;
}

body.context-navigation-enabled .menu {
  display: none;
}

body.context-navigation-open:not(.context-navigation-available) .header {
  z-index: 540;
}

body.context-navigation-open:not(.context-navigation-available) .header .brand,
body.context-navigation-open:not(.context-navigation-available) .header .navlinks {
  opacity: 0;
  pointer-events: none;
}

.language-switcher {
  top: auto;
  bottom: calc(
    var(--switcher-edge-offset) + var(--footer-avoidance)
  );
}

body.context-navigation-open {
  overflow: hidden;
}

.context-navigation__trigger-slot {
  display: block;
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  pointer-events: none;
}

.context-navigation__trigger {
  position: fixed;
  z-index: 550;
  top: var(--context-trigger-topbar-top, 19px);
  right: var(--context-trigger-topbar-right, 20px);
  display: grid;
  width: 46px;
  height: 46px;
  padding: 0;
  place-items: center;
  border: 1px solid rgb(10 10 11 / 12%);
  border-radius: 14px;
  background: rgb(255 255 255 / 82%);
  color: var(--color-text-primary);
  box-shadow: none;
  cursor: pointer;
  opacity: 0.78;
  backdrop-filter: blur(16px) saturate(135%);
  -webkit-backdrop-filter: blur(16px) saturate(135%);
  transition:
    top 220ms cubic-bezier(0.2, 0.8, 0.2, 1),
    right 220ms cubic-bezier(0.2, 0.8, 0.2, 1),
    width 220ms cubic-bezier(0.2, 0.8, 0.2, 1),
    height 220ms cubic-bezier(0.2, 0.8, 0.2, 1),
    border-radius 220ms cubic-bezier(0.2, 0.8, 0.2, 1),
    opacity 180ms ease,
    transform 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease;
}

body.context-navigation-available .context-navigation__trigger {
  top: max(var(--context-menu-edge), env(safe-area-inset-top));
  right: max(var(--context-menu-edge), env(safe-area-inset-right));
  width: 52px;
  height: 52px;
  border-radius: 16px;
  box-shadow: 0 14px 38px rgb(20 24 40 / 14%);
}

.context-navigation__trigger:hover,
.context-navigation__trigger:focus-visible,
body.context-navigation-open .context-navigation__trigger {
  background: rgb(255 255 255 / 96%);
  box-shadow: 0 18px 48px rgb(20 24 40 / 18%);
  opacity: 1;
}

.context-navigation__icon {
  position: relative;
  display: grid;
  width: 22px;
  height: 16px;
  align-content: space-between;
}

.context-navigation__icon span {
  display: block;
  width: 100%;
  height: 2px;
  border-radius: 999px;
  background: currentColor;
  transform-origin: center;
  transition: transform 180ms ease, opacity 140ms ease;
}

body.context-navigation-open .context-navigation__icon span:first-child {
  transform: translateY(7px) rotate(45deg);
}

body.context-navigation-open .context-navigation__icon span:nth-child(2) {
  opacity: 0;
}

body.context-navigation-open .context-navigation__icon span:last-child {
  transform: translateY(-7px) rotate(-45deg);
}

.context-navigation__backdrop {
  position: fixed;
  z-index: 510;
  inset: 0;
  background: rgb(10 10 11 / 22%);
  opacity: 0;
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  transition: opacity 180ms ease;
}

.context-navigation__panel {
  position: fixed;
  z-index: 520;
  top: calc(max(var(--context-menu-edge), env(safe-area-inset-top)) + 66px);
  right: max(var(--context-menu-edge), env(safe-area-inset-right));
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100dvh - 98px);
  padding: 22px;
  overflow-y: auto;
  overscroll-behavior: contain;
  border: 1px solid rgb(10 10 11 / 11%);
  border-radius: 24px;
  background: rgb(255 255 255 / 96%);
  box-shadow: 0 28px 90px rgb(20 24 40 / 24%);
  opacity: 0;
  transform: translateY(-10px) scale(0.98);
  transform-origin: top right;
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  transition: opacity 180ms ease, transform 180ms ease;
}

.context-navigation.is-open .context-navigation__backdrop,
.context-navigation.is-open .context-navigation__panel {
  opacity: 1;
}

.context-navigation.is-open .context-navigation__panel {
  transform: none;
}

.context-navigation__header {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--color-border);
}

.context-navigation__header p {
  margin: 0 0 7px;
  color: var(--color-cobalt-core);
  font-size: 0.7rem;
  font-weight: 820;
  line-height: 1.2;
  letter-spacing: 0.12em;
}

.context-navigation__header h2 {
  margin: 0;
  font-size: clamp(1.55rem, 4vw, 2rem);
  line-height: 1;
  letter-spacing: -0.045em;
}

.context-navigation__group {
  padding-top: 20px;
}

.context-navigation__group + .context-navigation__group {
  margin-top: 20px;
  border-top: 1px solid var(--color-border);
}

.context-navigation__group h3 {
  margin: 0 0 10px;
  color: var(--color-text-muted);
  font-size: 0.72rem;
  line-height: 1.3;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.context-navigation__group ul {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.context-navigation__group a {
  position: relative;
  display: grid;
  min-height: 76px;
  align-content: center;
  gap: 4px;
  padding: 13px 14px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: rgb(246 246 248 / 74%);
  text-decoration: none;
  transition:
    border-color 160ms ease,
    background-color 160ms ease,
    transform 160ms ease;
}

.context-navigation__group a:hover {
  border-color: rgb(46 85 238 / 16%);
  background: var(--color-cobalt-mist);
  transform: translateY(-1px);
}

.context-navigation__group a[aria-current] {
  border-color: rgb(46 85 238 / 24%);
  background: var(--color-cobalt-mist);
}

.context-navigation__group a[aria-current]::after {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--color-cobalt-core);
  content: "";
}

.context-navigation__group a > span {
  color: var(--color-text-primary);
  font-size: 0.94rem;
  font-weight: 780;
  line-height: 1.2;
}

.context-navigation__group small {
  color: var(--color-text-muted);
  font-size: 0.72rem;
  line-height: 1.35;
}

@media (max-width: 760px) {
  :root {
    --context-menu-edge: 12px;
  }

  .context-navigation__trigger-slot {
    width: 44px;
    height: 44px;
    flex-basis: 44px;
  }

  .context-navigation__trigger {
    width: 44px;
    height: 44px;
    border-radius: 13px;
  }

  body.context-navigation-available .context-navigation__trigger {
    width: 48px;
    height: 48px;
    border-radius: 14px;
  }

  .context-navigation__panel {
    top: calc(max(var(--context-menu-edge), env(safe-area-inset-top)) + 60px);
    right: max(var(--context-menu-edge), env(safe-area-inset-right));
    left: max(var(--context-menu-edge), env(safe-area-inset-left));
    width: auto;
    max-height: calc(100dvh - 84px);
    padding: 18px;
    border-radius: 20px;
  }

  .context-navigation__group ul {
    grid-template-columns: 1fr;
  }

  .context-navigation__group a {
    min-height: 64px;
  }
}

@media (max-width: 480px) {
  .context-navigation__header h2 {
    font-size: 1.45rem;
  }

  .context-navigation__panel {
    padding: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .header,
  .context-navigation__trigger,
  .context-navigation__icon span,
  .context-navigation__backdrop,
  .context-navigation__panel,
  .context-navigation__group a {
    transition-duration: 0.01ms !important;
  }
}
