/* ============================================================
   AMLRD — redesign
   design-engineer's notebook: off-white paper, ink, one orange
   ============================================================ */

/* ---------- tokens ---------- */
:root {
  /* color — OKLCH, neutrals tinted slightly warm toward the accent */
  --paper:      oklch(0.972 0.006 70);   /* warm off-white, not #fff */
  --paper-2:    oklch(0.945 0.008 70);   /* recessed panel */
  --ink:        oklch(0.235 0.012 65);   /* off-black, not #000 */
  --ink-soft:   oklch(0.435 0.014 65);   /* secondary text (>=4.5:1 on paper) */
  --ink-faint:  oklch(0.52 0.013 65);    /* labels / meta — 5.06:1, passes small text */
  --line:       oklch(0.235 0.012 65 / 0.14);
  --line-strong:oklch(0.235 0.012 65 / 0.26);
  --accent:     oklch(0.64 0.205 40);    /* his orange, tuned: 3.38:1 on paper, 4.55:1 as a fill under ink text */
  --accent-hi:  oklch(0.71 0.185 42);    /* lighter lift for primary-button hover (keeps dark text legible) */
  --accent-ink: oklch(0.44 0.155 39);    /* accent as text on paper — 7.66:1 */
  --live:       oklch(0.62 0.17 150);

  /* type */
  --f-display: "Doto", ui-monospace, monospace;
  --f-sans: "Space Grotesk", system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SF Mono", monospace;

  /* spacing — 4px base */
  --sp-1: 0.25rem; --sp-2: 0.5rem;  --sp-3: 0.75rem; --sp-4: 1rem;
  --sp-5: 1.5rem;  --sp-6: 2rem;    --sp-8: 3rem;    --sp-10: 4rem;
  --sp-12: 6rem;   --sp-16: 8rem;

  /* radius — one system, cards top out low */
  --r-sm: 6px; --r-md: 10px; --r-lg: 14px; --r-pill: 999px;

  /* motion — strong custom curves (not the weak CSS built-ins) */
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);

  --wrap: 76rem;
  --gutter: clamp(1.25rem, 4vw, 3.5rem);
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--f-sans);
  font-size: clamp(1rem, 0.96rem + 0.2vw, 1.0625rem);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

/* subtle engineer's-paper grid, extremely low contrast */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 4.5rem 4.5rem;
  opacity: 0.35;
  -webkit-mask-image: radial-gradient(120% 90% at 50% 0%, #000 25%, transparent 78%);
          mask-image: radial-gradient(120% 90% at 50% 0%, #000 25%, transparent 78%);
  pointer-events: none;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
ul, ol { list-style: none; padding: 0; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: var(--r-sm);
}

.skip-link {
  position: absolute; left: var(--sp-4); top: -4rem;
  background: var(--ink); color: var(--paper);
  padding: var(--sp-2) var(--sp-4); border-radius: var(--r-sm);
  font-family: var(--f-mono); font-size: 0.8rem; z-index: 100;
  transition: top 160ms var(--ease-out);
}
.skip-link:focus { top: var(--sp-4); }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }

/* ---------- wordmark ---------- */
.wordmark {
  font-family: var(--f-display);
  font-weight: 800;
  letter-spacing: 0.06em;
  font-size: 1.4rem;
  line-height: 1;
  color: var(--ink);
}
.wordmark--sm { font-size: 1.15rem; }

/* ============================================================
   NAV — translucent floating chrome (apple-design materials)
   ============================================================ */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: oklch(0.972 0.006 70 / 0.72);
  backdrop-filter: blur(16px) saturate(140%);
  -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid transparent;
  transition: border-color 240ms var(--ease-out), background 240ms var(--ease-out);
}
.nav.is-stuck { border-bottom-color: var(--line); }
.nav__inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 4.25rem;
}
.nav__links { display: flex; align-items: center; gap: clamp(0.75rem, 2vw, 2rem); }
.nav__links > a {
  font-family: var(--f-mono);
  font-size: 0.8125rem;
  color: var(--ink-soft);
  position: relative;
  padding: 0.35rem 0.35rem ;
}
.nav__links > a:not(.nav__cta)::after {
  content: ""; position: absolute; left: 0; bottom: -1px; height: 1.5px;
  width: 100%; background: var(--accent);
  transform: scaleX(0); transform-origin: left;
  transition: transform 220ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .nav__links > a:not(.nav__cta):hover { color: var(--ink); }
  .nav__links > a:not(.nav__cta):hover::after { transform: scaleX(1); }
}
.nav__cta {
  display: inline-flex; align-items: center; gap: 0.5rem;
  background: var(--ink); color: var(--paper);
  padding: 0.5rem 0.9rem; border-radius: var(--r-pill);
  transition: transform 160ms var(--ease-out), background 200ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .nav__cta:hover { background: var(--accent); }
}
.nav__cta:active { transform: scale(0.97); }

