/* ============================================================
   site.css — personal site layout. Consumes brand.css tokens.
   ============================================================ */
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--fg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
.wrap { max-width: 1120px; margin: 0 auto; padding: 0 40px; }
.eyebrow {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.2em;
  text-transform: uppercase; color: var(--accent);
}

/* ---- Nav ---- */
.nav {
  position: sticky; top: 0; z-index: 20;
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 40px; font-family: var(--font-mono); font-size: 12px;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.nav-logo { font-weight: 700; color: var(--fg-strong); }
.nav-right { display: flex; gap: 22px; align-items: center; }
.nav-right a { color: var(--fg-muted); }
.nav-right a:hover { color: var(--fg-strong); }
.nav-toggle {
  display: flex; gap: 7px; align-items: center; cursor: pointer;
  font-family: var(--font-mono); font-size: 11px; letter-spacing: 0.05em;
  color: var(--fg); background: transparent;
  border: 1px solid var(--border-strong); border-radius: 6px; padding: 5px 9px;
}
.nav-toggle .dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 8px var(--accent);
}

/* ---- Hero ---- */
.hero {
  position: relative; min-height: 88vh; display: flex; align-items: center;
  overflow: hidden;
  background-image:
    radial-gradient(circle at 16% 28%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 44%),
    linear-gradient(color-mix(in srgb, var(--fg-strong) 4%, transparent) 1px, transparent 1px),
    linear-gradient(90deg, color-mix(in srgb, var(--fg-strong) 4%, transparent) 1px, transparent 1px);
  background-size: auto, 44px 44px, 44px 44px;
}
/* .hero is a flex container (vertical centering); width:100% keeps .wrap at full column width
   instead of shrinking to its content, so hero content aligns with the nav and sections. */
.hero .wrap { width: 100%; }
.hero .eyebrow { margin-bottom: 18px; }
/* scale the brand name-frame up for the hero; padding moves to .nm so the scan can clip to the box.
   line-height:0 removes the inline-block baseline gap that otherwise leaves a strip below .nm. */
.hero .name-frame { padding: 0; border-width: 2px; margin-bottom: 26px; line-height: 0; }
.hero .name-frame .c { width: 18px; height: 18px; }

/* Hero name: a clipped nameplate (.nm) holding two stacked text layers — a hollow outline
   (the real <h1>) and a solid fill revealed by a moving clip — plus the scan line. The line and
   the fill clip both span the FULL .nm box, so the line sweeps border-to-border, and the trail
   is clipped to the box via overflow:hidden (no spilling outside the frame). */
