/* ──────────────────────────────────────────────────────────────
   Haultin — Ghost theme styles
   ─────────────────────────────────────────────────────────────
   Built on the FORWARD design canon as adopted by the dashboard
   (dashboard/src/client/styles.css), not the older marketing CSS:

     · Petrona        — headings, wordmark, long-form reading, figures
     · Libre Franklin — body furniture, apparatus, labels, nav, meta
     · Spline Sans Mono — machine tokens only (used sparingly)

   Labels/kickers are sentence-case Libre Franklin with NO tracking
   and NO all-caps (canon update). Two surfaces only — parchment
   ground, parchment-soft panels. Hard corners, hairline rules.
─────────────────────────────────────────────────────────────── */

/* ─── Tokens — mirrored from the dashboard canon ─────────────── */
:root {
  --parchment: #ECEEF1;        /* primary paper — cool light grey */
  --parchment-soft: #F5F6F7;   /* second surface — panels / cards */
  --bone-50: #FAFBFC;
  --bone-200: #D5D8DD;
  --bone-300: #B7BDC6;

  --admiralty: #0E1726;        /* chrome, fills, borders */
  --navy-ink:  #15233B;        /* prose + labels ink */
  --oxblood:   #7A1F1F;        /* accent — kickers, links, rules */
  --oxblood-600: #5E1818;
  --quill:     #777F8B;        /* muted apparatus */
  --floor-gray:#6E7789;        /* captions, source lines */

  /* Fonts — canon forward stack (all SIL OFL, loaded in default.hbs) */
  --serif: "Petrona", "Times New Roman", serif;
  --sans:  "Libre Franklin", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --mono:  "Spline Sans Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --body:  var(--sans);

  /* Spacing — 4pt grid */
  --s-1: 4px;   --s-2: 8px;   --s-3: 12px;  --s-4: 16px;
  --s-5: 20px;  --s-6: 24px;  --s-8: 32px;  --s-10: 40px;
  --s-12: 48px; --s-16: 64px; --s-20: 80px; --s-24: 96px;
  --s-32: 128px;

  /* Geometry — institutional restraint, no rounded edges */
  --radius: 0px;
  --hairline:       1px solid var(--admiralty);
  --hairline-soft:  1px solid rgba(14, 23, 38, 0.18);
  --hairline-faint: 1px solid rgba(14, 23, 38, 0.08);

  --measure: 68ch;
}

/* ─── Reset + base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
html { color-scheme: light; }
body {
  background: var(--parchment);
  color: var(--navy-ink);
  font-family: var(--body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; }

/* Figures pull Petrona + lining/tabular numerals wherever they sit. */
.tnum, time, .post-card-meta, .post-meta {
  font-variant-numeric: tabular-nums lining-nums;
}

/* ─── Page frame ─────────────────────────────────────────────── */
.page {
  max-width: 1100px;
  margin: 0 auto;
  padding: var(--s-8) var(--s-8) var(--s-32);
}
.site-main { display: block; }

/* ─── Masthead ───────────────────────────────────────────────── */
.masthead {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--s-6);
  padding: var(--s-2) 0;
}
.masthead-mark {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 20px;
  letter-spacing: -0.025em;
  line-height: 1;
  color: var(--admiralty);
}
.masthead-nav {
  display: flex;
  gap: var(--s-5);
  flex-wrap: wrap;
}
.masthead-nav a {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  color: var(--navy-ink);
  transition: color .12s;
}
.masthead-nav a:hover { color: var(--oxblood); }
.masthead-nav a[aria-current="page"] { color: var(--oxblood); }

.rule {
  border-top: var(--hairline);
  opacity: 0.5;
  margin-top: var(--s-3);
}

/* ─── Kicker / eyebrow label (canon: sentence-case, no tracking) ─ */
.kicker {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 11px;
  letter-spacing: 0;
  color: var(--oxblood);
  margin: 0 0 var(--s-3);
}

