/* ==========================================================================
   Saru — portfolio
   Themes: light tokens on :root, dark via system preference or [data-theme].
   ========================================================================== */

:root {
  --bg: #f3f0e9;
  --bg-2: #ebe7de;
  --bg-3: #dfdace;
  --ink: #121210;
  --ink-2: #55524b;
  --ink-3: #8a867c;
  --line: rgba(18, 18, 16, 0.14);
  --accent: #ec4c0d;
  --accent-ink: #121210;
  --grain: 0.07;

  --pulse: 0; /* 0..1, heartbeat + training ticks */

  --f-display: "Unbounded", "Inter Tight", system-ui, sans-serif;
  --f-serif: "Instrument Serif", Georgia, serif;
  --f-body: "Inter Tight", system-ui, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, monospace;

  --gutter: clamp(16px, 3vw, 44px);
  --ease: cubic-bezier(0.7, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0c0b; --bg-2: #141412; --bg-3: #1d1d1a;
    --ink: #efebe2; --ink-2: #a8a49a; --ink-3: #66635c;
    --line: rgba(239, 235, 226, 0.14);
    --accent: #ff5b1f; --accent-ink: #0c0c0b; --grain: 0.06;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0c0c0b; --bg-2: #141412; --bg-3: #1d1d1a;
  --ink: #efebe2; --ink-2: #a8a49a; --ink-3: #66635c;
  --line: rgba(239, 235, 226, 0.14);
  --accent: #ff5b1f; --accent-ink: #0c0c0b; --grain: 0.06;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-body);
  font-size: clamp(15px, 1.05vw, 17px);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
html.is-loading body { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
ul, ol { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, p, pre { margin: 0; }
em { font-family: var(--f-serif); font-style: italic; font-weight: 400; color: var(--accent); letter-spacing: 0; }
kbd {
  font-family: var(--f-mono); font-size: 0.68rem; line-height: 1; padding: 3px 6px; border-radius: 4px;
  border: 1px solid var(--line); background: var(--bg-2); color: var(--ink-2); text-transform: none;
}
::selection { background: var(--accent); color: var(--accent-ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.mono { font-family: var(--f-mono); font-size: 0.72rem; letter-spacing: 0.04em; text-transform: uppercase; }
.eyebrow {
  font-family: var(--f-mono); font-size: 0.72rem; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--ink-2); display: flex; gap: 0.8em; align-items: center;
  font-weight: 400; /* some eyebrows are h1/h2 for SEO; keep them visually identical */
}
.eyebrow span { color: var(--accent); }

/* Film grain */
body::after {
  content: ""; position: fixed; inset: -50%; z-index: 90; pointer-events: none; opacity: var(--grain);
  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='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 1s steps(6) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); } 20% { transform: translate(-3%, 2%); } 40% { transform: translate(2%, -4%); }
  60% { transform: translate(-4%, -1%); } 80% { transform: translate(3%, 3%); } 100% { transform: translate(0, 0); }
}

/* Theme switch: circular reveal (View Transitions API) */
::view-transition-old(root), ::view-transition-new(root) { animation: none; mix-blend-mode: normal; }

/* ---------- Loader ---------- */
.loader {
  position: fixed; inset: 0; z-index: 100; color: var(--bg); isolation: isolate;
  display: flex; flex-direction: column; justify-content: space-between; gap: 2rem; padding: var(--gutter);
}
/* Five panels that lift away one after another to reveal the hero */
.loader__cols { position: absolute; inset: 0; z-index: -1; display: flex; }
.loader__cols i { flex: 1; margin-right: -1px; background: var(--ink); transition: transform 0.95s var(--ease); }
.loader__cols i:nth-child(2) { transition-delay: 0.06s; }
.loader__cols i:nth-child(3) { transition-delay: 0.12s; }
.loader__cols i:nth-child(4) { transition-delay: 0.18s; }
.loader__cols i:nth-child(5) { transition-delay: 0.24s; }
html.is-loaded .loader__cols i { transform: translateY(-101%); }
.loader > :not(.loader__cols) { transition: opacity 0.45s, transform 0.8s var(--ease); }
html.is-loaded .loader > :not(.loader__cols) { opacity: 0; transform: translateY(-48px); }

.loader__top { display: flex; justify-content: space-between; gap: 1rem; font-family: var(--f-mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: color-mix(in srgb, var(--bg) 60%, transparent); }
.loader__top span:nth-child(2) { display: none; }
@media (min-width: 720px) { .loader__top span:nth-child(2) { display: inline; } }

.loader__foot { display: flex; flex-wrap: wrap-reverse; justify-content: space-between; align-items: flex-end; gap: 1.2rem 2rem; margin-top: auto; }
.loader__id { display: grid; gap: 0.7rem; padding-bottom: 0.6em; }
@media (min-width: 720px) { .loader__foot { flex-wrap: nowrap; } }
.loader__name { font-family: var(--f-display); font-weight: 300; font-size: clamp(26px, 3.6vw, 54px); letter-spacing: -0.05em; line-height: 1; }
.loader__role { font-family: var(--f-mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: color-mix(in srgb, var(--bg) 60%, transparent); }
/* word-by-word rise */
.loader .w { display: inline-block; overflow: hidden; vertical-align: bottom; padding-bottom: 0.08em; margin-bottom: -0.08em; }
.loader .w > span { display: inline-block; animation: loader-rise 1s var(--ease-out) both; }
.loader__name .w:nth-child(2) > span { animation-delay: 0.08s; }
.loader__role .w > span { animation-delay: 0.22s; }
@keyframes loader-rise { from { transform: translateY(110%); } }

/* odometer percentage */
.loader__count { display: flex; align-items: flex-start; font-family: var(--f-display); font-weight: 200; font-size: clamp(80px, 15vw, 250px); line-height: 0.8; letter-spacing: -0.06em; font-variant-numeric: tabular-nums; }
.loader__count em { font-size: 0.34em; line-height: 1; margin: 0.06em 0 0 0.08em; color: var(--accent); }
.loader__digits { display: flex; }
.loader__slot { display: block; height: 0.8em; width: calc(1ch - 0.07em); overflow: hidden; transition: width 0.5s var(--ease-out); }
.loader__slot.is-off { width: 0; }
.loader__reel { display: block; transition: transform 0.55s var(--ease-out); }
.loader__reel b { display: block; height: 0.8em; line-height: 0.8; font-weight: inherit; }

.loader__bar { height: 2px; background: color-mix(in srgb, var(--bg) 16%, transparent); overflow: hidden; }
.loader__bar i { display: block; height: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; }

/* ---------- Cursor ---------- */
.cursor { position: fixed; inset: 0 auto auto 0; z-index: 95; pointer-events: none; }
.cursor__dot, .cursor__ring { position: fixed; top: 0; left: 0; border-radius: 50%; will-change: transform; }
.cursor__dot { width: 6px; height: 6px; margin: -3px 0 0 -3px; background: var(--accent); }
.cursor__ring {
  width: 38px; height: 38px; margin: -19px 0 0 -19px; border: 1px solid color-mix(in srgb, var(--ink) 45%, transparent);
  display: grid; place-items: center;
  transition: width 0.4s var(--ease-out), height 0.4s var(--ease-out), margin 0.4s var(--ease-out), background 0.3s, border-color 0.3s;
}
.cursor__ring span { font-family: var(--f-mono); font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--accent-ink); opacity: 0; transition: opacity 0.2s; }
.cursor.has-label .cursor__ring { width: 84px; height: 84px; margin: -42px 0 0 -42px; background: var(--accent); border-color: var(--accent); }
.cursor.has-label .cursor__ring span { opacity: 1; }
.cursor.has-label .cursor__dot { opacity: 0; }
.cursor.is-down .cursor__ring { scale: 0.85; }
@media (hover: none), (pointer: coarse) { .cursor { display: none; } }
@media (hover: hover) and (pointer: fine) { html.has-cursor, html.has-cursor a, html.has-cursor button, html.has-cursor summary { cursor: none; } }

/* ---------- Nav ---------- */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 1rem;
  padding: 16px var(--gutter); mix-blend-mode: difference; color: #fff;
}
.nav__logo { font-family: var(--f-display); font-weight: 600; font-size: 1.1rem; letter-spacing: -0.03em; display: inline-block; justify-self: start; }
.caret { animation: blink 1.1s steps(1) infinite; font-weight: 400; }
@keyframes blink { 50% { opacity: 0; } }
.nav__links, .nav__meta { display: none; }
.nav__mobile { display: flex; align-items: center; gap: 14px; }
.nav__menu { position: relative; overflow: hidden; height: 1.3em; font-family: var(--f-mono); font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; }
.nav__menu span { display: block; transition: transform 0.5s var(--ease); }
.nav__menu[aria-expanded="true"] span { transform: translateY(-100%); }

.theme-btn { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.35); }
.theme-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; transition: transform 0.7s var(--ease); }
.theme-btn__half { fill: currentColor; stroke: none; }
:root[data-theme="light"] .theme-btn svg { transform: rotate(180deg); }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .theme-btn svg { transform: rotate(180deg); } }

.kbd-btn { display: inline-flex; gap: 3px; }
.kbd-btn kbd { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.35); }

[data-hover-text] { position: relative; display: inline-block; overflow: hidden; vertical-align: bottom; }
[data-hover-text]::after { content: attr(data-hover-text); position: absolute; left: 0; top: 100%; transition: transform 0.45s var(--ease); }
.roll { display: inline-block; transition: transform 0.45s var(--ease); }
[data-hover-text]:hover .roll, [data-hover-text]:hover::after { transform: translateY(-100%); }

.status { display: inline-flex; align-items: center; gap: 0.6em; font-family: var(--f-mono); font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.04em; }
.beat-dot {
  width: 8px; height: 8px; border-radius: 50%; background: #3dff8b;
  box-shadow: 0 0 calc(var(--pulse) * 14px) #3dff8b;
  transform: scale(calc(1 + var(--pulse) * 0.7));
}
/* nav uses mix-blend-mode: difference — pre-invert the dot so it reads green on light backgrounds */
:root[data-theme="light"] .beat-dot { background: #cb287b; box-shadow: none; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .beat-dot { background: #cb287b; box-shadow: none; } }

@media (min-width: 960px) {
  .nav { grid-template-columns: 1fr auto 1fr; }
  .nav__links { display: flex; gap: 2rem; font-size: 0.9rem; }
  .nav__meta { display: flex; justify-self: end; gap: 1.1rem; align-items: center; }
  .nav__mobile { display: none; }
}

.menu {
  position: fixed; inset: 0; z-index: 45; background: var(--accent); color: var(--accent-ink);
  display: flex; flex-direction: column; justify-content: flex-end; gap: 2rem; padding: 90px var(--gutter) var(--gutter);
  clip-path: circle(0% at calc(100% - 40px) 30px); transition: clip-path 0.8s var(--ease); visibility: hidden;
}
.menu.is-open { clip-path: circle(150% at calc(100% - 40px) 30px); visibility: visible; }
.menu nav { display: flex; flex-direction: column; }
.menu nav a { font-family: var(--f-display); font-weight: 500; font-size: clamp(40px, 11vw, 96px); line-height: 1.05; letter-spacing: -0.05em; }
.menu nav sup { font-family: var(--f-mono); font-size: 0.75rem; letter-spacing: 0; margin-right: 0.6rem; vertical-align: top; }

/* ---------- Command palette ---------- */
.palette {
  position: fixed; inset: 0; z-index: 97; display: grid; place-items: start center; padding: 14vh var(--gutter) 0;
  background: color-mix(in srgb, var(--bg) 55%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.palette[hidden] { display: none; }
.palette__panel {
  width: min(600px, 100%); background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; overflow: hidden;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.4); animation: pop 0.35s var(--ease-out);
}
@keyframes pop { from { opacity: 0; transform: translateY(-10px) scale(0.98); } }
.palette__input { display: flex; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.palette__input > span.mono { color: var(--accent); font-size: 1rem; }
.palette__input input { flex: 1; min-width: 0; background: none; border: 0; outline: 0; color: var(--ink); font: 400 1.05rem var(--f-body); }
.palette__input input::placeholder { color: var(--ink-3); }
.palette__list { max-height: 50vh; overflow: auto; padding: 8px; }
.palette__group { font-family: var(--f-mono); font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); padding: 10px 10px 6px; }
.palette__item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 12px; border-radius: 8px; cursor: pointer; }
.palette__item span:last-child { font-family: var(--f-mono); font-size: 0.68rem; color: var(--ink-3); }
.palette__item[aria-selected="true"] { background: var(--ink); color: var(--bg); }
.palette__item[aria-selected="true"] span:last-child { color: var(--accent); }
.palette__empty { padding: 18px 12px; color: var(--ink-3); }

/* ---------- Hero ---------- */
.hero { position: relative; min-height: 100svh; display: flex; align-items: flex-end; overflow: hidden; isolation: isolate; }
.hero__gl, .hero__fallback { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -1; }
.hero__fallback {
  z-index: -2;
  background:
    repeating-radial-gradient(circle at 70% 40%, transparent 0 22px, color-mix(in srgb, var(--ink) 8%, transparent) 22px 23px),
    radial-gradient(60% 60% at 70% 40%, color-mix(in srgb, var(--accent) 25%, transparent), transparent 70%),
    var(--bg);
}
.hero__inner { width: 100%; padding: 120px var(--gutter) 28px; display: grid; gap: clamp(28px, 5vh, 56px); }
.hero__title {
  font-family: var(--f-display); font-weight: 300; font-size: clamp(30px, 6.4vw, 124px);
  line-height: 0.98; letter-spacing: -0.055em;
}
.hero__title em { font-size: 1.12em; letter-spacing: -0.02em; padding-right: 0.06em; }
.line { display: block; overflow: hidden; padding-bottom: 0.08em; margin-bottom: -0.08em; }
.line__in { display: block; transform: translateY(110%) rotate(4deg); transform-origin: left bottom; transition: transform 1.3s var(--ease-out); }
.line:nth-child(2) .line__in { transition-delay: 0.09s; padding-left: 0.9em; }
.line:nth-child(3) .line__in { transition-delay: 0.18s; padding-left: 1.8em; }
html.is-loaded .line__in { transform: none; }

.hero__eyebrow, .hero__foot > * { opacity: 0; transform: translateY(14px); transition: opacity 1s 0.5s, transform 1s 0.5s var(--ease-out); }
html.is-loaded .hero__eyebrow, html.is-loaded .hero__foot > * { opacity: 1; transform: none; }

.hero__foot { display: grid; gap: 22px; align-items: end; border-top: 1px solid var(--line); padding-top: 20px; }
.hero__blurb { max-width: 36ch; color: var(--ink-2); font-size: 1.05rem; }
.hero__blurb em { font-size: 1.15em; }
.hero__readout { display: flex; flex-wrap: wrap; gap: 0.4rem 1.4rem; color: var(--ink-3); }
.hero__readout b { color: var(--ink); font-weight: 500; font-variant-numeric: tabular-nums; }
.hero__scroll {
  display: none; justify-self: end; align-items: center; gap: 0.6rem; font-family: var(--f-mono); font-size: 0.72rem; text-transform: uppercase;
  padding: 14px 18px; border: 1px solid var(--line); border-radius: 999px;
}
.hero__scroll svg { width: 16px; height: 16px; animation: bob 2s var(--ease) infinite; }
@keyframes bob { 50% { transform: translateY(4px); } }
@media (min-width: 900px) {
  .hero__foot { grid-template-columns: 1.2fr 1fr auto; }
  .hero__scroll { display: inline-flex; }
}

/* ---------- Marquee ---------- */
.marquee { border-block: 1px solid var(--line); overflow: hidden; padding: clamp(18px, 3vw, 34px) 0; background: var(--bg); }
.marquee__track { display: flex; width: max-content; will-change: transform; }
.marquee__group { display: flex; align-items: center; flex-shrink: 0; }
.marquee__group span {
  font-family: var(--f-display); font-weight: 500; font-size: clamp(32px, 6vw, 96px); letter-spacing: -0.05em; line-height: 1;
  padding: 0 0.35em; white-space: nowrap;
}
.marquee__group span:nth-of-type(even) { -webkit-text-stroke: 1px var(--ink); color: transparent; font-weight: 300; }
.marquee__group i { font-style: normal; color: var(--accent); font-size: clamp(24px, 4vw, 60px); display: inline-block; transform: rotate(calc(var(--pulse) * 45deg)) scale(calc(1 + var(--pulse) * 0.25)); }

/* ---------- Section scaffolding ---------- */
section { position: relative; }
.about, .work, .services, .toolbox, .writing, .contact { padding: clamp(80px, 13vw, 180px) var(--gutter); }
.section-head { display: grid; gap: 1.2rem; margin-bottom: clamp(40px, 6vw, 80px); }
.section-title { font-family: var(--f-display); font-weight: 300; font-size: clamp(34px, 6vw, 96px); line-height: 1; letter-spacing: -0.055em; max-width: 16ch; }
.section-title em { font-size: 1.1em; }
.section-note { color: var(--ink-3); }
@media (min-width: 900px) {
  .section-head { grid-template-columns: 1fr 2.4fr auto; align-items: end; }
}

[data-reveal] { clip-path: inset(0 0 100% 0); transform: translateY(30px); transition: clip-path 1.2s var(--ease-out), transform 1.2s var(--ease-out); }
[data-reveal].in { clip-path: inset(0 0 -10% 0); transform: none; }

/* ---------- About ---------- */
.about { display: grid; gap: 40px; }
.about__text { font-family: var(--f-display); font-weight: 300; font-size: clamp(24px, 3.2vw, 52px); line-height: 1.12; letter-spacing: -0.04em; }
.about__text .w { opacity: 0.16; transition: opacity 0.35s; }
.about__text .w.on { opacity: 1; }
.about__aside { display: grid; gap: 28px; align-content: start; }
.about__facts li { display: flex; justify-content: space-between; gap: 1rem; padding: 12px 0; border-bottom: 1px solid var(--line); }
.about__facts li span:first-child { color: var(--ink-3); }
.about__facts li span:last-child { text-align: right; }
@media (min-width: 900px) {
  .about { grid-template-columns: 1fr 3fr 1.5fr; gap: 4vw; }
}

/* terminal card */
.term { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--bg-2); }
.term__bar { display: flex; align-items: center; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.term__bar i { width: 10px; height: 10px; border-radius: 50%; background: var(--bg-3); }
.term__bar i:first-child { background: var(--accent); }
.term__bar span { margin-left: auto; color: var(--ink-3); font-size: 0.64rem; text-transform: none; }
.term__body {
  font-family: var(--f-mono); font-size: 0.74rem; line-height: 1.65; padding: 14px 16px 18px; min-height: 14.5em;
  white-space: pre-wrap; word-break: break-word; color: var(--ink-2);
}
.term__body .p { color: var(--accent); }
.term__body .c { color: var(--ink); }
.term__body .k { color: var(--ink-3); }
.term__cursor { display: inline-block; width: 0.6em; height: 1.1em; vertical-align: -0.2em; background: var(--accent); animation: blink 1s steps(1) infinite; }

/* ---------- Work ---------- */
.work__list { border-top: 1px solid var(--line); }
.work__item a {
  position: relative; display: grid; grid-template-columns: 2.4rem 1fr auto; grid-template-areas: "num title year" "thumb thumb thumb" ". tags tags" ". desc desc";
  gap: 6px 12px; align-items: baseline; padding: 22px 0; border-bottom: 1px solid var(--line); isolation: isolate;
}
.work__num { grid-area: num; color: var(--ink-3); }
.work__title { grid-area: title; font-family: var(--f-display); font-weight: 400; font-size: clamp(28px, 4.4vw, 68px); letter-spacing: -0.05em; line-height: 1.05; transition: transform 0.6s var(--ease-out); }
.work__tags { grid-area: tags; color: var(--ink-2); font-size: 0.95rem; }
.work__year { grid-area: year; color: var(--ink-3); }
.work__desc { grid-area: desc; display: block; max-width: 68ch; margin-top: 10px; color: var(--ink-2); font-size: 0.95rem; line-height: 1.6; transition: color 0.3s; }
.work__stack { display: block; margin-top: 14px; color: var(--ink-3); transition: color 0.3s; }
.work__thumb { grid-area: thumb; display: block; aspect-ratio: 16 / 10; margin: 14px 0 8px; border-radius: 4px; overflow: hidden; position: relative; }
.work__item a::before {
  content: ""; position: absolute; inset: 0; z-index: -1; background: var(--ink);
  clip-path: inset(100% 0 0 0); transition: clip-path 0.6s var(--ease);
}
@media (hover: hover) and (pointer: fine) {
  .work__thumb { display: none; }
  .work__item a { grid-template-columns: 4rem 1.3fr 1.2fr auto; grid-template-areas: "num title tags year" ". desc desc ."; padding: 28px 12px; transition: opacity 0.4s, color 0.3s; }
  .work__item a:hover::before { clip-path: inset(0 0 0 0); }
  .work__item a:hover { color: var(--bg); }
  .work__item a:hover .work__title { transform: translateX(1.2rem); }
  .work__item a:hover .work__tags, .work__item a:hover .work__year, .work__item a:hover .work__num, .work__item a:hover .work__desc, .work__item a:hover .work__stack { color: var(--bg); }
  .work__list:hover .work__item a:not(:hover) { opacity: 0.4; }
}

/* project art (thumbs + floating preview) */
.art {
  position: absolute; inset: 0; overflow: hidden;
  background:
    repeating-radial-gradient(circle at 72% 28%, transparent 0 13px, rgba(0, 0, 0, 0.16) 13px 14px),
    radial-gradient(110% 80% at 15% 10%, var(--a), transparent 62%),
    radial-gradient(90% 110% at 95% 100%, var(--b), transparent 58%),
    var(--c);
}
.art b {
  position: absolute; right: 6%; bottom: 0; font-family: var(--f-display); font-weight: 700; font-size: 9rem; line-height: 1;
  color: var(--c); mix-blend-mode: difference; opacity: 0.9;
}
.art small, .art strong {
  position: absolute; left: 14px; font-family: var(--f-mono); font-size: 0.64rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: #fff; mix-blend-mode: difference; font-weight: 400;
}
.art small { top: 12px; }
.art strong { bottom: 12px; font-size: 0.74rem; padding: 6px 10px; border: 1px solid #fff; border-radius: 999px; }

.preview {
  --w: clamp(260px, 24vw, 400px);
  position: fixed; top: 0; left: 0; z-index: 40; width: var(--w); aspect-ratio: 4 / 3;
  margin: calc(var(--w) * -0.375) 0 0 calc(var(--w) * -0.5);
  border-radius: 6px; overflow: hidden; pointer-events: none; will-change: transform; transform: scale(0);
}
.preview__track { position: absolute; inset: 0; transition: transform 0.7s var(--ease); }
.preview__slide { position: absolute; left: 0; right: 0; height: 100%; }
@media (hover: none), (pointer: coarse) { .preview { display: none; } }

/* ---------- Capabilities ---------- */
.services { background: var(--bg-2); }
.services__list { border-top: 1px solid var(--line); }
.service { border-bottom: 1px solid var(--line); }
.service summary {
  list-style: none; display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "num name plus" ". meta meta";
  gap: 4px 16px; align-items: center; padding: 26px 0; cursor: pointer;
}
.service summary::-webkit-details-marker { display: none; }
.service__num { grid-area: num; color: var(--accent); }
.service__name { grid-area: name; font-family: var(--f-display); font-weight: 400; font-size: clamp(24px, 3.6vw, 56px); letter-spacing: -0.05em; line-height: 1.05; transition: transform 0.5s var(--ease-out); }
.service__meta { grid-area: meta; color: var(--ink-3); }
.service__plus { grid-area: plus; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%; position: relative; transition: transform 0.5s var(--ease), background 0.3s; }
.service__plus::before, .service__plus::after { content: ""; position: absolute; left: 50%; top: 50%; width: 14px; height: 1px; background: currentColor; translate: -50% -50%; }
.service__plus::after { rotate: 90deg; transition: rotate 0.5s var(--ease); }
.service[open] .service__plus { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); transform: rotate(180deg); }
.service[open] .service__plus::after { rotate: 0deg; }
.service summary:hover .service__name { transform: translateX(0.6rem); }
.service__body { display: grid; gap: 22px; padding: 0 0 34px; max-width: 980px; animation: open 0.6s var(--ease-out); }
.service__body p { color: var(--ink-2); font-size: 1.1rem; max-width: 52ch; }
@keyframes open { from { opacity: 0; transform: translateY(-10px); } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; align-content: start; }
.chips li { padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; font-size: 0.85rem; }
@media (min-width: 900px) {
  .service summary { grid-template-columns: 6rem 1fr 15rem 44px; grid-template-areas: "num name meta plus"; }
  .service__body { padding-left: 6rem; grid-template-columns: 1.3fr 1fr; align-items: start; }
}

.btn-round {
  width: 96px; height: 96px; border-radius: 50%; background: var(--accent); color: var(--accent-ink);
  font-family: var(--f-display); font-weight: 600; font-size: 1rem; display: inline-grid; place-items: center;
  box-shadow: 0 0 0 calc(var(--pulse) * 10px) color-mix(in srgb, var(--accent) 25%, transparent);
}
.btn-round--sm { width: 76px; height: 76px; font-size: 0.8rem; }

/* ---------- Process (horizontal scroll) ---------- */
.process { height: 400vh; background: var(--ink); color: var(--bg); }
.process__sticky { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; display: flex; flex-direction: column; justify-content: center; gap: 4vh; }
.process__head { display: flex; justify-content: space-between; padding: 0 var(--gutter); }
.process__head .eyebrow { color: var(--bg); }
.process__track { display: flex; padding-left: var(--gutter); will-change: transform; }
.step {
  flex: 0 0 min(82vw, 640px); padding: 0 clamp(20px, 4vw, 64px) 0 0; margin-right: clamp(20px, 4vw, 64px);
  border-right: 1px solid color-mix(in srgb, var(--bg) 18%, transparent); display: grid; gap: 1.2rem; align-content: start;
}
.step__num { font-family: var(--f-display); font-weight: 200; font-size: clamp(90px, 16vw, 260px); line-height: 0.8; letter-spacing: -0.07em; -webkit-text-stroke: 1.5px var(--bg); color: transparent; transition: color 0.6s; }
.step.active .step__num { color: var(--accent); -webkit-text-stroke-color: var(--accent); }
.step h3 { font-family: var(--f-display); font-weight: 500; font-size: clamp(26px, 3vw, 48px); letter-spacing: -0.05em; line-height: 1.05; }
.step p { max-width: 38ch; font-size: 1.05rem; opacity: 0.75; }
.process.no-pin { height: auto; }
.process.no-pin .process__sticky { position: static; height: auto; padding: 80px 0; }
.process.no-pin .process__track { flex-direction: column; gap: 56px; padding-right: var(--gutter); }
.process.no-pin .step { flex: none; border: 0; margin: 0; padding: 0; }

/* ---------- Toolbox ---------- */
.toolbox { border-bottom: 1px solid var(--line); }
.toolbox__grid { display: grid; grid-template-columns: 1fr; border-top: 1px solid var(--line); }
.tool { display: grid; gap: 10px; padding: 26px 0; border-bottom: 1px solid var(--line); transition: background 0.4s; }
.tool .mono { color: var(--accent); }
.tool p { font-family: var(--f-display); font-weight: 300; font-size: clamp(20px, 2vw, 32px); letter-spacing: -0.04em; line-height: 1.2; }
@media (min-width: 760px) {
  .toolbox__grid { grid-template-columns: repeat(2, 1fr); }
  .tool { padding: 30px 28px 30px 0; }
  .tool:nth-child(2n) { padding-left: 28px; border-left: 1px solid var(--line); }
}
@media (min-width: 1100px) {
  .toolbox__grid { grid-template-columns: repeat(3, 1fr); }
  .tool, .tool:nth-child(2n) { padding: 34px 28px; border-left: 1px solid var(--line); }
  .tool:nth-child(3n + 1) { padding-left: 0; border-left: 0; }
}

/* ---------- Writing ---------- */
.writing__all { justify-self: start; color: var(--ink-2); }
.writing__list { border-top: 1px solid var(--line); counter-reset: post; }
.post a {
  position: relative; display: grid; grid-template-columns: 1fr auto; grid-template-areas: "meta arrow" "main main";
  gap: 14px 24px; padding: 30px 0; border-bottom: 1px solid var(--line); isolation: isolate;
}
.post__meta { grid-area: meta; display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--ink-3); align-self: center; }
.post__meta time { color: var(--accent); }
.post__main { grid-area: main; display: grid; gap: 12px; }
.post__title {
  font-family: var(--f-display); font-weight: 400; font-size: clamp(24px, 3.2vw, 48px); letter-spacing: -0.045em; line-height: 1.08;
  max-width: 24ch; text-wrap: balance;
  text-decoration: underline 2px transparent; text-underline-offset: 0.16em;
  transition: text-decoration-color 0.4s;
}
.post__excerpt { color: var(--ink-2); max-width: 60ch; font-size: 1.02rem; }
.post__tags { display: flex; flex-wrap: wrap; gap: 6px; }
.post__tags span { font-family: var(--f-mono); font-size: 0.66rem; text-transform: lowercase; letter-spacing: 0.02em; padding: 5px 10px; border: 1px solid var(--line); border-radius: 999px; color: var(--ink-2); }
.post__tags span::before { content: "#"; color: var(--accent); }
.post__arrow {
  grid-area: arrow; width: 56px; height: 56px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center;
  font-size: 1.3rem; transition: background 0.4s, color 0.4s, border-color 0.4s, transform 0.6s var(--ease);
}
.post a:hover .post__title, .post a:focus-visible .post__title { text-decoration-color: var(--accent); }
.post a:hover .post__arrow, .post a:focus-visible .post__arrow { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); transform: rotate(45deg); }
@media (min-width: 900px) {
  .post a { grid-template-columns: 12rem 1fr auto; grid-template-areas: "meta main arrow"; align-items: start; padding: 40px 0; }
  .post__meta { flex-direction: column; align-self: start; padding-top: 0.6em; }
  .post__arrow { width: 72px; height: 72px; }
}
.writing__list.is-loading { opacity: 0.6; }

