/* ==========================================================================
   home.css — index.html sections, in page order:
   hero · about (+ floorplan) · experience (+ timing diagram) · design team ·
   projects (+ case-study modal) · photography band · contact
   ========================================================================== */

/* ==========================================================================
   Hero — signal field background (see assets/js/lib/signal-field.js)
   ========================================================================== */
.hero {
  position: relative;
  min-height: max(660px, 100svh);
  display: flex; flex-direction: column; justify-content: flex-end;
  padding-top: var(--nav-h);
  overflow: hidden;
  isolation: isolate;
}
.hero__canvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -2; touch-action: pan-y; }
.hero::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(ellipse 62% 58% at 20% 76%, color-mix(in srgb, var(--bg) 88%, transparent) 0%, transparent 72%),
    linear-gradient(to bottom, transparent 72%, var(--bg));
}
.hero__frame { inset: calc(var(--nav-h) + 14px) var(--gutter) 14px; z-index: -1; }
.hero__fig { position: absolute; top: 28px; right: 32px; color: var(--ink-3); }
.hero__fig b { color: var(--accent); font-weight: 400; }

.hero__content { padding-bottom: clamp(28px, 5vh, 64px); }

/* Status pill: shrinks a touch on small phones so it stays on one line */
.status {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 7px 14px 7px 10px;
  border: 1px solid var(--line-2); border-radius: 999px;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  color: var(--ink-2);
}
.status__dot { position: relative; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.status__dot::after {
  content: ""; position: absolute; inset: -4px; border-radius: 50%;
  border: 1px solid var(--ok); opacity: 0;
  animation: ping 2.4s var(--ease-out) infinite;
}

.display {
  margin: 0.32em 0 0.34em;
  font-family: var(--font-serif); font-weight: 400;
  font-size: clamp(2.9rem, 6.9vw, 7rem);
  line-height: 0.94; letter-spacing: -0.022em; word-spacing: 0.04em;
}
.display em { font-style: italic; }
.display .line { display: block; overflow: hidden; padding-bottom: 0.06em; margin-bottom: -0.06em; }
.display .line > span { display: inline-block; }
.js .display .line > span { transform: translateY(105%); animation: rise 1.2s var(--ease-out) forwards; animation-delay: calc(0.15s + var(--i, 0) * 0.12s); }

.hero__lede { max-width: 56ch; margin: 0; font-size: clamp(1.02rem, 1.25vw, 1.16rem); color: var(--ink-2); }
.hero__lede strong { color: var(--ink); font-weight: 500; }
.hero__cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 30px; }
.js .hero__fade { opacity: 0; animation: fade-up 1s var(--ease-out) forwards; animation-delay: var(--d, 0.5s); }

.readout {
  display: grid;
  grid-template-columns: repeat(3, auto);
  justify-content: space-between;
  gap: 12px 24px;
  margin-top: clamp(32px, 6vh, 64px);
  padding: 14px 0 0;
  border-top: 1px solid var(--line-2);
}
.readout__item { display: grid; gap: 2px; }
.readout__label { color: var(--ink-3); }
.readout__value { color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; text-transform: none; }
.readout__value .muted { color: var(--ink-3); }
.scroll-cue { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-2); }
.scroll-cue:hover { color: var(--accent); }
.scroll-cue .i { animation: bob 2.2s var(--ease) infinite; }
@keyframes bob { 50% { transform: translateY(3px); } }

