:root {
  --bg-light: #f6f4ee;
  --bg-dark: #0a0b0e;
  --card-light: #fbfaf6;
  --card-dark: #101218;
  --ink-light: #141413;
  --ink-dark: #edeae2;
  --muted-light: #5c5a54;
  --muted-dark: #97948c;
  --faint-light: #8a867d;
  --faint-dark: #66635c;
  --line-light: rgba(20, 20, 19, 0.11);
  --line-dark: rgba(237, 234, 226, 0.11);
  --line-strong-light: rgba(20, 20, 19, 0.26);
  --line-strong-dark: rgba(237, 234, 226, 0.28);
  --gold-light: #9a6b21;
  --gold-dark: #d4ae6a;
  --live-light: #166534;
  --live-dark: #6ee7b7;
  --live-border-light: rgba(22, 101, 52, 0.25);
  --live-border-dark: rgba(110, 231, 183, 0.25);
  --topbar-bg-light: rgba(246, 244, 238, 0.86);
  --topbar-bg-dark: rgba(10, 11, 14, 0.86);

  --bg: var(--bg-light);
  --card: var(--card-light);
  --ink: var(--ink-light);
  --muted: var(--muted-light);
  --faint: var(--faint-light);
  --line: var(--line-light);
  --line-strong: var(--line-strong-light);
  --gold: var(--gold-light);
  --live: var(--live-light);
  --live-border: var(--live-border-light);
  --topbar-bg: var(--topbar-bg-light);

  @media (prefers-color-scheme: dark) {
    --bg: var(--bg-dark);
    --card: var(--card-dark);
    --ink: var(--ink-dark);
    --muted: var(--muted-dark);
    --faint: var(--faint-dark);
    --line: var(--line-dark);
    --line-strong: var(--line-strong-dark);
    --gold: var(--gold-dark);
    --live: var(--live-dark);
    --live-border: var(--live-border-dark);
    --topbar-bg: var(--topbar-bg-dark);
  }

  @supports (color: light-dark(white, black)) {
    --bg: light-dark(var(--bg-light), var(--bg-dark));
    --card: light-dark(var(--card-light), var(--card-dark));
    --ink: light-dark(var(--ink-light), var(--ink-dark));
    --muted: light-dark(var(--muted-light), var(--muted-dark));
    --faint: light-dark(var(--faint-light), var(--faint-dark));
    --line: light-dark(var(--line-light), var(--line-dark));
    --line-strong: light-dark(var(--line-strong-light), var(--line-strong-dark));
    --gold: light-dark(var(--gold-light), var(--gold-dark));
    --live: light-dark(var(--live-light), var(--live-dark));
    --live-border: light-dark(var(--live-border-light), var(--live-border-dark));
    --topbar-bg: light-dark(var(--topbar-bg-light), var(--topbar-bg-dark));
  }

  color-scheme: light dark;

  &:has(> head > meta[name="color-scheme"][content="dark"]) {
    color-scheme: dark;
  }
  &:has(> head > meta[name="color-scheme"][content="light"]) {
    color-scheme: light;
  }

  --serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --max: 1080px;
}

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

html {
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;

  @media (prefers-reduced-motion: no-preference) {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  min-height: 100dvh;
  position: relative;
  overflow-x: clip;
}

.frame-lines {
  position: fixed;
  inset: 0;
  width: min(100% - 2.5rem, var(--max));
  margin-inline: auto;
  border-inline: 1px solid var(--line);
  pointer-events: none;
  z-index: 0;
  opacity: 0.55;
}

.wrap {
  position: relative;
  z-index: 1;
  width: min(100% - 2.5rem, var(--max));
  margin-inline: auto;
  padding-inline: clamp(1rem, 3.5vw, 2.75rem);
}

.visually-hidden {
  position: absolute !important;
  clip-path: inset(50%) !important;
  overflow: hidden !important;
  width: 1px !important;
  height: 1px !important;
  margin: -1px !important;
  padding: 0 !important;
  border: 0 !important;
  white-space: nowrap !important;
}

/* Topbar */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
  background: var(--topbar-bg);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 1rem;
}

.wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 0.45rem;
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-decoration: none;
  color: var(--ink);
}

.wordmark-sub {
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  color: var(--gold);
  font-weight: 500;
}

.topnav {
  display: flex;
  gap: 1.85rem;

  & a {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.86rem;
    transition: color 0.18s ease;

    &:hover {
      color: var(--ink);
    }
  }
}

.controls {
  display: flex;
  align-items: center;
  gap: 0.55rem;
}

.lang-toggle {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px;
}

.lang-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.06em;
  padding: 0.24rem 0.6rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background-color 0.16s ease, color 0.16s ease;

  &[aria-pressed="true"] {
    background: var(--ink);
    color: var(--bg);
  }
}

.theme-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: border-color 0.18s ease;

  &:hover {
    border-color: var(--line-strong);
  }
}

