/* Madhav K portfolio.
   Quiet on purpose: the work (real screenshots) carries the page.
   Small colour accents keep one meaning everywhere: blue = what I built,
   rose = a rule or constraint, brass = the result. */

:root {
  --paper: #eff1ec;
  --surface: #fbfcf9;
  --ink: #15201a;
  --graphite: #4a564f;
  --faint: #8a948d;
  --line: #d9ded6;
  --deep: #1d3326;

  /* names kept for the replay canvas: "blue" is the primary (forest), "brass" the accent (turmeric) */
  --blue: #1f6b45;   --blue-fill: #2f8a5b;
  --rose: #b12d4a;   --rose-fill: #d9536b;
  --brass: #865600;  --brass-fill: #e9a91c;
  --slate-fill: #a3ada6;
  --accent-soft: #fbefcf;

  --focus: #1f6b45;
  --shadow: none;

  --f-head: "Bricolage Grotesque", "Atkinson Hyperlegible Next", system-ui, sans-serif;
  --f-body: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "Martian Mono", ui-monospace, "Cascadia Mono", Menlo, Consolas, monospace;

  --wrap: 62rem;
  --text: 42rem;
  --gutter: 1.25rem;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0e1511; --surface: #151f19; --ink: #e7ede8; --graphite: #a5b2aa; --faint: #6d7a72; --line: #25332b; --deep: #1b2e23;
    --blue: #8fd6ae; --blue-fill: #3fa771; --rose: #f08aa0; --rose-fill: #d9536b; --brass: #f2be4a; --brass-fill: #e9a91c; --slate-fill: #5b6961; --accent-soft: #2b2513;
    --focus: #8fd6ae;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0e1511; --surface: #151f19; --ink: #e7ede8; --graphite: #a5b2aa; --faint: #6d7a72; --line: #25332b; --deep: #1b2e23;
  --blue: #8fd6ae; --blue-fill: #3fa771; --rose: #f08aa0; --rose-fill: #d9536b; --brass: #f2be4a; --brass-fill: #e9a91c; --slate-fill: #5b6961; --accent-soft: #2b2513;
  --focus: #8fd6ae;
  --shadow: none;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 1.5rem; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } *, *::before, *::after { transition: none !important; } }

body { margin: 0; background: var(--paper); color: var(--ink); font: 400 1.0625rem/1.65 var(--f-body); }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--blue); text-underline-offset: 0.2em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; border-radius: 3px; }
p { margin: 0 0 1rem; }
ul { margin: 0; padding-left: 1.1rem; }
li + li { margin-top: 0.35rem; }
code { font: 0.84em var(--f-mono); }
h1, h2, h3 { margin: 0; line-height: 1.2; letter-spacing: -0.012em; }

.wrap { width: 100%; max-width: var(--wrap); margin: 0 auto; padding: 0 var(--gutter); }
.mono { font-family: var(--f-mono); font-variation-settings: "wdth" 87.5; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 0.5rem; top: -3rem; z-index: 20; background: var(--ink); color: var(--paper); padding: 0.5rem 0.8rem; border-radius: 6px; }
.skip:focus { top: 0.5rem; }

/* ---------- header ---------- */
.site-header { position: sticky; top: 0; z-index: 30; padding: 0.6rem 0; }
.site-header::before { content: ""; position: absolute; inset: 0; background: linear-gradient(var(--paper) 40%, transparent); pointer-events: none; z-index: -1; }
.site-header .wrap { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 0.75rem; }
.brand { color: var(--ink); text-decoration: none; font-weight: 700; justify-self: start; }
@media (max-width: 30rem) { .brand { display: none; } .site-header .wrap { grid-template-columns: auto 1fr; } .pill { justify-self: start; } }
.pill { position: relative; display: flex; gap: 0.1rem; padding: 0.25rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.pill a { position: relative; z-index: 1; padding: 0.4rem 0.8rem; border-radius: 999px; color: var(--graphite); text-decoration: none; font-size: 0.9rem; transition: color 0.2s; white-space: nowrap; }
.pill a:hover, .pill a.is-active { color: var(--ink); }
@media (max-width: 30rem) { .pill a { padding: 0.4rem 0.55rem; font-size: 0.82rem; } }
.pill-ind { position: absolute; z-index: 0; top: 0.25rem; bottom: 0.25rem; left: 0; width: 0; border-radius: 999px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--brass-fill) 45%, transparent); opacity: 0; transition: transform 0.35s cubic-bezier(.3,.7,.2,1), width 0.35s cubic-bezier(.3,.7,.2,1), opacity 0.2s; }
.head-right { justify-self: end; display: flex; align-items: center; gap: 0.75rem; }
.clock { font: 0.72rem var(--f-mono); color: var(--graphite); white-space: nowrap; }
@media (max-width: 52rem) { .clock { display: none; } }
.theme-toggle {
  display: inline-grid; place-items: center; width: 2.4rem; height: 2.4rem; flex: none;
  border: 1px solid var(--line); border-radius: 50%; background: var(--surface); color: var(--ink); cursor: pointer; transition: transform 0.3s;
}
.theme-toggle:hover { transform: rotate(20deg); }
.theme-toggle svg { width: 1.05rem; height: 1.05rem; }
.theme-toggle .moon { display: none; }
:root[data-theme="dark"] .theme-toggle .sun { display: none; }
:root[data-theme="dark"] .theme-toggle .moon { display: block; }

