/* ============================================================
   Shared design system — derived from the Vancouver Coffee
   Shop Study aesthetic. Used by dmitryuduman.com pieces and
   (in copied form) by errata.studio pieces.

   Each piece can extend with a piece-specific <style> block
   for bespoke layouts (KPI grids, cost grids, etc.).
   ============================================================ */

:root {
  /* Paper / ink */
  --paper: #F7F3EB;
  --paper-2: #EFE8DA;
  --ink: #1B1410;
  --ink-2: #3A2D24;
  --ink-3: #6B5544;
  --ink-4: #94806E;
  --rule: #D6CBB7;

  /* Accents */
  --espresso: #2A1B11;
  --forest: #2F4634;
  --moss: #5C7159;
  --copper: #B26A3C;
  --copper-soft: #D89366;
  --crema: #E8D4B8;
  --gold: #C9963F;

  /* Status */
  --good: #4F6E4D;
  --warn: #B26A3C;
  --bad: #963F2A;

  /* Typography */
  --serif: "Newsreader", "Iowan Old Style", Georgia, serif;
  --sans: "Plus Jakarta Sans", "Inter", -apple-system, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  /* Layout */
  --measure: 38rem;
  --wide: 76rem;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--sans);
  font-weight: 400;
  color: var(--ink);
  background: var(--paper);
  background-image:
    radial-gradient(1200px 600px at 10% -10%, rgba(178,106,60,0.06), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, rgba(47,70,52,0.05), transparent 60%),
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220' viewBox='0 0 220 220'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.10  0 0 0 0 0.08  0 0 0 0 0.06  0 0 0 0.045 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ---------- Typography ---------- */
.display, h1, h2, h3, h4, .section-num, .pullquote, .caps-display {
  font-family: var(--serif);
  font-variation-settings: "opsz" 72;
  color: var(--ink);
}
h1 { font-weight: 500; letter-spacing: -0.02em; line-height: 0.96; }
h2 { font-weight: 500; letter-spacing: -0.018em; line-height: 1.04; }
h3 { font-weight: 500; letter-spacing: -0.01em; line-height: 1.15; }
h4 { font-weight: 600; letter-spacing: -0.005em; line-height: 1.2; }

.eyebrow {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--copper);
}
.label {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.num { font-family: var(--mono); font-feature-settings: "tnum"; }

a {
  color: var(--copper);
  text-decoration: none;
  border-bottom: 1px solid rgba(178,106,60,0.3);
  transition: border-color .2s;
}
a:hover { border-bottom-color: var(--copper); }

/* ---------- Layout shell ---------- */
.shell {
  max-width: var(--wide);
  margin: 0 auto;
  padding: 2rem clamp(1.25rem, 4vw, 3.5rem);
}

.measure { max-width: var(--measure); }

/* ---------- Hero ---------- */
.hero {
  padding: clamp(3rem, 7vw, 6rem) clamp(1.25rem, 4vw, 3.5rem) clamp(2.5rem, 5vw, 4rem);
  max-width: var(--wide);
  margin: 0 auto;
  border-bottom: 1px solid var(--rule);
  position: relative;
}
.hero .top-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: clamp(2rem, 5vw, 4rem);
}
.wordmark {
  font-family: var(--serif);
  font-weight: 600;
  font-style: italic;
  font-size: 1rem;
  letter-spacing: 0.01em;
  color: var(--ink-2);
}
.wordmark::before {
  content: "○ ";
  color: var(--copper);
  font-style: normal;
}

.hero h1 {
  font-size: clamp(3rem, 8vw, 6.4rem);
  margin: 0 0 1.5rem;
  max-width: 14ch;
}
.hero h1 em {
  font-style: italic;
  font-variation-settings: "opsz" 72;
  color: var(--copper);
  font-weight: 400;
}

.hero .standfirst {
  font-family: var(--serif);
  font-weight: 300;
  font-size: clamp(1.15rem, 1.8vw, 1.4rem);
  line-height: 1.45;
  color: var(--ink-2);
  max-width: 50ch;
  margin: 0 0 2.5rem;
}

.hero .meta-row {
  display: flex;
  justify-content: space-between;
  margin-top: 2rem;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 500;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}