/* ─── Hero ───────────────────────────────────────────────────── */
.hero {
  padding: var(--s-24) 0 var(--s-20);
  display: grid;
  gap: var(--s-6);
  max-width: 880px;
}
.hero-wordmark {
  font-family: var(--serif);
  font-weight: 500;
  letter-spacing: -0.025em;
  line-height: 0.92;
  font-size: clamp(72px, 12vw, 132px);
  color: var(--admiralty);
  margin: 0;
}
.hero-headline {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(32px, 4.5vw, 56px);
  line-height: 1.05;
  letter-spacing: -0.015em;
  margin: var(--s-2) 0 0;
}
.hero-headline em { font-style: italic; color: var(--oxblood); }
.hero-lede {
  font-family: var(--serif);   /* standfirst reads in the serif */
  font-weight: 400;
  font-size: clamp(19px, 1.6vw, 22px);
  line-height: 1.5;
  margin: var(--s-2) 0 0;
  max-width: 56ch;
  text-wrap: pretty;
}

/* ─── Bands / sections ───────────────────────────────────────── */
.band { margin-top: var(--s-24); }
.section-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(24px, 2.4vw, 32px);
  line-height: 1.2;
  letter-spacing: -0.008em;
  margin: 0 0 var(--s-8);
  padding-bottom: var(--s-3);
  border-bottom: var(--hairline-faint);
}

/* ─── Tiles (what we add) ────────────────────────────────────── */
.tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-8);
}
.tile {
  background: var(--parchment-soft);
  border: var(--hairline-soft);
  padding: var(--s-6);
}
.tile-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: -0.005em;
  margin: 0 0 var(--s-3);
}
.tile-body {
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  color: var(--navy-ink);
  margin: 0;
  text-wrap: pretty;
}

/* ─── Contact ────────────────────────────────────────────────── */
.contact-body {
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.55;
  margin: 0 0 var(--s-4);
  max-width: 56ch;
  text-wrap: pretty;
}
.contact-mail {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(28px, 3vw, 40px);
  letter-spacing: -0.01em;
  display: inline-block;
  border-bottom: 1px solid currentColor;
  transition: color .12s, border-color .12s;
}
.contact-mail:hover { color: var(--oxblood); }

/* ─── Email signup (native Ghost members) ───────────────────── */
.signup-blurb {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--navy-ink);
  margin: 0 0 var(--s-5);
  max-width: 52ch;
  text-wrap: pretty;
}
.signup-form { max-width: 480px; }
.signup-fields {
  display: flex;
  gap: var(--s-2);
}
.signup-input {
  flex: 1 1 auto;
  min-width: 0;
  font-family: var(--sans);
  font-size: 15px;
  color: var(--navy-ink);
  background: var(--parchment-soft);
  border: 1px solid var(--admiralty);
  border-radius: 0;
  padding: 10px var(--s-3);
  outline: none;
  transition: box-shadow .12s, border-color .12s;
}
.signup-input::placeholder { color: var(--floor-gray); }
.signup-input:focus { box-shadow: 0 0 0 1px var(--admiralty); }
.signup-btn {
  flex: 0 0 auto;
  font-family: var(--sans);
  font-weight: 500;
  font-size: 14px;
  color: var(--parchment);
  background: var(--admiralty);
  border: 1px solid var(--admiralty);
  border-radius: 0;
  padding: 10px var(--s-5);
  transition: background .12s, border-color .12s;
}
.signup-btn:hover { background: var(--oxblood); border-color: var(--oxblood); }
.signup-form.loading .signup-btn { opacity: 0.6; pointer-events: none; }

/* Messages — hidden by default; Ghost toggles .success / .error on the form. */
.signup-message {
  font-family: var(--sans);
  font-size: 13px;
  margin: var(--s-3) 0 0;
  display: none;
}
.signup-success { color: var(--floor-gray); }
.signup-error { color: var(--oxblood); }
.signup-form.success .signup-fields { display: none; }
.signup-form.success .signup-success { display: block; }
.signup-form.error .signup-error:not(:empty) { display: block; }

@media (max-width: 480px) {
  .signup-fields { flex-direction: column; }
  .signup-btn { width: 100%; }
}

