/* =====================================================================
   COUNTER — First Crack Coffee Roasters, indexed.
   Swiss / International Typographic Style. One grotesque, a drawn modular
   grid, ruled hairlines, oversized numerals, one scarce vermilion accent.
   ===================================================================== */

/* ---------- Fonts (self-hosted, no CDN) ---------- */
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("./assets/fonts/space-grotesk-400.woff2") format("woff2");
}
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("./assets/fonts/space-grotesk-500.woff2") format("woff2");
}
@font-face {
  font-family: "Space Grotesk";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("./assets/fonts/space-grotesk-700.woff2") format("woff2");
}

/* ---------- Tokens ---------- */
:root {
  /* palette */
  --canvas: #f7f6f2;
  --panel: #efeee9;
  --ink: #111111;
  --slate: #504d47;
  --stone: #6b6862;
  --rule: #111111;
  --grid: #d8d6cd;
  --hairline: #e3e1d9;
  --vermilion: #e63b16;
  --vermilion-press: #c22f10;
  --on-ink: #f7f6f2;
  --on-ink-soft: #b8b5ac;

  /* type */
  --font: "Space Grotesk", system-ui, sans-serif;

  /* layout */
  --maxw: 1280px;
  --marg: 48px;
  --gutter: 24px;

  /* 8px spacing scale */
  --s1: 8px;
  --s2: 16px;
  --s3: 24px;
  --s4: 32px;
  --s5: 40px;
  --s6: 48px;
  --s7: 56px;
  --s8: 64px;
  --s14: 112px;
}

/* ---------- Reset ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font);
  font-weight: 400;
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img {
  display: block;
  max-width: 100%;
  height: auto;
}

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

h1, h2, h3, p, dl, dd, figure { margin: 0; }

/* ---------- Layout primitives ---------- */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: var(--marg);
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gutter);
}

/* column spans (desktop) */
.c-1-2  { grid-column: 1 / span 2; }
.c-1-6  { grid-column: 1 / span 6; }
.c-1-7  { grid-column: 1 / span 7; }
.c-1-8  { grid-column: 1 / span 8; }
.c-3-7  { grid-column: 3 / span 5; }
.c-3-8  { grid-column: 3 / span 6; }
.c-7-12 { grid-column: 7 / span 6; }
.c-8-9  { grid-column: 8 / span 2; }
.c-8-12 { grid-column: 8 / span 5; }
.c-9-12 { grid-column: 9 / span 4; }
.c-10-12{ grid-column: 10 / span 3; }

/* section rhythm — baseline multiples */
.section { padding-block: var(--s14); }
.section--tight { padding-top: 0; }

/* ---------- Exposed modular grid ---------- */
/* Faint --grid column lines drawn on purpose, aligned to the content box. */
.exposed { position: relative; }
.exposed > * { position: relative; z-index: 1; }
.gridlines {
  position: absolute;
  top: 0;
  bottom: 0;
  left: var(--marg);
  right: var(--marg);
  z-index: 0;
  pointer-events: none;
  background-image: repeating-linear-gradient(
    to right,
    var(--grid) 0,
    var(--grid) 1px,
    transparent 1px,
    transparent calc(100% / 12)
  );
}

/* ---------- Type roles ---------- */
.poster {
  font-weight: 700;
  font-size: 88px;
  line-height: 1.0;
  letter-spacing: -0.02em;
}
.display-l {
  font-weight: 700;
  font-size: 56px;
  line-height: 1.05;
  letter-spacing: -0.02em;
}
.display-m {
  font-weight: 500;
  font-size: 34px;
  line-height: 1.15;
  letter-spacing: -0.01em;
}
.title {
  font-weight: 500;
  font-size: 20px;
  line-height: 1.35;
}
.body { font-size: 17px; line-height: 1.6; }
.lede { font-size: 20px; line-height: 1.5; color: var(--slate); }
.data {
  font-size: 14px;
  line-height: 1.5;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}