/* dots */
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; flex: none; }
.dot--live { background: var(--live); position: relative; }
.dot--live::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 1px solid var(--live); opacity: 0.5;
  animation: ping 2.4s var(--ease-out) infinite;
}
@keyframes ping { 0% { transform: scale(0.6); opacity: 0.6; } 100% { transform: scale(1.6); opacity: 0; } }

/* ============================================================
   HERO
   ============================================================ */
.hero { padding-top: clamp(3.5rem, 8vw, 7rem); padding-bottom: clamp(3rem, 6vw, 5rem); }
.hero__eyebrow {
  font-family: var(--f-mono);
  font-size: 0.9375rem;
  color: var(--ink-soft);
  letter-spacing: 0.01em;
  margin-bottom: var(--sp-5);
}
.hero__eyebrow .tilde { color: var(--accent); }
.hero__eyebrow .muted { color: var(--ink-faint); }

.hero__title {
  font-family: var(--f-display);
  font-weight: 700;
  font-size: clamp(2.75rem, 1.6rem + 7vw, 6rem);
  line-height: 0.98;
  letter-spacing: -0.01em;
  text-transform: lowercase;
  text-wrap: balance;
  margin-bottom: var(--sp-6);
}
.hero__title .line { display: block; }
.hero__title em { font-style: normal; color: var(--accent); }

.hero__lead {
  max-width: 54ch;
  color: var(--ink-soft);
  font-size: clamp(1.0625rem, 1rem + 0.35vw, 1.25rem);
  line-height: 1.62;
  text-wrap: pretty;
  margin-bottom: var(--sp-6);
}

.hero__actions { display: flex; flex-wrap: wrap; gap: var(--sp-3); margin-bottom: var(--sp-6); }

.hero__socials {
  display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-5);
  font-family: var(--f-mono); font-size: 0.8125rem;
}
.hero__socials a {
  color: var(--ink-faint); position: relative;
  transition: color 180ms var(--ease-out);
}
.hero__socials a::before { content: "↗"; margin-right: 0.35em; color: var(--accent); opacity: 0.7; }
@media (hover: hover) and (pointer: fine) { .hero__socials a:hover { color: var(--ink); } }

/* ---------- buttons ---------- */
.btn {
  --btn-bg: var(--ink); --btn-fg: var(--paper);
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--f-mono); font-size: 0.875rem; font-weight: 500;
  padding: 0.75rem 1.35rem; border-radius: var(--r-pill);
  border: 1px solid transparent;
  background: var(--btn-bg); color: var(--btn-fg);
  cursor: pointer; white-space: nowrap;
  transition: transform 160ms var(--ease-out), background 200ms var(--ease-out), border-color 200ms var(--ease-out), color 200ms var(--ease-out);
}
.btn:active { transform: scale(0.97); }
/* dark ink on orange reads at 4.55:1 (white-on-orange only hit 3:1); hover lifts brighter */
.btn--primary { --btn-bg: var(--accent); --btn-fg: var(--ink); font-weight: 600; }
@media (hover: hover) and (pointer: fine) {
  .btn--primary:hover { --btn-bg: var(--accent-hi); }
}
.btn--ghost { --btn-bg: transparent; --btn-fg: var(--ink); border-color: var(--line-strong); }
@media (hover: hover) and (pointer: fine) {
  .btn--ghost:hover { --btn-bg: var(--ink); --btn-fg: var(--paper); border-color: var(--ink); }
}

/* ============================================================
   SPEC STRIP — real technical spec sheet (earned mono detail)
   ============================================================ */
.spec {
  padding-block: var(--sp-6);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.spec__grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-5);
}
.spec__item { display: flex; flex-direction: column; gap: 0.4rem; }
.spec__item dt {
  font-family: var(--f-mono); font-size: 0.6875rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink-faint);
}
.spec__item dd { font-size: 0.9375rem; line-height: 1.4; color: var(--ink); }
.status { display: inline-flex; align-items: center; gap: 0.5rem; }
.spec__note {
  margin-top: var(--sp-5); max-width: 60ch;
  font-family: var(--f-mono); font-size: 0.8125rem; line-height: 1.7;
  color: var(--ink-soft);
}