/* ---------- intro ---------- */
.intro { padding: 2.5rem 0 2.5rem; }
@media (min-width: 44rem) { .intro { padding: 4.5rem 0 3.5rem; } }
.intro h1 { font-size: clamp(2rem, 1.5rem + 2.2vw, 2.9rem); font-weight: 700; letter-spacing: -0.025em; line-height: 1.1; max-width: 20ch; margin-bottom: 1.25rem; }
.intro .who { font-size: 1.15rem; color: var(--graphite); max-width: var(--text); }
.intro .who strong { color: var(--ink); font-weight: 700; }
.linkrow { display: flex; flex-wrap: wrap; gap: 0.4rem 1.4rem; margin: 1.75rem 0 0; padding: 0; list-style: none; font-weight: 700; }
.linkrow li { margin: 0; }
.linkrow a { display: inline-flex; align-items: center; gap: 0.35rem; min-height: 2.75rem; color: var(--ink); text-decoration: none; border-bottom: 1.5px solid var(--line); }
.linkrow a:hover { border-bottom-color: var(--ink); }
.linkrow svg { width: 0.95rem; height: 0.95rem; }

/* ---------- sections ---------- */
.section { padding: 3rem 0; }
.label { font-size: 0.95rem; font-weight: 700; color: var(--graphite); margin: 0 0 1.5rem; display: flex; align-items: center; gap: 0.75rem; }
.label::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.prose { max-width: var(--text); }
.intro .about { max-width: var(--text); margin-top: 1.25rem; }
.intro .about p { color: var(--graphite); margin: 0; }

/* ---------- work ---------- */
.work { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.25rem 2.5rem; padding: 2rem 0; border-top: 1px solid var(--line); }
.work:first-of-type { border-top: 0; padding-top: 0; }
@media (min-width: 52rem) { .work { grid-template-columns: minmax(0, 11fr) minmax(0, 10fr); align-items: start; } }
.shot { margin: 0; }
.shot a { display: block; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); box-shadow: var(--shadow); background: var(--surface); transition: transform 0.25s ease, box-shadow 0.25s ease; }
.shot a:hover { transform: translateY(-3px); }
.shot a, .shot a:hover { text-decoration: none; color: inherit; }
.shot img { width: 100%; aspect-ratio: 16 / 10; object-fit: cover; object-position: top left; }
.shot figcaption { font-size: 0.82rem; color: var(--graphite); margin-top: 0.6rem; }
.work h3 { font-size: 1.3rem; font-weight: 700; margin-bottom: 0.3rem; }
.work h3 a { color: var(--ink); text-decoration: none; }
.work h3 a:hover { text-decoration: underline; }
.work .tagline { color: var(--graphite); margin-bottom: 1rem; }
.pbr { display: grid; gap: 0.7rem; margin: 0 0 1rem; }
.pbr dt { font-size: 0.8rem; font-weight: 700; color: var(--graphite); display: flex; align-items: center; gap: 0.4rem; }
.pbr dt::before { content: ""; width: 0.45rem; height: 0.45rem; border-radius: 2px; background: var(--slate-fill); }
.pbr .f-built dt { color: var(--blue); } .pbr .f-built dt::before { background: var(--blue-fill); }
.pbr .f-result dt { color: var(--brass); } .pbr .f-result dt::before { background: var(--brass-fill); }
.pbr .f-decision dt { color: var(--ink); } .pbr .f-decision dt::before { background: var(--ink); }
.pbr dd { margin: 0; font-size: 0.97rem; }
.stack { font: 0.74rem/1.8 var(--f-mono); color: var(--graphite); margin-bottom: 0.5rem; }
.links { display: flex; flex-wrap: wrap; gap: 0 1.3rem; margin: 0; font-weight: 700; font-size: 0.97rem; }
.links a { display: inline-flex; align-items: center; min-height: 2.75rem; }