.hero .name-frame .nm {
  position: relative; display: inline-block; z-index: 0;
  padding: 16px 24px;            /* the nameplate's inner padding (formerly on .name-frame) */
  overflow: hidden;              /* clips the comet trail to the box */
}
.hero .name-frame .nm-text {
  display: block; margin: 0;
  font-size: clamp(34px, 6vw, 50px); font-weight: 400;
  letter-spacing: -0.03em; line-height: 1;
}
.hero .name-frame .nm-outline {            /* under layer: hollow letters */
  position: relative; z-index: 1;
  color: transparent;
  -webkit-text-stroke: 1.2px var(--fg-strong);
}
.hero .name-frame .nm-fill {               /* solid letters; padding matches .nm so it overlaps the outline exactly */
  position: absolute; inset: 0; z-index: 2; padding: 16px 24px;
  color: var(--fg-strong);
  -webkit-text-stroke: 1.2px var(--fg-strong);
  clip-path: inset(0 0 0 0);               /* default fully shown (reduced-motion / no-anim fallback) */
}
.hero .name-frame .scan {                  /* the bright scan line; full nameplate height */
  z-index: 3; top: 0; bottom: 0; left: 0; width: 2px;
  opacity: 0;                              /* hidden until the sweep runs */
  background: var(--accent);
  box-shadow: 0 0 6px 1px var(--accent),
              0 0 16px 3px color-mix(in srgb, var(--accent) 65%, transparent);
}
.hero .name-frame .scan::before {         /* comet trail: brightest at the line, fading back */
  content: ""; position: absolute; top: 0; bottom: 0; right: 0; width: 170px;
  pointer-events: none;
  background: linear-gradient(90deg,
    transparent 0%,
    color-mix(in srgb, var(--accent) 24%, transparent) 58%,
    color-mix(in srgb, var(--accent) 60%, transparent) 100%);
}
.tagline {
  font-size: clamp(20px, 3vw, 25px); font-weight: 500; letter-spacing: -0.015em;
  color: var(--fg-strong); max-width: 620px;
}
.lede { font-size: 15px; color: var(--fg-muted); max-width: 560px; margin-top: 14px; }
.cta { display: flex; gap: 12px; margin-top: 30px; font-family: var(--font-mono); font-size: 13px; flex-wrap: wrap; }
.btn { padding: 11px 18px; border-radius: 7px; font-weight: 500; transition: transform .12s, background .15s, border-color .15s; }
.btn:hover { transform: translateY(-1px); }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: color-mix(in srgb, var(--accent) 88%, #fff); }
.btn-ghost { border: 1px solid var(--border-strong); color: var(--fg); }
.btn-ghost:hover { border-color: var(--accent); color: var(--fg-strong); }

/* ---- Section shell + spine-node header ---- */
.block { padding: 64px 0; border-top: 1px solid var(--border); }
.sec-head { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.sec-head .node { width: 9px; height: 9px; background: var(--accent); flex: none; }
.sec-head h2 {
  font-family: var(--font-mono); font-size: 13px; font-weight: 500;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--fg-muted);
}
.sec-head .rule { flex: 1; height: 1px; background: var(--border); }

/* ---- Project cards ---- */
.proj {
  display: block; border: 1px solid var(--border); border-radius: 10px;
  background: var(--panel); padding: 26px 28px; margin-bottom: 18px;
  transition: border-color .15s, transform .15s;
}
.proj:hover { border-color: var(--accent); transform: translateY(-2px); }
.proj-top { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; }
.proj-top h3 { font-size: 20px; font-weight: 600; color: var(--fg-strong); letter-spacing: -0.01em; }
.proj-meta { font-family: var(--font-mono); font-size: 11px; color: var(--fg-subtle); white-space: nowrap; }
.proj p { color: var(--fg-muted); font-size: 14.5px; margin-top: 10px; max-width: 680px; }
.proj-link:hover h3 { color: var(--accent); }

/* status badge next to a project title: live (green, public) vs demo-on-request (muted, hollow) */
.status {
  display: inline-flex; align-items: center; gap: 6px; margin-left: 10px;
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  font-weight: 500; vertical-align: middle;
}
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; flex: none; }
.status.live { color: var(--live); }
.status.live::before { background: var(--live); box-shadow: 0 0 7px var(--live); }
.status.req { color: var(--fg-subtle); }              /* also used as an <a> linking to #contact */
.status.req::before { background: transparent; border: 1.5px solid var(--fg-subtle); }
.status.req::after { content: "→"; font-size: 20px; line-height: 1; position: relative; top: -3px; }  /* lift glyph to optical center (it sits low in its box) */
.status.req:hover { color: var(--fg); }
.status.req:hover::before { border-color: var(--fg); }

/* in-card link row (e.g. live demo / source) */
.proj-links { display: flex; gap: 18px; margin-top: 18px; font-family: var(--font-mono); font-size: 12.5px; }
.proj-links a.demo { color: var(--accent); font-weight: 500; }
.proj-links a.src { color: var(--fg-muted); }
.proj-links a:hover { text-decoration: underline; }

.stats { display: flex; gap: 28px; margin-top: 16px; flex-wrap: wrap; }
.stat { display: flex; flex-direction: column; }
.stat .n { font-size: 22px; font-weight: 600; color: var(--fg-strong); }
.stat .l { font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--fg-subtle); }

.tags { list-style: none; display: flex; flex-wrap: wrap; gap: 7px; margin-top: 18px; }
.tags li {
  font-family: var(--font-mono); font-size: 11px; color: var(--fg);
  border: 1px solid var(--border); border-radius: 5px; padding: 3px 9px; background: var(--panel-2);
}

