/* ---------- tokens ---------- */
:root {
  --bg: #f6f5f1;
  --bg-2: #efede6;
  --ink: #111110;
  --ink-2: #2a2925;
  --muted: #8a867c;
  --rule: #cfcbbf;
  --rule-2: #e3dfd2;
  --accent: #c2410c; /* rust — single chromatic accent */
  --serif: 'Newsreader', 'Iowan Old Style', Georgia, serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  --px: 1px;
  --maxw: 1440px;
  --gutter: clamp(20px, 4vw, 56px);
  --vgap: clamp(60px, 9vh, 120px);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { background: var(--bg); color: var(--ink); }
body {
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

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

a { color: inherit; text-decoration: none; }

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }

.mono { font-family: var(--mono); font-feature-settings: "ss01"; letter-spacing: 0; }
.sans-caps { font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.12em; font-size: 11px; color: var(--muted); font-weight: 500; }
.tabular { font-variant-numeric: tabular-nums; }

/* ---------- layout ---------- */
.shell {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.divider { height: 1px; background: var(--rule); border: 0; margin: 0; }
.divider-thin { height: 1px; background: var(--rule-2); border: 0; margin: 0; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: saturate(1.1) blur(10px);
  background: color-mix(in oklab, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--rule-2);
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 56px;
}
.brand { font-family: var(--serif); font-weight: 500; font-size: 18px; letter-spacing: -0.01em; display: flex; align-items: baseline; gap: 10px; }
.brand .dot { width: 7px; height: 7px; background: var(--ink); border-radius: 99px; display: inline-block; transform: translateY(-2px); }
.brand em { font-style: italic; color: var(--muted); font-weight: 400; font-size: 14px; }

.topnav { display: flex; gap: 28px; align-items: center; }
.topnav a { font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); padding: 6px 0; position: relative; }
.topnav a.active::after, .topnav a:hover::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 1px; background: var(--ink);
}

/* ---------- hero ---------- */
.hero {
  padding: clamp(80px, 14vh, 160px) 0 clamp(80px, 12vh, 140px);
  position: relative;
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
  gap: clamp(24px, 4vw, 80px);
  align-items: end;
}
.hero-kicker {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 clamp(28px, 4vh, 44px);
  display: flex; align-items: center; gap: 14px;
}
.hero-kicker .bullet { width: 6px; height: 6px; background: var(--accent); border-radius: 99px; }
.hero-kicker .sep { color: var(--rule); }

.hero h1 {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(64px, 11vw, 176px);
  line-height: 0.92;
  letter-spacing: -0.035em;
  margin: 0;
  text-wrap: balance;
}
.hero h1 em { font-style: italic; font-weight: 300; color: var(--ink); }
.hero h1 .amp { font-style: italic; color: var(--accent); font-weight: 300; }

.hero-meta {
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.7;
  color: var(--ink-2);
  border-top: 1px solid var(--ink);
  padding-top: 14px;
  align-self: end;
}
.hero-meta dt { color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; font-size: 10px; margin-top: 10px; }
.hero-meta dt:first-child { margin-top: 0; }
.hero-meta dd { margin: 2px 0 0; }

/* subtitle / lede */
.lede {
  margin-top: clamp(36px, 5vh, 60px);
  display: grid;
  grid-template-columns: 1fr minmax(0, 620px) 1fr;
  gap: 24px;
}
.lede p {
  grid-column: 2;
  font-family: var(--serif);
  font-size: clamp(20px, 1.7vw, 24px);
  line-height: 1.45;
  color: var(--ink-2);
  margin: 0;
  text-wrap: pretty;
}
.lede p .drop {
  font-family: var(--serif);
  font-style: italic;
  color: var(--accent);
}

/* ---------- section headers ---------- */
.section {
  padding: clamp(70px, 10vh, 120px) 0;
}
.section-head {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 18px;
  align-items: baseline;
  margin-bottom: clamp(36px, 6vh, 64px);
}
.section-num {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.1em;
}
.section-title {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(32px, 4vw, 56px);
  line-height: 1;
  letter-spacing: -0.02em;
  margin: 0;
}
.section-title em { font-style: italic; color: var(--muted); }