.theme-opt-light { display: none; }
.theme-opt-dark { display: inline-flex; }

@media (prefers-color-scheme: dark) {
  :root:not(:has(> head > meta[name="color-scheme"][content="light"])) {
    .theme-opt-dark { display: none; }
    .theme-opt-light { display: inline-flex; }
  }
}
:root:has(> head > meta[name="color-scheme"][content="dark"]) {
  .theme-opt-dark { display: none; }
  .theme-opt-light { display: inline-flex; }
}
:root:has(> head > meta[name="color-scheme"][content="light"]) {
  .theme-opt-dark { display: inline-flex; }
  .theme-opt-light { display: none; }
}

/* Hero */
.hero {
  padding-block: clamp(4.25rem, 9vw, 7.25rem) clamp(3.75rem, 7vw, 5.75rem);
  border-bottom: 1px solid var(--line);
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(240px, 0.85fr);
  align-items: center;
  gap: clamp(2rem, 5vw, 4.5rem);
}

.kicker {
  margin: 0 0 1.25rem;
  font-size: 0.74rem;
  font-weight: 500;
  letter-spacing: 0.18em;
  color: var(--gold);
}

.display {
  margin: 0 0 1.4rem;
  font-family: var(--serif);
  font-size: clamp(2.65rem, 5.8vw, 4.55rem);
  font-weight: 400;
  line-height: 1.04;
  letter-spacing: -0.02em;
}

.lead {
  margin: 0 0 2.15rem;
  max-width: 52ch;
  font-size: clamp(1rem, 1.45vw, 1.08rem);
  color: var(--muted);
}

.hero-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
}

.btn-solid,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  padding: 0.72rem 1.35rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
  transition: border-color 0.18s ease, opacity 0.18s ease, translate 0.2s ease;
}

.btn-solid {
  background: var(--ink);
  color: var(--bg);

  &:hover {
    opacity: 0.88;
  }
}

.btn-ghost {
  border: 1px solid var(--line-strong);
  color: var(--ink);

  &:hover {
    border-color: var(--ink);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .btn-solid:hover,
  .btn-ghost:hover {
    translate: 0 -1px;
  }
}

.hero-emblem {
  display: flex;
  justify-content: center;
  color: var(--ink);

  & svg {
    width: min(100%, 300px);
    height: auto;
  }
}

/* Sections */
.section {
  padding-block: clamp(3.75rem, 7.5vw, 5.75rem);
  border-bottom: 1px solid var(--line);
}

.section-bar {
  display: flex;
  align-items: baseline;
  gap: 0.85rem;
  margin-bottom: clamp(1.85rem, 3.8vw, 2.75rem);

  & .num {
    font-family: var(--serif);
    font-style: italic;
    font-size: 1.12rem;
    color: var(--gold);
  }

  & h2 {
    margin: 0;
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--faint);
  }
}

.statement {
  margin: 0 0 clamp(2.25rem, 4.5vw, 3.5rem);
  max-width: 28ch;
  font-family: var(--serif);
  font-size: clamp(1.85rem, 3.6vw, 2.75rem);
  line-height: 1.18;
  letter-spacing: -0.015em;
}

.pillars {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(1.5rem, 3vw, 2.5rem);
  padding-top: 2rem;
  border-top: 1px solid var(--line);
}

.pillar {
  & .pillar-idx {
    display: block;
    margin-bottom: 0.7rem;
    font-family: var(--serif);
    font-style: italic;
    font-size: 1rem;
    color: var(--gold);
  }

  & h3 {
    margin: 0 0 0.5rem;
    font-family: var(--serif);
    font-size: 1.55rem;
    font-weight: 400;
  }

  & p {
    margin: 0;
    color: var(--muted);
    font-size: 0.93rem;
  }
}

/* Stage tags (honest maturity indicators) */
.stage {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.18rem 0.58rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--faint);
}

.stage-live {
  color: var(--live);
  border-color: var(--live-border);
}

/* Flagship Work */
.work-flagship {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  align-items: center;
  gap: 2rem;
  padding: clamp(1.75rem, 4vw, 2.85rem);
  margin-bottom: 1.25rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.22s ease, translate 0.24s ease;

  &:hover {
    border-color: var(--line-strong);
  }
}

.meta-line {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.65rem;
}

.work-domain {
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  color: var(--gold);
}

.flagship-copy {
  & h3 {
    margin: 0 0 0.4rem;
    font-family: var(--serif);
    font-size: clamp(2.1rem, 4vw, 2.8rem);
    font-weight: 400;
    line-height: 1.05;
  }

  & .work-tagline {
    margin: 0 0 0.75rem;
    font-size: 1.04rem;
    font-weight: 500;
  }

  & .work-body {
    margin: 0 0 1.4rem;
    max-width: 48ch;
    color: var(--muted);
    font-size: 0.94rem;
  }
}