/* ---------- Sections ---------- */
section {
  padding: clamp(3rem, 6vw, 5.5rem) 0;
  border-bottom: 1px solid var(--rule);
}
section:last-of-type { border-bottom: none; }

.section-head {
  display: grid;
  grid-template-columns: 6rem 1fr;
  gap: 1.5rem;
  align-items: baseline;
  margin-bottom: 2.5rem;
}
@media (max-width: 700px) {
  .section-head { grid-template-columns: 1fr; gap: 0.5rem; }
}
.section-num {
  font-size: 1.4rem;
  font-style: italic;
  font-weight: 400;
  color: var(--copper);
  letter-spacing: 0.05em;
  font-variation-settings: "opsz" 72;
}
.section-head h2 {
  font-size: clamp(1.8rem, 3.5vw, 2.8rem);
  margin: 0;
}
.section-head .kicker {
  grid-column: 2 / 3;
  color: var(--ink-3);
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: 1.1rem;
  line-height: 1.5;
  margin-top: 0.6rem;
  max-width: 60ch;
}
@media (max-width: 700px) { .section-head .kicker { grid-column: 1; } }

/* ---------- Prose ---------- */
.prose p {
  max-width: var(--measure);
  margin: 0 0 1.1rem;
  font-size: 1.04rem;
  line-height: 1.7;
  color: var(--ink-2);
}
.prose p:first-of-type:not(.lede)::first-letter {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 4.2rem;
  line-height: 0.85;
  float: left;
  margin: 0.4rem 0.6rem 0 -0.05rem;
  color: var(--copper);
  font-variation-settings: "opsz" 72;
}
.prose strong { color: var(--ink); font-weight: 600; }

/* ---------- Pull quote ---------- */
.pullquote {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 300;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  line-height: 1.25;
  color: var(--ink);
  margin: 2.5rem 0;
  padding: 0 0 0 2rem;
  border-left: 2px solid var(--copper);
  max-width: 32ch;
  font-variation-settings: "opsz" 72;
}
.pullquote .attribution {
  display: block;
  font-style: normal;
  font-family: var(--sans);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-top: 1rem;
  font-weight: 600;
}

/* ---------- Tables ---------- */
.tbl-wrap { overflow-x: auto; margin: 1.5rem 0; }
table { width: 100%; border-collapse: collapse; font-size: 0.93rem; }
th, td {
  text-align: left;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--rule);
  vertical-align: top;
}
th {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-3);
  border-bottom: 1px solid var(--ink-3);
  padding-bottom: 0.7rem;
}
td.num, th.num { font-family: var(--mono); text-align: right; }
td.label-cell { font-weight: 600; color: var(--ink); }
tr.totals td { border-top: 1px solid var(--ink-3); border-bottom: 2px solid var(--ink); font-weight: 600; color: var(--ink); }
tr.subtotal td { color: var(--ink); font-weight: 600; }

/* ---------- Footer ---------- */
.site-footer {
  padding: 3rem clamp(1.25rem, 4vw, 3.5rem) 4rem;
  max-width: var(--wide);
  margin: 0 auto;
  border-top: 1px solid var(--rule);
  font-size: 0.82rem;
  color: var(--ink-3);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}
.site-footer a { color: var(--ink-2); border-bottom-color: var(--rule); }

/* ---------- Index list (homepage) ---------- */
.piece-list { list-style: none; padding: 0; margin: 0; }
.piece-list li {
  border-top: 1px solid var(--rule);
  padding: 1.6rem 0;
}
.piece-list li:last-child { border-bottom: 1px solid var(--rule); }
.piece-list .meta {
  display: flex;
  gap: 1rem;
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 600;
  margin-bottom: 0.4rem;
}
.piece-list .meta .copper { color: var(--copper); }
.piece-list h3 {
  font-size: clamp(1.4rem, 2.4vw, 2rem);
  margin: 0.2rem 0 0.4rem;
  letter-spacing: -0.015em;
}
.piece-list h3 a {
  color: var(--ink);
  border-bottom: none;
}
.piece-list h3 a:hover { color: var(--copper); }
.piece-list .desc {
  font-family: var(--serif);
  font-weight: 300;
  font-style: italic;
  color: var(--ink-2);
  font-size: 1.05rem;
  line-height: 1.5;
  max-width: 60ch;
  margin: 0;
}
