/* ==========================================================================
   Clay Studio, creative layer. Loads after styles.css + theme.css.

   Design Read: an independent data practice portfolio for hiring managers and
   clients, in a warm ceramic-studio language. Dial: ENERGY 3 / RHYTHM 3 /
   MOTION 2.

   Identity motif: the kiln arch. Every "finished piece" (the 96% specimen,
   product thumbnails, impact readouts, the closing panel) carries the same
   arched top, so the page reads like work pulled out of one studio kiln.
   Reasons, one line each:
   - Arch: one repeated shape that is specific to "studio", not a card default.
   - Outlined italic numerals: section numbers become wall labels in a
     gallery, the only place clay appears at display size besides results.
   - Specimen tilt on the hero readout: the single focal object on screen one,
     straightens on hover/focus so it never fights readability.
   - Grain: a 3% noise on the sand ground gives the paper a fired-clay surface;
     it is the material, not a pattern grid.
   - Motion: sections rise once (existing reveal), panels lift on hover. No
     loops, nothing moves for prefers-reduced-motion.
   ========================================================================== */

:root {
  --arch: 50% 50% var(--r) var(--r) / 96px 96px var(--r) var(--r);
  --arch-s: 50% 50% var(--r) var(--r) / 44px 44px var(--r) var(--r);
  --arch-l: 50% 50% var(--r) var(--r) / 180px 180px var(--r) var(--r);
}

