/* ─────────────────────────────────────────────────
   Revscale Media — shared design system
   Tokens, resets, primitives reused across every page.
   Page-specific styles stay in each page's <style> block.
───────────────────────────────────────────────── */

:root {
  --ink: #141310;
  --ink-90: #2a2622;
  --ink-80: #3b3732;
  --ink-70: #56514b;
  --ink-60: #7a756e;
  --ink-30: #c0bcb4;
  --paper: #F6F3EE;
  --paper-deep: #EFEAE1;
  --rule: #dcd6cb;
  --accent: oklch(0.55 0.17 30);
  --accent-soft: oklch(0.85 0.08 55);
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "IBM Plex Sans", -apple-system, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --page: 1440px;
  --gutter: 40px;
  --measure: 680px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  background: var(--paper); color: var(--ink);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; }
img, svg { display: block; max-width: 100%; }
h1, h2, h3, h4, p, figure, ul, ol { margin: 0; }
button { font: inherit; }
::selection { background: var(--accent); color: var(--paper); }

body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 1;
  background-image: radial-gradient(rgba(0,0,0,0.02) 1px, transparent 1px);
  background-size: 3px 3px; mix-blend-mode: multiply; opacity: 0.6;
}
main, header, footer, .ticker { position: relative; z-index: 2; }

/* Skip to content — visually hidden until focused */
.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--ink); color: var(--paper);
  padding: 10px 14px; font-family: var(--mono); font-size: 12px;
  letter-spacing: 0.1em; text-transform: uppercase;
  text-decoration: none; z-index: 100;
}
.skip:focus { left: 12px; top: 12px; }

/* Focus-visible: editorial-accent outline */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
button:focus-visible, a:focus-visible {
  outline-offset: 3px;
}

/* Layout wrapper */
.wrap {
  max-width: var(--page);
  margin: 0 auto;
  padding: 0 var(--gutter);
}
.wrap-measure {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ─── Ticker ─── */
.ticker { background: var(--ink); color: var(--paper); overflow: hidden; }
.ticker-inner {
  display: flex; align-items: center; gap: 24px;
  height: 32px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em;
}
.ticker-live {
  color: var(--accent); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.14em; white-space: nowrap;
}
.ticker-items {
  display: flex; gap: 32px; flex: 1;
  overflow: hidden; white-space: nowrap;
}
.ticker-items span { opacity: 0.82; }
.ticker-items .sep { opacity: 0.35; margin-left: 32px; }
.ticker-date { opacity: 0.6; margin-left: auto; white-space: nowrap; }

/* ─── Masthead ─── */
.mast {
  position: sticky; top: 0; z-index: 20;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
}
.mast-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 76px; gap: 40px;
}
.wordmark {
  text-decoration: none; color: var(--ink);
  font-family: var(--sans); font-weight: 500;
  font-size: 16px; line-height: 1;
  display: flex; align-items: baseline; gap: 10px;
  letter-spacing: 0.18em; text-transform: uppercase;
}
.wordmark .dim { color: var(--ink-60); }
.mast-nav {
  display: flex; gap: 28px; align-items: center;
  font-family: var(--sans); font-size: 14px;
}
.mast-nav a { color: var(--ink); text-decoration: none; font-weight: 450; }
.mast-nav a:hover { color: var(--accent); }
.mast-nav a[aria-current="page"] {
  color: var(--accent); border-bottom: 1.5px solid var(--accent);
  padding-bottom: 2px;
}
.btn-subscribe {
  background: var(--ink); color: var(--paper);
  padding: 9px 14px; font-size: 12px; letter-spacing: 0.06em;
  text-decoration: none; font-weight: 500;
}
.btn-subscribe:hover { background: var(--accent); color: var(--paper); }

/* ─── Primitives ─── */
.kicker {
  font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-60); font-weight: 500;
}
.kicker.accent { color: var(--accent); }
.kicker-box {
  background: var(--accent); color: var(--paper);
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.16em;
  text-transform: uppercase; padding: 4px 8px; font-weight: 600;
}
.byline {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap;
  font-family: var(--sans); font-size: 12px; color: var(--ink-60);
}
.byline .author, .byline a.author {
  color: var(--ink-90); text-decoration: none;
}
.byline a.author:hover { color: var(--accent); }
.byline .slash { opacity: 0.4; }

