/* General Sans — self-hosted woff2 (TYPE-01) */
@font-face {
  font-family: 'General Sans';
  src: url('../fonts/GeneralSans-Regular.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'General Sans';
  src: url('../fonts/GeneralSans-Medium.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'General Sans';
  src: url('../fonts/GeneralSans-Semibold.woff2') format('woff2');
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

/* Base reset */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  background: var(--color-bg);
  color: var(--color-ink);
  font-family: var(--font-sans);
}

/* Native smooth-scroll + reduced-motion override (D-07/D-09) */
html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  #nav { transition: none; }
  .mobile-bar { transition: none; }
  .menu-overlay { transition: none; }
}

/* ── Hero container ──────────────────────────────────────────────────────── */
.hero {
  width: 100%;
  height: 100dvh;
  padding: var(--pad-edge);
  display: flex;
  flex-flow: column;
}

/* Fixed nav: transparent over hero, condenses on scroll (NAV-01, D-01) */
#nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 8000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--pad-edge);
  font-size: var(--text-nav);
  border-bottom: 1px solid transparent;
  transition: padding .4s var(--ease-expo), background .4s var(--ease-expo),
    border-color .4s var(--ease-expo);
}
#nav .brand { font-weight: 500; display: flex; align-items: center; gap: .4em; }
#nav .nav-right { display: flex; gap: 2.5em; align-items: center; }
#nav .nav-links { display: flex; gap: 0.5em; align-items: baseline; }
.nav-sep { color: var(--color-text-muted); user-select: none; }

/* Condensed state: solid bar after 24px scroll (NAV-01, D-03) */
#nav.condensed {
  padding: .7em var(--pad-edge);
  background: rgba(244,244,244,0.9);
  backdrop-filter: blur(8px);
  border-bottom-color: var(--color-border);
}
#nav.condensed .brand { font-size: .95em; }

/* Menu button: hidden on desktop; Plan 03 reveals at <=620px */
.menu-btn { display: none; }

/* Mobile-only elements: hidden by default (desktop-first) */
.mobile-intro { display: none; }
.mobile-bar   { display: none; }

/* Nav link: grow-from-left underline on hover (D-02) */
.nav-a {
  position: relative;
  text-decoration: none;
  color: inherit;
  padding-bottom: 2px;
}
.nav-a::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  height: 1px;
  width: 0;
  background: currentColor;
  transition: width 0.3s var(--ease-expo);
}
.nav-a:hover::after { width: 100%; }

/* CTA pill: ink-fill on hover (D-02) */
.cta {
  border: 1px solid var(--color-ink);
  border-radius: 999px;
  padding: 0.35em 0.9em;
  text-decoration: none;
  color: inherit;
  transition: all 0.2s var(--ease-expo);
  white-space: nowrap;
}
.cta:hover { background: var(--color-ink); color: var(--color-bg); }

/* Mid area: intro paragraph top-right */
.c-mid {
  flex: 1;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: start;
  gap: 2em;
  padding-top: 8vh;
}
.c-intro {
  font-size: clamp(1.05rem, 1.7vw, 1.5rem);
  line-height: 1.4;
  max-width: 26ch;
  justify-self: end;
  text-align: left;
}
.c-intro .muted { color: var(--color-text-muted); }

/* Bottom: name bottom-left, scroll cue bottom-right */
.c-bottom { display: flex; justify-content: space-between; align-items: flex-end; }

/* Giant name — .ln wrappers MUST stay intact for Phase 8 GSAP masked-rise */
.name {
  font-size: var(--text-hero);
  font-weight: var(--display-weight);
  line-height: var(--display-leading);
  letter-spacing: var(--display-tracking);
}
.name .ln { display: block; overflow: hidden; }   /* Phase 8 GSAP target: yPercent rise */
.name .ln > span { display: inline-block; }   /* per-letter .letter-h spans flow horizontally; inline-block keeps GSAP yPercent rise (inline can't transform) */

/* Ink-square motif — 0.5em × 0.5em (UI-SPEC.md; not the sketch's 0.62em) */
.ink-square {
  width: 0.5em;
  height: 0.5em;
  background: var(--color-ink);
  display: inline-block;
  vertical-align: -0.02em;
}

/* Scroll cue */
.scroll-cue {
  display: inline-flex;
  align-items: center;
  gap: 0.5em;
  font-size: var(--text-nav);
  color: var(--color-text-muted);
}
.scroll-cue .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-ink);
}

