/* ---------- Tokens ---------- */
:root {
  color-scheme: light dark;
  --bg: #fbf8f4;
  --surface: #ffffff;
  --ink: #1f1c1a;
  --muted: #6b645e;
  --faint: #9a928b;
  --rule: #ebe4dc;
  --accent: #c2416b;
  --accent-soft: #f8e3ea;
  --shadow: 0 1px 2px rgba(40, 30, 20, .04), 0 8px 24px -12px rgba(40, 30, 20, .12);
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Consolas, monospace;
  --wrap: 720px;
  --wide: 1040px;
  --gutter: 24px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141211;
    --surface: #1c1a18;
    --ink: #f1ece6;
    --muted: #aaa29b;
    --faint: #7a726b;
    --rule: #2e2a27;
    --accent: #f08fac;
    --accent-soft: #3a2129;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 30px -14px rgba(0, 0, 0, .6);
  }
}

/* ---------- Base ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem/1.7 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
h1, h2, h3, p, ul, ol { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: underline; text-decoration-color: color-mix(in srgb, var(--accent) 45%, transparent); text-decoration-thickness: 1px; text-underline-offset: .22em; transition: color .15s, text-decoration-color .15s; }
a:hover { color: var(--accent); text-decoration-color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }
::selection { background: var(--accent); color: var(--bg); }


.wrap { max-width: calc(var(--wide) + var(--gutter) * 2); margin-inline: auto; padding-inline: var(--gutter); }
.dot { color: var(--accent); }

.skip-link { position: absolute; left: 1rem; top: -4rem; z-index: 10; padding: .5rem 1rem; background: var(--ink); color: var(--bg); border-radius: 6px; }
.skip-link:focus { top: 1rem; }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid transparent;
  transition: border-color .2s;
}
.site-header.scrolled { border-bottom-color: var(--rule); }
.header-inner { max-width: calc(var(--wide) + var(--gutter) * 2); display: flex; align-items: center; justify-content: space-between; gap: 1rem; height: 64px; }
.wordmark { font: 500 1.35rem/1 var(--serif); letter-spacing: -.02em; text-decoration: none; }
.site-header nav { display: flex; gap: 1.4rem; font-size: .9rem; }
.site-header nav a { color: var(--muted); text-decoration: none; padding: .4rem 0; }
.site-header nav a:hover, .site-header nav a[aria-current="page"] { color: var(--ink); }
.site-header nav a[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 2px; text-underline-offset: .5em; }
.ext { font-size: .75em; margin-left: .15em; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; }
.hero-inner { position: relative; z-index: 1; padding-top: clamp(56px, 10vw, 120px); padding-bottom: clamp(56px, 9vw, 104px); }
.hero-text { max-width: 540px; }
/* Live fractal: a soft-edged glow on the right of the hero, never under the text */
#hero-fractal {
  position: absolute; z-index: 0; top: 0; bottom: 0; right: max(-120px, calc((100vw - 1088px) / 2 - 120px));
  width: min(56%, 720px); height: 100%;
  -webkit-mask-image: radial-gradient(closest-side, #000 55%, transparent 100%);
          mask-image: radial-gradient(closest-side, #000 55%, transparent 100%);
  pointer-events: none;
}
.hero-note { margin-top: 1.8rem; font-size: .84rem; line-height: 1.6; color: var(--faint); max-width: 32em; }
.hero-note a { color: var(--muted); }
.kicker { display: block; font: 400 .8rem/1.4 var(--mono); color: var(--muted); letter-spacing: .01em; margin-bottom: 1.6rem; }
.pulse { display: inline-block; vertical-align: .05em; margin-right: .6rem; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 50%, transparent); animation: pulse 2.4s ease-out infinite; flex: none; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 45%, transparent); } 70%, 100% { box-shadow: 0 0 0 10px transparent; } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }
h1 { font: 400 clamp(2.9rem, 8vw, 4.8rem)/1.02 var(--serif); letter-spacing: -.035em; font-variation-settings: "opsz" 144; margin-bottom: 1.6rem; }
.lead { font-size: clamp(1.08rem, 2.2vw, 1.25rem); line-height: 1.65; max-width: 36em; text-wrap: pretty; }
.lead + .lead { margin-top: 1rem; }
.lead.soft { color: var(--muted); }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1rem; margin-top: 2.2rem; }
.btn { display: inline-flex; align-items: center; gap: .55rem; min-height: 44px; padding: .6rem 1.1rem; border: 1px solid var(--rule); border-radius: 999px; background: var(--surface); font-size: .92rem; font-weight: 500; text-decoration: none; transition: border-color .15s, background .15s, color .15s, transform .15s; }
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); color: var(--bg); }
.btn-meta { font: 500 .68rem/1 var(--mono); opacity: .65; letter-spacing: .04em; }