/* ─── Post feed + cards ──────────────────────────────────────── */
.post-feed {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--s-8);
}
.post-card {
  display: flex;
  flex-direction: column;
  border-top: var(--hairline-soft);
  padding-top: var(--s-4);
}
.post-card-image-link { display: block; margin-bottom: var(--s-4); }
.post-card-image {
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  background: var(--bone-200);
}
.post-card-tag {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 11px;
  color: var(--oxblood);
  display: inline-block;
  margin-bottom: var(--s-2);
}
.post-card-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 21px;
  line-height: 1.2;
  letter-spacing: -0.008em;
  margin: 0 0 var(--s-2);
  text-wrap: pretty;
}
.post-card-title a { transition: color .12s; }
.post-card-title a:hover { color: var(--oxblood); }
.post-card-excerpt {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  color: var(--navy-ink);
  margin: 0 0 var(--s-3);
  text-wrap: pretty;
}
.post-card-meta {
  margin-top: auto;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--floor-gray);
  display: flex;
  align-items: center;
  gap: var(--s-2);
}
.dot { opacity: 0.5; }

/* ─── Single post / page ─────────────────────────────────────── */
.post {
  max-width: 760px;
  margin: var(--s-16) auto 0;
}
.post-header { margin-bottom: var(--s-10); }
.post-kicker {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 12px;
  color: var(--oxblood);
  display: inline-block;
  margin-bottom: var(--s-4);
}
.post-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(34px, 5vw, 56px);
  line-height: 1.05;
  letter-spacing: -0.018em;
  margin: 0;
  text-wrap: pretty;
}
.post-standfirst {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(19px, 2vw, 22px);
  line-height: 1.5;
  color: var(--navy-ink);
  margin: var(--s-5) 0 0;
  max-width: 60ch;
  text-wrap: pretty;
}
.post-meta {
  font-family: var(--sans);
  font-size: 13px;
  color: var(--floor-gray);
  display: flex;
  align-items: center;
  gap: var(--s-2);
  margin-top: var(--s-6);
  padding-top: var(--s-4);
  border-top: var(--hairline-faint);
}
.post-meta-author { color: var(--navy-ink); font-weight: 500; }
.post-meta-author:hover { color: var(--oxblood); }

.post-image {
  margin: 0 0 var(--s-10);
}
.post-image img { width: 100%; }
.post-image figcaption {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--floor-gray);
  margin-top: var(--s-2);
  text-align: center;
}

/* ─── Long-form prose (.gh-content) — Petrona reading ────────── */
.gh-content {
  font-family: var(--serif);
  font-size: 19px;
  line-height: 1.7;
  color: var(--navy-ink);
}
.gh-content > * + * { margin-top: var(--s-6); }
.gh-content p { margin: 0; }
.gh-content a {
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(122, 31, 31, 0.4);
  transition: color .12s, text-decoration-color .12s;
}
.gh-content a:hover { color: var(--oxblood); text-decoration-color: var(--oxblood); }
.gh-content em { font-style: italic; }
.gh-content strong { font-weight: 600; }
.gh-content h2 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 30px;
  line-height: 1.15;
  letter-spacing: -0.012em;
  margin-top: var(--s-12);
}
.gh-content h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 23px;
  line-height: 1.2;
  margin-top: var(--s-10);
}
.gh-content h4 {
  font-family: var(--sans);
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0;
  margin-top: var(--s-8);
}
.gh-content ul, .gh-content ol { padding-left: 1.3em; }
.gh-content li + li { margin-top: var(--s-2); }
.gh-content blockquote {
  margin: var(--s-8) 0;
  padding-left: var(--s-5);
  border-left: 2px solid var(--oxblood);
  font-style: italic;
  color: var(--admiralty);
}
.gh-content hr {
  border: 0;
  border-top: var(--hairline-soft);
  margin: var(--s-12) 0;
}
.gh-content figure { margin: var(--s-8) 0; }
.gh-content figcaption {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--floor-gray);
  text-align: center;
  margin-top: var(--s-2);
}
.gh-content code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: var(--parchment-soft);
  border: var(--hairline-faint);
  padding: 1px 5px;
}
.gh-content pre {
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.55;
  background: var(--admiralty);
  color: var(--parchment);
  padding: var(--s-5);
  overflow-x: auto;
}
.gh-content pre code { background: none; border: 0; padding: 0; color: inherit; }