/* ---------- about ---------- */
.about-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 24px;
  align-items: start;
}
.about-text { grid-column: 3 / span 7; }
.about-text p {
  font-family: var(--serif);
  font-size: clamp(19px, 1.45vw, 22px);
  line-height: 1.55;
  color: var(--ink-2);
  margin: 0 0 22px;
  text-wrap: pretty;
}
.about-text p:first-of-type::first-letter {
  font-family: var(--serif);
  font-size: 4.2em;
  float: left;
  line-height: 0.9;
  padding: 6px 10px 0 0;
  font-weight: 400;
  color: var(--ink);
}
.about-side { grid-column: 10 / span 3; }
.spec-list { font-family: var(--mono); font-size: 11px; color: var(--ink-2); border-top: 1px solid var(--ink); padding-top: 14px; }
.spec-list dt { color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; font-size: 10px; margin-top: 14px; }
.spec-list dt:first-child { margin-top: 0; }
.spec-list dd { margin: 3px 0 0; line-height: 1.5; }

/* ---------- work (apps) index ---------- */
.work-list { border-top: 1px solid var(--ink); }
.work-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, 0.9fr) 140px;
  gap: 24px;
  padding: clamp(28px, 4vh, 44px) 0;
  border-bottom: 1px solid var(--rule-2);
  align-items: baseline;
  cursor: pointer;
  position: relative;
  transition: background 220ms ease, padding-left 260ms cubic-bezier(.2,.7,.2,1);
}
.work-row:hover { background: linear-gradient(90deg, rgba(0,0,0,0.02), transparent 70%); padding-left: 12px; }
.work-row:hover .work-title { color: var(--accent); }
.work-row:hover .work-arrow { transform: translateX(8px); color: var(--accent); }

.work-index { font-family: var(--mono); font-size: 12px; color: var(--muted); letter-spacing: 0.08em; }
.work-title {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(36px, 4.4vw, 64px);
  line-height: 1;
  letter-spacing: -0.025em;
  margin: 0;
  transition: color 220ms ease;
}
.work-title em { font-style: italic; color: var(--muted); font-weight: 300; }
.work-desc { font-family: var(--serif); font-size: 16px; line-height: 1.5; color: var(--ink-2); text-wrap: pretty; }
.work-meta { font-family: var(--mono); font-size: 11px; color: var(--muted); line-height: 1.7; }
.work-meta span { display: block; }
.work-meta .k { color: var(--muted); }
.work-meta .v { color: var(--ink-2); }
.work-cta {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  justify-self: end;
  display: flex; align-items: center; gap: 10px;
  white-space: nowrap;
}
.work-arrow { display: inline-block; transition: transform 260ms cubic-bezier(.2,.7,.2,1), color 220ms ease; }

/* ---------- footer ---------- */
.foot {
  padding: clamp(80px, 12vh, 140px) 0 48px;
  border-top: 1px solid var(--ink);
  margin-top: clamp(80px, 10vh, 120px);
}
.foot-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: end; }
.foot-big {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(40px, 7vw, 110px);
  line-height: 0.95;
  letter-spacing: -0.03em;
  margin: 0;
}
.foot-big em { font-style: italic; }
.foot-big a { border-bottom: 1px solid currentColor; padding-bottom: 0.03em; }
.foot-big a:hover { color: var(--accent); }
.foot-side { font-family: var(--mono); font-size: 12px; color: var(--ink-2); }
.foot-side a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.foot-base { display: flex; justify-content: space-between; margin-top: 56px; font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; }

/* ---------- detail pages ---------- */
.detail {
  padding-top: clamp(40px, 6vh, 70px);
}
.back {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-2);
  display: inline-flex; align-items: center; gap: 10px;
  padding: 6px 0;
  margin-bottom: clamp(48px, 8vh, 80px);
}
.back:hover { color: var(--accent); }
.back .arr { transition: transform 220ms ease; }
.back:hover .arr { transform: translateX(-6px); }