/* ---------- Contact ---------- */
.contact { display: grid; gap: clamp(28px, 4vw, 48px); padding-bottom: 24px; overflow: hidden; }
.contact__title { font-family: var(--f-display); font-weight: 300; font-size: clamp(40px, 7.6vw, 144px); line-height: 0.95; letter-spacing: -0.06em; }
.contact__title em { font-size: 1.08em; }
.contact__email {
  justify-self: start; text-align: left; display: grid; gap: 6px; position: relative;
  font-family: var(--f-display); font-weight: 400; font-size: clamp(20px, 3.4vw, 54px); letter-spacing: -0.04em;
  padding-bottom: 10px; max-width: 100%; overflow-wrap: anywhere;
}
.contact__email::after { content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: var(--accent); transform: scaleX(0.15); transform-origin: left; transition: transform 0.7s var(--ease); }
.contact__email:hover::after, .contact__email:focus-visible::after { transform: scaleX(1); }
.contact__email-hint { color: var(--ink-3); }
.contact__cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; align-items: start; }
.contact__cols ul { display: grid; gap: 8px; color: var(--ink-2); }
.contact__cols .btn-round { grid-column: 1 / -1; }
@media (min-width: 900px) {
  .contact__cols { grid-template-columns: 1fr 1fr auto; }
  .contact__cols .btn-round { grid-column: auto; }
}
.bigname {
  font-family: var(--f-display); font-size: 25vw; line-height: 0.78; letter-spacing: -0.06em; text-align: center;
  margin: 2vw calc(var(--gutter) * -1) 0; white-space: nowrap; user-select: none;
}
.bigname span { display: inline-block; font-weight: 200; transition: color 0.4s; }
.bigname span:hover { color: var(--accent); }
.contact__legal { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; color: var(--ink-3); border-top: 1px solid var(--line); padding-top: 18px; }

/* ---------- Phone tweaks ---------- */
@media (max-width: 600px) {
  .hero__title { font-size: 11vw; line-height: 1.02; }
  .line:nth-child(2) .line__in, .line:nth-child(3) .line__in { padding-left: 0; }
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; transition-delay: 0s !important; }
  html { scroll-behavior: auto; }
  [data-reveal] { clip-path: none; transform: none; }
}
