/* ------------------------------------------------------------------
   Brewline — "Dark Lab Journal"
   Field-notebook aesthetic. Shared across all pages.
------------------------------------------------------------------ */

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

:root {
  /* Palette */
  --bg:           #15110d;
  --bg-deep:      #100d0a;
  --surface:      #1c1814;
  --surface-2:    #221c17;
  --ink:          #ece1cb;
  --ink-soft:     #c7b89e;
  --muted:        #897866;
  --muted-deep:   #5f5345;
  --line:         #2e2620;
  --line-soft:    #221c17;
  --accent:       #c89150;
  --accent-hot:   #e2a566;
  --accent-soft:  rgba(200, 145, 80, 0.18);
  --tag-review:   #c89150;
  --tag-blog:     #8aa67a;

  /* Layout */
  --max: 1080px;
  --gutter: clamp(24px, 5vw, 56px);
  --rail-w: clamp(48px, 7vw, 80px);

  /* Type */
  --serif:  "IBM Plex Serif", "Iowan Old Style", Georgia, serif;
  --mono:   "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

html {
  font-size: 16.5px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.65;
  font-feature-settings: "liga", "kern", "tnum";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;

  /* Faint horizontal scanlines for laboratory feel */
  background-image:
    repeating-linear-gradient(
      to bottom,
      transparent 0,
      transparent 31px,
      rgba(236, 225, 203, 0.015) 31px,
      rgba(236, 225, 203, 0.015) 32px
    );
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }

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

/* ------------------ Container ------------------ */
.container {
  max-width: var(--max);
  padding-inline: var(--gutter);
  margin-inline: auto;
}

/* ------------------ Header ------------------ */
.site-header {
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: relative;
}

.site-header::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -3px;
  height: 1px;
  background: var(--line-soft);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.brand__title {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.84rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  margin: 0;
  color: var(--ink);
}

.brand__title::before {
  content: "▸ ";
  color: var(--accent);
  margin-right: 2px;
}

.brand__tagline {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0 22px;
}

.nav a {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
  padding: 4px 0;
  position: relative;
  transition: color 200ms ease;
}

.nav a::before {
  content: "·";
  margin-right: 8px;
  color: var(--muted-deep);
}

.nav a:hover { color: var(--ink); }
.nav a.is-active { color: var(--accent); }
.nav a.is-active::before { color: var(--accent); }

/* ------------------ Page rail (line numbers) ------------------ */
.page {
  position: relative;
}

.page__rail {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: var(--rail-w);
  border-right: 1px solid var(--line);
  padding-top: 28px;
  font-family: var(--mono);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  color: var(--muted-deep);
  text-align: right;
  pointer-events: none;
  user-select: none;
}

.page__rail span {
  display: block;
  line-height: 2;
  padding-right: 12px;
}

.page__rail span:nth-child(3n+1) { color: var(--muted); }

@media (max-width: 720px) {
  .page__rail { display: none; }
}

.page__body {
  padding-left: 0;
}

@media (min-width: 721px) {
  .page__body {
    padding-left: var(--rail-w);
  }
}

/* ------------------ Hero ------------------ */
.hero {
  padding-block: clamp(56px, 9vw, 96px) clamp(40px, 6vw, 64px);
}

.hero__eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--muted);
  margin: 0 0 36px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.hero__eyebrow strong {
  color: var(--accent);
  font-weight: 500;
}

.hero__eyebrow::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
  max-width: 320px;
}

.hero__title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2.4rem, 7.5vw, 4.6rem);
  line-height: 1.04;
  letter-spacing: -0.025em;
  margin: 0 0 26px;
  color: var(--ink);
  max-width: 18ch;
}

.hero__title em {
  font-style: italic;
  color: var(--accent);
}

.hero__subtitle {
  font-family: var(--serif);
  font-size: clamp(1.04rem, 1.5vw, 1.2rem);
  max-width: 52ch;
  color: var(--ink-soft);
  margin: 0 0 44px;
  font-weight: 400;
  line-height: 1.6;
}

/* Brewing-now strip */
.brewing-now {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  font-family: var(--mono);
  max-width: 640px;
}

.brewing-now__indicator {
  position: relative;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  animation: brewPulse 3s ease-in-out infinite;
}

.brewing-now__label {
  font-size: 0.66rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--muted);
}

.brewing-now__value {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: 0.98rem;
  color: var(--ink);
  text-align: right;
}

@keyframes brewPulse {
  0%, 100% { box-shadow: 0 0 0 4px rgba(200, 145, 80, 0.20); }
  50%      { box-shadow: 0 0 0 8px rgba(200, 145, 80, 0.02); }
}

@media (max-width: 540px) {
  .brewing-now {
    grid-template-columns: auto 1fr;
    row-gap: 4px;
  }
  .brewing-now__value {
    grid-column: 1 / -1;
    text-align: left;
  }
}

/* ------------------ Section head ------------------ */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 24px;
  padding: clamp(40px, 6vw, 72px) 0 22px;
  margin-bottom: 0;
  border-top: 1px solid var(--line);
}