/* ── Section stubs (D-05/D-06) ──────────────────────────────────────────── */
section {
  min-height: 70vh;
  padding: var(--pad-edge);
  scroll-margin-top: 60px;
}
section h2 {
  font-size: var(--text-hero);
  font-weight: var(--display-weight);
  color: var(--color-ink);
}

/* ── Mobile breakpoint ───────────────────────────────────────────────────── */
@media (max-width: 767px) {
  .c-mid { grid-template-columns: 1fr; }
  .c-intro { justify-self: start; }
  .nav-right { flex-direction: column; gap: 1em; }
}

/* ── Phone recomposition (005-C, MOB-01/03/04, D-04) ────────────────────── */
/* This is a SEPARATE block from the 767px theme-padding query above.         */
/* The >=620px desktop layout is visually unchanged.                          */
@media (max-width: 620px) {
  /* Nav: keep the 3 inline links on mobile; hide the nav CTA (mobile-bar covers it).
     Menu button stays hidden (display:none from base rule) — links are the mobile nav. */
  #nav .cta { display: none; }

  /* Mobile nav: always solid from scroll 0 (D-04) — no transparent-over-hero phase */
  #nav { padding: .7em var(--pad-edge);
    background: rgba(244,244,244,0.9); backdrop-filter: blur(8px);
    border-bottom-color: var(--color-border); }

  /* Hero: recomposed single-column layout */
  .hero { min-height: auto; height: auto; padding-top: 2.4em; padding-bottom: 3.2em; }
  .c-mid { display: none; }
  .c-bottom { flex-direction: column; align-items: flex-start; gap: 1em; }
  .name { font-size: clamp(3rem, 22vw, 6rem); }
  .mobile-intro { display: block; max-width: 40ch; line-height: 1.45;
    font-size: var(--text-body); margin-top: 1.3em; }

  /* Mobile bottom CTA bar */
  body { padding-bottom: 64px; }
  .mobile-bar { display: flex; position: fixed; left: 0; right: 0; bottom: 0;
    justify-content: center; padding: .8em;
    background: rgba(244,244,244,0.95); backdrop-filter: blur(8px);
    border-top: 1px solid var(--color-border);
    transition: opacity .4s var(--ease-expo); }
  .mobile-bar .cta { background: var(--color-ink); color: var(--color-bg);
    border-color: var(--color-ink); }

  /* JS-driven hide: bar fades when #contact is in view (D-08) */
  .mobile-bar.contact-visible { opacity: 0; pointer-events: none; }
}

/* ── Section system (Phase 9 / sketch-003 Variant D) ────────────────────── */

/* numbered editorial header — ink number, muted slash + label */
.sec-num {
  font-weight: 600; line-height: 1.3; letter-spacing: -.02em;
  font-size: clamp(2rem, 6.5vw, 6rem);
  display: flex; align-items: baseline; gap: .28em;
}
.sec-num .num   { color: var(--color-ink); }
.sec-num .slash { color: var(--color-text-muted); font-weight: 400; }
.sec-num .lbl   { color: var(--color-text-muted); }

/* editorial rows */
.entry {
  padding: clamp(1.6rem, 3.5vh, 2.6rem) 0;
  border-top: 1px solid var(--color-border);
  display: grid; grid-template-columns: 1fr; gap: .8em;
}
.entry:first-of-type { border-top: 0; }

/* project title row — title left, muted status right */
.proj-row {
  display: flex; justify-content: space-between;
  align-items: baseline; gap: 1.5em; flex-wrap: wrap;
}

/* project title link — grow-from-left underline (mirrors .nav-a) */
.p-title {
  position: relative; text-decoration: none; color: var(--color-ink);
  padding-bottom: 2px;
}
.p-title::after {
  content: ''; position: absolute; left: 0; bottom: -2px;
  height: 1px; width: 0; background: currentColor;
  transition: width .3s var(--ease-expo);
}
.p-title:hover::after { width: 100%; }

/* project description + attribution — capped to a reading measure (matches .xp-impact) */
.p-desc { max-width: 60ch; }
/* attribution and secondary labels */
.attrib { color: var(--color-text-muted); font-size: var(--text-body); max-width: 60ch; }
.attrib a { color: var(--color-ink); }
.attrib a:hover { color: var(--color-text-muted); }
.sec-label { color: var(--color-text-muted); font-size: var(--text-body); white-space: nowrap; }