/* Koenig card widths — break out of the measure on wide/full cards. */
.gh-content :where(.kg-width-wide) { width: min(100vw, 1040px); margin-left: 50%; transform: translateX(-50%); max-width: 100vw; }
.gh-content :where(.kg-width-full) { width: 100vw; margin-left: 50%; transform: translateX(-50%); }

/* ─── Post footer tag chips ──────────────────────────────────── */
.post-footer {
  max-width: 760px;
  margin: var(--s-12) auto 0;
  padding-top: var(--s-5);
  border-top: var(--hairline-faint);
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
}
.post-tag-chip {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--navy-ink);
  border: var(--hairline-soft);
  padding: 4px 10px;
  transition: background .12s, color .12s, border-color .12s;
}
.post-tag-chip:hover { background: var(--admiralty); color: var(--parchment); border-color: var(--admiralty); }

/* ─── Archive header (tag / author) ──────────────────────────── */
.archive-header {
  margin: var(--s-12) 0 var(--s-12);
  max-width: 760px;
}
.archive-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(32px, 4vw, 48px);
  line-height: 1.1;
  letter-spacing: -0.015em;
  margin: 0;
}
.archive-desc {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  color: var(--navy-ink);
  margin: var(--s-4) 0 0;
  max-width: 60ch;
}

/* ─── Pagination ─────────────────────────────────────────────── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--s-4);
  margin-top: var(--s-16);
  padding-top: var(--s-5);
  border-top: var(--hairline-faint);
}
.pagination-link {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 13px;
  color: var(--navy-ink);
  border: var(--hairline-soft);
  padding: 8px var(--s-4);
  transition: background .12s, color .12s, border-color .12s;
}
.pagination-link:hover { background: var(--admiralty); color: var(--parchment); border-color: var(--admiralty); }
.pagination-link.is-disabled { opacity: 0.35; pointer-events: none; }
.pagination-page {
  font-family: var(--sans);
  font-size: 12px;
  color: var(--floor-gray);
  font-variant-numeric: tabular-nums lining-nums;
}

/* ─── Error ──────────────────────────────────────────────────── */
.error {
  max-width: 600px;
  margin: var(--s-32) auto;
  text-align: center;
}
.error-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.1;
  letter-spacing: -0.012em;
  margin: var(--s-2) 0 var(--s-8);
}
.more-link {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 13px;
  color: var(--navy-ink);
  border-bottom: 1px solid currentColor;
  transition: color .12s;
}
.more-link:hover { color: var(--oxblood); }

/* ─── Colophon ───────────────────────────────────────────────── */
.colophon {
  margin-top: var(--s-32);
  padding-top: var(--s-4);
  border-top: var(--hairline-faint);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--s-4);
  font-family: var(--sans);
  font-size: 12px;
  color: var(--floor-gray);
}
.colophon-nav {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-4);
  justify-content: flex-end;
}
.colophon-nav a {
  color: var(--floor-gray);
  transition: color .12s;
}
.colophon-nav a:hover { color: var(--oxblood); }
.colophon-nav a[aria-current="page"] { color: var(--navy-ink); }

/* ─── Motion — gentle pop-in (reduced-motion safe) ───────────── */
@keyframes haultin-card-pop {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: no-preference) {
  .tile, .post-card {
    animation: haultin-card-pop 520ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }
  .tiles > .tile:nth-child(2),
  .post-feed > .post-card:nth-child(2) { animation-delay: 70ms; }
  .tiles > .tile:nth-child(3),
  .post-feed > .post-card:nth-child(3) { animation-delay: 140ms; }
  .post-feed > .post-card:nth-child(n+4) { animation-delay: 200ms; }
}

/* ─── Responsive ─────────────────────────────────────────────── */
@media (max-width: 900px) {
  .tiles, .post-feed { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .page { padding: var(--s-6) var(--s-5) var(--s-24); }
  .hero { padding: var(--s-16) 0 var(--s-12); }
  .band { margin-top: var(--s-16); }
  .tiles, .post-feed { grid-template-columns: 1fr; gap: var(--s-8); }
  .masthead { flex-direction: column; align-items: flex-start; gap: var(--s-3); }
  .colophon { flex-direction: column; align-items: flex-start; gap: var(--s-3); }
  .colophon-nav { justify-content: flex-start; }
}