.section-head__title {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  margin: 0;
  color: var(--ink);
}

.section-head__title::before {
  content: "§ ";
  color: var(--accent);
}

.section-head__meta {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
}

/* ------------------ Articles list ------------------ */
.articles {
  padding-bottom: clamp(72px, 10vw, 120px);
  display: flex;
  flex-direction: column;
}

.article-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto auto;
  column-gap: 28px;
  row-gap: 10px;
  padding: 28px 0 32px;
  border-top: 1px solid var(--line);
  transition: background 280ms ease;
  position: relative;
}

.article-card:last-of-type {
  border-bottom: 1px solid var(--line);
}

.article-card::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 50%;
  transform: translateY(-50%);
  width: 0;
  height: 60%;
  border-left: 2px solid var(--accent);
  opacity: 0;
  transition: opacity 240ms ease, width 240ms ease;
}

.article-card:hover::before { opacity: 1; }

.article-card__index {
  grid-row: 1;
  grid-column: 1;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--accent);
}

.article-card__date {
  grid-row: 1;
  grid-column: 2;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted);
}

.article-card__meta {
  grid-row: 2;
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
}

.article-card__tag {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid currentColor;
  color: var(--tag-blog);
  font-size: 0.6rem;
  letter-spacing: 0.22em;
}

.article-card__tag.is-review { color: var(--tag-review); }

.article-card__body {
  grid-row: 3;
  grid-column: 1 / -1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.article-card__title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.45rem, 2.6vw, 1.95rem);
  line-height: 1.15;
  letter-spacing: -0.018em;
  margin: 0;
  color: var(--ink);
}

.article-card__title span {
  background-image: linear-gradient(var(--accent), var(--accent));
  background-size: 0 1px;
  background-repeat: no-repeat;
  background-position: 0 100%;
  transition: background-size 320ms ease, color 240ms ease;
}

.article-card:hover .article-card__title span {
  background-size: 100% 1px;
  color: var(--accent);
}

.article-card__excerpt {
  color: var(--ink-soft);
  margin: 0;
  font-size: 1rem;
  line-height: 1.6;
  max-width: 56ch;
}

.article-card__more {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 0.66rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
  margin-top: 4px;
  transition: color 240ms ease;
}

.article-card__more::after {
  content: "→";
  transition: transform 280ms ease;
}

.article-card:hover .article-card__more { color: var(--accent); }
.article-card:hover .article-card__more::after { transform: translateX(5px); }

@media (max-width: 540px) {
  .article-card {
    grid-template-columns: 1fr;
    row-gap: 8px;
  }
  .article-card__date {
    grid-row: auto;
    grid-column: 1;
  }
}

/* ------------------ Footer ------------------ */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 28px 0 56px;
  background: var(--bg);
  font-family: var(--mono);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
}

.site-footer__inner {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 20px;
  flex-wrap: wrap;
}

.site-footer__note {
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.96rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink-soft);
}

/* ------------------ Article page ------------------ */
.article {
  padding: clamp(40px, 6vw, 72px) 0 clamp(72px, 10vw, 120px);
}

.article-header {
  max-width: 62ch;
  margin: 0 auto clamp(36px, 5vw, 52px);
}

.article-header__eyebrow {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
  margin: 0 0 26px;
}

.article-header__eyebrow::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
  max-width: 240px;
}

.article-header__eyebrow .tag {
  display: inline-block;
  padding: 2px 8px;
  border: 1px solid currentColor;
  color: var(--tag-blog);
  font-size: 0.6rem;
  letter-spacing: 0.22em;
}

.article-header__eyebrow .tag.is-review { color: var(--tag-review); }

.article-header__title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(2rem, 4.6vw, 3rem);
  line-height: 1.08;
  letter-spacing: -0.022em;
  margin: 0 0 22px;
  color: var(--ink);
}

.article-header__dek {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(1.04rem, 1.5vw, 1.2rem);
  color: var(--ink-soft);
  margin: 0;
  max-width: 52ch;
  line-height: 1.5;
}

.article-body {
  max-width: 62ch;
  margin: 0 auto;
  font-size: 1.06rem;
  line-height: 1.72;
  color: var(--ink-soft);
}

.article-body > p:first-of-type {
  font-size: 1.16rem;
  line-height: 1.62;
  color: var(--ink);
}

.article-body p { margin: 0 0 1.3em; }

.article-body h2 {
  font-family: var(--mono);
  font-weight: 500;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--ink);
  margin: 2.6em 0 1em;
  padding-top: 1.2em;
  border-top: 1px solid var(--line);
  position: relative;
}

.article-body h2::before {
  content: counter(h2-counter, decimal-leading-zero) " / ";
  counter-increment: h2-counter;
  color: var(--accent);
}

.article-body { counter-reset: h2-counter; }

.article-body h3 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.2rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin: 1.8em 0 0.4em;
}

.article-body ul,
.article-body ol {
  margin: 0 0 1.3em;
  padding-left: 1.3em;
}

.article-body li { margin-bottom: 0.5em; }

.article-body strong {
  font-weight: 600;
  color: var(--ink);
}

