/* Layout: label rail + content grid, every section opened by a 3px ink rule.
   Color: Sanzo Wada No. 343. Type: Instrument Serif / Instrument Sans / IBM Plex Mono. */
:root {
  --paper: #ebd3a2;  /* Ivory Buff */
  --accent: #ae5224; /* Burnt Sienna */
  --quiet: #635a3a;  /* Deep Grayish Olive */
  --deep: #064f6e;   /* Vandar Poel's Blue */

  --bg: color-mix(in oklab, var(--paper) 30%, #fffdf8);
  --surface: color-mix(in oklab, var(--paper) 58%, #fffdf8);
  --fg: color-mix(in oklab, var(--deep) 62%, #0c0c0c);
  --fg-soft: color-mix(in oklab, var(--quiet) 88%, #000);
  --rule: var(--deep);
  --hair: color-mix(in oklab, var(--deep) 22%, transparent);
  --accent-ink: color-mix(in oklab, var(--accent) 88%, #000);
  --accent-fill: var(--accent);
  --on-accent: #fffdf8;
  --band: color-mix(in oklab, var(--deep) 88%, #000);
  --on-band: color-mix(in oklab, var(--paper) 45%, #fff);
  --grain-opacity: .09;
  --grain-blend: multiply;

  --display: "Instrument Serif", "Iowan Old Style", Georgia, serif;
  --text: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --step-5: clamp(3rem, 8vw, 6rem);
  --step-4: clamp(2.2rem, 5vw, 3.6rem);
  --step-3: clamp(1.6rem, 3.2vw, 2.3rem);
  --step-2: 1.3rem;
  --step-1: 1.0625rem;
  --step-0: .8125rem;
  --s1: 4px; --s2: 8px; --s3: 16px; --s4: 24px; --s5: 40px; --s6: 64px; --s7: 104px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: color-mix(in oklab, var(--deep) 30%, #0b0d0e);
    --surface: color-mix(in oklab, var(--deep) 42%, #121517);
    --fg: color-mix(in oklab, var(--paper) 50%, #fff);
    --fg-soft: color-mix(in oklab, var(--paper) 55%, #8e8a80);
    --rule: color-mix(in oklab, var(--paper) 75%, #fff);
    --hair: color-mix(in oklab, var(--paper) 22%, transparent);
    --accent-ink: color-mix(in oklab, var(--accent) 70%, #fff);
    --accent-fill: color-mix(in oklab, var(--accent) 85%, #fff);
    --on-accent: #111;
    --band: color-mix(in oklab, var(--paper) 14%, #16191b);
    --on-band: color-mix(in oklab, var(--paper) 55%, #fff);
    --grain-opacity: .16;
    --grain-blend: soft-light;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: color-mix(in oklab, var(--deep) 30%, #0b0d0e);
  --surface: color-mix(in oklab, var(--deep) 42%, #121517);
  --fg: color-mix(in oklab, var(--paper) 50%, #fff);
  --fg-soft: color-mix(in oklab, var(--paper) 55%, #8e8a80);
  --rule: color-mix(in oklab, var(--paper) 75%, #fff);
  --hair: color-mix(in oklab, var(--paper) 22%, transparent);
  --accent-ink: color-mix(in oklab, var(--accent) 70%, #fff);
  --accent-fill: color-mix(in oklab, var(--accent) 85%, #fff);
  --on-accent: #111;
  --band: color-mix(in oklab, var(--paper) 14%, #16191b);
  --on-band: color-mix(in oklab, var(--paper) 55%, #fff);
  --grain-opacity: .16;
  --grain-blend: soft-light;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { scroll-behavior: auto; }
body {
  background: var(--bg); color: var(--fg);
  font-family: var(--text); font-size: var(--step-1); line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
body::after {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 50;
  opacity: var(--grain-opacity); mix-blend-mode: var(--grain-blend);
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 .9 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
body::before {
  content: ""; position: fixed; inset: 0 0 auto;
  height: env(safe-area-inset-top, 0px); z-index: 30; background: var(--bg);
}
.wrap {
  max-width: 1120px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

/* Type */
h1, h2 { font-family: var(--display); font-weight: 400; line-height: 1.04; margin: 0; text-wrap: balance; letter-spacing: -.015em; }
h1 { font-size: var(--step-5); }
h2 { font-size: var(--step-4); }
h3 { font-family: var(--text); font-weight: 600; font-size: var(--step-2); line-height: 1.3; margin: 0; text-wrap: balance; }
h1 em, h2 em { font-style: italic; color: var(--accent-ink); }
p { margin: 0; max-width: 62ch; }
.label { font-family: var(--mono); font-size: var(--step-0); letter-spacing: .12em; text-transform: uppercase; color: var(--fg-soft); }
.lede { font-size: var(--step-2); line-height: 1.55; max-width: 44ch; }
.soft { color: var(--fg-soft); }
a { color: var(--accent-ink); text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 2px solid var(--accent-ink); outline-offset: 3px; }

/* Header */
.site-head { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20; background: var(--bg); border-bottom: 1px solid var(--hair); }
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding-block: 14px; }
.brand { font-family: var(--display); font-size: 1.5rem; color: var(--fg); text-decoration: none; line-height: 1; white-space: nowrap; }
nav { display: flex; align-items: center; gap: var(--s4); }
nav a { color: var(--fg); text-decoration: none; font-weight: 500; font-size: .95rem; }
nav a[aria-current="page"] { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 6px; }
.nav-cta { background: var(--accent-fill); color: var(--on-accent) !important; padding: 8px 14px; font-weight: 600 !important; }
.menu-btn { display: none; font-family: var(--mono); font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; background: none; border: 1px solid var(--fg); color: var(--fg); padding: 8px 12px; cursor: pointer; }
@media (max-width: 720px) {
  .menu-btn { display: block; }
  nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--bg); border-bottom: 3px solid var(--rule); flex-direction: column; align-items: stretch; gap: 0;
        padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-block: 8px 16px; }
  nav.open { display: flex; }
  nav a { padding: 12px 0; border-bottom: 1px solid var(--hair); font-size: 1.05rem; }
  .nav-cta { margin-top: 12px; text-align: center; border-bottom: 0 !important; }
}

/* Views */
.view { padding-bottom: var(--s6); }

/* Hero */
.hero { padding-block: var(--s6) var(--s5); display: grid; gap: var(--s4); }
@media (min-width: 900px) { .hero.split { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: end; gap: var(--s5); } }
.hero-text { display: grid; gap: var(--s4); min-width: 0; }
.cred { font-family: var(--mono); font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-soft); }
.btns { display: flex; flex-wrap: wrap; gap: var(--s2); }
.btn { display: inline-block; font-family: var(--text); font-weight: 600; font-size: .95rem; padding: 12px 20px; border: 2px solid var(--fg); color: var(--fg); background: transparent; text-decoration: none; cursor: pointer; }
.btn.primary { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--on-accent); }

/* Real images: same frame as the placeholders */
.shot { position: relative; max-width: 100%; border: 1px solid var(--hair); overflow: hidden; background: var(--surface); margin: 0; }
.shot img { display: block; width: 100%; height: 100%; object-fit: cover; }
.shot.wide { aspect-ratio: 16 / 9; }
.shot.card { aspect-ratio: 3 / 2; }
.shot.phones img { object-fit: contain; }
.shot.page img { object-fit: contain; background: #fff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .shot.page img { filter: brightness(.88); } }
:root[data-theme="dark"] .shot.page img { filter: brightness(.88); }

/* Image placeholders on linen */
.ph {
  position: relative; max-width: 100%; border: 1px solid var(--hair); overflow: hidden;
  display: grid; place-items: center; text-align: center; padding: var(--s3);
  background:
    repeating-linear-gradient(90deg, transparent 0 7px, var(--hair) 7px 8px),
    repeating-linear-gradient(0deg, transparent 0 11px, color-mix(in oklab, var(--hair) 60%, transparent) 11px 12px),
    var(--surface);
}
.ph span { font-family: var(--mono); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--fg-soft); background: var(--bg); padding: 4px 8px; }
.ph.portrait { aspect-ratio: 4 / 5; }
.ph.wide { aspect-ratio: 16 / 9; }
.ph.card { aspect-ratio: 3 / 2; }


.logo { color: var(--fg); display: block; }
.logo svg { display: block; height: 100%; width: auto; max-width: 100%; }
.logo .logo-mask { display: inline-block; vertical-align: top; height: 100%; width: auto; }
.logo .logo-mask { background: currentColor; -webkit-mask-size: contain; mask-size: contain; -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat; -webkit-mask-position: center; mask-position: center; }
.case-logo { height: 104px; }
.case-logo.wordmark { height: 68px; }
/* .ph.card also matches .card (a grid), so double the class to win */
.ph.ph { display: flex; align-items: center; justify-content: center; align-content: center; }
.ph .logo { width: 64%; height: 68%; background: var(--bg); display: flex; align-items: center; justify-content: center; }
.ph .logo > svg, .ph .logo > .logo-mask { height: 56%; max-width: 84%; }
.ph .logo.wordmark > svg { height: 38%; }

/* Section anatomy */
.sec { border-top: 3px solid var(--rule); padding-block: var(--s4) var(--s5); display: grid; grid-template-columns: 1fr; gap: var(--s4); }
@media (min-width: 820px) { .sec { grid-template-columns: 200px minmax(0, 1fr); gap: var(--s5); } }
.rail { display: grid; gap: var(--s2); align-content: start; }
.body { display: grid; gap: var(--s4); min-width: 0; }

/* Offers */
.offers { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 var(--s5); }
.offer { display: grid; gap: var(--s2); padding-block: var(--s3) var(--s4); border-bottom: 1px solid var(--hair); align-content: start; }
.offer .proof { font-size: .92rem; color: var(--fg-soft); }
.more { font-weight: 600; text-decoration: none; }
.more::after { content: " \2192"; }

/* Work cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--s5) var(--s4); }
.card { display: grid; gap: var(--s2); text-decoration: none; color: var(--fg); align-content: start; }
.card h3 { font-family: var(--display); font-weight: 400; font-size: var(--step-3); line-height: 1.1; }
.card p { color: var(--fg-soft); font-size: .98rem; }
.card:hover h3 { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 5px; }

/* Writing list */
.posts { list-style: none; margin: 0; padding: 0; display: grid; }
.posts li { border-bottom: 1px solid var(--hair); }
.posts a { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; padding-block: var(--s3); color: var(--fg); text-decoration: none; }
@media (min-width: 680px) { .posts a { grid-template-columns: 110px minmax(0, 1fr); gap: var(--s4); } }
.posts .t { font-family: var(--display); font-size: 1.55rem; line-height: 1.15; }
.posts .d { color: var(--fg-soft); font-size: .95rem; }
.posts a:hover .t { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 4px; }
.posts .meta { font-family: var(--mono); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-soft); padding-top: 6px; }

/* Case study */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0; border-top: 1px solid var(--hair); }
.fact { padding: var(--s3) var(--s3) var(--s3) 0; border-bottom: 1px solid var(--hair); display: grid; gap: 2px; }
.fact b { font-family: var(--display); font-weight: 400; font-size: 2rem; line-height: 1.1; }
.fact span { font-size: .88rem; color: var(--fg-soft); }
.prose { display: grid; gap: var(--s3); }
.prose ul { margin: 0; padding-left: 1.1em; display: grid; gap: var(--s2); max-width: 62ch; }
.prose li::marker { color: var(--accent-ink); }
.stack { font-family: var(--mono); font-size: .8rem; color: var(--fg-soft); letter-spacing: .04em; }
.next { display: flex; justify-content: space-between; flex-wrap: wrap; gap: var(--s3); border-top: 3px solid var(--rule); padding-top: var(--s4); }

/* Steps */
.steps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--s4); counter-reset: step; }
.steps li { counter-increment: step; display: grid; gap: var(--s2); border-top: 1px solid var(--hair); padding-top: var(--s3); }
.steps li::before { content: counter(step); font-family: var(--display); font-size: 2.6rem; line-height: 1; color: var(--accent-ink); }

/* Form */
form { display: grid; gap: var(--s3); max-width: 560px; }
.field { display: grid; gap: 6px; }
.field label { font-weight: 600; font-size: .92rem; }
input, textarea, select { font: inherit; font-size: 1rem; color: var(--fg); background: var(--bg); border: 1px solid var(--fg-soft); padding: 12px; width: 100%; border-radius: 0; }
textarea { min-height: 130px; resize: vertical; }
.form-note { font-size: .9rem; color: var(--fg-soft); }
.sent { border-top: 3px solid var(--rule); padding-top: var(--s3); }

/* Background */
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.timeline li { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; padding-block: var(--s3); border-bottom: 1px solid var(--hair); }
@media (min-width: 680px) { .timeline li { grid-template-columns: 220px minmax(0, 1fr); gap: var(--s4); } }
.timeline .role { font-weight: 600; }
.pubs { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); }
.pubs li { display: grid; gap: 2px; }
.pubs .pt { font-family: var(--display); font-size: 1.4rem; line-height: 1.2; }
.skills { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--s4); }
.skills div { display: grid; gap: 4px; border-top: 1px solid var(--hair); padding-top: var(--s2); }

/* Post */
.article { display: grid; gap: var(--s4); padding-block: var(--s6) var(--s5); max-width: 760px; }
.article h1 { font-size: var(--step-4); }
.article .prose { gap: var(--s3); }
.prose p, .prose li { max-width: 66ch; }
.prose ol { margin: 0; padding-left: 1.3em; display: grid; gap: var(--s2); max-width: 62ch; }
.prose h2, .prose h3 { font-family: var(--display); font-weight: 400; font-size: var(--step-2); line-height: 1.15; margin-top: var(--s4); }
.prose h4 { font-family: var(--text); font-weight: 600; font-size: 1.05rem; margin-top: var(--s3); }
.prose blockquote { margin: 0; padding-left: var(--s3); border-left: 3px solid var(--accent-fill); font-family: var(--display); font-size: 1.35rem; line-height: 1.35; }
.prose blockquote p { max-width: none; }
.prose pre { margin: 0; font-family: var(--mono); font-size: .82rem; line-height: 1.6; background: var(--surface); border: 1px solid var(--hair); padding: var(--s3); overflow-x: auto; white-space: pre; }
.prose figure { margin: var(--s2) 0; display: grid; gap: var(--s1); }
.prose img { display: block; max-width: 100%; height: auto; border: 1px solid var(--hair); }
.prose figcaption { font-size: .85rem; color: var(--fg-soft); }
.prose a { color: var(--accent-ink); }
.prose .continue { border-top: 1px solid var(--hair); padding-top: var(--s3); color: var(--fg-soft); }
.post-src { font-family: var(--mono); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-soft); }

/* Contact band with seigaiha */
.band { background: var(--band); color: var(--on-band); position: relative; overflow: hidden; }
.band canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.band .wrap { position: relative; padding-block: var(--s6); display: grid; gap: var(--s3); }
.band h2 { color: var(--on-band); }
.band .label { color: var(--on-band); opacity: .8; }
.band .btn { border-color: var(--on-band); color: var(--on-band); }
.band .btn.primary { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--on-accent); }
.band .mail { font-family: var(--mono); font-size: 1rem; user-select: all; }

footer.site-foot .wrap { padding-block: var(--s4) var(--s5); display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--s3); }
footer.site-foot a { color: var(--fg); }
.links { display: flex; flex-wrap: wrap; gap: var(--s4); }

@media (prefers-reduced-motion: no-preference) {
  .view { animation: rise .35s ease-out both; }
  @keyframes rise { from { opacity: .4; transform: translateY(6px); } to { opacity: 1; transform: none; } }
}

/* Production additions */
.h1-name { display: block; font-family: var(--text); font-weight: 600; font-size: var(--step-2); letter-spacing: 0; color: var(--fg-soft); margin-bottom: var(--s3); }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.form-error { color: var(--accent-ink); font-weight: 600; }
.skip { position: absolute; left: -10000px; }
.skip:focus { left: 16px; top: 8px; z-index: 100; background: var(--bg); padding: 8px 12px; }