.label {
  font-weight: 500;
  font-size: 12px;
  line-height: 1.3;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.ink   { color: var(--ink); }
.slate { color: var(--slate); }
.stone { color: var(--stone); }

/* ---------- Nav ---------- */
.nav {
  border-bottom: 1px solid var(--rule);
  background: var(--canvas);
}
.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s3);
  min-height: 64px;
}
.wordmark {
  font-weight: 500;
  font-size: 16px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: var(--s3);
}
.nav-link {
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--slate);
  padding-block: 6px;
  border-bottom: 2px solid transparent;
  transition: color 100ms ease-out, border-color 100ms ease-out;
}
.nav-link:hover { color: var(--ink); }
.nav-link[aria-current="page"] {
  color: var(--ink);
  border-bottom-color: var(--vermilion);
}
.nav-cta { margin-left: var(--s1); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  font-family: var(--font);
  font-weight: 500;
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 12px 20px;
  border-radius: 2px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 100ms ease-out, color 100ms ease-out,
    border-color 100ms ease-out;
}
.btn-primary {
  background: var(--vermilion);
  color: var(--on-ink);
  border-color: var(--vermilion);
}
.btn-primary:hover,
.btn-primary:focus-visible {
  background: var(--vermilion-press);
  border-color: var(--vermilion-press);
}
.btn-secondary {
  background: var(--canvas);
  color: var(--ink);
  border-color: var(--ink);
}
.btn-secondary:hover,
.btn-secondary:focus-visible {
  background: var(--ink);
  color: var(--on-ink);
}
/* inverted secondary on the ink band */
.btn-on-ink {
  background: transparent;
  color: var(--on-ink);
  border-color: var(--on-ink);
}
.btn-on-ink:hover,
.btn-on-ink:focus-visible {
  background: var(--on-ink);
  color: var(--ink);
}

/* ---------- Section marker (promoted ink rule + vermilion square) ---------- */
.section-rule {
  position: relative;
  border-top: 1px solid var(--ink);
  padding-top: 14px;
  margin-bottom: var(--s6);
}
.section-marker {
  position: absolute;
  top: -4px;
  left: 0;
  width: 8px;
  height: 8px;
  background: var(--vermilion);
}
.section-eyebrow {
  display: block;
  color: var(--slate);
}

/* ---------- Numeric origin index — compact (index page) ---------- */
.index-list { display: grid; }
.index-entry {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gutter);
  align-items: end;
  border-top: 1px solid var(--ink);
  padding-block: var(--s5) var(--s3);
}
.idx-num {
  grid-column: 1 / span 2;
  font-weight: 500;
  font-size: 168px;
  line-height: 0.9;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--vermilion);
}
.idx-body {
  grid-column: 3 / span 9;
  display: grid;
  gap: var(--s1);
  padding-bottom: 10px;
}
.idx-name { font-weight: 500; font-size: 34px; line-height: 1.15; letter-spacing: -0.01em; }
.idx-note { color: var(--slate); max-width: 62ch; }
.idx-roast { color: var(--stone); }

/* ---------- Numeric origin index — full detail (beans page) ---------- */
.origin-entry {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: var(--gutter);
  align-items: start;
  border-top: 1px solid var(--ink);
  padding-top: var(--s5);
  padding-bottom: var(--s6);
}
.oe-num {
  grid-column: 1 / span 2;
  font-weight: 500;
  font-size: 168px;
  line-height: 0.9;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  color: var(--vermilion);
  align-self: start;
}
.oe-meta {
  grid-column: 3 / span 5;
  align-self: start;
  display: grid;
  gap: var(--s2);
}
.oe-name { font-weight: 500; font-size: 34px; line-height: 1.15; letter-spacing: -0.01em; }
.oe-specs { display: grid; gap: 0; }
.oe-specs > div {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: var(--s2);
  align-items: baseline;
  padding-block: 8px;
  border-bottom: 1px solid var(--hairline);
}
.oe-specs dt {
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--stone);
}
.oe-specs dd {
  font-size: 14px;
  color: var(--slate);
  font-variant-numeric: tabular-nums;
}
.oe-notes {
  grid-column: 8 / span 2;
  align-self: start;
  display: grid;
  gap: var(--s2);
}
.oe-tasting { font-size: 17px; line-height: 1.5; }
.oe-roast { color: var(--stone); }
.oe-img {
  grid-column: 10 / span 3;
  align-self: start;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border: 1px solid var(--hairline);
}