.detail-kicker { font-family: var(--mono); font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); margin: 0 0 24px; display: flex; gap: 14px; align-items: center; }
.detail-kicker .dot { width: 6px; height: 6px; background: var(--accent); border-radius: 99px; }

.detail-title {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(64px, 12vw, 200px);
  line-height: 0.9;
  letter-spacing: -0.035em;
  margin: 0 0 8px;
  text-wrap: balance;
}
.detail-title em { font-style: italic; color: var(--muted); }
.detail-tag {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(22px, 2.4vw, 34px);
  line-height: 1.2;
  color: var(--ink-2);
  margin: 0 0 clamp(48px, 8vh, 80px);
  max-width: 820px;
  text-wrap: pretty;
}

.detail-facts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 32px;
  border-top: 1px solid var(--ink);
  border-bottom: 1px solid var(--rule-2);
  padding: 22px 0;
  margin-bottom: clamp(60px, 8vh, 100px);
}
.fact dt { font-family: var(--mono); font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.12em; margin: 0 0 8px; }
.fact dd { font-family: var(--serif); font-size: 20px; font-weight: 400; line-height: 1.2; margin: 0; color: var(--ink); }

.detail-body {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 24px;
  align-items: start;
  margin-bottom: clamp(60px, 8vh, 100px);
}
.detail-body h3 {
  grid-column: 1 / span 3;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 6px 0 0;
  font-weight: 500;
}
.detail-body .body-copy {
  grid-column: 5 / span 7;
  font-family: var(--serif);
  font-size: clamp(19px, 1.4vw, 22px);
  line-height: 1.55;
  color: var(--ink-2);
  margin: 0;
}
.detail-body .body-copy p { margin: 0 0 18px; text-wrap: pretty; }
.detail-body .body-copy p:last-child { margin-bottom: 0; }

/* placeholder / screenshot — no fake product imagery, just editorial placeholder */
.shot-wrap {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 24px;
  margin-bottom: clamp(60px, 8vh, 100px);
}
.shot {
  position: relative;
  background: var(--bg-2);
  border: 1px solid var(--rule-2);
  aspect-ratio: 9 / 16;
  overflow: hidden;
}
.shot::before {
  content: "";
  position: absolute; inset: 0;
  background-image: repeating-linear-gradient(45deg, transparent 0 10px, rgba(17,17,16,0.025) 10px 11px);
}
.shot-label {
  position: absolute; left: 12px; top: 12px;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--muted);
  background: var(--bg); padding: 4px 7px; border: 1px solid var(--rule-2);
}
.shot-caption {
  position: absolute; left: 12px; bottom: 12px; right: 12px;
  font-family: var(--mono); font-size: 10px; color: var(--muted);
  letter-spacing: 0.05em;
}
.shot-inner {
  position: absolute; inset: 14%;
  display: flex; flex-direction: column;
  justify-content: center; align-items: center;
  font-family: var(--mono); font-size: 11px; color: var(--muted);
  text-align: center; line-height: 1.6;
}

/* feature rows */
.feature-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  border-top: 1px solid var(--ink);
  margin-bottom: clamp(60px, 8vh, 100px);
}
.feature {
  padding: 28px 28px 28px 0;
  border-bottom: 1px solid var(--rule-2);
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 16px;
  align-items: baseline;
}
.feature:nth-child(odd) { border-right: 1px solid var(--rule-2); padding-right: 32px; }
.feature:nth-child(even) { padding-left: 32px; padding-right: 0; }
.feature .idx { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.feature h4 { font-family: var(--serif); font-weight: 400; font-size: 22px; margin: 0 0 6px; letter-spacing: -0.015em; }
.feature p { font-family: var(--serif); font-size: 16px; line-height: 1.5; color: var(--ink-2); margin: 0; text-wrap: pretty; }

/* prev / next */
.pager {
  border-top: 1px solid var(--ink);
  padding-top: 28px;
  margin-top: clamp(40px, 6vh, 80px);
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 20px;
  flex-wrap: wrap;
}
.pager a {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(28px, 4vw, 48px);
  letter-spacing: -0.02em;
  line-height: 1;
}
.pager a small { font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); display: block; margin-bottom: 8px; }
.pager a:hover { color: var(--accent); }