.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  border-bottom: 1px solid var(--rule);
  padding-bottom: 14px; margin-bottom: 28px;
  gap: 20px; flex-wrap: wrap;
}
.section-head-left {
  display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap;
}
.section-head h2 {
  font-family: var(--serif); font-weight: 400;
  font-size: 30px; letter-spacing: -0.01em; color: var(--ink);
}
.section-head .eyebrow {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--accent);
}
.section-head a.more {
  font-family: var(--sans); font-size: 12px; color: var(--ink-60);
  text-decoration: none; border-bottom: 1px solid var(--ink-30);
  padding-bottom: 2px; white-space: nowrap;
}
.section-head a.more:hover { color: var(--accent); border-color: var(--accent); }

.crumb {
  display: flex; gap: 10px; align-items: center;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink-60);
}
.crumb a { text-decoration: none; color: var(--ink-60); }
.crumb a:hover { color: var(--accent); }
.crumb .sep { opacity: 0.4; }
.crumb .cat { color: var(--accent); font-weight: 600; }

/* Placeholder SVG containers (patterns are inline per page) */
.ph { width: 100%; position: relative; overflow: hidden; }
.ph svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.ph .ph-label {
  position: absolute; left: 10px; bottom: 8px;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.08em;
  text-transform: uppercase; opacity: 0.75;
}
.ph-hvac    { background: #2a2d2e; }
.ph-call    { background: #1b2a33; }
.ph-crew    { background: #3a2d23; }
.ph-store   { background: #2e2a24; }
.ph-ops     { background: #1f2722; }
.ph-portrait{ background: #2a241f; }
.ph-generic { background: #2a2622; }

/* ─── Story cards (shared between topic, author, search, saved) ─── */
.story-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px;
}
.story-card {
  display: flex; flex-direction: column; gap: 10px;
  border-top: 1px solid var(--rule); padding-top: 18px;
  text-decoration: none; color: inherit;
}
.story-card:hover h3 { color: var(--accent); }
.story-card h3 {
  font-family: var(--serif); font-weight: 400;
  font-size: 20px; line-height: 1.2; letter-spacing: -0.015em;
  color: var(--ink); text-wrap: balance;
  transition: color 0.12s ease;
}
.story-card .kicker { color: var(--ink-60); }
.story-card .kicker.accent { color: var(--accent); }
.story-card .byline { color: var(--ink-60); }

/* ─── Pagination ─── */
.pagination {
  display: flex; justify-content: center; gap: 4px;
  margin-top: 48px; padding-top: 28px;
  border-top: 1px solid var(--rule);
  font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.1em; text-transform: uppercase;
}
.pagination a, .pagination span, .pagination button {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 36px; height: 36px; padding: 0 12px;
  background: transparent; border: none; cursor: pointer;
  text-decoration: none; color: var(--ink-60);
}
.pagination a:hover, .pagination button:hover { color: var(--accent); }
.pagination .current {
  background: var(--ink); color: var(--paper); cursor: default;
}
.pagination .disabled { opacity: 0.3; cursor: not-allowed; }

/* ─── Forms (tip, newsletter, contact) ─── */
.form { display: flex; flex-direction: column; gap: 20px; max-width: 520px; }
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field label {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink-60); font-weight: 500;
}
.form-field input,
.form-field textarea,
.form-field select {
  font-family: var(--sans); font-size: 15px;
  background: transparent; color: var(--ink);
  border: none; border-bottom: 1px solid var(--ink-30);
  padding: 8px 0; outline: none; border-radius: 0;
}
.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
  border-bottom-color: var(--accent); outline: none;
}
.form-field textarea { min-height: 120px; resize: vertical; font-family: var(--serif); font-size: 17px; line-height: 1.55; }
.form-help {
  font-family: var(--sans); font-size: 12px; color: var(--ink-70);
  line-height: 1.5;
}
.form-submit {
  background: var(--ink); color: var(--paper);
  padding: 12px 22px; border: none; cursor: pointer;
  font-family: var(--sans); font-size: 13px; font-weight: 500;
  letter-spacing: 0.04em; align-self: flex-start;
}
.form-submit:hover { background: var(--accent); }
.form-submit:disabled { opacity: 0.6; cursor: not-allowed; }

/* ─── Search input ─── */
.search-input {
  width: 100%;
  font-family: var(--serif); font-size: 28px;
  background: transparent; color: var(--ink);
  border: none; border-bottom: 2px solid var(--ink);
  padding: 12px 0; outline: none; border-radius: 0;
}
.search-input::placeholder {
  font-family: var(--mono); font-size: 14px; letter-spacing: 0.08em;
  color: var(--ink-60); text-transform: uppercase;
  vertical-align: middle;
}

/* ─── Legal / reading-width prose ─── */
.legal-prose {
  max-width: var(--measure); margin: 0 auto; padding: 56px var(--gutter) 72px;
  font-family: var(--serif); font-size: 17px; line-height: 1.6;
  color: var(--ink-90);
}
.legal-prose > * + * { margin-top: 16px; }
.legal-prose h1 {
  font-family: var(--serif); font-weight: 400; font-size: 40px;
  line-height: 1.1; letter-spacing: -0.02em; color: var(--ink);
  text-wrap: balance;
}
.legal-prose h2 {
  font-family: var(--serif); font-weight: 500; font-size: 24px;
  letter-spacing: -0.01em; margin-top: 36px; color: var(--ink);
}
.legal-prose h3 {
  font-family: var(--sans); font-weight: 500; font-size: 15px;
  letter-spacing: 0.04em; text-transform: uppercase;
  margin-top: 24px; color: var(--ink-80);
}
.legal-prose .crumb { margin-bottom: 36px; }
.legal-prose .updated {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ink-60);
  padding-bottom: 28px; border-bottom: 1px solid var(--rule);
  margin-bottom: 28px !important;
}
.legal-prose ul, .legal-prose ol { padding-left: 24px; }
.legal-prose li + li { margin-top: 8px; }
.legal-prose a {
  color: var(--ink); text-decoration: underline;
  text-decoration-color: var(--accent); text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
}

/* ─── Empty state ─── */
.empty {
  padding: 56px 20px; text-align: center;
  font-family: var(--serif); font-size: 18px; color: var(--ink-60);
  border-top: 1px solid var(--rule);
}
.empty .empty-title {
  font-family: var(--serif); font-size: 22px;
  color: var(--ink); margin-bottom: 8px; letter-spacing: -0.01em;
}

/* ─── Footer ─── */
footer.site { background: var(--paper); padding: 72px 0 40px; }
.foot-grid {
  display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr;
  gap: 40px; padding-bottom: 56px;
  border-bottom: 1px solid var(--rule);
}
.foot-brand .wordmark { font-size: 18px; }
.foot-brand p {
  font-family: var(--sans); font-size: 13px; line-height: 1.55;
  color: var(--ink-70); margin-top: 18px; max-width: 340px;
}
.foot-form {
  display: flex; margin-top: 24px; max-width: 340px;
  border-bottom: 1px solid var(--ink);
}
.foot-form input {
  flex: 1; border: none; background: transparent; outline: none;
  padding: 10px 0; font-family: var(--sans); font-size: 13px;
  color: var(--ink);
}
.foot-form button {
  border: none; background: transparent; color: var(--ink);
  font-family: var(--mono); font-size: 11px; cursor: pointer;
  letter-spacing: 0.12em; text-transform: uppercase;
}
.foot-form button:hover { color: var(--accent); }
.foot-col .head {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--ink-60); margin-bottom: 18px;
}
.foot-col ul {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 10px;
}
.foot-col a {
  font-family: var(--sans); font-size: 14px; color: var(--ink);
  text-decoration: none;
}
.foot-col a:hover { color: var(--accent); }
.foot-fine {
  display: flex; justify-content: space-between; padding-top: 28px;
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em;
  color: var(--ink-60); text-transform: uppercase;
  flex-wrap: wrap; gap: 16px;
}
.foot-fine .links { display: flex; gap: 24px; }
.foot-fine a { color: inherit; text-decoration: none; }
.foot-fine a:hover { color: var(--accent); }

/* ─── Page header (for archive/author/tip pages) ─── */
.page-head {
  padding: 56px 0 36px;
  border-bottom: 1px solid var(--rule);
}
.page-head-inner {
  max-width: var(--page); margin: 0 auto; padding: 0 var(--gutter);
  display: flex; flex-direction: column; gap: 18px;
}
.page-head h1 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(36px, 4.4vw, 58px);
  line-height: 1.05; letter-spacing: -0.025em;
  color: var(--ink); text-wrap: balance;
}
.page-head .dek {
  font-family: var(--serif); font-size: 20px; line-height: 1.45;
  color: var(--ink-80); font-weight: 300; max-width: 680px;
}

/* ─── Responsive ─── */
@media (max-width: 1100px) {
  .story-grid { grid-template-columns: repeat(2, 1fr); }
  .foot-grid { grid-template-columns: 1fr; gap: 40px; }
}
@media (max-width: 680px) {
  :root { --gutter: 20px; }
  .mast-inner { height: 64px; }
  .mast-nav { gap: 14px; font-size: 13px; }
  .mast-nav a:not(.btn-subscribe) { display: none; }
  .ticker-date { display: none; }
  .story-grid { grid-template-columns: 1fr; }
  .section-head h2 { font-size: 24px; }
  .page-head h1 { font-size: 32px; }
  .search-input { font-size: 22px; }
}