/* --- material ------------------------------------------------------------ */
body {
  background-color: var(--paper);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.3 0 0 0 0 0.2 0 0 0 0 0.1 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

:root[data-theme="dark"] body {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 .9 0 0 0 0 .8 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

::selection {
  background: var(--accent);
  color: var(--accent-ink);
}

/* --- header: a studio sign ---------------------------------------------- */
.site-header {
  box-shadow: 0 0 0 100vmax var(--paper);
  clip-path: inset(0 -100vmax);
}

.brand {
  border-radius: var(--arch-s);
  width: 44px;
  height: 52px;
  padding-top: 6px;
  background: var(--accent);
  color: var(--accent-ink);
}

.nav-links a {
  position: relative;
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 100%;
  bottom: 6px;
  height: 1px;
  background: var(--accent);
  transition: right 260ms ease-out;
}

.nav-links a:hover::after,
.nav-links a:focus-visible::after {
  right: 0;
}

/* --- section numbers as gallery wall labels ----------------------------- */
.band-head::before,
.pipeline-header::before,
.projects-column > .section-heading:first-child::before,
.band-skills > .section-heading:first-child::before,
.experience-title-group::before,
.band-about > .section-heading:first-child::before,
.band-contact .contact-copy::before {
  content: counter(band, decimal-leading-zero);
  display: block;
  margin-bottom: 4px;
  font-family: var(--font-head);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(88px, 10vw, 148px);
  line-height: 0.82;
  letter-spacing: -0.04em;
  color: transparent;
  -webkit-text-stroke: 1.2px var(--accent);
}

.band-title,
.section-heading {
  font-style: italic;
}

/* --- hero: statement + specimen ------------------------------------------ */
.band-hero {
  grid-template-columns: 7fr 5fr;
  gap: clamp(32px, 5vw, 88px);
  padding-top: clamp(40px, 6vw, 88px);
}

.hero-title {
  font-size: clamp(44px, 5.2vw, 82px);
  line-height: 1;
  max-width: 16ch;
}

.hero-title::first-letter {
  font-style: italic;
  color: var(--accent);
  font-size: 1.32em;
  line-height: 0.8;
}

.availability-tag {
  margin-top: var(--sp-24);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.availability-tag::before {
  width: 10px;
  height: 12px;
  border-radius: 50% 50% 2px 2px / 6px 6px 2px 2px;
}

.hero-readout {
  position: relative;
  border-radius: var(--arch);
  padding-top: 72px;
  transform: rotate(-2.4deg);
  transform-origin: 50% 100%;
  transition: transform 420ms cubic-bezier(.2, .7, .2, 1);
  outline: 1px solid var(--line);
  outline-offset: 10px;
}

.hero-readout:hover,
.hero-readout:focus-within {
  transform: rotate(0deg);
}

.hero-readout .readout-label {
  text-align: center;
}

.readout-figure-row {
  justify-content: center;
}

.readout-huge {
  color: var(--accent);
}

.readout-summary {
  text-align: center;
  margin-left: auto;
  margin-right: auto;
}

/* --- services: an asymmetric wall --------------------------------------- */
.sv-card {
  transition: transform 260ms ease-out;
}

.sv-card:hover {
  transform: translateY(-4px);
}

.sv-card:first-child {
  border-radius: var(--arch-l);
  padding-top: 120px;
}

.sv-card:first-child .sv-title::before {
  display: block;
  font-family: var(--font-head);
  font-style: italic;
  font-size: 72px;
  line-height: 1;
  color: #E8875C;
  text-align: center;
  margin: -64px 0 32px;
}

/* --- products: arched thumbnails ---------------------------------------- */
.pr-thumb {
  border-radius: var(--arch);
  padding-top: 40px;
  overflow: hidden;
}

.pr-flag:nth-of-type(even) .pr-name {
  font-style: italic;
}

.pr-flag .pr-name::after {
  content: ".";
  color: var(--accent);
}

/* --- impact: three fired pieces, uneven heights -------------------------- */
.cell-metric,
.cell-metric + .cell-metric {
  border-radius: var(--arch-s);
  padding-top: 56px;
}

.impact-list .cell-metric:nth-child(2) {
  margin-top: 40px;
}

.impact-list .cell-metric:nth-child(3) {
  margin-top: 16px;
}

.cell-figure {
  line-height: 0.9;
}

/* --- pipeline ------------------------------------------------------------ */
.pipeline-column {
  border-radius: var(--arch);
  padding-top: 64px;
}

/* --- work table: rows lift into clay on hover --------------------------- */
.proof-table tbody tr {
  transition: background-color 200ms ease-out;
}

.proof-table tbody tr:hover {
  background: var(--hl);
}

.project-name {
  font-style: italic;
}

/* --- stack --------------------------------------------------------------- */
.stack-grid .skill-badge {
  transition: transform 220ms ease-out, background-color 220ms ease-out;
}

.stack-grid .skill-badge:hover {
  transform: translateY(-3px);
}

/* --- experience: the current role carries a clay seal -------------------- */
.timeline-card:first-child .timeline-role::after {
  content: "";
  display: inline-block;
  width: 12px;
  height: 14px;
  margin-left: 12px;
  border-radius: 50% 50% 2px 2px / 7px 7px 2px 2px;
  background: var(--accent);
  vertical-align: 0.15em;
}

/* --- contact: the kiln door ---------------------------------------------- */
.band-contact {
  border-radius: var(--arch-l);
  padding-top: clamp(96px, 12vw, 180px);
  text-align: center;
}

.band-contact .contact-copy,
.band-contact .contact-links {
  margin-left: auto;
  margin-right: auto;
  justify-content: center;
}

.band-contact .contact-text {
  margin-left: auto;
  margin-right: auto;
}

.band-contact > * {
  grid-column: 1 / -1;
}

.contact-links .contact-link:hover {
  color: var(--accent);
}

/* --- charts: annotated, labelled in words, numbers in mono --------------- */
.chart-svg text { font-family: var(--font-mono); }
.c-row-label { font-family: var(--font-serif) !important; font-size: 12.5px; font-weight: 500; fill: var(--ink); text-anchor: end; }
.c-row-label.is-start { text-anchor: start; }
.c-tick { font-size: 11.5px; fill: var(--muted); text-anchor: middle; }
.c-tick.is-start { text-anchor: start; }
.c-tick.is-end { text-anchor: end; }
.c-tick.is-mid { text-anchor: middle; }
.is-accent { fill: var(--accent) !important; }
.c-in-label { font-size: 11.5px; fill: var(--ink); text-anchor: start; }
.c-in-label.is-end { text-anchor: end; }
.c-in-label.is-mid { text-anchor: middle; }
.c-in-label.is-onaccent { fill: var(--accent-ink); font-weight: 600; }
.c-callout { font-size: 12px; font-weight: 600; fill: var(--accent); }
.c-legend-num { font-size: 13px; font-weight: 600; fill: var(--ink); }
.c-track { fill: none !important; stroke: var(--line); stroke-width: 1; stroke-dasharray: 2 3; }
.c-bracket { fill: none; stroke: var(--muted); stroke-width: 1; }
.c-marker { stroke: var(--ink); stroke-width: 1; stroke-dasharray: 3 3; }

/* waterfall */
.wf-base, .wf-keep { fill: var(--chart-3); }
.wf-cut { fill: url(#wf-hatch); stroke: var(--accent); stroke-width: 1; }
.wf-hatch-bg { fill: var(--hl); }
.wf-hatch-line { stroke: var(--accent); stroke-width: 1.4; opacity: .55; }
.wf-left { fill: var(--accent); }
.wf-step { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 2; }

/* 9x */
.speed-old { fill: var(--chart-3); }
.speed-new { fill: var(--accent); }

/* waffle */
.wf-c-table { fill: var(--chart-4); }
.wf-c-view { fill: var(--chart-3); }
.wf-c-incr { fill: var(--accent); }

/* TB/day */
.scan-stored { fill: var(--chart-3); }
.scan-day { fill: var(--accent); }
.scan-dayblock { fill: var(--accent); opacity: .78; }

/* quality */
.cell-test { fill: var(--chart-4); }
.cell-table { fill: var(--accent); }
.cell-table:hover { opacity: .7; }
.clock-num { font-family: var(--font-serif) !important; font-weight: 600; letter-spacing: .01em; font-size: 38px; fill: var(--ink); text-anchor: middle; }

/* pipeline */
.pipe-rail { stroke: var(--line); stroke-width: 1; }
.pipe-rail-dot { fill: var(--accent); }
.pipe-rail-label { font-size: 12px; fill: var(--accent); text-anchor: middle; }
.pipe-connector { stroke-width: 1.4px; }
.pipeline-phone .pipe-node-sub { letter-spacing: -0.04em; }
.pipeline-column .pipe-node-label,
.pipeline-column .pipe-node-sub,
.pipeline-column .pipe-stage-label { paint-order: stroke; stroke: #231E19; stroke-width: 5px; stroke-linejoin: round; }
:root[data-theme="dark"] .pipeline-column .pipe-node-label,
:root[data-theme="dark"] .pipeline-column .pipe-node-sub,
:root[data-theme="dark"] .pipeline-column .pipe-stage-label { stroke: #24201B; }
.c-in-label, .c-tick { paint-order: stroke; }
.pipeline-column .pipe-node-sub { font-size: 10.5px; }

/* motion: plays once when the chart scrolls in; off without JS or with
   reduced motion (the .chart-anim class is only set when both are fine) */
.chart-anim .chart-svg .grow-x { transform: scaleX(0); transform-box: fill-box; transform-origin: left center; transition: transform 800ms cubic-bezier(.2, .7, .2, 1) var(--d, 0s); }
.chart-anim .chart-svg .fade-in { opacity: 0; transition: opacity 500ms ease-out var(--d, 0s); }
.chart-anim .chart-svg .pop-in { opacity: 0; transition: opacity 360ms ease-out var(--d, 0s); }
.chart-anim .chart-svg .draw-in { stroke-dasharray: 1; stroke-dashoffset: 1; transition: stroke-dashoffset 1100ms ease-in-out .2s; }
.chart-anim .chart-svg.in .grow-x { transform: none; }
.chart-anim .chart-svg.in .fade-in,
.chart-anim .chart-svg.in .pop-in { opacity: 1; }
.chart-anim .chart-svg.in .draw-in { stroke-dashoffset: 0; }
.chart-anim .chart-svg.in .scan-dayblock { opacity: .78; }

/* --- detail pages (about, changelog, projects/*) ------------------------- */
.pj-header {
  padding-top: var(--sp-96);
}

.pj-kicker {
  letter-spacing: 0.04em;
}

.pj-title {
  font-family: var(--font-head);
  font-weight: 400;
  font-style: italic;
  font-size: clamp(38px, 5vw, 64px);
  line-height: 1.02;
  max-width: 20ch;
}

.pj-title::first-letter {
  color: var(--accent);
}

.pj-h2 {
  font-family: var(--font-head);
  font-weight: 400;
  font-size: 34px;
  border-bottom: 0;
}

.pj-figure {
  border: 0;
  border-radius: var(--arch);
  padding-top: 40px;
}

.pj-proof-value {
  font-family: var(--font-head);
  font-style: italic;
  font-size: 40px;
}

.project-page .band-about,
.project-page .about-facts {
  border-radius: var(--r);
}

/* --- responsive ---------------------------------------------------------- */
@media (max-width: 1024px) {
  .band-hero { grid-template-columns: 1fr; }
  .hero-readout { transform: none; margin-top: var(--sp-24); }
  .impact-list .cell-metric:nth-child(n) { margin-top: 0; }
  .sv-card:first-child { padding-top: 96px; }
}

@media (max-width: 720px) {
  :root {
    --arch: 50% 50% var(--r) var(--r) / 64px 64px var(--r) var(--r);
    --arch-l: 50% 50% var(--r) var(--r) / 96px 96px var(--r) var(--r);
  }
  .hero-readout { padding-top: 56px; outline-offset: 6px; }
  .band-contact { padding-top: 88px; }
  .sv-card:first-child { padding-top: 80px; }
  .pj-header { padding-top: var(--sp-48); }
}

@media (prefers-reduced-motion: reduce) {
  .hero-readout,
  .sv-card,
  .cell-metric,
  .stack-grid .skill-badge,
  .nav-links a::after {
    transition: none;
  }
  .sv-card:hover,
  .stack-grid .skill-badge:hover,
  .cell-metric:hover {
    transform: none;
  }
}