/* ---- About ---- */
.prose { font-size: 15.5px; color: var(--fg); max-width: 680px; margin-bottom: 14px; }
.prose strong { color: var(--fg-strong); font-weight: 600; }

/* ---- Contact ---- */
.contact { display: flex; flex-direction: column; gap: 14px; }
.c-row { display: flex; gap: 14px; align-items: baseline; font-family: var(--font-mono); font-size: 14px; }
.c-row dt { color: var(--fg-subtle); width: 96px; flex: none; }
.c-row dd a { color: var(--accent); }
.c-row dd a:hover { text-decoration: underline; }

/* ---- Footer ---- */
.footer { padding: 40px 0; border-top: 1px solid var(--border);
  font-family: var(--font-mono); font-size: 11px; color: var(--fg-subtle); text-align: center; }

/* ---- Scroll reveal ---- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .5s ease, transform .5s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---- Hero name scan: a single reveal pass; the line then parks at the right edge, glow on ---- */
.hero .name-frame .nm-fill { animation: nm-reveal 4300ms linear both; }
.hero .name-frame .scan    { animation: nm-scan 4300ms linear both; }

@keyframes nm-reveal {
  from { clip-path: inset(0 100% 0 0); }       /* hidden: fully clipped from the right */
  to   { clip-path: inset(0 0 0 0); }          /* fully revealed */
}
@keyframes nm-scan {
  from { left: 0;                opacity: 1; }
  to   { left: calc(100% - 2px); opacity: 1; } /* rests flush inside the right edge (not clipped) */
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .hero .name-frame .nm-fill { animation: none; clip-path: inset(0 0 0 0); }
  .hero .name-frame .scan { animation: none; opacity: 0; }
}

/* ---- Focus visibility (keyboard) ---- */
a:focus-visible, button:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px;
}

/* ---- Responsive ---- */
@media (max-width: 720px) {
  .wrap { padding: 0 22px; }
  .nav { padding: 12px 22px; }
  .nav-right { gap: 14px; }
  .nav-right a { display: none; }            /* keep logo + toggle on small screens */
  .hero { min-height: 82vh; }
  .proj-top { flex-direction: column; gap: 4px; }
  .proj-meta { white-space: normal; }
  .stats { gap: 20px; }
  .c-row { flex-direction: column; gap: 2px; }
  .c-row dt { width: auto; }
}

/* ---- Contact form ---- */
#contact-form { display: flex; flex-direction: column; gap: 16px; max-width: 560px; margin-bottom: 26px; }
#contact-form .field { display: flex; flex-direction: column; gap: 6px; }
#contact-form label {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--fg-subtle);
}
#contact-form input, #contact-form textarea {
  font-family: var(--font-sans); font-size: 14px; color: var(--fg);
  background: var(--panel); border: 1px solid var(--border-strong); border-radius: 7px;
  padding: 10px 12px; width: 100%; resize: vertical;
}
#contact-form input:focus, #contact-form textarea:focus {
  outline: none; border-color: var(--accent);
}
#contact-form input::placeholder, #contact-form textarea::placeholder { color: var(--fg-subtle); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.cf-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
#contact-form button[type="submit"] { cursor: pointer; border: none; }
#contact-form button[disabled] { opacity: 0.55; cursor: default; }
.cf-status { font-family: var(--font-mono); font-size: 12px; color: var(--fg-muted); }
.cf-status.ok { color: var(--live); }
.cf-status.err { color: #f87171; }

/* the secondary meta rows (github/resume/location), now below the form */
.contact-meta { display: flex; flex-direction: column; gap: 14px; }
.contact-meta .c-row { display: flex; gap: 14px; align-items: baseline; font-family: var(--font-mono); font-size: 14px; }
.contact-meta .c-row dt { color: var(--fg-subtle); width: 96px; flex: none; }
.contact-meta .c-row dd a { color: var(--accent); }
.contact-meta .c-row dd a:hover { text-decoration: underline; }

@media (max-width: 720px) {
  .contact-meta .c-row { flex-direction: column; gap: 2px; }
  .contact-meta .c-row dt { width: auto; }
}