/* ============================================================
   SECTION HEADS
   ============================================================ */
section { position: relative; }
.work, .stack, .awards { padding-block: clamp(3.5rem, 7vw, 6rem); }
.section-head {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: var(--sp-4);
  align-items: baseline;
  margin-bottom: var(--sp-8);
}
.section-index {
  font-family: var(--f-display); font-weight: 600;
  font-size: 1rem; color: var(--accent);
  grid-row: 1 / span 2;
}
.section-title {
  font-family: var(--f-sans); font-weight: 600;
  font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.75rem);
  line-height: 1.1; letter-spacing: -0.02em;
}
.section-sub { grid-column: 2; color: var(--ink-soft); max-width: 48ch; margin-top: 0.5rem; }

/* ============================================================
   TABS — segmented control with sliding indicator
   ============================================================ */
.tabs {
  position: relative;
  display: inline-flex;
  gap: 0.25rem;
  padding: 0.3rem;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  margin-bottom: var(--sp-8);
}
.tabs__indicator {
  position: absolute; top: 0.3rem; left: 0.3rem;
  height: calc(100% - 0.6rem);
  background: var(--ink);
  border-radius: var(--r-pill);
  transform: translateX(0); width: 0;
  transition: transform 280ms var(--ease-out), width 280ms var(--ease-out);
  z-index: 0;
}
.tab {
  position: relative; z-index: 1;
  font-family: var(--f-mono); font-size: 0.8125rem;
  padding: 0.5rem 1rem; border: 0; background: transparent;
  color: var(--ink-soft); cursor: pointer; border-radius: var(--r-pill);
  transition: color 220ms var(--ease-out);
  white-space: nowrap;
}
.tab.is-active { color: var(--paper); }
@media (hover: hover) and (pointer: fine) {
  .tab:not(.is-active):hover { color: var(--ink); }
}

/* ============================================================
   WORK GRID
   ============================================================ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 20rem), 1fr));
  gap: clamp(1rem, 2.5vw, 1.75rem);
}
.card { }
.card.is-hidden { display: none; }
.card__link { display: block; }
.card__media {
  position: relative; overflow: hidden;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  aspect-ratio: 4 / 3;
  background: var(--paper-2);
}
.card__media img {
  width: 100%; height: 100%; object-fit: cover;
  transition: transform 600ms var(--ease-out), filter 400ms var(--ease-out);
  filter: saturate(0.92);
}
.card__media::after {
  content: "→"; position: absolute; right: 0.85rem; bottom: 0.85rem;
  width: 2rem; height: 2rem; display: grid; place-items: center;
  background: var(--paper); color: var(--ink); border-radius: 50%;
  font-family: var(--f-mono); font-size: 0.9rem;
  opacity: 0; transform: translateY(6px) scale(0.9);
  transition: opacity 240ms var(--ease-out), transform 240ms var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
  .card__link:hover .card__media img { transform: scale(1.045); filter: saturate(1.02); }
  .card__link:hover .card__media::after { opacity: 1; transform: translateY(0) scale(1); }
}
.card__body { padding-top: var(--sp-3); }
.card__title { font-size: 1.0625rem; font-weight: 600; letter-spacing: -0.01em; }
.card__meta {
  display: flex; gap: var(--sp-3); margin-top: 0.3rem;
  font-family: var(--f-mono); font-size: 0.75rem; color: var(--ink-faint);
}
.card__meta span + span { position: relative; padding-left: var(--sp-3); }
.card__meta span + span::before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 3px; height: 3px; border-radius: 50%; background: var(--line-strong);
}

/* ============================================================
   STACK
   ============================================================ */
.stack__groups {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
  gap: clamp(1.5rem, 3vw, 2.5rem);
}
.stack__group h3 {
  font-family: var(--f-mono); font-size: 0.6875rem; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink-faint);
  padding-bottom: var(--sp-3); margin-bottom: var(--sp-3);
  border-bottom: 1px solid var(--line);
}
.stack__group--focus h3 { color: var(--ink); border-bottom-color: var(--line-strong); }
.stack__tag { color: var(--accent-ink); margin-left: 0.4rem; }
.stack__group ul { display: flex; flex-direction: column; gap: 0.55rem; }
.stack__group li {
  font-size: 0.9375rem; color: var(--ink);
  display: flex; align-items: center; gap: 0.6rem;
}
.stack__group li::before {
  content: ""; width: 5px; height: 5px; border-radius: 1px;
  background: var(--accent); flex: none; transform: rotate(45deg);
}