/* Finstox has no UI of its own to show, so its "screenshot" is its real API surface */
.api { aspect-ratio: 16 / 10; overflow: hidden; max-width: 100%; background: #0f141c; color: #c9d1dc; padding: 1.1rem 1.25rem; font: 0.74rem/1.75 var(--f-mono); }
.api .api-title { color: #8b95a5; margin-bottom: 0.5rem; }
.api ul { list-style: none; padding: 0; margin: 0; columns: 2; column-gap: 1.5rem; }
.api li { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.api b { display: inline-block; width: 2.8rem; font-weight: 500; color: #6fa8f5; }
.api .post b { color: #e0a53a; }
@media (max-width: 30rem) { .api { font-size: 0.62rem; padding: 0.8rem; } .api b { width: 2.3rem; } .api ul { column-gap: 0.8rem; } }
.api .hot { color: #fff; }
.api .hot b { color: #e0609f; }

/* ---------- experience ---------- */
.xp { list-style: none; padding: 0; margin: 0; max-width: 50rem; }
.xp > li { margin: 0; display: grid; gap: 0.15rem 1.5rem; padding: 1rem 0.75rem; margin: 0 -0.75rem; border-radius: 8px; transition: background-color 0.2s; }
.xp > li:hover { background: var(--surface); }
@media (min-width: 44rem) { .xp > li { grid-template-columns: 9.5rem minmax(0, 1fr); } }
.when { font: 0.76rem/2 var(--f-mono); color: var(--graphite); }
.xp h3 { font-size: 1.02rem; font-weight: 700; }
.xp h3 .org { font-weight: 400; color: var(--graphite); }
.xp p { margin: 0.25rem 0 0; font-size: 0.97rem; color: var(--graphite); }
.xp .sub { font-size: 0.8rem; font-weight: 700; color: var(--faint); margin: 1.5rem 0 0.25rem; }

/* ---------- skills ---------- */
.skills { display: grid; gap: 1.25rem 2.5rem; max-width: 50rem; }
@media (min-width: 40rem) { .skills { grid-template-columns: 1fr 1fr; } }
.skills h3 { font-size: 0.95rem; margin-bottom: 0.25rem; }
.skills p { color: var(--graphite); margin: 0; font-size: 0.97rem; }

/* ---------- contact ---------- */
.contact .email { display: inline-block; font-size: clamp(1.2rem, 0.9rem + 1.6vw, 1.9rem); font-weight: 700; letter-spacing: -0.02em; color: var(--ink); text-decoration: none; border-bottom: 2px solid var(--line); overflow-wrap: anywhere; }
.contact .email:hover { border-bottom-color: var(--ink); }
.copy { margin-left: 0.75rem; font: 500 0.75rem var(--f-mono); padding: 0.5rem 0.7rem; min-height: 2.25rem; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); cursor: pointer; vertical-align: middle; }
.copy:hover { border-color: var(--ink); }

footer { padding: 3rem 0 3rem; color: var(--graphite); font-size: 0.88rem; }
footer .wrap { display: flex; flex-wrap: wrap; gap: 0.5rem 1.5rem; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 1.5rem; }


/* ---------- case study pages ---------- */
.case-head { padding: 2.5rem 0 2rem; }
.back { display: inline-flex; align-items: center; min-height: 2.75rem; font-weight: 700; font-size: 0.95rem; margin-bottom: 1rem; }
.kicker { font-size: 0.9rem; color: var(--graphite); margin-bottom: 0.5rem; }
.case-head h1 { font-size: clamp(1.9rem, 1.4rem + 2.2vw, 2.8rem); font-weight: 700; letter-spacing: -0.025em; margin-bottom: 1rem; }
.case-head .lede { font-size: 1.15rem; color: var(--graphite); max-width: var(--text); }
.facts { display: grid; gap: 0.75rem 2rem; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); margin: 1.75rem 0 0; padding-top: 1.25rem; border-top: 1px solid var(--line); max-width: 50rem; }
.facts dt { font-weight: 700; font-size: 0.82rem; color: var(--graphite); }
.facts dd { margin: 0; }
.case-shot { margin: 0.5rem 0 1rem; }
.case-shot img { border-radius: 10px; border: 1px solid var(--line); box-shadow: var(--shadow); aspect-ratio: 16 / 10; object-fit: cover; object-position: top left; width: 100%; }
.case-shot figcaption { font-size: 0.85rem; color: var(--graphite); margin-top: 0.6rem; }
.case-shot .api { border-radius: 10px; }
.case section { padding: 1.75rem 0; }
.case h2 { font-size: 1.3rem; font-weight: 700; margin-bottom: 0.8rem; }
.case .prose ul { margin-bottom: 1rem; }

table { border-collapse: collapse; width: 100%; font-size: 0.95rem; margin-bottom: 1rem; }
th, td { text-align: left; padding: 0.55rem 0.75rem 0.55rem 0; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.8rem; font-weight: 700; color: var(--graphite); }
td.num { font-family: var(--f-mono); font-size: 0.84rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
tr.hl td.num { color: var(--brass); }
.table-scroll { overflow-x: auto; }

.tradeoffs { list-style: none; padding: 0; }
.tradeoffs li { padding: 0.9rem 0; border-top: 1px solid var(--line); margin: 0; }
.tradeoffs b { display: block; }

pre.diagram { font: 0.72rem/1.55 var(--f-mono); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 1rem; overflow-x: auto; color: var(--graphite); }

.next-case { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; padding: 2rem 0 1rem; margin-top: 1.5rem; border-top: 1px solid var(--line); }
.next-case a { font-weight: 700; font-size: 1.05rem; text-decoration: none; color: var(--ink); }
.next-case a:hover { color: var(--blue); }
.next-case small { display: block; font-weight: 400; font-size: 0.85rem; color: var(--graphite); }

/* ---------- replay (Mandate case study only) ---------- */
.replay { margin: 0 0 1.5rem; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 1rem 1rem 0.9rem; max-width: 50rem; }
.replay-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.5rem; }
.replay-head h3 { font-size: 1rem; }
.replay-btn { flex: none; display: inline-flex; align-items: center; gap: 0.35rem; min-height: 2.25rem; padding: 0 0.7rem; border: 1px solid var(--line); border-radius: 6px; background: var(--paper); color: var(--ink); font: 500 0.72rem/1 var(--f-mono); cursor: pointer; }
.replay-btn:hover { border-color: var(--ink); }
.replay-btn svg { width: 0.85rem; height: 0.85rem; }
.replay canvas { display: block; width: 100%; height: clamp(15rem, 48vw, 20rem); }
.legend { list-style: none; padding: 0.75rem 0 0; margin: 0.25rem 0 0; border-top: 1px solid var(--line); display: grid; gap: 0.35rem 1.25rem; }
@media (min-width: 34rem) { .legend { grid-template-columns: 1fr 1fr; } }
.legend li { margin: 0; display: grid; grid-template-columns: 0.7rem 1fr auto; gap: 0.55rem; align-items: baseline; font-size: 0.9rem; color: var(--graphite); }
.legend i { width: 0.7rem; height: 0.7rem; border-radius: 50%; display: inline-block; }
.legend b { font: 500 0.85rem/1 var(--f-mono); color: var(--ink); font-variant-numeric: tabular-nums; }
.legend .k-r i { background: var(--brass-fill); } .legend .k-s i { background: var(--rose-fill); }
.legend .k-n i { background: var(--slate-fill); } .legend .k-t i { border: 1.5px solid var(--slate-fill); }
.replay figcaption { margin-top: 0.8rem; font-size: 0.88rem; color: var(--graphite); }
.replay figcaption strong { color: var(--brass); font-family: var(--f-mono); font-weight: 500; }

/* ---------- intro additions ---------- */
.btn-solid { background: var(--ink); color: var(--paper) !important; border: 0 !important; padding: 0 1rem; border-radius: 999px; }
.btn-solid:hover { opacity: 0.88; }
.linklike { font: inherit; font-weight: 700; color: var(--ink); background: none; border: 0; border-bottom: 1.5px solid var(--line); min-height: 2.75rem; padding: 0; cursor: pointer; }
.linklike:hover { border-bottom-color: var(--ink); }

/* ---------- section heads ---------- */
.sec-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.25rem 1rem; margin-bottom: 1.5rem; }
.sec-head h2 { font-size: clamp(1.35rem, 1.1rem + 1vw, 1.75rem); font-weight: 700; letter-spacing: -0.02em; }
.hint { margin: 0; font-size: 0.85rem; color: var(--graphite); }

/* ---------- bento ---------- */
.bento { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 1rem; }
.tile { grid-column: span 12; min-width: 0; }
@media (min-width: 48rem) { .t-7 { grid-column: span 7; } .t-5 { grid-column: span 5; } .t-6 { grid-column: span 6; } }
.tile-link { display: flex; flex-direction: column; height: 100%; padding: 0.6rem; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); text-decoration: none; transition: transform 0.3s cubic-bezier(.3,.7,.2,1), box-shadow 0.3s, border-color 0.3s; }
.tile-link:hover { border-color: var(--ink); }
.tile-link:active { transform: translateY(-1px) scale(0.995); }
.frame { display: block; aspect-ratio: 16 / 10; overflow: hidden; border-radius: 4px; border: 1px solid var(--line); background: var(--paper); }
.frame img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 0%; transition: object-position var(--sd, 2s) cubic-bezier(.45,.05,.35,1); }
.tile-link:hover .frame img, .tile-link:focus-visible .frame img { object-position: 50% 100%; transition-duration: var(--sd, 2s); }
.tile-link .frame img { transition-duration: 0.9s; }
.frame .api { height: 100%; aspect-ratio: auto; }
.tile-meta { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; padding: 0.85rem 0.4rem 0.35rem; }
.tile-text { min-width: 0; }
.tile-name { display: block; font-weight: 700; font-size: 1.05rem; line-height: 1.3; }
.tile-line { display: block; color: var(--graphite); font-size: 0.9rem; line-height: 1.45; margin-top: 0.15rem; }
.tile-side { display: flex; flex-direction: column; align-items: flex-end; gap: 0.5rem; flex: none; }
.chip { font: 700 0.95rem/1.1 var(--f-head); color: var(--brass); white-space: nowrap; }
.tile-arrow { width: 1.9rem; height: 1.9rem; padding: 0.4rem; border-radius: 50%; border: 1px solid var(--line); color: var(--graphite); transition: transform 0.3s, background-color 0.3s, color 0.3s; }
.tile-link:hover .tile-arrow { transform: rotate(45deg); background: var(--brass-fill); color: #15201a; border-color: var(--brass-fill); }

.pub-badge { align-self: flex-start; font: 500 0.68rem/1 var(--f-mono); padding: 0.4rem 0.55rem; border-radius: 999px; color: #f2be4a; border: 1px solid color-mix(in srgb, #e9a91c 55%, transparent); }



/* ---------- peek dialog ---------- */
.peek { width: min(52rem, calc(100% - 2rem)); max-width: none; max-height: min(88vh, 60rem); padding: 0; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); color: var(--ink); box-shadow: none; overflow: auto; overscroll-behavior: contain; }
.peek::backdrop { background: rgba(8, 14, 10, 0.62); }
.peek[open] { animation: peek-in 0.32s cubic-bezier(.3,.7,.2,1); }
.peek[open]::backdrop { animation: fade-in 0.25s ease; }
@keyframes peek-in { from { opacity: 0; transform: translateY(18px) scale(0.98); } }
@keyframes fade-in { from { opacity: 0; } }
@media (max-width: 40rem) {
  .peek { width: 100%; margin: auto 0 0; border-radius: 18px 18px 0 0; max-height: 90vh; border-bottom: 0; }
  .peek[open] { animation-name: sheet-in; }
  @keyframes sheet-in { from { transform: translateY(40%); opacity: 0.5; } }
}
.peek-inner { position: relative; padding: 0.75rem; }
.peek-close { position: sticky; top: 0; float: right; z-index: 2; display: grid; place-items: center; width: 2.5rem; height: 2.5rem; margin: 0 0 -2.5rem; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; }
.peek-close svg { width: 1rem; height: 1rem; }
.peek-close:hover { background: var(--paper); }
.peek-shot { margin: 0; }
.peek-shot .frame { aspect-ratio: auto; max-height: min(26rem, 45vh); overflow-y: auto; overscroll-behavior: contain; }
.peek-shot .frame img { height: auto; object-fit: initial; }
.peek-shot .frame .api { aspect-ratio: 16 / 10; }
.peek-shot figcaption { font-size: 0.8rem; color: var(--graphite); margin: 0.5rem 0.25rem 0; }
.peek-body { padding: 1.1rem 0.75rem 0.75rem; }
.peek-body h3 { font-size: 1.4rem; font-weight: 700; letter-spacing: -0.02em; margin-bottom: 0.25rem; }
.peek-body .tagline { color: var(--graphite); margin-bottom: 1.1rem; }
@media (min-width: 40rem) { .peek-body .pbr { grid-template-columns: 1fr 1fr; column-gap: 1.75rem; } }
.btn-case { background: var(--ink); color: var(--paper) !important; padding: 0 1rem; border-radius: 999px; text-decoration: none; }
.btn-case:hover { opacity: 0.88; }
html.peek-open { overflow: hidden; }

/* ---------- beliefs ---------- */
.beliefs { list-style: none; padding: 0; margin: 0; display: grid; max-width: 54rem; }
.beliefs li { margin: 0; padding: 1.25rem 0; border-top: 1px solid var(--line); display: grid; gap: 0.3rem; }
@media (min-width: 48rem) { .beliefs li { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 2rem; } }
.b-head { margin: 0; font-size: clamp(1.1rem, 1rem + 0.5vw, 1.3rem); font-weight: 700; letter-spacing: -0.015em; line-height: 1.3; }
.b-body { margin: 0; color: var(--graphite); font-size: 0.97rem; }
.b-body a { white-space: nowrap; font-weight: 700; }

/* ---------- contact card ---------- */
.contact-card { padding: clamp(1.5rem, 1rem + 3vw, 3rem); border-radius: 8px; background: var(--surface); border: 1px solid var(--line); }
.contact-card h2 { font-size: clamp(1.8rem, 1.3rem + 2.4vw, 2.8rem); font-weight: 700; letter-spacing: -0.03em; margin-bottom: 0.75rem; }
.contact-card p { color: var(--graphite); max-width: 36rem; }
.contact-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem; margin: 1.5rem 0 0; }
.contact-row .copy { margin: 0; }

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: 1.5rem; z-index: 50; transform: translate(-50%, 1rem); opacity: 0; pointer-events: none; background: var(--ink); color: var(--paper); font-size: 0.9rem; font-weight: 700; padding: 0.6rem 1rem; border-radius: 999px; box-shadow: var(--shadow); transition: opacity 0.25s, transform 0.25s cubic-bezier(.3,.7,.2,1); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- reveal on scroll (only when JS is running) ---------- */
html.js .reveal { opacity: 0; transform: translateY(14px); transition: opacity 0.6s ease, transform 0.6s cubic-bezier(.3,.7,.2,1); transition-delay: var(--d, 0s); }
html.js .reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { html.js .reveal { opacity: 1; transform: none; } .peek[open], .peek[open]::backdrop { animation: none; } }

/* ---------- accent details ---------- */
::selection { background: var(--brass-fill); color: #15201a; }
.mark { background: linear-gradient(transparent 64%, color-mix(in srgb, var(--brass-fill) 60%, transparent) 64%, color-mix(in srgb, var(--brass-fill) 60%, transparent) 92%, transparent 92%); padding: 0 0.06em; }

/* ---------- v5: type ---------- */
h1, h2, .tile-name, .peek-body h3, .b-head, .pub-title, .case-head h1, .contact-card h2, .brand { font-family: var(--f-head); font-optical-sizing: auto; }
.intro h1 { font-weight: 800; letter-spacing: -0.035em; line-height: 1.02; font-size: clamp(2.4rem, 1.4rem + 4.2vw, 4.4rem); max-width: 16ch; }
.sec-head h2 { font-weight: 700; letter-spacing: -0.03em; }

/* headline: words rise in, then the last word cycles */
.headline .w { display: inline-block; overflow: hidden; vertical-align: bottom; padding-bottom: 0.08em; margin-bottom: -0.08em; }
.headline .w > span { display: inline-block; }
html.js .headline .w > span { animation: rise 0.9s cubic-bezier(.2,.7,.1,1) both; animation-delay: calc(var(--i) * 70ms + 80ms); }
@keyframes rise { from { transform: translateY(105%); } }
.swap { display: inline-grid; vertical-align: bottom; overflow: hidden; padding-bottom: 0.08em; margin-bottom: -0.08em; }
.swap > span { grid-area: 1 / 1; transition: transform 0.6s cubic-bezier(.7,0,.2,1), opacity 0.6s; color: var(--blue); }
.swap > span:not(.on) { transform: translateY(100%); opacity: 0; }
.swap > span.out { transform: translateY(-100%); opacity: 0; }
.swap > span.on { transform: none; opacity: 1; }
html:not(.js) .swap > span:not(:first-child) { display: none; }
html:not(.js) .swap > span:first-child { transform: none; opacity: 1; }

/* scroll progress */
.progress { position: fixed; inset: 0 0 auto 0; height: 3px; z-index: 60; background: var(--brass-fill); transform-origin: 0 50%; transform: scaleX(0); pointer-events: none; }
@supports (animation-timeline: scroll()) {
  .progress { animation: grow linear both; animation-timeline: scroll(root); }
  @keyframes grow { to { transform: scaleX(1); } }
}

/* cursor label over project tiles (fine pointers only) */
.cursor-tag { position: fixed; left: 0; top: 0; z-index: 55; pointer-events: none; padding: 0.45rem 0.75rem; border-radius: 999px; background: var(--brass-fill); color: #15201a; font: 700 0.8rem var(--f-body); opacity: 0; transform: translate(-50%, -50%) scale(0.6); transition: opacity 0.2s, scale 0.25s; will-change: transform; }
.cursor-tag.on { opacity: 1; }
@media (hover: none), (pointer: coarse) { .cursor-tag { display: none; } }

/* magnetic buttons */
.magnetic { transition: transform 0.35s cubic-bezier(.2,.7,.1,1); will-change: transform; }

/* beliefs: words light up as each line scrolls in */
.b-head .bw { opacity: 0.18; transition: opacity 0.5s ease; transition-delay: calc(var(--i) * 45ms); }
.beliefs li.lit .b-head .bw, html:not(.js) .b-head .bw { opacity: 1; }

/* experience: a sweep behind the row on hover */
.xp > li { position: relative; isolation: isolate; }
.xp > li::before { content: ""; position: absolute; inset: 0; z-index: -1; border-radius: 8px; background: var(--accent-soft); transform: scaleX(0); transform-origin: 0 50%; transition: transform 0.45s cubic-bezier(.2,.7,.1,1); }
.xp > li:hover { background: transparent; }
.xp > li:hover::before { transform: scaleX(1); }
.xp > li:hover .when { color: var(--brass); }

/* tile title arrow nudges */
.tile-name { transition: transform 0.35s cubic-bezier(.2,.7,.1,1); }
.tile-link:hover .tile-name { transform: translateX(4px); }

@media (prefers-reduced-motion: reduce) {
  html.js .headline .w > span { animation: none; }
  .swap > span { transition: none; }
  .progress, .cursor-tag { display: none; }
  .b-head .bw { opacity: 1; transition: none; }
  .xp > li::before { transition: none; }
}

/* ---------- publication tile + quick look ---------- */
.tile-pub .tile-link { padding: 0; border: 0; background: none; }
.tile-pub .pub-card { height: 100%; display: flex; flex-direction: column; gap: 0.85rem; padding: 1.4rem; border-radius: 8px; background: var(--deep); color: #e7ede8; border: 1px solid transparent; transition: border-color 0.3s; }
.tile-pub .tile-link:hover .pub-card { border-color: var(--brass-fill); }
.pub-top { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.pub-when { font: 500 0.7rem var(--f-mono); color: #a5b2aa; }
.pub-title { display: block; font-family: var(--f-head); font-size: clamp(1.1rem, 0.95rem + 0.6vw, 1.35rem); font-weight: 700; line-height: 1.25; letter-spacing: -0.015em; }
.pub-line { display: block; font-size: 0.9rem; line-height: 1.5; color: #c9d3cc; }
.pub-foot { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: auto; font-size: 0.82rem; color: #a5b2aa; }
.pub-foot .tile-arrow { color: #e7ede8; border-color: #3a4d41; }
.pub-badge-light { color: var(--brass); border-color: color-mix(in srgb, var(--brass-fill) 55%, transparent); display: inline-block; margin: 0 0 0.75rem; }

/* confusion matrix (real numbers from the paper) */
.cm { display: grid; gap: 4px; font-family: var(--f-mono); }
.cm-h, .cm-row { display: grid; grid-template-columns: 5.5rem 1fr 1fr; gap: 4px; align-items: stretch; }
.cm-h span { font-size: 0.62rem; color: #a5b2aa; text-align: center; }
.cm-l { font-size: 0.62rem; color: #a5b2aa; display: flex; align-items: center; }
.cm-cell { display: flex; flex-direction: column; justify-content: center; padding: 0.4rem 0.5rem; border-radius: 4px; min-height: 2.9rem; }
.cm-cell b { font-size: 1rem; font-weight: 500; line-height: 1.1; }
.cm-cell small { font-size: 0.6rem; opacity: 0.85; }
.cm-ok { background: color-mix(in srgb, #e9a91c calc(var(--v) * 70%), #26392d); color: #15201a; }
.cm-err { background: #26392d; color: #e7ede8; border: 1px dashed #4a6152; }
.cm-lg { margin: 0.25rem 0 1.25rem; max-width: 30rem; }
.cm-lg .cm-h span, .cm-lg .cm-l { color: var(--graphite); font-size: 0.7rem; }
.cm-lg .cm-cell { min-height: 3.6rem; }
.cm-lg .cm-cell b { font-size: 1.25rem; }
@media (max-width: 30rem) { .cm-h, .cm-row { grid-template-columns: 4.2rem 1fr 1fr; } }

/* ---------- punch line ---------- */
.intro .punch { font-family: var(--f-head); font-weight: 600; font-size: clamp(1.2rem, 1rem + 1vw, 1.6rem); letter-spacing: -0.015em; line-height: 1.3; color: var(--ink); margin: -0.5rem 0 1.5rem; max-width: 42ch; }

/* ---------- round 7: live demos in the quick looks ---------- */
.demo { border: 1px solid var(--line); border-radius: 8px; padding: 1rem; margin: 0 0 1.25rem; }
.demo-h { font-size: 0.8rem; font-weight: 700; color: var(--graphite); margin: 0 0 0.75rem; }
.demo-cap { font-size: 0.78rem; color: var(--graphite); margin: 0; }
.clk-wrap { display: grid; gap: 1rem; align-items: center; }
@media (min-width: 36rem) { .clk-wrap { grid-template-columns: 13rem minmax(0, 1fr); } }
.clk { display: block; width: 100%; max-width: 13rem; height: auto; margin: 0 auto; border-radius: 50%; }
.clk .wedge { cursor: pointer; transition: opacity 0.2s; }
.clk path { stroke: var(--surface); stroke-width: 1.5; }
.clk .w-blocked { fill: color-mix(in srgb, var(--rose-fill) 62%, transparent); }
.clk .w-allowed { fill: var(--brass-fill); fill-opacity: var(--o, 0.6); }
.clk .w-zero { fill: var(--line); }
.clk:has(.on) .wedge:not(.on) { opacity: 0.45; }
.clk .wedge.on, .clk .wedge.on path { stroke: var(--ink); stroke-width: 2.5; }
.clk-tick { font: 500 9px var(--f-mono); fill: var(--graphite); }
.clk-c1 { font: 700 16px var(--f-head); fill: var(--ink); }
.clk-c2 { font: 500 8.5px var(--f-mono); fill: var(--graphite); }
.clk-read { font-weight: 700; margin: 0 0 0.6rem; min-height: 3em; }
.demo-key { font-size: 0.82rem; color: var(--graphite); margin: 0 0 0.5rem; line-height: 1.8; }
.demo-key .k { display: inline-block; width: 0.8rem; height: 0.8rem; border-radius: 2px; margin-right: 0.45rem; vertical-align: -1px; }
.k-blocked { background: color-mix(in srgb, var(--rose-fill) 62%, transparent); }
.k-allowed { background: var(--brass-fill); }

.cite-quote { margin: 0 0 0.6rem; padding: 0; font-size: 0.95rem; }
.cite-quote p { margin: 0 0 0.6rem; }
.cite-bad-line { color: var(--graphite); font-size: 0.88rem; }
.cite-wrap { position: relative; display: inline-block; }
.cite { font: 600 0.78em var(--f-mono); color: var(--blue); background: none; border: 1px solid color-mix(in srgb, var(--blue) 45%, transparent); border-radius: 4px; padding: 0.05em 0.3em; cursor: pointer; vertical-align: 0.1em; }
.cite:hover, .cite-wrap.open .cite { background: var(--accent-soft); }
.cite-bad { color: var(--rose); border-color: color-mix(in srgb, var(--rose-fill) 55%, transparent); text-decoration: line-through; }
.src-card { position: absolute; left: 50%; bottom: calc(100% + 8px); z-index: 3; width: max-content; max-width: 15rem; padding: 0.6rem 0.75rem; border-radius: 6px; background: var(--ink); color: var(--paper); font: 400 0.8rem/1.4 var(--f-body); opacity: 0; pointer-events: none; transform: translate(calc(-50% + var(--dx, 0px)), 4px); transition: opacity 0.18s, transform 0.18s; }
.src-card b { display: block; font-weight: 700; }
.src-card small { display: block; opacity: 0.8; margin-top: 0.15rem; font-size: 0.75rem; }
.cite-wrap:hover .src-card, .cite:focus-visible + .src-card, .cite-wrap.open .src-card { opacity: 1; transform: translate(calc(-50% + var(--dx, 0px)), 0); }

/* ---------- round 7: skills point to work ---------- */
.skill { font: inherit; line-height: inherit; color: var(--ink); background: none; border: 0; padding: 0; border-bottom: 1.5px dotted color-mix(in srgb, var(--brass-fill) 85%, transparent); cursor: pointer; }
.skill:hover, .skill:focus-visible { color: var(--blue); border-bottom-style: solid; }
.skill.on { color: var(--blue); font-weight: 700; border-bottom: 2px solid var(--brass-fill); }
.skill-read { margin: 1.25rem 0 0; font-size: 0.92rem; color: var(--graphite); min-height: 1.6em; }
.filter-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.25rem 1rem; margin: -0.5rem 0 1rem; padding: 0.4rem 0.9rem; border: 1px solid color-mix(in srgb, var(--brass-fill) 60%, transparent); border-radius: 8px; background: var(--accent-soft); font-weight: 700; font-size: 0.92rem; }
.filter-bar[hidden] { display: none; }
.filter-bar .linklike { min-height: 2.25rem; }
html.js .bento .tile.reveal { transition: opacity 0.45s ease, transform 0.6s cubic-bezier(.3,.7,.2,1), filter 0.45s ease; }
.bento.filtering .tile:not(.match) { opacity: 0.28; filter: grayscale(1); }
.bento.filtering .tile.match .tile-link { border-color: var(--brass-fill); }

/* ---------- round 7: quick-look prev/next ---------- */
.peek-nav { position: sticky; top: 0; float: left; z-index: 2; display: flex; align-items: center; gap: 0.2rem; margin: 0 0 -2.5rem; padding: 0.2rem; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.peek-step { display: grid; place-items: center; width: 2.1rem; height: 2.1rem; border-radius: 50%; border: 0; background: transparent; color: var(--ink); font: 700 1rem var(--f-body); cursor: pointer; }
.peek-step:hover { background: var(--paper); }
.peek-count { font: 500 0.72rem var(--f-mono); color: var(--graphite); min-width: 2.6rem; text-align: center; }
#peek-paper .peek-body { padding-top: 3.4rem; }
.peek.no-anim[open], .peek.no-anim[open]::backdrop { animation: none; }

/* ---------- round 7: paper tile meta line (no badge above the title) ---------- */
.pub-meta2 { display: block; font: 500 0.72rem var(--f-mono); color: #f2be4a; }

/* ---------- round 7: page and theme transitions ---------- */
@view-transition { navigation: auto; }
.site-header { view-transition-name: site-header; }
::view-transition-group(*) { animation-duration: 0.4s; animation-timing-function: cubic-bezier(.2,.7,.1,1); }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: 0.28s; }
html.theme-vt::view-transition-old(root), html.theme-vt::view-transition-new(root) { animation: none; mix-blend-mode: normal; }
html.theme-vt .site-header, html.theme-vt [style*="view-transition-name"] { view-transition-name: none !important; }
@media (prefers-reduced-motion: reduce) {
  @view-transition { navigation: none; }
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
  .src-card, .clk .wedge { transition: none; }
}

/* ---------- OnLabel: claim demo in the quick look ---------- */
.cl-copy { font-size: 1rem; line-height: 2; margin: 0 0 0.9rem; }
.cl { font: inherit; line-height: inherit; color: var(--ink); background: none; border: 0; padding: 0 0.1em; border-bottom: 2.5px solid var(--c); border-radius: 2px; cursor: pointer; text-align: left; }
.cl.v-no, .vtag.v-no { --c: var(--rose-fill); }
.cl.v-ok, .vtag.v-ok { --c: var(--blue-fill); }
.cl.v-q, .vtag.v-q { --c: var(--brass-fill); }
.cl:hover, .cl.on { background: color-mix(in srgb, var(--c) 20%, transparent); }
.cl::after { content: attr(data-n); font: 600 0.62em var(--f-mono); vertical-align: super; margin-left: 0.15em; color: var(--graphite); }
.cl-panel { border-top: 1px solid var(--line); padding-top: 0.85rem; }
.cl-panel + .cl-panel { margin-top: 0.85rem; }
.cl-panel[hidden] { display: none; }
.cl-verdict { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.6rem; margin: 0 0 0.4rem; }
.vtag { font-weight: 700; font-size: 0.85rem; padding: 0.15rem 0.5rem; border-radius: 4px; background: color-mix(in srgb, var(--c) 22%, transparent); border: 1px solid color-mix(in srgb, var(--c) 60%, transparent); }
.vkind { font: 500 0.74rem var(--f-mono); color: var(--graphite); }
.cl-why { font-size: 0.92rem; color: var(--graphite); margin: 0 0 0.6rem; }
.cl-ev { margin: 0 0 0.5rem; }
.cl-ev figcaption { font: 500 0.72rem var(--f-mono); color: var(--graphite); margin: 0 0 0.3rem; }
.cl-ev blockquote { margin: 0; padding: 0.6rem 0.75rem; border-radius: 6px; background: color-mix(in srgb, var(--brass-fill) 18%, var(--surface)); font-size: 0.9rem; }
.cl-ev blockquote p { margin: 0; }
.cl-ev blockquote p + p { margin-top: 0.4rem; }
.cl-doc { font-size: 0.88rem; margin: 0.9rem 0 0.6rem; padding: 0.55rem 0.75rem; border: 1.5px solid var(--ink); border-radius: 4px; }

/* ---------- OnLabel: extra screenshots inside the case study ---------- */
.case-fig { margin: 1.25rem 0 0.5rem; }
.case-fig .frame { aspect-ratio: auto; max-height: 34rem; overflow-y: auto; overscroll-behavior: contain; }
.case-fig .frame img { height: auto; object-fit: initial; }
.case-fig figcaption { font-size: 0.85rem; color: var(--graphite); margin-top: 0.6rem; }
.case .prose ol { padding-left: 1.3rem; margin-bottom: 1rem; }

/* ---------- paper tile across the full width ---------- */
@media (min-width: 48rem) {
  .tile-pub.t-12 { grid-column: span 12; }
  .tile-pub.t-12 .pub-card { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 22rem); column-gap: 2.5rem; row-gap: 0.6rem; align-content: start; }
  .tile-pub.t-12 .pub-card > :not(.cm) { grid-column: 1; }
  .tile-pub.t-12 .cm { grid-column: 2; grid-row: 1 / span 4; align-self: center; }
}
