/* =========================================================================
   Case study pages (/work/<slug>/): a long-form business write-up on a white
   page, deliberately unlike the home page's night theme. Self-contained: it
   does not load styles.css. Serif body for reading, Space Grotesk headings
   (the wordmark face), olive accent and the navy closing block as the only
   ties to the brand. Readable without JS; the inline script only marks the
   current section in the contents list.
   ========================================================================= */

@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("../fonts/space-grotesk-v22-latin-600.woff2") format("woff2");
}

:root {
  --ink:    #1c2327;   /* body text */
  --head:   #10191e;   /* headings */
  --muted:  #59636a;   /* dek, captions, labels */
  --rule:   #e3e6e8;   /* hairlines */
  --tint:   #f5f6f2;   /* figure and summary grounds */
  --accent: #4b5f36;   /* deep olive: kicker, numbers, links (7:1 on white) */
  --accent-bg: #eef1e8;
  --navy:   #142430;   /* closing call-to-action block */
  --olivine: #A0B389;

  --serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, "Iowan Old Style", Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --display: "Space Grotesk", var(--sans);

  --text-w: 720px;
  --wide-w: 1120px;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  margin: 0;
  background: #ffffff;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--head); }
:where(a, summary, .btn):focus-visible { outline: 2px solid #2f5e8c; outline-offset: 3px; border-radius: 3px; }
img { max-width: 100%; }
b { color: var(--head); }

h1, h2, h3 { font-family: var(--display); font-weight: 600; color: var(--head); }

.btn {
  display: inline-block;
  padding: 0.8rem 1.3rem;
  border-radius: 999px;
  background: var(--accent);
  color: #ffffff;
  font-family: var(--sans);
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  transition: background-color .15s ease;
}
.btn:hover { background: #3d4e2b; color: #ffffff; }
.btn-small { padding: 0.6rem 1rem; font-size: 0.88rem; }

/* ---- Top bar ------------------------------------------------------------- */
.bar { border-bottom: 1px solid var(--rule); }
.bar-inner {
  max-width: var(--wide-w);
  margin: 0 auto;
  padding: 0.85rem var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--head);
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.1rem;
  text-decoration: none;
}
.brand img { display: block; }
.bar-nav { display: flex; align-items: center; gap: 1.25rem; font-family: var(--sans); font-size: 0.92rem; }
.bar-nav > a:not(.btn) { color: var(--muted); text-decoration: none; font-weight: 600; }
.bar-nav > a:not(.btn):hover { color: var(--head); }

/* ---- Title block --------------------------------------------------------- */
.head {
  max-width: 880px;
  margin: 0 auto;
  padding: clamp(2.5rem, 7vw, 5rem) var(--gutter) clamp(2rem, 4vw, 2.75rem);
}
.kicker {
  margin: 0 0 1rem;
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}
.head h1 {
  margin: 0 0 1.25rem;
  font-size: clamp(2.1rem, 1.4rem + 3vw, 3.5rem);
  line-height: 1.08;
  letter-spacing: -0.015em;
}
.dek {
  margin: 0 0 2rem;
  font-size: clamp(1.15rem, 1rem + 0.5vw, 1.35rem);
  line-height: 1.55;
  color: var(--muted);
}
.meta {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem 1.5rem;
  margin: 0;
  padding: 1.25rem 0;
  border-block: 1px solid var(--rule);
  font-family: var(--sans);
}
.meta-wide { grid-column: 1 / -1; }
.meta dt {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.meta dd { margin: 0.2rem 0 0; font-size: 0.95rem; line-height: 1.45; color: var(--head); }
.reviewed { margin: 0.75rem 0 0; font-family: var(--sans); font-size: 0.85rem; color: var(--muted); }

/* ---- Figures --------------------------------------------------------------- */
.fig { margin: 2.25rem 0; }
.fig-hero {
  max-width: var(--wide-w);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.fig figcaption {
  margin-top: 0.75rem;
  font-family: var(--sans);
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--muted);
}
.fig figcaption b { color: var(--head); }

.browser {
  border: 1px solid #d9dde0;
  border-radius: 12px;
  overflow: hidden;
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(16,25,30,0.06), 0 24px 48px -28px rgba(16,25,30,0.35);
}
.browser-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  border-bottom: 1px solid #e3e6e8;
  background: #f3f4f5;
}
.browser-bar i { width: 10px; height: 10px; border-radius: 50%; background: #d3d7da; }
.browser-bar span {
  flex: 1;
  min-width: 0;
  margin-left: 10px;
  padding: 3px 10px;
  border-radius: 6px;
  background: #ffffff;
  font-family: var(--sans);
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.browser img { display: block; width: 100%; height: auto; }
.shot { display: block; width: 100%; height: auto; border-radius: 10px; border: 1px solid var(--rule); }

.phones { display: flex; justify-content: center; gap: clamp(1rem, 4vw, 2.5rem); padding: 1.5rem; border-radius: 14px; background: var(--tint); }
.phone {
  display: block;
  width: min(42%, 250px);
  height: auto;
  border: 7px solid #15191c;
  border-radius: 28px;
  box-shadow: 0 18px 36px -22px rgba(16,25,30,0.55);
}
.renders { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.75rem; }

/* ---- At a glance ----------------------------------------------------------- */
.glance {
  max-width: var(--wide-w);
  margin: clamp(2.5rem, 6vw, 4rem) auto 0;
  padding: 0 var(--gutter);
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
}
.glance > div { padding: 1.5rem; border-radius: 14px; background: var(--tint); }
.glance h2 {
  margin: 0 0 0.5rem;
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.glance p { margin: 0; font-size: 1.02rem; line-height: 1.6; }

/* ---- Document: contents list + body column --------------------------------- */
.doc {
  max-width: var(--wide-w);
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 4.5rem) var(--gutter) clamp(3rem, 7vw, 5rem);
  display: grid;
  grid-template-columns: 210px minmax(0, var(--text-w));
  justify-content: space-between;
  gap: 3.5rem;
}
.toc {
  position: sticky;
  top: 1.5rem;
  align-self: start;
  font-family: var(--sans);
  font-size: 0.9rem;
}
.toc-title {
  margin: 0 0 0.75rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.toc ol { list-style: none; margin: 0 0 1.5rem; padding: 0; border-left: 2px solid var(--rule); counter-reset: toc; }
.toc li { counter-increment: toc; }
.toc ol a {
  display: block;
  margin-left: -2px;
  padding: 0.35rem 0 0.35rem 0.9rem;
  border-left: 2px solid transparent;
  color: var(--muted);
  text-decoration: none;
  line-height: 1.35;
}
.toc ol a::before { content: counter(toc, decimal-leading-zero) "  "; color: #9aa3a9; font-variant-numeric: tabular-nums; white-space: pre; }
.toc ol a:hover { color: var(--head); }
.toc ol a.on { color: var(--head); font-weight: 600; border-left-color: var(--accent); }
.toc-cta { font-size: 0.88rem; }

.body { min-width: 0; }
.body section { scroll-margin-top: 1.5rem; }
.body section + section { margin-top: clamp(3rem, 6vw, 4.5rem); }
.body h2 {
  display: flex;
  align-items: baseline;
  gap: 0.9rem;
  margin: 0 0 1.25rem;
  font-size: clamp(1.6rem, 1.3rem + 1.2vw, 2.1rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
}
.num { font-size: 0.55em; color: var(--accent); letter-spacing: 0.04em; font-variant-numeric: tabular-nums; }
.body h3 { margin: 2.5rem 0 0.75rem; font-size: 1.3rem; line-height: 1.25; }
.body p { margin: 0 0 1.1rem; }

.tells, .checks { margin: 0 0 1.25rem; padding-left: 1.25rem; }
.tells li, .checks li { margin-bottom: 0.5rem; padding-left: 0.25rem; }
.checks { list-style: none; padding-left: 0; }
.checks li { position: relative; padding-left: 1.6rem; }
.checks li::before {
  content: "";
  position: absolute;
  left: 0.2rem;
  top: 0.55em;
  width: 0.65rem;
  height: 0.35rem;
  border-left: 2px solid var(--accent);
  border-bottom: 2px solid var(--accent);
  transform: rotate(-45deg);
}

.pull {
  margin: 0.5rem 0 1.75rem;
  padding: 0.25rem 0 0.25rem 1.5rem;
  border-left: 4px solid var(--accent);
}
.pull p {
  margin: 0;
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.5rem, 1.2rem + 1.3vw, 2rem);
  line-height: 1.2;
  color: var(--head);
}

.rules { margin: 0; }
.rules dt { margin-top: 1.1rem; font-weight: 700; color: var(--head); }
.rules dd { margin: 0.15rem 0 0; }

/* "For your business": the same build translated for the reader */
.you {
  margin: 1.25rem 0 0;
  padding: 1.1rem 1.35rem;
  border-left: 3px solid var(--accent);
  border-radius: 0 12px 12px 0;
  background: var(--accent-bg);
}
.you-label {
  margin: 0 0 0.3rem !important;
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
}
.you p { margin: 0; }

/* Figure 3: the order flow */
.flow {
  list-style: none;
  margin: 0;
  padding: 1.25rem;
  border-radius: 14px;
  background: var(--tint);
  font-family: var(--sans);
  font-size: 0.97rem;
  line-height: 1.5;
}
.flow li {
  position: relative;
  display: grid;
  grid-template-columns: 2rem minmax(0, 1fr) auto;
  align-items: start;
  gap: 0.9rem;
  padding: 0.8rem 0;
}
.flow li + li { border-top: 1px solid #e2e5df; }
.flow-n {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  background: #ffffff;
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--accent);
}
.flow-me .flow-n { background: var(--accent); color: #ffffff; }
.flow li > div { padding-top: 0.2rem; }
.tag {
  margin-top: 0.25rem;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  border: 1px solid #c9d1bd;
  background: #ffffff;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  color: var(--accent);
}
.flow-me .tag { border-color: var(--accent); background: var(--accent); color: #ffffff; }

/* Results */
.results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin: 0 0 1.5rem;
}
.results > div { padding: 1.25rem 1.35rem; border: 1px solid var(--rule); border-radius: 14px; }
.result-h {
  margin: 0 0 0.35rem !important;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.25rem;
  line-height: 1.2;
  color: var(--head);
}
.results p { margin: 0; font-size: 1rem; line-height: 1.55; }

/* How it grew */
.timeline { list-style: none; margin: 0 0 1.5rem; padding: 0; }
.timeline li {
  display: grid;
  grid-template-columns: 8.5rem minmax(0, 1fr);
  gap: 1rem;
  padding: 0.9rem 0;
  border-top: 1px solid var(--rule);
}
.timeline li:last-child { border-bottom: 1px solid var(--rule); }
.when {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--accent);
  padding-top: 0.2rem;
}

/* For your business: steps, questions, closing block */
.steps { margin: 0 0 1.5rem; padding-left: 1.5rem; }
.steps li { margin-bottom: 0.6rem; padding-left: 0.25rem; }
.steps li::marker { font-family: var(--display); font-weight: 600; color: var(--accent); }

.faq { border-top: 1px solid var(--rule); margin-bottom: 3rem; }
.faq details { border-bottom: 1px solid var(--rule); }
.faq summary {
  position: relative;
  padding: 1rem 2.25rem 1rem 0;
  list-style: none;
  cursor: pointer;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 1.02rem;
  color: var(--head);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 0.25rem; top: 50%; transform: translateY(-50%); font-size: 1.35rem; color: var(--accent); }
.faq details[open] summary::after { content: "\2013"; }
.faq details p { margin: 0 0 1.1rem; }

.cta {
  padding: clamp(1.5rem, 4vw, 2.25rem);
  border-radius: 18px;
  background: var(--navy);
  color: #c9d0d4;
}
.cta h3 { margin: 0 0 0.6rem; font-size: clamp(1.4rem, 1.2rem + 1vw, 1.8rem); color: #ffffff; }
.cta p { margin: 0 0 1.4rem; }
.cta-row { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.5rem; font-family: var(--sans); }
.btn-light { background: var(--olivine); color: #14201a; }
.btn-light:hover { background: #b4c4a0; color: #14201a; }
.cta-link { color: #ffffff; font-weight: 600; font-size: 0.95rem; }
.cta-link:hover { color: var(--olivine); }

/* ---- Footer ------------------------------------------------------------------ */
.foot { border-top: 1px solid var(--rule); background: #fafaf8; }
.foot-inner {
  max-width: var(--wide-w);
  margin: 0 auto;
  padding: 1.75rem var(--gutter);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1.5rem;
  font-family: var(--sans);
  font-size: 0.88rem;
  color: var(--muted);
}
.foot-inner p { margin: 0; }
.foot-inner > a:last-child { font-weight: 600; }

/* ---- Responsive ---------------------------------------------------------- */
@media (max-width: 1020px) {
  .doc { grid-template-columns: minmax(0, 1fr); max-width: calc(var(--text-w) + 2 * var(--gutter)); }
  .toc { display: none; }
}

@media (max-width: 760px) {
  .meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .glance { grid-template-columns: minmax(0, 1fr); }
  .results { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 560px) {
  body { font-size: 1.0625rem; }
  .bar-nav > a:not(.btn) { display: none; }
  .flow { padding: 0.75rem 1rem; }
  .flow li { grid-template-columns: 2rem minmax(0, 1fr); }
  .flow .tag { grid-column: 2; justify-self: start; margin-top: -0.35rem; }
  .timeline li { grid-template-columns: minmax(0, 1fr); gap: 0.2rem; }
  .renders { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .renders img:nth-child(3) { display: none; }
  .phones { padding: 1rem; }
  .foot-inner { flex-direction: column; align-items: flex-start; }
}

/* ---- Print: the write-up as a clean document --------------------------------- */
@media print {
  .bar-nav, .toc, .cta-row .btn, .foot { display: none; }
  .doc { display: block; padding-top: 1rem; }
  .browser, .phone { box-shadow: none; }
  .cta { background: none; color: var(--ink); border: 1px solid var(--rule); }
  .cta h3, .cta-link { color: var(--head); }
  .fig, .results > div, .flow li { break-inside: avoid; }
}