/* ---------- Sections ---------- */
.section { padding-top: 56px; padding-bottom: 56px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: .75rem 1.5rem; margin-bottom: 1.75rem; padding-bottom: .9rem; border-bottom: 1px solid var(--rule); }
.section h2 { font: 400 clamp(1.6rem, 3.4vw, 2rem)/1.2 var(--serif); letter-spacing: -.02em; }
.section-note { font: 400 .8rem/1 var(--mono); color: var(--muted); }

/* Now */
.now-list { display: grid; gap: 1rem; max-width: var(--wrap); }
.now-list li { display: grid; grid-template-columns: 112px 1fr; gap: 1rem; align-items: baseline; }
.now-tag { font: 500 .75rem/1.6 var(--mono); color: var(--accent); letter-spacing: .02em; }
.now-list p { color: var(--ink); }

/* Experience */
.timeline { display: grid; gap: 2.25rem; max-width: 780px; }
.role { display: grid; grid-template-columns: 112px 1fr; gap: 1rem; }
.role-when { font: 400 .78rem/1.9 var(--mono); color: var(--muted); }
.role h3 { font: 600 1.06rem/1.45 var(--sans); letter-spacing: -.01em; }
.role h3 a { text-decoration-color: var(--rule); }
.at { font-weight: 400; color: var(--muted); }
.role-where { font-size: .88rem; color: var(--muted); margin-top: .1rem; }
.role ul { margin-top: .7rem; display: grid; gap: .5rem; }
.role li { position: relative; padding-left: 1.1rem; color: var(--muted); font-size: .96rem; }
.role li::before { content: ""; position: absolute; left: 0; top: .72em; width: 6px; height: 6px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 55%, transparent); }

/* Projects */
.filters { display: flex; flex-wrap: wrap; gap: .4rem; }
.chip { font: 500 .8rem/1 var(--sans); color: var(--muted); background: transparent; border: 1px solid var(--rule); border-radius: 999px; padding: .5rem .85rem; min-height: 34px; cursor: pointer; transition: color .15s, border-color .15s, background .15s; }
.chip:hover { color: var(--ink); border-color: var(--faint); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }

.card { position: relative; background: var(--surface); border: 1px solid var(--rule); border-radius: 14px; padding: 1.4rem 1.4rem 1.3rem; box-shadow: var(--shadow); transition: transform .2s ease, border-color .2s, opacity .25s; scroll-margin-top: 90px; }
.card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 35%, var(--rule)); }
.card:target { border-color: var(--accent); }
.card[hidden] { display: none; }
.meta { display: flex; flex-wrap: wrap; gap: .25rem .9rem; font: 400 .74rem/1.6 var(--mono); color: var(--muted); margin-bottom: .55rem; }
.meta span:first-child { color: var(--accent); }
.card h3 { font: 600 1.12rem/1.35 var(--sans); letter-spacing: -.015em; margin-bottom: .55rem; }
.card p:not(.meta) { color: var(--muted); font-size: .95rem; }
.card p + p { margin-top: .7rem; }
.card .note { font-size: .84rem !important; color: var(--faint) !important; font-style: italic; }
.card-link { display: inline-block; margin-top: 1rem; font-size: .9rem; font-weight: 500; text-decoration: none; color: var(--ink); }
.card-link:hover { color: var(--accent); }
.card-link::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.card .links a:not(.card-link) { position: relative; z-index: 1; }
.feature .links { margin-top: 1rem; padding-top: 0; }
.feature .links .card-link { margin-top: 0; }

.featured { display: grid; gap: 1.25rem; margin-bottom: 1.25rem; }
.feature { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 1.75rem; padding: 1.25rem; align-items: center; }
.feature .card-body { padding: .5rem .75rem .5rem 0; }
.feature h3 { font: 400 1.6rem/1.2 var(--serif); letter-spacing: -.02em; margin-bottom: .8rem; }
.feature-art { position: relative; border-radius: 10px; overflow: hidden; background: var(--accent-soft); align-self: stretch; min-height: 260px; }
.feature-art img, .feature-art svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover; }
.play { position: absolute; left: 14px; bottom: 14px; width: 44px; height: 44px; border-radius: 50%; background: rgba(18, 14, 16, .72); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); transition: background .2s, transform .2s; }
.play::after { content: ""; position: absolute; left: 17px; top: 13px; border-style: solid; border-width: 9px 0 9px 14px; border-color: transparent transparent transparent #fff; }
.feature:hover .play { background: var(--accent); transform: scale(1.06); }
.feature:nth-child(even) { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); }
.feature:nth-child(even) .feature-art { order: 2; }
.feature:nth-child(even) .card-body { padding: .5rem 0 .5rem .75rem; }