@media (max-width: 480px) {
  .status { font-size: 0.6rem; letter-spacing: 0.035em; gap: 8px; }
}
@media (max-width: 900px) {
  .readout { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .readout__item--hide-sm, .scroll-cue { display: none; }
  .hero__fig { display: none; }
}

/* ==========================================================================
   About
   ========================================================================== */
.about { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(36px, 7vw, 112px); align-items: start; }

.portrait { position: relative; margin: 0; }
.portrait__frame { position: relative; aspect-ratio: 4 / 5; border-radius: var(--radius); overflow: hidden; background: #9d9078; }
.portrait__frame img { width: 100%; height: 100%; object-fit: cover; object-position: center 30%; transition: transform 1.6s var(--ease-out); }
.portrait:hover .portrait__frame img { transform: scale(1.04); }
.portrait__hud { inset: 16px; --corner: rgba(255, 255, 255, 0.9); }
.portrait__focus { position: absolute; top: 29%; left: 52%; width: 44px; height: 44px; translate: -50% -50%; border: 1.5px solid #8fe08f; border-radius: 3px; opacity: 0.9; }
.portrait__exif {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 0 26px 6px;
  display: flex; justify-content: space-between; gap: 8px;
  color: rgba(255, 255, 255, 0.9);
  font-family: var(--font-mono); font-size: 0.68rem; letter-spacing: 0.06em;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.5);
}
.portrait figcaption { margin-top: 14px; color: var(--ink-3); }

.about__intro {
  margin: 0 0 28px;
  font-family: var(--font-serif); font-weight: 400;
  font-size: clamp(1.8rem, 3.1vw, 2.75rem); line-height: 1.12; letter-spacing: -0.015em;
}
.about__intro em { color: var(--accent); }
.about__body p { margin: 0 0 1em; max-width: 62ch; color: var(--ink-2); font-size: 1.04rem; }

.spec { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: 28px; margin: 36px 0 0; border-top: 1px solid var(--line-2); }
.spec > div { display: grid; gap: 3px; padding: 15px 0; border-bottom: 1px solid var(--line); }
.spec dt { color: var(--ink-3); }
.spec dd { margin: 0; font-weight: 500; }

/* ---------- Technical skills, drawn as a chip floorplan ---------- */
.floorplan { margin: clamp(48px, 6vw, 80px) 0 0; }
.floorplan__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 8px 24px; margin-bottom: 18px; }
.floorplan__title { margin: 0; font-family: var(--font-serif); font-weight: 400; font-size: clamp(2.2rem, 4vw, 3.4rem); line-height: 1; letter-spacing: -0.02em; }
.floorplan__title em { color: var(--accent); }
.floorplan__label { color: var(--accent); }
.die {
  position: relative;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-template-areas:
    "rtl rtl rtl rtl rtl ver ver ver ver fpga fpga fpga"
    "rtl rtl rtl rtl rtl hw  hw  hw  hw  io   io   io"
    "rtl rtl rtl rtl rtl sw  sw  sw  sw  pic  pic  pic";
  gap: 8px;
  padding: 22px;
  border: 1px solid var(--line-2);
  border-radius: 6px;
  background: var(--surface);
}
.die::before { /* seal ring */
  content: ""; position: absolute; inset: 8px;
  border: 1px dashed var(--line-2); border-radius: 3px;
  pointer-events: none;
}
.block {
  position: relative;
  padding: 16px 18px 20px;
  border: 1px solid var(--line-2);
  background: repeating-linear-gradient(to bottom, transparent 0 11px, var(--grid) 11px 12px), var(--surface); /* standard-cell rows */
  transition: border-color 0.25s var(--ease);
}
.block h3 { margin: 0 0 8px; font-size: 0.7rem; color: var(--ink-3); transition: color 0.25s var(--ease); }
.block p { margin: 0; font-size: 1rem; line-height: 1.5; color: var(--ink-2); }
.block:hover { border-color: var(--accent); }
.block:hover h3 { color: var(--accent); }
.block--rtl { grid-area: rtl; }
.block--rtl h3 { color: var(--accent); }
.block--rtl p { font-size: clamp(1.15rem, 1.7vw, 1.4rem); line-height: 1.45; color: var(--ink); }
.block--ver { grid-area: ver; }
.block--hw { grid-area: hw; }
.block--fpga { grid-area: fpga; }
.block--io { grid-area: io; }
.block--sw { grid-area: sw; }
.block--pic { grid-area: pic; }
.floorplan figcaption { margin-top: 12px; color: var(--ink-3); }

@media (max-width: 1000px) {
  .die {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    grid-template-areas:
      "rtl  rtl  rtl  ver ver ver"
      "rtl  rtl  rtl  hw  hw  hw"
      "sw   sw   sw   io  io  io"
      "fpga fpga fpga pic pic pic";
  }
}
@media (max-width: 900px) {
  .about { grid-template-columns: 1fr; }
  .portrait { max-width: 440px; }
}
@media (max-width: 640px) {
  .spec { grid-template-columns: 1fr; }
  .die {
    grid-template-columns: 1fr 1fr;
    padding: 14px;
    grid-template-areas: "rtl rtl" "ver ver" "hw hw" "sw sw" "io io" "fpga pic";
  }
}

/* ==========================================================================
   Experience — timeline + timing diagram (assets/js/components/waveform-viewer.js)
   ========================================================================== */
.xp { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: clamp(36px, 6vw, 96px); }
.xp__aside { position: sticky; top: calc(var(--nav-h) + 28px); align-self: start; display: grid; gap: 16px; }

.panel { margin: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.panel__head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line); color: var(--ink-3); }
.panel__head b { color: var(--ink); font-weight: 400; }
.panel__foot { display: grid; grid-template-columns: repeat(3, 1fr); border-top: 1px solid var(--line); color: var(--ink-3); }
.panel__foot > div { padding: 12px 16px; display: grid; gap: 2px; }
.panel__foot > div + div { border-left: 1px solid var(--line); }
.panel__foot strong { font-family: var(--font-serif); font-weight: 400; font-size: 1.6rem; line-height: 1; color: var(--ink); text-transform: none; letter-spacing: -0.01em; }