/* tech stack — inline muted line */
.tech-line { font-size: .9rem; color: var(--color-text-muted); line-height: 1.45; }
.tech-line .sep { opacity: .5; padding: 0 .15em; }

/* experience — two-column dated grid */
.xp-row {
  display: grid; grid-template-columns: minmax(0,1fr) auto;
  gap: .4em 2em; align-items: baseline;
}
.xp-date { color: var(--color-text-muted); white-space: nowrap; text-align: right; }
.xp-co   { color: var(--color-text-muted); }
.xp-impact { grid-column: 1 / -1; max-width: 60ch; line-height: 1.5; }

/* skills — auto-fit grid, no media queries */
.skills-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: clamp(1.6rem, 4vh, 3rem);
}
.skill-group h3 { font-weight: 600; margin-bottom: .6em; }
.skill-group ul  { list-style: none; }
.skill-group li  { color: var(--color-text-muted); line-height: 1.5;
                   font-size: var(--text-body); }
.skill-group a   { color: var(--color-ink); }
.skill-group a:hover { color: var(--color-text-muted); }
/* clustered group — small category label above its wrapped tool line */
.skill-group .clustered li { margin-bottom: .6em; }
.skill-group .cat { display: block; color: var(--color-ink);
                    font-size: .82rem; letter-spacing: .02em; margin-bottom: .1em; }

/* Scroll-reveal mask */
.reveal   { overflow: hidden; }
.reveal-i { display: block; }

/* Reduced-motion: sections render at rest */
@media (prefers-reduced-motion: reduce) {
  .reveal   { overflow: visible; }
  .reveal-i { opacity: 1 !important; transform: none !important; }
}

/* Section padding override — override stub min-height/padding for filled sections */
#projects, #experience, #skills, #contact {
  padding: clamp(4rem, 11vh, 9rem) var(--pad-edge);
  min-height: auto;
}

/* ── Contact section (Phase 10 / sketch 006-C) ──────────────────────────── */

/* Two-column grid: oversized statement left, form right */
.contact-layout {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: clamp(2rem, 6vw, 5rem);
  align-items: start;
}

@media (max-width: 760px) {
  .contact-layout { grid-template-columns: 1fr; }
}

/* Oversized statement — the section's visual anchor */
.statement {
  font-size: clamp(2.6rem, 9vw, 8rem);
  font-weight: 600;
  line-height: 0.92;
  letter-spacing: -0.03em;
}
.statement .muted { color: var(--color-text-muted); }

/* ── Headshot — small, circular, hairline ring, strict monochrome ── */
.c-headshot {
  margin: var(--space-6) 0 0;
  max-width: 96px;
}
.c-headshot img {
  display: block;
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  filter: grayscale(1);
  transition: filter 0.4s var(--ease-expo);
}
.c-headshot img:hover {
  filter: grayscale(0.85);
}

/* Surfaceless underline fields (winner 006-C) */
.field {
  display: flex;
  flex-direction: column;
  gap: 0;
  margin-bottom: var(--space-6);
}

.field label {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-2);
}

.field input,
.field textarea {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--color-ink);
  background: transparent;
  font-family: var(--font-sans);
  font-size: var(--text-body);
  color: var(--color-ink);
  padding: 0.35em 0;
  resize: vertical;
  transition: padding 0.2s var(--ease-expo);
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-bottom-width: 3px;
  padding-bottom: calc(0.35em - 2px);
}

/* Error state: dashed ink underline (no red/amber/green — hard monochrome constraint) */
.field.invalid input,
.field.invalid textarea {
  border-bottom-style: dashed;
}

/* Inline error message — muted dash prefix, no color change */
.err-msg {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-top: 0.4em;
  min-height: 1.2em;
}
.err-msg::before { content: '—\00a0'; }
.err-msg:empty::before { content: none; }

/* Submission-level error (above submit button) */
.form-error {
  font-size: 0.875rem;
  color: var(--color-text-muted);
  margin-bottom: var(--space-4);
  min-height: 1.2em;
}
.form-error::before { content: '—\00a0'; }
.form-error:empty::before { content: none; }