/* ---------- cursor halo ---------- */
#halo {
  position: fixed;
  width: 360px; height: 360px;
  top: 0; left: 0;
  pointer-events: none;
  z-index: 5;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(194,65,12,0.08) 0%, rgba(194,65,12,0) 60%);
  mix-blend-mode: multiply;
  opacity: 0;
  transition: opacity 300ms ease;
}
body.has-halo #halo { opacity: 1; }
@media (prefers-reduced-motion: reduce) { #halo { display: none; } }
@media (hover: none) { #halo { display: none; } }

/* ---------- reveal on scroll ---------- */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity 700ms ease, transform 700ms cubic-bezier(.2,.7,.2,1); }
.reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .reveal { opacity: 1; transform: none; transition: none; } }

/* ---------- tweaks panel ---------- */
.tweaks-panel {
  position: fixed; right: 20px; bottom: 20px; z-index: 100;
  width: 280px;
  background: var(--bg);
  border: 1px solid var(--ink);
  box-shadow: 0 14px 40px rgba(0,0,0,0.12);
  font-family: var(--mono);
  font-size: 12px;
}
.tweaks-head { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--ink); text-transform: uppercase; letter-spacing: 0.12em; font-size: 10px; }
.tweaks-body { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.tweaks-body label { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 11px; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.08em; }
.tweaks-body input[type="color"] { width: 40px; height: 22px; border: 1px solid var(--rule); background: none; padding: 0; cursor: pointer; }
.tweaks-body select { font: inherit; border: 1px solid var(--rule); background: var(--bg); padding: 4px 6px; }
.tweaks-body input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--ink); }

/* ---------- grid overlay (tweak) ---------- */
body.grid-on::after {
  content: "";
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(17,17,16,0.06) 1px, transparent 1px);
  background-size: calc(100% / 12) 100%;
  max-width: var(--maxw); margin: 0 auto;
}

/* ---------- density ---------- */
body.density-tight { --vgap: clamp(40px, 6vh, 80px); }
body.density-tight .section { padding: clamp(48px, 7vh, 80px) 0; }
body.density-tight .hero { padding: clamp(56px, 10vh, 110px) 0 clamp(56px, 8vh, 90px); }
body.density-roomy { --vgap: clamp(80px, 12vh, 160px); }
body.density-roomy .section { padding: clamp(100px, 14vh, 180px) 0; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; }
  .hero-meta { margin-top: 40px; }
  .about-text { grid-column: 1 / -1; }
  .about-side { grid-column: 1 / -1; }
  .work-row {
    grid-template-columns: 48px 1fr;
    grid-template-rows: auto auto auto;
    gap: 10px 16px;
  }
  .work-index { grid-column: 1; grid-row: 1; }
  .work-title { grid-column: 2; grid-row: 1; }
  .work-desc { grid-column: 1 / -1; grid-row: 2; }
  .work-meta { grid-column: 1 / -1; grid-row: 3; display: flex; gap: 24px; flex-wrap: wrap; }
  .work-meta span { display: inline; }
  .work-cta { grid-column: 1 / -1; grid-row: 4; justify-self: start; margin-top: 6px; }
  .detail-facts { grid-template-columns: 1fr 1fr; gap: 20px; }
  .detail-body h3 { grid-column: 1 / -1; }
  .detail-body .body-copy { grid-column: 1 / -1; }
  .shot-wrap { grid-template-columns: 1fr; }
  .feature-list { grid-template-columns: 1fr; }
  .feature:nth-child(odd) { border-right: 0; padding-right: 0; }
  .feature:nth-child(even) { padding-left: 0; }
  .foot-grid { grid-template-columns: 1fr; }
  .tweaks-panel { left: 12px; right: 12px; bottom: 12px; width: auto; }
}