.scope__body { padding: 6px 0 8px; }
.scope__body svg { width: 100%; overflow: visible; }
.scope text { font-family: var(--font-mono); letter-spacing: 0.04em; }
.scope .axis text { font-size: 9px; fill: var(--ink-3); }
.scope .gridline { stroke: var(--line); stroke-width: 1; }
.scope .clk path { fill: none; stroke: var(--trace-strong); stroke-width: 1; }
.scope .sig { cursor: pointer; }
.scope .sig__label { font-size: 10px; fill: var(--ink-3); transition: fill 0.25s; }
.scope .sig__wave { fill: none; stroke: var(--trace-strong); stroke-width: 1.4; stroke-linejoin: round; transition: stroke 0.25s; }
.scope .sig__high { fill: var(--grid); transition: fill 0.25s; }
.scope .sig__ongoing { fill: none; stroke: var(--trace-strong); stroke-width: 1.4; stroke-dasharray: 2 3; }
.scope .sig--incoming .sig__wave { stroke-dasharray: 3 3; }
.scope .sig:hover .sig__label { fill: var(--ink); }
.scope .sig.is-active .sig__label { fill: var(--ink); }
.scope .sig.is-active .sig__wave, .scope .sig.is-active .sig__ongoing { stroke: var(--accent); }
.scope .sig.is-active .sig__high { fill: var(--accent-soft); }
.scope .now line { stroke: var(--ink-3); stroke-width: 1; stroke-dasharray: 2 3; }
.scope .now text { font-size: 9px; fill: var(--ink-3); }
.scope .cursor { transition: transform 0.7s var(--ease-out); }
.scope .cursor line { stroke: var(--accent); stroke-width: 1.2; }
.scope .cursor rect { fill: var(--accent); }
.scope .cursor text { font-size: 9px; fill: #fff; }

.timeline { list-style: none; margin: 0; padding: 0; }
.job { position: relative; padding: 0 0 64px 44px; }
.job::before { content: ""; position: absolute; left: 6px; top: 14px; bottom: -6px; border-left: 1px dashed var(--line-2); }
.job:last-child::before { display: none; }
.job__pin {
  position: absolute; left: 0; top: 6px;
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--bg); border: 2px solid var(--ink-3);
  transition: background-color 0.3s, border-color 0.3s, box-shadow 0.3s;
}
.job.is-active .job__pin { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 6px var(--accent-soft); }
.job--incoming .job__pin { border-style: dashed; }
.job__when { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 0; color: var(--ink-3); }
.job__when b { color: var(--accent); font-weight: 400; }
.job__role { margin: 10px 0 4px; font-family: var(--font-serif); font-weight: 400; font-size: clamp(1.7rem, 2.6vw, 2.3rem); line-height: 1.05; letter-spacing: -0.015em; }
.job__org { margin: 0 0 14px; font-weight: 500; color: var(--ink); }
.job__org-note { color: var(--ink-3); font-weight: 400; }
.job p { margin: 0 0 12px; max-width: 62ch; color: var(--ink-2); }
.job__more { margin-top: 16px; }

/* Dash-bulleted list, shared by the timeline and the design-team section */
.dash-list { margin: 0 0 18px; padding: 0; list-style: none; max-width: 62ch; }
.dash-list li { position: relative; padding-left: 22px; margin-bottom: 6px; color: var(--ink-2); }
.dash-list li::before { content: ""; position: absolute; left: 0; top: 0.8em; width: 10px; height: 1px; background: var(--ink-3); }

@media (max-width: 900px) {
  .xp { grid-template-columns: 1fr; }
  .xp__aside { position: static; }
}