/* feature SVG art */
.paper rect { fill: var(--surface); stroke: color-mix(in srgb, var(--accent) 30%, transparent); }
.paper path { stroke: color-mix(in srgb, var(--ink) 22%, transparent); stroke-width: 5; stroke-linecap: round; }
.flow { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-dasharray: 4 7; }
.in-view .flow { animation: flow 1.2s linear infinite; }
@keyframes flow { to { stroke-dashoffset: -22; } }
.land { fill: color-mix(in srgb, var(--accent) 16%, var(--surface)); stroke: color-mix(in srgb, var(--accent) 40%, transparent); stroke-width: 1.5; }
.map circle { fill: var(--accent); opacity: .85; }
@media (prefers-reduced-motion: reduce) {
  .in-view .flow { animation: none; }
}

.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; }
.grid .card { display: flex; flex-direction: column; }
.card .links { display: flex; flex-wrap: wrap; align-items: baseline; gap: .4rem 1.2rem; margin-top: auto; padding-top: 1rem; font-size: .9rem; font-weight: 500; }
.card .links a { color: var(--ink); text-decoration: none; }
.card .links a:hover { color: var(--accent); }
.card .links .links-note { font-weight: 400; font-size: .8rem; color: var(--faint); }
.more { margin-top: 1.75rem; font-size: .92rem; }

/* Toolbox */
.toolbox { margin: 0; display: grid; gap: .9rem; max-width: 880px; }
.toolbox > div { display: grid; grid-template-columns: 112px 1fr; gap: 1rem; align-items: baseline; }
.toolbox dt { font: 500 .75rem/1.6 var(--mono); color: var(--accent); }
.toolbox dd { margin: 0; color: var(--ink); }

/* Beyond */
.beyond { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.75rem 2.5rem; }
.beyond h3 { font: 500 .78rem/1.6 var(--mono); color: var(--accent); letter-spacing: .02em; margin-bottom: .35rem; }
.beyond p { color: var(--muted); }

/* Contact */
.contact { padding-top: 64px; padding-bottom: 88px; text-align: center; }
.contact h2 { font: 400 clamp(2rem, 5vw, 3rem)/1.12 var(--serif); letter-spacing: -.03em; max-width: 14em; margin: 0 auto 1rem; text-wrap: balance; }
.contact > p { color: var(--muted); max-width: 32em; margin-inline: auto; }
.contact-actions { display: flex; justify-content: center; margin-top: 1.6rem; }
.contact-links { display: flex; justify-content: center; gap: 1.4rem; margin-top: 1.1rem; font-size: .92rem; }

/* Footer */
.site-footer { display: flex; justify-content: space-between; gap: 1rem; padding-top: 1.4rem; padding-bottom: 2.4rem; border-top: 1px solid var(--rule); font-size: .84rem; color: var(--muted); max-width: calc(var(--wide) + var(--gutter) * 2); }
.site-footer a { color: var(--muted); text-decoration: none; }
.site-footer a:hover { color: var(--accent); }

/* Reveal on scroll */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in-view { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }

/* Utility pages (404, redirects) */
.utility { min-height: 70vh; display: grid; align-content: center; padding-block: 80px; }
.utility h1 { margin-bottom: 1rem; }
.utility p { color: var(--muted); }
.utility p + p { margin-top: 1rem; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero-inner { padding-bottom: 390px; }
  #hero-fractal { top: auto; bottom: -30px; right: 0; left: 0; width: 100%; max-width: 640px; margin-inline: auto; height: 400px; }
  .feature, .feature:nth-child(even) { grid-template-columns: 1fr; gap: 1.1rem; }
  .feature:nth-child(even) .feature-art { order: 0; }
  .feature .card-body, .feature:nth-child(even) .card-body { padding: 0 .35rem .35rem; }
  .feature-art { min-height: 0; aspect-ratio: 8 / 5; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 600px) {
  :root { --gutter: 16px; }
  .header-inner { height: 58px; }
  .site-header nav { gap: .95rem; font-size: .85rem; }
  .site-header nav a[href="#now"], .site-header nav a[href="#work"] { display: none; }
  .now-list li, .role, .toolbox > div { grid-template-columns: 1fr; gap: .2rem; }
  .hero-inner { padding-bottom: 350px; }
  #hero-fractal { height: 360px; }
  .beyond { grid-template-columns: 1fr; gap: 1.4rem; }
  .card { padding: 1.2rem; }
  .grid { grid-template-columns: 1fr; }
  .section-head { flex-direction: column; align-items: flex-start; }
  .site-footer { flex-direction: column; gap: .3rem; }
}
@media (max-width: 340px) {
  .site-header nav { gap: .7rem; font-size: .8rem; }
}

@media print {
  .site-header, .hero-actions, #hero-fractal, .hero-note, .filters, .site-footer { display: none !important; }
  .card { box-shadow: none; break-inside: avoid; }
  .reveal { opacity: 1; transform: none; }
}