/* ---------- Two-up (image + copy) ---------- */
.split { align-items: start; row-gap: var(--s5); }
.split-copy { display: grid; gap: var(--s3); align-content: start; }
.figure-frame { border: 1px solid var(--hairline); }
.img-16-9 { width: 100%; aspect-ratio: 16 / 9; object-fit: cover; }
.img-3-2  { width: 100%; aspect-ratio: 3 / 2;  object-fit: cover; }
.img-4-5  { width: 100%; aspect-ratio: 4 / 5;  object-fit: cover; }

/* ---------- Hero ---------- */
.hero { padding-top: var(--s8); padding-bottom: var(--s14); }
.hero-grid { align-items: end; row-gap: var(--s6); }
.hero-copy { display: grid; gap: var(--s4); align-content: end; }
.hero-eyebrow { color: var(--slate); }
.hero-actions { display: flex; flex-wrap: wrap; gap: var(--s2); }

/* ---------- Process steps ---------- */
.steps { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.steps li {
  display: grid;
  grid-template-columns: 56px 200px 1fr;
  gap: var(--s3);
  align-items: baseline;
  padding-block: var(--s3);
  border-bottom: 1px solid var(--hairline);
}
.steps li:first-child { border-top: 1px solid var(--hairline); }
.step-n {
  font-weight: 500;
  font-size: 14px;
  color: var(--vermilion);
  font-variant-numeric: tabular-nums;
}
.step-name { font-weight: 500; font-size: 20px; line-height: 1.35; }
.step-desc { color: var(--slate); }

/* ---------- Brew table ---------- */
.brew-grid { row-gap: var(--s6); align-items: start; }
.brew-tables {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s6);
}
.brew-block { display: grid; gap: var(--s2); }
.brew-block .label { color: var(--slate); }
.brew-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}
.brew-table th[scope="col"] { display: none; }
.brew-table caption {
  text-align: left;
  padding-bottom: var(--s1);
}
.brew-table tbody tr { border-bottom: 1px solid var(--hairline); }
.brew-table tbody tr:first-child { border-top: 1px solid var(--rule); }
.brew-table th[scope="row"] {
  text-align: left;
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--stone);
  padding: 12px 16px 12px 0;
  white-space: nowrap;
}
.brew-table td {
  text-align: left;
  font-size: 14px;
  color: var(--ink);
  padding: 12px 0;
  font-variant-numeric: tabular-nums;
}

/* ---------- Spec list (about visit info) ---------- */
.spec { display: grid; gap: 0; }
.spec > div {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: var(--s3);
  align-items: baseline;
  padding-block: var(--s2);
  border-bottom: 1px solid var(--hairline);
}
.spec > div:first-child { border-top: 1px solid var(--rule); }
.spec dt {
  font-weight: 500;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--stone);
}
.spec dd { font-size: 14px; color: var(--slate); font-variant-numeric: tabular-nums; }

/* ---------- Roast schedule note ---------- */
.roast-note { display: grid; gap: var(--s2); }
.roast-days {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s3);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}
.roast-day { display: inline-flex; align-items: center; gap: 8px; }
.sq {
  display: inline-block;
  width: 8px;
  height: 8px;
  background: var(--vermilion);
  flex: none;
}

/* ---------- Prose ---------- */
.prose { display: grid; gap: var(--s3); }
.prose p { max-width: 64ch; }

/* ---------- CTA band (ink, left-aligned) ---------- */
.band {
  background: var(--ink);
  color: var(--on-ink);
}
.band .label { color: var(--on-ink-soft); }
.cta {
  padding-block: var(--s14);
  display: grid;
  gap: var(--s4);
}
.cta-head { display: grid; gap: var(--s2); max-width: 22ch; }
.cta-sub { color: var(--on-ink-soft); }
.cta-actions { display: flex; flex-wrap: wrap; gap: var(--s2); }
.band .roast-note .roast-days { color: var(--on-ink); }