/* ==========================================================================
   Technical diagrams (case studies): inline SVG that follows the site theme.
   Each diagram's colours live in --dg-* tokens; light values first.
   ========================================================================== */
.dg {
  --dg-card: #fbfaf6;
  --dg-card-foot: #f3f0e8;
  --dg-grid: rgba(23, 22, 15, 0.06);
  --dg-frame: rgba(23, 22, 15, 0.16);
  --dg-box: #f4f1ea;
  --dg-box-stroke: #a39d90;
  --dg-wire: #6f6a5f;
  --dg-wire-dim: #a39d90;
  --dg-team: #9a9486;
  --dg-mine-fill: #fcece4;
  --dg-mine-inner: #fff8f4;
  --dg-mine-stroke: #e3ab93;
  --dg-chip-stroke: #ecc6b6;
  --dg-acc-dim: #c0603d;
  --dg-inner: #f6f4ee;
  --dg-inner-stroke: rgba(23, 22, 15, 0.14);
  --dg-sub: #6f6b60;
  --dg-ext: #aaa496;
  --dg-c-blue: #2f74a8;
  --dg-c-green: #2c8556;
  --dg-c-amber: #ad6b17;
  --dg-c-violet: #6b52ad;
  --dg-zone-opacity: 0.06;
  display: block; width: 100%; height: auto;
}
:root[data-theme="dark"] .dg {
  --dg-card: #1a1917;
  --dg-card-foot: #1d1c19;
  --dg-grid: #25241f;
  --dg-frame: #34322d;
  --dg-box: #1e1d1a;
  --dg-box-stroke: #6a665d;
  --dg-wire: #a8a397;
  --dg-wire-dim: #55534b;
  --dg-team: #6f6b62;
  --dg-mine-fill: #2a1a13;
  --dg-mine-inner: #1f1714;
  --dg-mine-stroke: #8a5a45;
  --dg-chip-stroke: #5e463b;
  --dg-acc-dim: #b9694b;
  --dg-inner: #1b1b17;
  --dg-inner-stroke: #34342c;
  --dg-sub: #817f74;
  --dg-ext: #45453c;
  --dg-c-blue: #6fa8d0;
  --dg-c-green: #7fbf9a;
  --dg-c-amber: #d9a05b;
  --dg-c-violet: #a892d6;
  --dg-zone-opacity: 0.045;
}
.dg text { font-family: var(--font-mono); }

/* shared pieces */
.dg-card { fill: var(--dg-card); }
.dg-card-foot { fill: var(--dg-card-foot); }
.dg-gridline { fill: none; stroke: var(--dg-grid); stroke-width: 1; }
.dg-frame { fill: none; stroke: var(--dg-frame); stroke-width: 1.4; }
.dg-rule { fill: none; stroke: var(--dg-frame); stroke-width: 1; }

/* Ray generator diagram */
.dg-hd { font-size: 15px; letter-spacing: 1.6px; font-weight: 500; fill: var(--ink); }
.dg-dim { fill: var(--ink-3); font-weight: 400; }
.dg-ttl { font-size: 15px; font-weight: 500; fill: var(--ink); }
.dg-sub { font-size: 12.5px; fill: var(--ink-3); }
.dg-acc { fill: var(--accent); }
.dg-acc-dim { fill: var(--dg-acc-dim); }
.dg-chip-text { font-size: 12.5px; fill: var(--ink-2); }
.dg-lab { font-size: 13px; letter-spacing: 1.4px; fill: var(--ink-3); }
.dg .dg-stat { font-family: var(--font-serif); font-size: 38px; fill: var(--ink); }
.dg-box { fill: var(--dg-box); stroke: var(--dg-box-stroke); stroke-width: 1.2; }
.dg-mine { fill: var(--dg-mine-fill); stroke: var(--accent); stroke-width: 1.6; }
.dg-mine-inner { fill: var(--dg-mine-inner); stroke: var(--dg-mine-stroke); stroke-width: 1.2; }
.dg-mine-inner.dg-dashed { stroke: var(--ink-3); stroke-dasharray: 4 3; }
.dg-chip { fill: var(--dg-mine-inner); stroke: var(--dg-chip-stroke); stroke-width: 1.1; }
.dg-team { fill: none; stroke: var(--dg-team); stroke-width: 1.2; stroke-dasharray: 5 4; }
.dg-wire { stroke: var(--dg-wire); stroke-width: 1.3; }
.dg-arrowhead { fill: var(--dg-wire); }
.dg-dot { fill: var(--accent); }