/* Big text send button — transparent, arrow nudges on hover */
.btn-send {
  display: inline-flex;
  align-items: center;
  gap: 0.7em;
  background: transparent;
  border: 0;
  color: var(--color-ink);
  font-family: var(--font-sans);
  font-size: clamp(1.2rem, 2.6vw, 1.8rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  padding: 0;
  cursor: pointer;
  min-height: 44px; /* CAP-05 touch target */
}
.btn-send .arrow { transition: transform 0.25s var(--ease-expo); }
.btn-send:hover:not(:disabled) .arrow { transform: translateX(6px); }
.btn-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Mono-ring spinner (shown while sending) */
.spinner {
  display: none;
  width: 0.8em;
  height: 0.8em;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.form-wrap.sending .spinner { display: inline-block; }
.form-wrap.sending { cursor: progress; }

@keyframes spin { to { transform: rotate(360deg); } }

/* Success panel — ink surface (the one inversion) */
.success {
  display: none;
  background: var(--color-bg-inv);
  color: var(--color-ink-inv);
  padding: var(--space-8);
}
.form-wrap.done .success { display: block; }
.form-wrap.done form { display: none; }

.success-big {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.02em;
  margin-bottom: var(--space-4);
}

.success-sub {
  font-size: var(--text-body);
  color: var(--color-text-muted-inv);
  margin-bottom: var(--space-6);
  line-height: 1.5;
}

.reset-btn {
  background: transparent;
  border: 0;
  color: var(--color-ink-inv);
  font-family: var(--font-sans);
  font-size: var(--text-body);
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Ink square in success panel */
.ink-sq {
  display: inline-block;
  width: 0.7em;
  height: 0.7em;
  background: currentColor;
  vertical-align: middle;
}

/* Social / location strip */
.contact-strip {
  margin-top: var(--space-8);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5em 2em;
  font-size: var(--text-body);
  color: var(--color-text-muted);
}

/* Footer social links — grow-from-left underline (mirrors .nav-a::after) */
.footlink {
  position: relative;
  text-decoration: none;
  color: var(--color-ink);
  padding-bottom: 2px;
}
.footlink::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  height: 1px;
  width: 0;
  background: currentColor;
  transition: width 0.3s var(--ease-expo);
}
.footlink:hover::after { width: 100%; }

/* Footer */
footer {
  border-top: 1px solid var(--color-border);
  padding: var(--space-6) var(--pad-edge);
}
.foot-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1em;
}
.foot-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
  font-weight: 500;
  font-size: var(--text-body);
}
.foot-nav {
  display: flex;
  gap: 1.5em;
  align-items: center;
}
.foot-copy {
  font-size: 0.875rem;
  color: var(--color-text-muted);
}

/* ── Menu overlay — full-screen monochrome editorial nav (D-05, D-06) ──────── */
.menu-overlay {
  position: fixed; inset: 0; z-index: 9000;
  background: var(--color-ink); color: var(--color-bg);
  display: flex; flex-direction: column;
  justify-content: center; padding: var(--pad-edge);
  opacity: 0; pointer-events: none; visibility: hidden;
  transition: opacity .4s var(--ease-expo), visibility .4s var(--ease-expo);
}
.menu-overlay.open {
  opacity: 1; pointer-events: auto; visibility: visible;
}

/* Close button — top-right ✕, large tappable hit area */
.menu-overlay .close-btn {
  position: absolute;
  top: var(--pad-edge); right: var(--pad-edge);
  background: transparent;
  border: 0;
  color: var(--color-bg);
  font-family: var(--font-sans);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.25em 0.5em;
  min-width: 44px; min-height: 44px;
  display: flex; align-items: center; justify-content: center;
}

/* Overlay links container */
.menu-overlay .overlay-links {
  display: flex;
  flex-direction: column;
  gap: .2em;
}

/* Large display-type section links (D-05) */
.menu-overlay .overlay-link {
  font-size: clamp(2.4rem, 10vw, 5rem);
  font-weight: 600;
  line-height: 0.9;
  letter-spacing: var(--display-tracking);
  color: var(--color-bg);
  text-decoration: none;
  position: relative;
  padding-bottom: 4px;
  display: inline-block;
}

/* Grow-from-left underline — inverted (bg color on ink surface) */
.menu-overlay .overlay-link::after {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  height: 1px;
  width: 0;
  background: var(--color-bg);
  transition: width 0.3s var(--ease-expo);
}
.menu-overlay .overlay-link:hover::after { width: 100%; }