/* ============================================================
   AWARDS — editorial list, not identical cards
   ============================================================ */
.awards__list { border-top: 1px solid var(--line-strong); }
.award {
  display: grid;
  grid-template-columns: 5rem 1fr;
  gap: var(--sp-4);
  align-items: baseline;
  padding-block: var(--sp-5);
  border-bottom: 1px solid var(--line);
  transition: background 200ms var(--ease-out);
}
.award__year { font-family: var(--f-mono); font-size: 0.8125rem; color: var(--ink-faint); }
.award__body { display: flex; flex-direction: column; gap: 0.25rem; }
.award__place { font-size: clamp(1.125rem, 1rem + 0.6vw, 1.375rem); font-weight: 600; letter-spacing: -0.01em; }
.award__event { color: var(--ink-soft); font-size: 0.9375rem; }
@media (hover: hover) and (pointer: fine) {
  .award:hover { background: linear-gradient(90deg, oklch(0.678 0.192 39 / 0.05), transparent 60%); }
}

/* ============================================================
   CONTACT
   ============================================================ */
.contact { padding-block: clamp(4rem, 9vw, 8rem); }
.contact__inner {
  background: var(--ink);
  color: var(--paper);
  border-radius: clamp(var(--r-lg), 3vw, 24px);
  padding: clamp(2.5rem, 6vw, 5rem);
  position: relative; overflow: hidden;
}
.contact__inner::before {
  content: ""; position: absolute; right: -10%; top: -40%;
  width: 55%; aspect-ratio: 1; border-radius: 50%;
  background: radial-gradient(circle, oklch(0.678 0.192 39 / 0.28), transparent 68%);
  pointer-events: none;
}
.contact__eyebrow {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-family: var(--f-mono); font-size: 0.8125rem;
  color: oklch(0.85 0.02 70); margin-bottom: var(--sp-5);
}
.contact__title {
  font-family: var(--f-sans); font-weight: 600;
  font-size: clamp(2rem, 1.3rem + 3.5vw, 3.75rem);
  line-height: 1.04; letter-spacing: -0.025em;
  margin-bottom: var(--sp-4); text-wrap: balance;
}
.contact__lead { color: oklch(0.82 0.015 70); max-width: 46ch; margin-bottom: var(--sp-6); }
.contact__actions { display: flex; flex-wrap: wrap; gap: var(--sp-3); }
.contact .btn--ghost { --btn-fg: var(--paper); border-color: oklch(0.99 0.01 70 / 0.28); }
@media (hover: hover) and (pointer: fine) {
  .contact .btn--ghost:hover { --btn-bg: var(--paper); --btn-fg: var(--ink); border-color: var(--paper); }
}

/* ============================================================
   FOOTER
   ============================================================ */
.footer { border-top: 1px solid var(--line); padding-block: var(--sp-6); }
.footer__inner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: var(--sp-4);
}
.footer__links { display: flex; flex-wrap: wrap; gap: var(--sp-4); font-family: var(--f-mono); font-size: 0.8125rem; }
.footer__links a { color: var(--ink-soft); transition: color 180ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) { .footer__links a:hover { color: var(--accent-ink); } }
.footer__copy { font-family: var(--f-mono); font-size: 0.8125rem; color: var(--ink-faint); }

/* ============================================================
   REVEAL — scroll-in (opacity + small translate, ease-out)
   ============================================================ */
.reveal {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 600ms var(--ease-out), transform 600ms var(--ease-out);
  will-change: opacity, transform;
}
.reveal.is-in { opacity: 1; transform: none; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 720px) {
  .spec__grid { grid-template-columns: repeat(2, 1fr); gap: var(--sp-5) var(--sp-4); }
  .nav__links > a:not(.nav__cta) { display: none; }
  .award { grid-template-columns: 3.5rem 1fr; gap: var(--sp-3); }
}

/* ============================================================
   REDUCED MOTION — gentler, comprehension-preserving
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: opacity 200ms ease; }
  .tabs__indicator { transition: none; }
  .card__media img { transition: filter 200ms ease; }
  .dot--live::after { animation: none; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; }
}