/* SPI-PWM architecture diagram: each block keeps its own hue via --zc */
.sp-blue { --zc: var(--dg-c-blue); }
.sp-green { --zc: var(--dg-c-green); }
.sp-amber { --zc: var(--dg-c-amber); }
.sp-violet { --zc: var(--dg-c-violet); }
.sp-zone { fill: var(--zc); fill-opacity: var(--dg-zone-opacity); stroke: var(--zc); stroke-width: 1.5; }
.sp-hd { font-size: 19px; letter-spacing: 1.5px; fill: var(--ink); }
.sp-hdim { fill: var(--ink-3); }
.sp-kick { font-size: 12px; letter-spacing: 2px; fill: var(--ink-3); }
.sp-ct { font-size: 17px; letter-spacing: 0.4px; fill: var(--zc); }
.sp-cn { font-size: 12px; fill: var(--ink-3); }
.sp-bt { font-size: 14px; fill: var(--ink); }
.sp-bs { font-size: 12px; fill: var(--dg-sub); }
.sp-bs.sp-strong { fill: var(--ink); }
.sp-bs.sp-addr { fill: var(--ink-2); }
.sp-et { font-size: 14px; fill: var(--ink-2); }
.sp-es { font-size: 12px; fill: var(--ink-3); }
.sp-inner { fill: var(--dg-inner); stroke: var(--dg-inner-stroke); stroke-width: 1; }
.sp-ext { fill: none; stroke: var(--dg-ext); stroke-width: 1.4; stroke-dasharray: 7 6; }
.sp-w { fill: none; stroke: var(--dg-wire-dim); stroke-width: 1.4; }
.sp-wa { fill: none; stroke: var(--dg-c-amber); stroke-width: 1.4; stroke-opacity: 0.75; }
.sp-amb { font-size: 12px; fill: var(--dg-c-amber); }
.sp-head { fill: none; stroke: var(--dg-wire-dim); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.sp-head--amber { stroke: var(--dg-c-amber); }
.sp-key { fill: var(--dg-c-blue); fill-opacity: 0.12; stroke: var(--dg-c-blue); stroke-width: 1.4; }

/* Figure wrapper inside the case-study modal */
.case-figure { margin: 0 0 24px; }
.case-figure__scroll { overflow-x: auto; border-radius: 16px; }
.case-figure__scroll .dg { min-width: 600px; }
.case-figure figcaption { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; margin-top: 10px; color: var(--ink-3); }
.case-figure figcaption a:hover { color: var(--accent); }

/* ==========================================================================
   Projects
   ========================================================================== */
.projects { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }

.project {
  position: relative;
  display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
  transition: transform 0.45s var(--ease-out), box-shadow 0.45s var(--ease-out), border-color 0.3s;
}
.project:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--line-2); }