/* ---------- Footer ---------- */
.footer {
  background: var(--ink);
  color: var(--on-ink);
  border-top: 1px solid var(--vermilion);
}
.footer-grid {
  padding-block: var(--s8);
  align-items: start;
  row-gap: var(--s6);
}
.footer-brand { grid-column: 1 / span 5; display: grid; gap: var(--s2); }
.footer-mark { color: var(--on-ink); }
.footer-addr { color: var(--on-ink-soft); }
.footer-index { grid-column: 7 / span 3; display: grid; gap: var(--s1); }
.footer-index a {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: var(--s2);
  align-items: baseline;
  color: var(--on-ink);
  padding-block: 4px;
  transition: color 100ms ease-out;
}
.footer-index a:hover { color: var(--on-ink-soft); }
.fi-num {
  font-weight: 500;
  font-size: 14px;
  color: var(--on-ink-soft);
  font-variant-numeric: tabular-nums;
}
.footer-order { grid-column: 11 / span 2; display: grid; gap: var(--s2); align-content: start; }
.footer-order .label { color: var(--on-ink-soft); }
.footer-cta {
  color: var(--vermilion);
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: color 100ms ease-out;
}
.footer-cta:hover { color: var(--vermilion-press); }

/* ---------- Focus ---------- */
:focus-visible {
  outline: 2px solid var(--vermilion);
  outline-offset: 2px;
}

/* ---------- Utilities ---------- */
.eyebrow-row { display: grid; gap: var(--s3); }
.stack-2 { display: grid; gap: var(--s2); }
.stack-3 { display: grid; gap: var(--s3); }
.stack-4 { display: grid; gap: var(--s4); }
.mt-6 { margin-top: var(--s6); }
.mt-4 { margin-top: var(--s4); }
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Motion (nearly absent, opt-in) ---------- */
@media (prefers-reduced-motion: no-preference) {
  .idx-num,
  .oe-num {
    animation: rise 0.6s ease-out both;
  }
  .index-entry:nth-child(2) .idx-num,
  .origin-entry:nth-child(2) .oe-num { animation-delay: 0.08s; }
  .index-entry:nth-child(3) .idx-num,
  .origin-entry:nth-child(3) .oe-num { animation-delay: 0.16s; }
  .section-marker { animation: pop 0.4s ease-out both; }
}
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
@keyframes pop {
  from { transform: scale(0); }
  to   { transform: scale(1); }
}

/* ---------- Responsive: 12-col -> 4-col ---------- */
@media (max-width: 860px) {
  :root { --marg: 20px; }

  body { font-size: 16px; }

  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); column-gap: var(--gutter); }

  .nav-inner {
    flex-wrap: wrap;
    gap: var(--s2);
    min-height: 0;
    padding-block: 12px;
  }
  .nav-links { gap: var(--s2); flex-wrap: wrap; }

  /* every span collapses to the full 4-col line */
  .c-1-2, .c-1-6, .c-1-7, .c-1-8, .c-3-7, .c-3-8,
  .c-7-12, .c-8-9, .c-8-12, .c-9-12, .c-10-12 {
    grid-column: 1 / -1;
  }

  .section { padding-block: var(--s8); }
  .hero { padding-top: var(--s6); padding-bottom: var(--s8); }

  .poster { font-size: 44px; line-height: 1.04; }
  .display-l { font-size: 36px; line-height: 1.1; }
  .display-m { font-size: 26px; line-height: 1.2; }
  .lede { font-size: 18px; }

  /* index / origin entries stack: numeral, then body, then image */
  .index-entry,
  .origin-entry {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: start;
    row-gap: var(--s3);
  }
  .idx-num, .oe-num { grid-column: 1 / -1; font-size: 84px; }
  .idx-body, .oe-meta, .oe-notes, .oe-img { grid-column: 1 / -1; }
  .idx-body { padding-bottom: 0; }
  .oe-img { max-width: 320px; }

  .oe-specs > div { grid-template-columns: 100px 1fr; }
  .spec > div { grid-template-columns: 140px 1fr; }
  .steps li { grid-template-columns: 48px 1fr; }
  .steps li .step-desc { grid-column: 2; }

  .brew-tables { grid-template-columns: 1fr; gap: var(--s5); }

  .footer-brand,
  .footer-index,
  .footer-order { grid-column: 1 / -1; }

  .gridlines {
    background-image: repeating-linear-gradient(
      to right,
      var(--grid) 0,
      var(--grid) 1px,
      transparent 1px,
      transparent calc(100% / 4)
    );
  }
}