.article-body a {
  color: var(--accent);
  border-bottom: 1px solid rgba(200, 145, 80, 0.4);
  transition: border-color 240ms ease;
}

.article-body a:hover { border-bottom-color: var(--accent); }

/* Brew specs — Aeropress */
.brew-specs {
  max-width: 62ch;
  margin: 0 auto clamp(36px, 5vw, 52px);
  padding: 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.brew-specs__label {
  font-family: var(--mono);
  font-size: 0.62rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  color: var(--muted);
  padding: 10px 18px 0;
}

.brew-specs__label::before {
  content: "// ";
  color: var(--accent);
}

.brew-specs dl {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0;
  margin: 0;
  padding: 8px 0 14px;
}

@media (min-width: 700px) {
  .brew-specs dl { grid-template-columns: repeat(5, 1fr); }
}

.brew-specs dl > div {
  padding: 12px 18px;
  border-left: 1px solid var(--line);
}

.brew-specs dl > div:first-child { border-left: none; }

@media (max-width: 699px) {
  .brew-specs dl > div:nth-child(odd) { border-left: none; }
  .brew-specs dl > div { border-top: 1px solid var(--line-soft); }
  .brew-specs dl > div:nth-child(-n+2) { border-top: none; }
}

.brew-specs dt {
  font-family: var(--mono);
  font-size: 0.6rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
  margin-bottom: 4px;
}

.brew-specs dd {
  margin: 0;
  font-family: var(--serif);
  font-size: 1rem;
  color: var(--ink);
}

/* Verdict */
.verdict {
  max-width: 62ch;
  margin: clamp(40px, 6vw, 56px) auto 0;
  padding: 24px 0 0;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 16px;
}

.verdict__label {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--muted);
}

.verdict__label::before {
  content: "↳ ";
  color: var(--accent);
}

.verdict__score {
  font-family: var(--mono);
  font-weight: 500;
  font-size: clamp(2.6rem, 6vw, 3.6rem);
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.verdict__score small {
  font-family: var(--mono);
  font-size: 0.42em;
  color: var(--muted);
  font-weight: 400;
  margin-left: 2px;
  letter-spacing: 0.05em;
}

/* Step entries — water + grind articles */
.step-entry {
  padding-top: 1.6em;
  margin-bottom: 2em;
  border-top: 1px solid var(--line-soft);
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 4px 20px;
}

.step-entry:first-of-type {
  border-top: none;
  padding-top: 0;
}

.step-entry__num {
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--accent);
  padding-top: 0.3em;
  font-variant-numeric: tabular-nums;
}

.step-entry__body { grid-column: 2; }

.article-body .step-entry__title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.32rem;
  text-transform: none;
  letter-spacing: -0.008em;
  color: var(--ink);
  margin: 0 0 0.55em;
  padding-top: 0;
  border-top: none;
  line-height: 1.18;
}

.article-body .step-entry__title::before { content: none; }

.step-entry__body p { margin: 0 0 0.8em; }

@media (max-width: 540px) {
  .step-entry {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .step-entry__body { grid-column: 1; }
  .step-entry__num { padding-top: 0; }
}

/* Article back-nav */
.article-nav {
  max-width: 62ch;
  margin: clamp(48px, 7vw, 72px) auto 0;
  padding-top: 28px;
  border-top: 1px solid var(--line);
}

.article-nav a {
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
  transition: color 240ms ease;
}

.article-nav a::before {
  content: "← ";
  margin-right: 2px;
  color: var(--accent);
}

.article-nav a:hover { color: var(--ink); }

/* ------------------ 404 ------------------ */
.notfound {
  padding-block: clamp(88px, 15vw, 160px);
  text-align: left;
  max-width: 50ch;
  margin: 0 auto;
}

.notfound__eyebrow {
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.24em;
  color: var(--accent);
  margin: 0 0 22px;
  display: flex;
  align-items: center;
  gap: 14px;
}

.notfound__eyebrow::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.notfound__code {
  font-family: var(--mono);
  font-weight: 500;
  font-size: clamp(4rem, 12vw, 7rem);
  letter-spacing: -0.04em;
  margin: 0 0 16px;
  color: var(--accent);
  line-height: 0.9;
  font-variant-numeric: tabular-nums;
}

.notfound__title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  letter-spacing: -0.018em;
  margin: 0 0 18px;
  color: var(--ink);
}

.notfound__text {
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink-soft);
  font-size: 1.08rem;
  margin: 0 0 40px;
  max-width: 42ch;
}

.notfound__back {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  padding-bottom: 4px;
  transition: color 240ms ease, border-color 240ms ease;
}

.notfound__back::before {
  content: "← ";
  color: var(--accent);
}

.notfound__back:hover {
  color: var(--ink);
  border-color: var(--accent);
}

/* ------------------ Mobile ------------------ */
@media (max-width: 480px) {
  .hero__title { letter-spacing: -0.02em; }
  .article-header__title,
  .article-card__title { word-break: break-word; }
  .brand__tagline { font-size: 0.62rem; }
}

/* ------------------ Reduced motion ------------------ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