.project--featured { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
.project--featured .project__visual { aspect-ratio: auto; min-height: 100%; border-bottom: 0; border-right: 1px solid var(--line); }

.project__visual {
  position: relative;
  aspect-ratio: 16 / 10;
  border-bottom: 1px solid var(--line);
  background-color: var(--bg-2);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 14px 14px;
  background-position: -1px -1px;
  color: var(--ink);
  overflow: hidden;
}
.project__visual::after { /* scan line on hover */
  content: ""; position: absolute; top: 0; bottom: 0; left: 0; width: 1px;
  background: var(--accent); box-shadow: 0 0 12px var(--accent);
  opacity: 0; transform: translateX(-2px);
}
.project:hover .project__visual::after { animation: scan 1.4s var(--ease) 1; }
@keyframes scan { 0% { opacity: 0; transform: translateX(0); } 10% { opacity: 0.9; } 90% { opacity: 0.9; } 100% { opacity: 0; transform: translateX(var(--scan-w, 600px)); } }

.project__tag { position: absolute; top: 14px; left: 16px; color: var(--ink-3); }
.project__tag b { color: var(--accent); font-weight: 400; }
.project__year { position: absolute; top: 14px; right: 16px; color: var(--ink-3); }

/* Line-art schematics inside each card */
.schematic { position: absolute; inset: 15% 8% 8%; width: 84%; height: 77%; overflow: visible; }
.schematic * { fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.schematic .acc { stroke: var(--accent); }
.schematic .fill-acc { fill: var(--accent); stroke: none; }
.schematic .dim { stroke: var(--ink-3); stroke-width: 0.9; stroke-dasharray: 3 3; }
.schematic .soft { stroke: var(--ink-3); stroke-width: 0.9; }
.schematic text { fill: var(--ink-3); stroke: none; font-family: var(--font-mono); font-size: 7.5px; letter-spacing: 0.06em; }
.schematic .lbl { fill: var(--ink-2); }
.schematic .dim.acc { stroke: var(--accent); stroke-opacity: 0.8; }
.schematic .acc-text { fill: var(--accent); }
.project:hover .schematic .dim { animation: ants 1s linear infinite; }
@keyframes ants { to { stroke-dashoffset: -12; } }
.js .project .schematic { clip-path: inset(0 100% 0 0); transition: clip-path 1.6s var(--ease-out) 0.25s; }
.js .project.is-visible .schematic { clip-path: inset(0 -10% 0 0); }

/* Featured card cover: the real chip layout (GDS render) */
.project__visual--layout { background: #1e1e1e; }
.project__visual--layout > img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 1.6s var(--ease-out); }
.project:hover .project__visual--layout > img { transform: scale(1.04); }
.project__visual--layout::before {
  content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none;
  background: linear-gradient(to bottom, rgba(10, 10, 8, 0.6), transparent 22%, transparent 66%, rgba(10, 10, 8, 0.72));
}
.project__visual--layout .project__tag,
.project__visual--layout .project__year { z-index: 2; color: rgba(255, 255, 255, 0.78); }
.layout-link {
  position: absolute; left: 16px; bottom: 16px; z-index: 2;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 14px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background: rgba(10, 10, 8, 0.6);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  color: #fff;
  transition: background-color 0.2s, border-color 0.2s;
}
.layout-link:hover { background: var(--accent); border-color: var(--accent); }
.layout-caption { position: absolute; right: 16px; bottom: 24px; z-index: 2; color: rgba(255, 255, 255, 0.7); }

.project__body { display: flex; flex-direction: column; gap: 10px; flex: 1; padding: 22px 22px 20px; }
.project__meta { color: var(--ink-3); }
.project__title { margin: 0; font-size: 1.32rem; font-weight: 600; line-height: 1.2; letter-spacing: -0.02em; }
.project--featured .project__title { font-family: var(--font-serif); font-weight: 400; font-size: clamp(2rem, 3vw, 2.7rem); line-height: 1; letter-spacing: -0.02em; }
.project__summary { margin: 0; color: var(--ink-2); font-size: 0.97rem; }
.project__stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 4px 0 0; padding: 14px 0; border-top: 1px solid var(--line); }
.project__stats strong { display: block; text-transform: none; font-family: var(--font-serif); font-weight: 400; font-size: 1.7rem; line-height: 1; letter-spacing: -0.01em; }
.project__stats span { color: var(--ink-3); }
.project__foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 16px; }
.project__note { color: var(--ink-3); }