.work-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.86rem;
  font-weight: 500;
  color: var(--ink);
  border-bottom: 1px solid var(--line-strong);
  padding-bottom: 2px;
}

.flagship-art {
  display: flex;
  justify-content: center;
  color: var(--ink);

  & svg {
    width: 100%;
    max-width: 255px;
    height: auto;
  }
}

.works-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.work-card {
  display: flex;
  flex-direction: column;
  padding: clamp(1.45rem, 3vw, 2rem);
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.22s ease, translate 0.24s ease;

  &:hover {
    border-color: var(--line-strong);
  }

  & h3 {
    margin: 0 0 0.45rem;
    font-family: var(--serif);
    font-size: 1.7rem;
    font-weight: 400;
    line-height: 1.12;
  }

  & .card-hook {
    margin: 0 0 0.5rem;
    font-size: 0.94rem;
    font-weight: 500;
    color: var(--ink);
  }

  & p:last-child {
    margin: 0;
    color: var(--muted);
    font-size: 0.91rem;
  }
}

.work-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.work-arrow {
  color: var(--faint);
  font-size: 0.95rem;
  transition: translate 0.2s ease, color 0.2s ease;
}

@media (prefers-reduced-motion: no-preference) {
  .work-flagship:hover,
  .work-card:hover {
    translate: 0 -2px;
  }
  .work-card:hover .work-arrow {
    translate: 2px -2px;
    color: var(--ink);
  }
  .work-flagship:hover .signal-dot {
    transform: translateX(4px);
    transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  }
}

/* Roadmap */
.roadmap {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}

.road-step {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 1.5rem;
  padding-block: 1.75rem;
  border-bottom: 1px solid var(--line);
  align-items: baseline;

  & h3 {
    margin: 0 0 0.45rem;
    font-family: var(--serif);
    font-size: 1.6rem;
    font-weight: 400;
    line-height: 1.15;
  }

  & p {
    margin: 0;
    max-width: 56ch;
    color: var(--muted);
    font-size: 0.94rem;
  }
}

/* About / Contact */
.closing-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}

.closing-note {
  margin: 0 0 1rem;
  font-family: var(--serif);
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  line-height: 1.22;
  max-width: 26ch;
}

.about-sub {
  margin: 0;
  color: var(--muted);
  font-size: 0.94rem;
  max-width: 44ch;
}

.social-links {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);

  & a {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 0.95rem 0;
    border-bottom: 1px solid var(--line);
    color: var(--ink);
    text-decoration: none;
    font-size: 0.95rem;
    transition: color 0.18s ease, translate 0.2s ease;

    &:hover .handle {
      color: var(--ink);
    }
  }

  & .handle {
    color: var(--muted);
    font-size: 0.86rem;
    transition: color 0.18s ease;
  }
}

@media (prefers-reduced-motion: no-preference) {
  .social-links a:hover {
    translate: 4px 0;
  }
}

.footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  padding-block: 2rem 2.75rem;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  color: var(--faint);
}

/* ----------------------------------------------------------------
 * Restrained Compositor Motion (modern-web-guidance compliant)
 * - Opts in inside @media (prefers-reduced-motion: no-preference)
 * - Uses finite entrance + native CSS scroll-driven view() reveal
 * - Keeps resting opacity: 1 when unsupported or reduced-motion
 * ---------------------------------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  @keyframes hero-rise {
    from {
      opacity: 0;
      translate: 0 14px;
    }
    to {
      opacity: 1;
      translate: 0 0;
    }
  }

  @keyframes emblem-settle {
    from {
      opacity: 0;
      transform: scale(0.95) rotate(-14deg);
    }
    to {
      opacity: 1;
      transform: scale(1) rotate(0deg);
    }
  }

  .hero-in {
    animation: hero-rise 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
  }
  .d1 { animation-delay: 0.04s; }
  .d2 { animation-delay: 0.12s; }
  .d3 { animation-delay: 0.2s; }
  .d4 { animation-delay: 0.28s; }

  .astrolabe {
    animation: emblem-settle 1.1s cubic-bezier(0.22, 1, 0.36, 1) 0.15s both;
  }

  /* Native Scroll-Driven Entry Reveal (progressive enhancement) */
  @supports ((animation-timeline: view()) and (animation-range: entry)) {
    @keyframes section-reveal {
      from {
        opacity: 0;
        translate: 0 18px;
      }
      to {
        opacity: 1;
        translate: 0 0;
      }
    }

    .reveal {
      animation: section-reveal auto linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 85%;
    }
  }
}

@media (max-width: 820px) {
  .hero-grid,
  .pillars,
  .work-flagship,
  .works-grid,
  .road-step,
  .closing-grid {
    grid-template-columns: 1fr;
  }

  .hero-emblem {
    display: none;
  }

  .topnav {
    display: none;
  }
}