/* Global focus-visible — visible outlines on all interactive elements (CAP-05) */
:focus-visible {
  outline: 2px solid var(--color-ink);
  outline-offset: 2px;
}

/* ── Project-detail drawer (Phase 13, D-01…D-06) ─────────────────────── */
#scrim {
  position: fixed; inset: 0; z-index: 9400;
  background: rgba(32,29,29,0.35);
  opacity: 0; visibility: hidden;
  transition: opacity .4s var(--ease-expo);
  pointer-events: none;
}
#scrim.open { opacity: 1; visibility: visible; pointer-events: auto; }

#drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 9500;
  width: min(680px, 92vw); background: var(--color-bg);
  transform: translateX(100%); display: flex; flex-direction: column;
  box-shadow: -20px 0 60px rgba(0,0,0,0.18); visibility: hidden;
}
#drawer.open { visibility: visible; }
#drawer .dw-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1.6em var(--pad-edge); border-bottom: 1px solid var(--color-border);
}
#drawer .dw-body { overflow-y: auto; padding: 2em var(--pad-edge) 4em; flex: 1; }

body.locked { overflow: hidden; }

/* Row hover nudge + open-cue affordance (D-02) */
.proj-row {
  cursor: pointer;
  transition: padding-left .3s var(--ease-expo);
}
.proj-row:hover { padding-left: .6em; }
.open-cue {
  font-size: .8rem; color: var(--color-text-muted);
  opacity: 0; transform: translateX(-6px);
  transition: all .3s var(--ease-expo);
}
.proj-row:hover .open-cue { opacity: 1; transform: translateX(0); }

/* Whole project block is the trigger (sketch 007-B); class added by drawer.js init() */
.reveal-i.is-drawer-trigger { cursor: pointer; }
.reveal-i.is-drawer-trigger:hover .proj-row { padding-left: .6em; }
.reveal-i.is-drawer-trigger:hover .open-cue { opacity: 1; transform: translateX(0); }

/* Attribution callout — ruled left border, Clawdmeter only (D-06, D-07) */
.dw-body .attrib-callout {
  border-left: 2px solid var(--color-ink); padding-left: 1em;
  margin: 0 0 2em; font-size: .95rem; color: var(--color-text-muted);
  line-height: 1.5; max-width: 60ch;
}
.dw-body .attrib-callout a { text-decoration: underline; text-underline-offset: 2px; }

/* Meta grid + link pills (D-04) */
.dw-body .meta {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1.4em; border-top: 1px solid var(--color-border); padding-top: 1.6em;
}
/* Section headers (Overview, What I built, Stack) — separate from the section above */
.dw-body h3 { margin-top: 2.2em; margin-bottom: .6em; }

/* Stack line — sits snug under its own "Stack" heading */
.dw-body .detail-stack {
  margin-top: 0; color: var(--color-text-muted);
  font-size: .9rem; letter-spacing: .02em;
}

/* Link pills — flex row so vertical padding can't overlap the meta grid above */
.dw-body .dw-links {
  display: flex; flex-wrap: wrap; gap: .75em; margin: 2em 0 0;
}
.dw-body .lk {
  display: inline-block; line-height: 1.2;
  border: 1px solid var(--color-ink); border-radius: 999px;
  padding: .5em 1.1em; text-decoration: none;
  transition: all .2s var(--ease-expo);
}
.dw-body .lk:hover { background: var(--color-ink); color: var(--color-bg); }

@media (prefers-reduced-motion: reduce) {
  #drawer { transition: none !important; }
  #scrim  { transition: none !important; }
}

/* ── Accessibility utilities (PERF-05) ───────────────────────────────────── */

/* Standard visually-hidden pattern (CSS clip — not display:none; no SEO risk) */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Skip navigation link — hidden until focused, then revealed at top of viewport */
.skip-link {
  position: absolute;
  top: -100%;
  left: var(--pad-edge);
  z-index: 10000;
  background: var(--color-bg);
  color: var(--color-ink);
  padding: 0.5em 1em;
  text-decoration: none;
  border: 1px solid var(--color-ink);
  font-size: var(--text-body);
  font-weight: 500;
  transition: top 0.1s;
}
.skip-link:focus {
  top: calc(var(--pad-edge) / 2);
}