/* Constraint → solution, the "timing closure" framing every card uses */
.tradeoff { margin: 4px 0; border-top: 1px solid var(--line); }
.tradeoff > div { display: grid; grid-template-columns: 84px minmax(0, 1fr); gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.tradeoff dt { padding-top: 3px; color: var(--ink-3); }
.tradeoff > div:first-child dt { color: var(--accent); }
.tradeoff dd { margin: 0; font-size: 0.92rem; line-height: 1.45; color: var(--ink-2); }

@media (max-width: 1080px) {
  .projects { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .projects { grid-template-columns: 1fr; }
  .project--featured { grid-template-columns: 1fr; }
  .project--featured .project__visual { aspect-ratio: 16 / 11; border-right: 0; border-bottom: 1px solid var(--line); }
  .layout-caption { display: none; }
}

/* ---------- Case-study modal ---------- */
.modal {
  width: min(960px, calc(100vw - 24px));
  max-height: calc(100svh - 40px);
  padding: 0;
  border: 1px solid var(--line-2); border-radius: var(--radius);
  background: var(--surface); color: var(--ink);
  box-shadow: 0 40px 120px -20px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}
.modal::backdrop { background: rgba(10, 10, 8, 0.55); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.modal[open] { display: flex; flex-direction: column; animation: modal-in 0.45s var(--ease-out); }
.modal[open]::backdrop { animation: fade 0.3s var(--ease); }
@keyframes modal-in { from { opacity: 0; transform: translateY(18px) scale(0.98); } }
.modal__head { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 16px 14px 24px; border-bottom: 1px solid var(--line); color: var(--ink-3); }
.modal__scroll { overflow-y: auto; padding: 28px 24px 32px; overscroll-behavior: contain; }
.modal__scroll.is-revealed > * { animation: fade-up 0.5s var(--ease-out) both; }
.modal h3 { margin: 0 0 10px; font-family: var(--font-serif); font-weight: 400; font-size: clamp(2.2rem, 5vw, 3.2rem); line-height: 1; letter-spacing: -0.02em; }
.modal .lead { margin: 0 0 24px; font-size: 1.1rem; color: var(--ink-2); }
.case { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px 20px; padding: 18px 0; border-top: 1px solid var(--line); }
.case h4 { margin: 0; padding-top: 4px; color: var(--ink-3); }
.case p { margin: 0; color: var(--ink-2); }
.case ul { margin: 0; padding-left: 18px; color: var(--ink-2); }
.case ul.chips { padding-left: 0; }
.case ul:not(.chips) li + li { margin-top: 6px; }
.modal__links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
@media (max-width: 560px) { .case { grid-template-columns: 1fr; gap: 6px; } }

/* Synthesis log shown for a moment before a case study opens */
.synth {
  margin: -28px -24px -32px;
  min-height: 300px;
  padding: 24px;
  background: var(--bg-2);
  color: var(--ink-3);
  font-family: var(--font-mono); font-size: 0.8rem; line-height: 1.8;
  white-space: pre-wrap;
}
.synth .cmd { color: var(--ink); }
.synth .ok { color: var(--ok); }
.synth .caret::after { content: "▍"; color: var(--accent); animation: blink 0.9s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }

/* ==========================================================================
   Photography band (always dark)
   ========================================================================== */
.photo-band { background: var(--bg); color: var(--ink); overflow: hidden; }
.photo-band.section, .photo-band + .section { border-top: 0; }
.photo-band__grid { display: grid; grid-template-columns: minmax(0, 4fr) minmax(0, 7fr); gap: clamp(36px, 6vw, 96px); align-items: center; }
.photo-band__title { margin: 0 0 24px; font-family: var(--font-serif); font-weight: 400; font-size: clamp(3.4rem, 7.5vw, 7rem); line-height: 0.88; letter-spacing: -0.035em; }
.photo-band__title em { color: var(--accent); }
.photo-band p { color: var(--ink-2); max-width: 44ch; margin: 0 0 28px; }

.collage {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  grid-template-rows: repeat(6, minmax(0, 1fr));
  gap: 12px;
  aspect-ratio: 1 / 0.92;
}
.collage__tile { position: relative; display: block; overflow: hidden; border-radius: 10px; background: var(--c, #222); will-change: transform; }
.collage__tile img { width: 100%; height: 100%; object-fit: cover; transition: transform 1.4s var(--ease-out), opacity 0.8s; opacity: 0; }
.collage__tile img.is-loaded { opacity: 1; }
.collage__tile:hover img { transform: scale(1.06); }
.collage__cap {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: space-between; align-items: flex-end; gap: 10px;
  padding: 30px 14px 12px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.65));
  color: #fff; opacity: 0; transform: translateY(6px);
  transition: opacity 0.35s, transform 0.45s var(--ease-out);
}
.collage__tile:hover .collage__cap, .collage__tile:focus-visible .collage__cap { opacity: 1; transform: none; }
.collage__tile:nth-child(1) { grid-column: 1 / 5; grid-row: 1 / 4; }
.collage__tile:nth-child(2) { grid-column: 5 / 7; grid-row: 1 / 3; }
.collage__tile:nth-child(3) { grid-column: 5 / 7; grid-row: 3 / 6; }
.collage__tile:nth-child(4) { grid-column: 1 / 3; grid-row: 4 / 7; }
.collage__tile:nth-child(5) { grid-column: 3 / 5; grid-row: 4 / 7; }
.collage__more {
  grid-column: 5 / 7; grid-row: 6 / 7;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 0 16px; border: 1px solid var(--line-2); border-radius: 10px;
  color: var(--ink-2);
  transition: border-color 0.2s, color 0.2s;
}
.collage__more:hover { border-color: var(--accent); color: var(--accent); }

@media (max-width: 900px) {
  .photo-band__grid { grid-template-columns: 1fr; }
  .collage { aspect-ratio: 1 / 1.05; gap: 8px; }
}

/* ==========================================================================
   Contact
   ========================================================================== */
.contact { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: clamp(40px, 7vw, 112px); }
.contact__title { margin: 0 0 24px; font-family: var(--font-serif); font-weight: 400; font-size: clamp(2.6rem, 5vw, 4.4rem); line-height: 0.98; letter-spacing: -0.025em; }
.contact__title em { color: var(--accent); }
.contact__lede { margin: 0 0 32px; max-width: 44ch; color: var(--ink-2); }

.email-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 6px 6px 18px;
  border: 1px solid var(--line-2); border-radius: 999px;
  font-family: var(--font-mono); font-size: 0.9rem;
  max-width: 100%;
}
.email-chip a { overflow: hidden; text-overflow: ellipsis; }
.email-chip a:hover { color: var(--accent); }
.email-chip .icon-btn { width: 34px; height: 34px; border: 0; background: var(--line); }
.email-chip .icon-btn:hover { background: var(--ink); color: var(--bg); }
.copy-btn .i--check { display: none; }
.copy-btn.is-copied .i--copy { display: none; }
.copy-btn.is-copied .i--check { display: block; color: var(--ok); }

.socials { display: grid; margin: 36px 0 0; padding: 0; list-style: none; border-top: 1px solid var(--line); max-width: 420px; }
.socials a { display: flex; justify-content: space-between; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); color: var(--ink-2); transition: color 0.2s, padding 0.4s var(--ease-out); }
.socials a:hover { color: var(--ink); padding-left: 8px; }
.socials a span { display: inline-flex; align-items: center; gap: 12px; }

.form { display: grid; gap: 26px; position: relative; }
.form__row { display: grid; grid-template-columns: 1fr 1fr; gap: 26px; }
.field { position: relative; display: grid; gap: 4px; }
.field label, .field legend { color: var(--ink-3); padding: 0; }
.field input, .field textarea {
  width: 100%;
  padding: 10px 0 12px;
  border: 0; border-bottom: 1px solid var(--line-2); border-radius: 0;
  background: transparent;
  font-size: 1.06rem;
  outline: none;
  transition: border-color 0.25s, box-shadow 0.25s;
}
.field textarea { min-height: 150px; resize: vertical; line-height: 1.5; }
.field input::placeholder, .field textarea::placeholder { color: var(--ink-3); opacity: 0.7; }
.field input:focus, .field textarea:focus { border-color: var(--ink); box-shadow: 0 1px 0 var(--ink); }
fieldset.field { border: 0; margin: 0; padding: 0; min-width: 0; }
.field.is-invalid input, .field.is-invalid textarea { border-color: var(--accent); }
.field__error { font-size: 0.82rem; color: var(--accent); }

.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.pill { position: relative; }
.pill input { position: absolute; top: 0; left: 0; width: 1px; height: 1px; margin: 0; padding: 0; border: 0; opacity: 0; pointer-events: none; }
.pill span {
  display: inline-flex; align-items: center; height: 38px; padding: 0 16px;
  border: 1px solid var(--line-2); border-radius: 999px;
  font-size: 0.9rem; color: var(--ink-2); cursor: pointer;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}
.pill span:hover { border-color: var(--ink); color: var(--ink); }
.pill input:checked + span { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.pill input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.honeypot { position: absolute !important; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.form__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.form__note { color: var(--ink-3); font-size: 0.85rem; margin: 0; }
.form__submit { min-width: 168px; }
.form__submit .spinner { display: none; width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin 0.8s linear infinite; }
.form__submit.is-loading .spinner { display: block; }
.form__submit.is-loading .i { display: none; }

.form__status { display: none; align-items: flex-start; gap: 12px; padding: 14px 16px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); font-size: 0.94rem; }
.form__status.is-shown { display: flex; animation: fade-up 0.5s var(--ease-out); }
.form__status.is-success { border-color: rgba(63, 166, 107, 0.5); background: rgba(63, 166, 107, 0.08); }
.form__status.is-error { border-color: color-mix(in srgb, var(--accent) 55%, transparent); background: var(--accent-soft); }
.form__status p { margin: 0; }
.form__status a { text-decoration: underline; text-underline-offset: 3px; }

@media (max-width: 900px) { .contact { grid-template-columns: 1fr; } }
@media (max-width: 560px) { .form__row { grid-template-columns: 1fr; } }
