/* ============================================================
   Jonathan Du Toit — Wisdom Reboot
   screen.css

   Sections:
   (0) Tokens (colors, type, spacing, radius)
   (1) Reset + base
   (2) Typography
   (3) Layout primitives (wrap, page)
   (4) Buttons + chips + forms
   (5) Site header
   (6) Site footer
   (7) Home hero
   (8) Section titles + section CTAs
   (9) Post grid + post cards
   (10) Featured card
   (11) Tag-as-image fallback
   (12) Single post (header, content, footer)
   (13) Page header (archives, etc)
   (14) Terms / codex
   (15) Archive list
   (16) Membership tiers
   (17) Auth shells
   (18) Error page
   (19) Load more button + grid reveal
   (20) Reading UI (progress + to-top)
   (21) Mobile drawer
   (22) Content features: pull quote, note, highlight, footnotes, nutshell
   (23) Responsive
   ============================================================ */

/* ============================================================
   Wisdom Reboot — screen.css
   ============================================================

   Single stylesheet. No build pipeline. Edit directly in Ghost
   admin (Design → Edit code → assets/css/screen.css) or in the
   theme files and re-upload.

   Section index:
   (0)  Tokens                       — colours, type, spacing
   (1)  Reset + base
   (2)  Typography
   (3)  Layout primitives            — .wrap, .page
   (4)  Buttons + chips + forms
   (5)  Site header                  — sticky, blur on scroll
   (6)  Site footer
   (7)  Home hero
   (8)  Section titles + section CTAs
   (9)  Post grid + post cards
   (10) Featured card                — wide image-side layout
   (11) Tag-as-image fallback        — letter glyph + tag image
   (12) Single post                  — header, content, footer
   (13) Page header                  — used by archives
   (14) Terms / codex                — search, filter, grid
   (15) Archive list
   (16) Membership tiers
   (17) Auth shells                  — kept for fallback only;
                                       Ghost Portal owns these
   (18) Error page
   (19) Load more
   (20) Reading UI                   — progress, scroll-to-top
   (21) Mobile drawer
   (22) Content features             — pullquote, note, highlight,
                                       footnotes, nutshell, term def,
                                       paywall, account, tag-card
   (23) Responsive
   ============================================================ */

/* ============================================================
   (0) TOKENS
   ============================================================ */
:root {
  /* Paragraph-style palette. Clean editorial. */
  --ink:        #1A1A1A;   /* near-black */
  --ink-soft:   #4A4A4A;   /* secondary text */
  --grey:       #8A8A8A;   /* meta, borders, mid */
  --line:       #ECECEC;   /* hairlines, dividers */
  --paper:      #FFFFFF;   /* page background */
  --paper-pure: #F5F5F5;   /* card / tag-mark background */
  --accent:     #1A1A1A;   /* accent IS the ink */
  --highlight:  rgba(255, 222, 130, 0.65);  /* mark, link gradient */
  --link-rule:  rgba(26, 26, 26, 0.18);     /* link underline */

  /* Typography
     --gh-font-heading and --gh-font-body are Ghost's admin-overridable
     font variables. Set in admin → Design → Customize → Typography.
     Our theme variables wrap them so admin overrides apply automatically. */
  --gh-font-heading: 'Fraunces', Georgia, 'Times New Roman', serif;
  --gh-font-body:    'Fraunces', Georgia, 'Times New Roman', serif;

  --font-display: var(--gh-font-heading);
  --font-body:    var(--gh-font-body);
  --font-ui:      'Inter', system-ui, -apple-system, sans-serif;

  --fs-prose: clamp(18px, 0.45vw + 16px, 21px);
  --lh-prose: 1.55;
  --fs-meta: 13px;
  --fs-eyebrow: 12px;

  /* Spacing */
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.75rem;
  --space-lg: 3rem;
  --space-xl: 5rem;
  --space-xxl: 8rem;

  /* Radius */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-pill: 999px;

  /* Layout */
  --wrap-max: 1180px;
  --wrap-narrow: 720px;
  --header-h: 72px;

  /* Motion */
  --ease: cubic-bezier(.2, .8, .2, 1);
  --dur: 220ms;
}

/* ============================================================
   (1) RESET + BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; }
html, body { overflow-x: hidden; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: var(--fs-prose);
  line-height: var(--lh-prose);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "kern", "liga", "ss01";
}
img, svg, picture { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; background: none; border: 0; color: inherit; }
input, button, select, textarea { font-family: inherit; }
[hidden] { display: none !important; }
.is-hidden { display: none !important; }

::selection { background: var(--highlight); color: var(--ink); }

/* ============================================================
   (2) TYPOGRAPHY
   ============================================================ */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--ink);
  margin: 0 0 0.6em;
}
h1 { font-size: clamp(34px, 4vw + 8px, 56px); font-weight: 800; letter-spacing: -0.035em; }
h2 { font-size: clamp(26px, 2vw + 12px, 36px); }
h3 { font-size: clamp(20px, 0.8vw + 16px, 26px); }
h4 { font-size: 20px; }

p { margin: 0 0 1.1em; }

/* ============================================================
   (3) LAYOUT PRIMITIVES
   ============================================================ */
.wrap {
  width: 100%;
  max-width: var(--wrap-max);
  margin: 0 auto;
  padding: 0 24px;
}
.wrap--narrow {
  max-width: var(--wrap-narrow);
}

.page {
  padding: var(--space-lg) 0 var(--space-xxl);
  min-height: 60vh;
}

.main { display: block; }

/* ============================================================
   (4) BUTTONS + CHIPS + FORMS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  padding: 0.7em 1.3em;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease), border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
  white-space: nowrap;
}
.btn--solid {
  background: var(--ink);
  color: var(--paper);
}
.btn--solid:hover { background: #000; }
.btn--ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
}
.btn--ghost:hover { border-color: var(--ink); }
.btn--block { width: 100%; }
.btn--loadmore { padding: 0.85em 2.4em; }

.chip {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.35em 0.8em;
  background: var(--paper-pure);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  color: var(--ink-soft);
}

/* ============================================================
   (5) SITE HEADER
   Paragraph-style: logo left, nav center, actions right.
   Sticky with subtle border on scroll.
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--paper);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.site-header.is-scrolled {
  border-bottom-color: var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-h);
  gap: 24px;
}
.site-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
}
.site-logo__mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  color: var(--ink);
  flex-shrink: 0;
}
.site-logo__mark svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
  display: block;
}
.site-logo__name { font-size: 17px; }

.site-nav {
  display: flex;
  align-items: center;
  gap: 28px;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 500;
}
.site-nav a {
  color: var(--ink-soft);
  position: relative;
  padding: 6px 2px;
  transition: color var(--dur) var(--ease);
}
.site-nav a::after {
  content: '';
  position: absolute;
  left: 2px; right: 2px;
  bottom: 0;
  height: 2px;
  background: var(--ink);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform var(--dur) var(--ease);
}
.site-nav a:hover,
.site-nav a.is-active {
  color: var(--ink);
}
.site-nav a.is-active::after { transform: scaleX(1); }

.site-header__actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.site-header__menu {
  display: none;
  width: 40px; height: 40px;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.site-header__menu span {
  display: block;
  width: 18px; height: 2px;
  background: var(--ink);
  transition: transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.site-header__menu[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.site-header__menu[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.site-header__menu[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ============================================================
   (6) SITE FOOTER
   ============================================================ */
.site-footer {
  border-top: 1px solid var(--line);
  background: var(--paper);
  padding: var(--space-lg) 0 var(--space-md);
  margin-top: var(--space-xl);
}
.site-footer__inner {
  display: grid;
  grid-template-columns: 1.2fr 2fr;
  gap: var(--space-lg);
  align-items: start;
}
.site-footer__brand .site-logo { margin-bottom: 12px; }
.site-footer__tagline {
  color: var(--grey);
  font-family: var(--font-body);
  font-size: 15px;
  font-style: italic;
}
.site-footer__nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  font-family: var(--font-ui);
  font-size: 14px;
}
.site-footer__nav > div { display: flex; flex-direction: column; gap: 10px; }
.site-footer__nav a { color: var(--ink-soft); }
.site-footer__nav a:hover { color: var(--ink); }
.site-footer__heading {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 4px;
}

/* Social links rendered from the primary author profile.
   Stacks vertically inside the footer Follow column. */
.site-socials {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.site-socials a {
  font-family: var(--font-ui);
  color: var(--ink-soft);
  text-decoration: none;
  width: fit-content;
}
.site-socials a:hover { color: var(--ink); }
.site-footer__bottom {
  border-top: 1px solid var(--line);
  margin-top: var(--space-md);
  padding: var(--space-md) 24px 0;
  max-width: var(--wrap-max);
  margin-left: auto;
  margin-right: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--grey);
  flex-wrap: wrap;
}

/* ============================================================
   (7) HOME HERO
   ============================================================ */
.home-hero {
  padding: var(--space-lg) 0 var(--space-lg);
  max-width: 760px;
}
.home-hero__title {
  font-size: clamp(38px, 4.5vw + 8px, 68px);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.05;
  margin-bottom: 0.4em;
}
.home-hero__lede {
  font-size: clamp(17px, 0.5vw + 14px, 20px);
  color: var(--ink-soft);
  line-height: 1.5;
  max-width: 56ch;
  margin: 0;
}

/* ============================================================
   (8) SECTION TITLES + SECTION CTA
   ============================================================ */
.section-block { margin-top: var(--space-xl); }
.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding-bottom: var(--space-sm);
  margin-bottom: var(--space-md);
  border-bottom: 1px solid var(--line);
}
.section-title__label {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink);
}

/* ============================================================
   (9) POST GRID + POST CARDS
   ============================================================ */
.post-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
}
.post-grid--three { grid-template-columns: repeat(3, 1fr); }

.post-card {
  display: flex;
  flex-direction: column;
  background: var(--paper-pure);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease);
  height: 100%;
}
.post-card:hover {
  border-color: var(--ink);
  transform: translateY(-2px);
}
.post-card__media {
  position: relative;
  aspect-ratio: 16 / 10;
  background: var(--line);
  overflow: hidden;
}
.post-card__image {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  transition: transform 600ms var(--ease);
}
.post-card:hover .post-card__image { transform: scale(1.04); }

.post-card__body {
  padding: 20px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
}
.post-card__body .chip { align-self: flex-start; }
.post-card__title {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
  margin: 0;
  color: var(--ink);
}
.post-card__excerpt {
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-soft);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.post-card__meta {
  margin-top: auto;
  padding-top: 12px;
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--grey);
  letter-spacing: 0.02em;
}

/* ============================================================
   (10) FEATURED CARD (wider, side-by-side on desktop)
   ============================================================ */
.post-card--featured {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 0;
  background: var(--paper-pure);
}
.post-card--featured .post-card__media {
  aspect-ratio: auto;
  min-height: 320px;
}
.post-card--featured .post-card__body {
  padding: var(--space-lg);
  justify-content: center;
}
.post-card--featured .post-card__title {
  font-size: clamp(28px, 2vw + 16px, 40px);
  letter-spacing: -0.02em;
}
.post-card--featured .post-card__excerpt {
  font-size: 17px;
  -webkit-line-clamp: 4;
}

/* ============================================================
   (11) ICON FALLBACK (tier 2 + tier 3)
   When the post has no feature image, we render either the
   primary_tag's icon (tier 2) or the W mark (tier 3).

   Tier 2: background = the tag's accent_color at full strength.
           Tag icon sits centered with 15px gutter.
   Tier 3: background = ink (black). W mark in paper (white).
           Accent color does NOT apply — fallback is uniform.

   The accent color comes from inline `--tag-accent` on the
   .post-card link (see post-card.hbs). The .has-accent class
   gates the color application; .--fallback overrides to black.
   ============================================================ */
.post-card__media--icon {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper-pure);
  border-bottom: 1px solid var(--line);
  aspect-ratio: 16 / 10;
  padding: 15px;
  overflow: hidden;
  position: relative;
}
.post-card__media--icon.has-accent:not(.post-card__media--fallback) {
  background: var(--tag-accent);
  border-bottom-color: var(--tag-accent);
}

/* W fallback: always black */
.post-card__media--fallback {
  background: var(--ink);
  border-bottom-color: var(--ink);
}

/* The icon image (tier 2): fills the inner box at native ratio */
.post-card__icon {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}

/* The W mark (tier 3): white on black */
.post-card__fallback {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  fill: var(--paper);
}

/* Featured card variant: taller block, but icon caps so it doesn't
   become absurdly large on the wide layout. */
.post-card--featured .post-card__media--icon {
  min-height: 320px;
  padding: 30px;
}
.post-card--featured .post-card__icon,
.post-card--featured .post-card__fallback {
  max-width: 180px;
  max-height: 180px;
}

/* ============================================================
   CARD STATE BADGES
   Top-right corner icons for "featured" and "members-only" posts.
   Stacks vertically if both apply.
   ============================================================ */
.post-card__states {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 2;
}
.post-card__state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: var(--paper);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.post-card__state svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}
/* On feature-image cards, the backdrop varies — use solid badge */
.post-card__media:not(.post-card__media--icon) .post-card__state {
  background: rgba(255, 255, 255, 0.92);
  color: var(--ink);
}

/* ============================================================
   (12) SINGLE POST
   ============================================================ */
.post-header {
  padding: var(--space-lg) 24px var(--space-md);
  text-align: center;
  position: relative;
}
.post-header__share {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: var(--space-md);
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--grey);
}
.post-header__sharelabel {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  font-weight: 700;
  margin-right: 4px;
}
.post-header__share a,
.post-header__share button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink-soft);
  transition: border-color var(--dur) var(--ease), color var(--dur) var(--ease);
}
.post-header__share a:hover,
.post-header__share button:hover {
  border-color: var(--ink);
  color: var(--ink);
}
.post-header__tag {
  display: inline-block;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: var(--space-md);
  padding: 6px 14px;
  border: 1px solid var(--ink);
  border-radius: var(--r-pill);
}
.post-header__title {
  font-size: clamp(34px, 3.5vw + 10px, 60px);
  font-weight: 800;
  letter-spacing: -0.035em;
  line-height: 1.05;
  margin-bottom: 0.5em;
}
.post-header__lede {
  font-size: clamp(18px, 0.6vw + 14px, 22px);
  line-height: 1.45;
  color: var(--ink-soft);
  max-width: 36em;
  margin: 0 auto 1.4em;
}
.post-header__meta {
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--grey);
}

/* Body content */
.post-content {
  padding: var(--space-md) 24px var(--space-lg);
}
.post-content p { font-size: var(--fs-prose); line-height: var(--lh-prose); }
.post-content h2 { margin-top: 1.6em; }
.post-content h3 { margin-top: 1.3em; }

/* Body-copy links: underline + highlight wash on hover */
.post-content :is(p, li, blockquote, figcaption) a {
  color: var(--ink);
  border-bottom: 2px solid var(--link-rule);
  background-image: linear-gradient(transparent 62%, var(--highlight) 62%);
  background-size: 100% 0%;
  background-repeat: no-repeat;
  background-position: 0 100%;
  padding: 0 0.06em;
  border-radius: 0.18em;
  transition: background-size var(--dur) var(--ease), border-bottom-color var(--dur) var(--ease);
}
.post-content :is(p, li, blockquote, figcaption) a:hover {
  background-size: 100% 100%;
  border-bottom-color: transparent;
}

/* Post footer */
.post-footer {
  padding: var(--space-md) 24px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.post-footer__share {
  display: flex;
  align-items: center;
  gap: 12px;
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--grey);
}
.post-footer__share span {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  font-weight: 700;
}
.post-footer__share a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink-soft);
}
.post-footer__share a:hover { border-color: var(--ink); color: var(--ink); }

/* Read next */
.read-next {
  margin-top: var(--space-xl);
  padding: 0 24px;
}

/* ============================================================
   (13) PAGE HEADER
   ============================================================ */
.page-header {
  padding: var(--space-md) 0 var(--space-lg);
  border-bottom: 1px solid var(--line);
  margin-bottom: var(--space-lg);
}
.page-header--center { text-align: center; border-bottom: 0; }
.page-header__eyebrow {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--grey);
  margin-bottom: 12px;
  display: block;
}
.page-header__title {
  font-size: clamp(40px, 4vw + 10px, 64px);
  margin-bottom: 0.3em;
}
.page-header__lede {
  font-size: clamp(17px, 0.5vw + 14px, 20px);
  color: var(--ink-soft);
  max-width: 56ch;
  margin: 0;
}

/* ============================================================
   (14) TERMS / CODEX
   ============================================================ */
.terms-search {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: var(--space-lg);
}
.terms-search input {
  width: 100%;
  padding: 1em 1.2em;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  background: var(--paper-pure);
  font-size: 16px;
  font-family: var(--font-ui);
  color: var(--ink);
  outline: none;
  transition: border-color var(--dur) var(--ease);
}
.terms-search input:focus { border-color: var(--ink); }

.terms-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.terms-filter {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 0.55em 1.1em;
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  color: var(--ink-soft);
  transition: all var(--dur) var(--ease);
}
.terms-filter:hover { border-color: var(--ink); color: var(--ink); }
.terms-filter.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--paper);
}

.terms-count {
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--grey);
  letter-spacing: 0.02em;
}

.terms-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
}
.term-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 18px 20px;
  background: var(--paper-pure);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  transition: border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.term-card:hover {
  border-color: var(--ink);
  transform: translateY(-1px);
}
.term-card__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 17px;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.term-card__type {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--grey);
  margin-bottom: -2px;
}
.term-card__def {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink-soft);
}

.terms-empty {
  text-align: center;
  padding: var(--space-lg);
  color: var(--grey);
  font-family: var(--font-ui);
}

/* ============================================================
   (15) ARCHIVE LIST — Tuuli-dense rows
   Each item: month/day on left, title in the middle, optional tag chip on right.
   No gap between items; year separators are inserted by main.js.
   ============================================================ */
.archive-list {
  display: flex;
  flex-direction: column;
}
.archive-year {
  margin-top: var(--space-md);
  padding-top: var(--space-sm);
  border-top: 1px solid var(--line);
}
.archive-year:first-child {
  margin-top: 0;
  border-top: none;
  padding-top: 0;
}
.archive-year__title {
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}
.archive-item {
  display: grid;
  grid-template-columns: 72px 1fr auto;
  align-items: baseline;
  gap: 16px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  transition: padding-left var(--dur) var(--ease);
}
.archive-item:hover {
  padding-left: 6px;
}
.archive-item__date {
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--grey);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.archive-item__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  line-height: 1.35;
  color: var(--ink);
}
.archive-item__tag {
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--grey);
}

/* ============================================================
   (16) MEMBERSHIP TIERS
   ============================================================ */
.billing-toggle {
  display: inline-flex;
  margin: 0 auto var(--space-lg);
  padding: 4px;
  background: var(--paper-pure);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  position: relative;
  left: 50%;
  transform: translateX(-50%);
}
.billing-toggle__btn {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  padding: 0.55em 1.4em;
  border-radius: var(--r-pill);
  color: var(--ink-soft);
  transition: all var(--dur) var(--ease);
}
.billing-toggle__btn.is-active {
  background: var(--ink);
  color: var(--paper);
}

.tier-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
  margin-top: var(--space-md);
}
.tier {
  background: var(--paper-pure);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.tier--featured {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--paper);
  transform: scale(1.02);
}
.tier--featured .tier__name,
.tier--featured .tier__amount,
.tier--featured .tier__currency,
.tier--featured .tier__period { color: var(--paper); }
.tier--featured .tier__pitch { color: rgba(247, 244, 238, 0.78); }
.tier--featured .tier__features li { color: rgba(247, 244, 238, 0.88); }
.tier--featured .tier__features li::before { background: var(--paper); }
.tier--featured .btn--solid { background: var(--paper); color: var(--ink); }
.tier--featured .btn--solid:hover { background: #fff; }

.tier__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 22px;
  margin: 0;
}
.tier__price {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.tier__currency {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 24px;
  color: var(--ink-soft);
}
.tier__amount {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 56px;
  letter-spacing: -0.04em;
  color: var(--ink);
  line-height: 1;
}
.tier__period {
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--grey);
  margin-left: 6px;
}
.tier__pitch {
  color: var(--ink-soft);
  font-size: 15px;
  margin: 0;
  min-height: 3em;
}
.tier__features {
  list-style: none;
  padding: 0;
  margin: 0 0 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tier__features li {
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--ink-soft);
  position: relative;
  padding-left: 22px;
}
.tier__features li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.55em;
  width: 12px;
  height: 2px;
  background: var(--ink);
}

.tier-foot {
  text-align: center;
  margin-top: var(--space-lg);
  color: var(--grey);
  font-family: var(--font-ui);
  font-size: 14px;
}
.tier-foot a {
  color: var(--ink);
  font-weight: 600;
  border-bottom: 1px solid var(--ink);
}

/* ============================================================
   (17) AUTH SHELLS
   Native signin/signup/account pages. Replaces Portal modals
   for these flows; Portal still handles billing/Stripe.
   ============================================================ */
.auth-shell {
  max-width: 440px;
  margin: var(--space-xl) auto;
  padding: var(--space-lg);
  background: var(--paper-pure);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
.auth-header { text-align: center; margin-bottom: var(--space-md); }
.auth-header h1 {
  font-size: clamp(28px, 2vw + 14px, 36px);
  margin-bottom: 0.3em;
}
.auth-header p {
  color: var(--ink-soft);
  font-size: 15px;
  margin: 0;
}
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.auth-form input {
  padding: 0.85em 1.1em;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: var(--paper);
  font-size: 15px;
  font-family: var(--font-ui);
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
  outline: none;
  transition: border-color var(--dur) var(--ease);
}
.auth-form input:focus { border-color: var(--ink); }

/* Message divs inside forms. Ghost toggles .success or .error
   on the parent form element after submission. We show only the
   matching message and otherwise keep them hidden.

   Used by .auth-form (signin, signup, account). */
.auth-form__msg {
  display: none;
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 500;
  text-align: center;
  margin: 4px 0 0;
  padding: 10px 14px;
  border-radius: var(--r-md);
  line-height: 1.4;
}
.auth-form__msg--success { background: #E7F5EC; color: #1f7a3a; }
.auth-form__msg--error   { background: #FBE9E7; color: #b04040; }

/* Reveal the right message after Ghost toggles the class */
form.success .auth-form__msg--success,
form.error   .auth-form__msg--error {
  display: block;
}

/* Loading state: Ghost adds .loading during submission. We disable
   the button visually and show a tiny spinner. */
form.loading button[type="submit"] {
  pointer-events: none;
  opacity: 0.7;
  position: relative;
  color: transparent !important;
}
form.loading button[type="submit"]::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  top: 50%;
  left: 50%;
  margin: -9px 0 0 -9px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-right-color: transparent;
  color: var(--paper);
  animation: wr-spin 0.7s linear infinite;
}
@keyframes wr-spin {
  to { transform: rotate(360deg); }
}

/* On success: lock the form. Hide the button entirely; the success
   message is now the visible action area. */
form.success button[type="submit"],
form.success input {
  pointer-events: none;
  opacity: 0.5;
}

.auth-foot {
  text-align: center;
  margin-top: var(--space-md);
  font-family: var(--font-ui);
  font-size: 14px;
  color: var(--grey);
}
.auth-foot a {
  color: var(--ink);
  font-weight: 600;
  border-bottom: 1px solid var(--ink);
}
.auth-foot a:hover { color: #000; }

/* ============================================================
   (18) ERROR PAGE
   ============================================================ */
.error-shell {
  text-align: center;
  padding: var(--space-xl) 24px;
}
.error-code {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(80px, 12vw, 160px);
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--ink);
  display: block;
  margin-bottom: 0.2em;
}
.error-shell h1 { font-size: clamp(28px, 2vw + 16px, 40px); margin-bottom: 0.4em; }
.error-shell p { color: var(--ink-soft); margin-bottom: 2em; }
.error-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* ============================================================
   (19) LOAD MORE + GRID REVEAL
   ============================================================ */
.loadmore-wrap {
  display: flex;
  justify-content: center;
  margin-top: var(--space-lg);
}

/* ============================================================
   (20) READING UI
   Progress bar + scroll-to-top
   ============================================================ */
.wr-progress {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 3px;
  z-index: 99998;
  background: rgba(0,0,0,0.05);
  pointer-events: none;
}
.wr-progress__bar {
  height: 100%;
  width: 0%;
  background: var(--ink);
  transition: width 0.06s linear;
}

.wr-to-top {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 99999;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  box-shadow: 0 10px 24px rgba(0,0,0,0.12);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.18s var(--ease), transform 0.18s var(--ease);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 0;
}
.wr-to-top[data-show="1"] {
  opacity: 1;
  transform: translateY(0);
}
.wr-to-top__svg { width: 18px; height: 18px; }
.wr-to-top__time {
  font-family: var(--font-ui);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0;
  opacity: 0.85;
  margin-top: -1px;
}

/* ============================================================
   (21) MOBILE DRAWER
   ============================================================ */
.mobile-menu {
  position: fixed;
  top: var(--header-h);
  left: 0; right: 0;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  padding: var(--space-md) 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  z-index: 40;
  font-family: var(--font-ui);
  font-size: 16px;
  font-weight: 500;
}
.mobile-menu a { color: var(--ink); }

/* ============================================================
   (22) CONTENT FEATURES
   Pull quote, note callout, highlight, footnotes, nutshell.
   Ported from your existing code injection.
   ============================================================ */

/* Standard prose elements inside post-content */
.post-content hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 2.4em auto;
  max-width: 6em;
}
.post-content ul,
.post-content ol {
  padding-left: 1.4em;
  margin-bottom: 1.2em;
}
.post-content li {
  margin-bottom: 0.4em;
  font-size: var(--fs-prose);
  line-height: var(--lh-prose);
}
.post-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.6em 0;
  font-family: var(--font-ui);
  font-size: 14px;
}
.post-content table th,
.post-content table td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}
.post-content table th {
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--paper-pure);
}
.post-content table td { color: var(--ink-soft); }
.post-content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.88em;
  background: var(--paper-pure);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  border: 1px solid var(--line);
}
.post-content pre {
  background: var(--paper-pure);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 18px 20px;
  overflow-x: auto;
  margin: 1.4em 0;
  font-size: 14px;
  line-height: 1.5;
}
.post-content pre code {
  background: transparent;
  border: 0;
  padding: 0;
  font-size: inherit;
}

/* Term definition block (for term posts) */
.term-definition {
  background: var(--paper-pure);
  border: 1px solid var(--line);
  border-left: 4px solid var(--ink);
  border-radius: var(--r-md);
  padding: 18px 22px;
  margin: 0 0 var(--space-md);
}
.term-definition__label {
  display: block;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 8px;
}
.term-definition__body {
  font-family: var(--font-display);
  font-size: clamp(18px, 0.6vw + 14px, 22px);
  line-height: 1.4;
  color: var(--ink);
  margin: 0;
  font-weight: 500;
}

/* Highlight: ==text== renders as <mark> */
mark {
  background: linear-gradient(transparent 58%, var(--highlight) 58%);
  padding: 0 0.08em;
  border-radius: 0.2em;
  color: var(--ink);
}

/* Pull quote: > :pull text */
blockquote.wr-pullquote {
  margin: 2em auto;
  padding: 0;
  border: 0;
  background: transparent;
  text-align: center;
  max-width: 22em;
}
blockquote.wr-pullquote p {
  font-family: var(--font-display);
  font-size: clamp(26px, 2.4vw + 12px, 40px);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.025em;
  color: var(--ink);
  margin: 0;
}
blockquote.wr-pullquote cite {
  display: block;
  margin-top: 12px;
  font-family: var(--font-ui);
  font-size: 13px;
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--grey);
  text-transform: uppercase;
}

/* Note callout: > :note Title \n body */
blockquote.wr-note-callout {
  margin: 1.6em 0 2em;
  padding: 16px 20px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--ink);
  border-radius: var(--r-md);
  background: var(--paper-pure);
}
blockquote.wr-note-callout .wr-note__title {
  display: block;
  margin-bottom: 8px;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink);
}
blockquote.wr-note-callout .wr-note__body { margin: 0; color: var(--ink-soft); }
blockquote.wr-note-callout .wr-note__body > :first-child { margin-top: 0; }
blockquote.wr-note-callout .wr-note__body > :last-child { margin-bottom: 0; }
blockquote.wr-note-callout .wr-note__body p { font-size: 16px; line-height: 1.5; }

/* Standard blockquote (non-pull, non-note) */
.post-content blockquote:not(.wr-pullquote):not(.wr-note-callout) {
  margin: 1.6em 0;
  padding-left: 1.4em;
  border-left: 3px solid var(--ink);
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.05em;
  color: var(--ink);
}

/* Footnote reference badge */
sup.footnote-ref > a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: super;
  font-size: 0.7em;
  font-family: var(--font-ui);
  font-weight: 700;
  line-height: 1;
  min-width: 1.6em;
  height: 1.6em;
  padding: 0 0.5em;
  margin-left: 0.16em;
  border-radius: 0.5em;
  background: var(--ink);
  color: var(--paper);
  text-decoration: none;
  font-variant-numeric: tabular-nums;
  border: 0;
  background-image: none;
}
sup.footnote-ref > a:hover { background: #000; }

.footnotes {
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--line);
  font-size: 15px;
  color: var(--ink-soft);
}
.footnotes ol {
  padding-left: 1.4em;
}
.footnotes li { margin-bottom: 0.8em; }
.footnotes li::marker { font-variant-numeric: tabular-nums; color: var(--grey); }
.footnote-backref { margin-left: 6px; color: var(--grey); }

/* Nutshell popover styling (carried over) */
.wr-nutshell-hidden { display: none !important; }
.nutshell-popover {
  margin: 14px 0 20px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--ink);
  border-radius: var(--r-md);
  background: var(--paper-pure);
}
.nutshell-popover__content > :first-child { margin-top: 0; }
.nutshell-popover__content > :last-child { margin-bottom: 0; }

/* Nutshell links: tappable depth markers.
   Inline indicator (+ glyph) signals "more here if you want it". */
.post-content a.nutshell-link {
  border-bottom: 1px dashed var(--ink-soft) !important;
  background-image: none !important;
  padding: 0 0.1em;
  cursor: pointer;
}
.post-content a.nutshell-link::after {
  content: '+';
  display: inline-block;
  margin-left: 0.25em;
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: 0.7em;
  vertical-align: super;
  color: var(--ink-soft);
  transition: transform var(--dur) var(--ease), color var(--dur) var(--ease);
}
.post-content a.nutshell-link[data-nutshell-open="1"]::after {
  content: '−';
  color: var(--ink);
}
.post-content a.nutshell-link:hover {
  border-bottom-color: var(--ink) !important;
}
.post-content a.nutshell-link:hover::after {
  color: var(--ink);
}

/* Footnote hover tooltip */
.wr-fn-tooltip {
  position: fixed;
  z-index: 99999;
  max-width: min(360px, calc(100vw - 24px));
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1.5;
  box-shadow: 0 10px 30px rgba(0,0,0,0.18);
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.12s var(--ease), transform 0.12s var(--ease);
  pointer-events: none;
}
.wr-fn-tooltip[data-show="1"] {
  opacity: 1;
  transform: translateY(0);
}

/* Anchor jump spacing */
[id^="fn"], [id^="fnref"], a[id] {
  scroll-margin-top: 100px;
}

/* ============================================================
   (22b) TAG INDEX CARDS (/tags/ page)
   ============================================================ */
.tag-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-md);
}
.tag-card {
  display: flex;
  flex-direction: column;
  background: var(--paper-pure);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: transform var(--dur) var(--ease), border-color var(--dur) var(--ease);
}
.tag-card:hover {
  border-color: var(--ink);
  transform: translateY(-2px);
}
/* Tag card media block.

   The accent color is set inline as a CSS variable on the .tag-card link
   via {{accent_color}} on each tag.

   Two visual states:
     1. Tag has an image: background = accent_color at full strength.
        The 48x48 SVG icon sits centered with 15px gutter on that color.
     2. Tag has no image: background = ink (black), W mark in paper (white).
        The accent color does NOT apply here — fallback is uniform across
        all unfilled tags so the W always reads the same way.

   When the tag has no accent_color, .has-accent isn't applied and the
   image background falls through to paper-pure.
*/
.tag-card__media {
  position: relative;
  aspect-ratio: 3 / 2;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 15px;
  overflow: hidden;
  background: var(--paper-pure);
}
.tag-card__media.has-accent:not(.tag-card__media--fallback) {
  background: var(--tag-accent);
}

/* Fallback variant: always black, regardless of tag accent_color */
.tag-card__media--fallback {
  background: var(--ink);
}

/* The icon: fills the inner box (after the 15px gutter), preserving its
   own aspect ratio. The aspect-ratio: 3/2 of the parent + 15px gutter
   means a 48x48 SVG icon will display centered at the max size the
   shorter dimension allows. */
.tag-card__img,
.tag-card__fallback {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* W fallback: white on black */
.tag-card__fallback {
  fill: var(--paper);
}

.tag-card__body {
  padding: 18px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}
.tag-card__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 20px;
  letter-spacing: -0.015em;
  margin: 0;
  color: var(--ink);
}
.tag-card__desc {
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink-soft);
  margin: 0;
  flex: 1;
}
.tag-card__count {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--grey);
  margin-top: 6px;
}

/* ============================================================
   (22c) PAYWALL (members-only post fallback)
   ============================================================ */
.paywall {
  margin-top: var(--space-lg);
  padding: 0 24px;
  position: relative;
}
.paywall::before {
  /* Fade-out scrim above the paywall block: implies more content */
  content: '';
  display: block;
  height: 80px;
  margin-top: -80px;
  background: linear-gradient(to bottom, rgba(255,255,255,0), var(--paper) 90%);
  pointer-events: none;
}
.paywall__inner {
  text-align: center;
  padding: var(--space-lg);
  background: var(--paper-pure);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  max-width: 560px;
  margin: 0 auto;
}
.paywall__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--ink);
  color: var(--paper);
  margin: 0 auto var(--space-sm);
}
.paywall__title {
  font-size: clamp(24px, 1.8vw + 14px, 32px);
  margin-bottom: 0.4em;
}
.paywall__lede {
  color: var(--ink-soft);
  font-size: 16px;
  margin-bottom: 1.6em;
}
.paywall__actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: var(--space-sm);
}
.paywall__note {
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--grey);
  margin: 0;
}

/* Members-only badge on post header meta */
.post-header__lock {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-right: 12px;
}

/* ============================================================
   (22d) ACCOUNT / PORTAL PREVIEW PAGE
   ============================================================ */
.portal-note {
  background: var(--paper-pure);
  border: 1px dashed var(--grey);
  border-radius: var(--r-md);
  padding: 12px 16px;
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--ink-soft);
  margin-bottom: var(--space-md);
}
.account-card {
  background: var(--paper-pure);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.account-card__row {
  display: grid;
  grid-template-columns: 110px 1fr auto;
  gap: 16px;
  align-items: center;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
}
.account-card__row:last-child { border-bottom: 0; }
.account-card__label {
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--grey);
}
.account-card__value {
  font-family: var(--font-body);
  font-size: 16px;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.account-card__edit {
  font-family: var(--font-ui);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  border-bottom: 1px solid var(--ink);
  padding: 0 2px 2px;
  background: transparent;
}
.account-card__edit:hover { color: #000; }
.plan-badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.account-actions {
  display: flex;
  gap: 10px;
  margin-top: var(--space-md);
  flex-wrap: wrap;
}
.account-secondary {
  margin-top: var(--space-lg);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--line);
}
.account-secondary h3 {
  font-size: 20px;
  margin-bottom: 0.4em;
}
.account-secondary > p {
  color: var(--ink-soft);
  font-size: 15px;
  margin-bottom: 1em;
}
.account-history {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.account-history li {
  font-family: var(--font-body);
  font-size: 15px;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.account-history a {
  color: var(--ink);
  border-bottom: 1px solid var(--link-rule);
}
.account-history a:hover { border-bottom-color: var(--ink); }
.account-history span {
  font-family: var(--font-ui);
  font-size: 12px;
  color: var(--grey);
}

/* ============================================================
   GHOST-SPECIFIC ADDITIONS
   Small bits the static demo didn't need but the live theme does.
   ============================================================ */

/* Tag archive header (rendered on /tag/{slug}/).
   Unified card pattern: image + body in a single bordered card.
   Two-column on desktop, stacks on mobile. */
.tag-hero {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: var(--space-md);
  align-items: center;
  padding: var(--space-md);
  background: var(--paper-pure);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  margin-bottom: var(--space-lg);
}
.tag-hero__media {
  width: 140px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  padding: 15px;
}
/* When tag has image AND accent color: media block becomes that color */
.tag-hero.has-accent .tag-hero__media {
  background: var(--tag-accent);
  border-color: var(--tag-accent);
}
/* When tag has no image: media block is always black (W in white) */
.tag-hero--fallback .tag-hero__media {
  background: var(--ink);
  border-color: var(--ink);
}
.tag-hero__media img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}
.tag-hero__fallback {
  max-width: 100%;
  max-height: 100%;
  fill: var(--paper);
}
.tag-hero__body {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.tag-hero__name {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(28px, 2vw + 14px, 42px);
  letter-spacing: -0.02em;
  line-height: 1.1;
  margin: 0;
  color: var(--ink);
}
.tag-hero__desc {
  font-size: 16px;
  color: var(--ink-soft);
  line-height: 1.5;
  margin: 0;
}
.tag-hero__count {
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--grey);
  margin-top: 4px;
}

/* Empty-state block for collection pages with no posts yet */
.empty-state {
  padding: var(--space-xl);
  text-align: center;
  background: var(--paper-pure);
  border: 1px dashed var(--line);
  border-radius: var(--r-lg);
  color: var(--ink-soft);
  font-family: var(--font-body);
  font-size: 16px;
}

/* Author page avatar */
.author-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  margin: 0 auto var(--space-sm);
  display: block;
  object-fit: cover;
  border: 1px solid var(--line);
}
.author-meta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: var(--space-sm);
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--grey);
}
.author-meta a {
  color: var(--ink);
  border-bottom: 1px solid var(--link-rule);
}
.author-meta a:hover { border-bottom-color: var(--ink); }

/* ============================================================
   GHOST PORTAL OVERRIDES
   Portal is Ghost's members UI (signin/signup/account modals).
   It exposes CSS variables we can override to match our theme.
   These are scoped to the Portal container so they don't leak
   into the rest of the page.
   ============================================================ */
[data-portal] { cursor: pointer; }

#ghost-portal-root {
  --gh-portal-color-accent: var(--ink);
  --gh-portal-color-accent-hover: #000;
  --gh-portal-text-color: var(--ink);
  --gh-portal-text-color-secondary: var(--ink-soft);
  --gh-portal-background-color: var(--paper);
  --gh-portal-button-color: var(--ink);
  --gh-portal-button-hover-color: #000;
  --gh-portal-border-color: var(--line);
}

/* The Portal frame iframe has fixed sizing. Make sure it doesn't
   get cut off on small screens. */
#ghost-portal-root iframe {
  max-width: 100vw !important;
}

/* Inline Portal triggers (the [data-portal] links) — match our btn style
   when they appear standalone in content. */
.gh-portal-trigger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  padding: 0.7em 1.3em;
  border-radius: var(--r-pill);
  background: var(--ink);
  color: var(--paper);
}

/* ============================================================
   COMMENTS WRAPPER (native Ghost comments)
   ============================================================ */
.post-comments {
  margin-top: var(--space-xl);
  padding: var(--space-md) 24px;
  border-top: 1px solid var(--line);
}

/* Page feature image (renders on /about/ etc when toggle is on) */
.page-feature-image {
  margin: var(--space-md) auto var(--space-lg);
  text-align: center;
}
.page-feature-image img {
  max-width: 100%;
  height: auto;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
}
.page-feature-image figcaption {
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--grey);
  margin-top: 12px;
}

/* Ghost-rendered card classes inside {{content}}.
   These are NOT in the static demo because they only appear
   when Ghost renders real post content. */
.kg-image-card,
.kg-gallery-card,
.kg-embed-card,
.kg-bookmark-card,
.kg-callout-card,
.kg-toggle-card,
.kg-video-card,
.kg-audio-card,
.kg-file-card,
.kg-product-card,
.kg-header-card {
  margin: 1.6em 0;
}
.kg-image-card img,
.kg-gallery-image img {
  max-width: 100%;
  height: auto;
  border-radius: var(--r-md);
}
.kg-image-card figcaption,
.kg-embed-card figcaption {
  font-family: var(--font-ui);
  font-size: 13px;
  color: var(--grey);
  text-align: center;
  margin-top: 8px;
}
.kg-width-wide { max-width: 1080px; margin-left: auto; margin-right: auto; }
.kg-width-full { max-width: 100vw; margin-left: calc(50% - 50vw); margin-right: calc(50% - 50vw); }
.kg-bookmark-card {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}
.kg-bookmark-container {
  display: flex;
  text-decoration: none;
  color: inherit;
}
.kg-bookmark-content {
  flex: 1;
  padding: 18px 20px;
}
.kg-bookmark-title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 18px;
  color: var(--ink);
  margin-bottom: 6px;
}
.kg-bookmark-description {
  font-size: 14px;
  color: var(--ink-soft);
}
.kg-bookmark-thumbnail {
  flex: 0 0 160px;
  background-size: cover;
  background-position: center;
}
.kg-callout-card {
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--ink);
  border-radius: var(--r-md);
  background: var(--paper-pure);
}

/* ============================================================
   (23) RESPONSIVE
   ============================================================ */
@media (max-width: 980px) {
  .post-grid,
  .post-grid--three,
  .terms-grid,
  .tier-grid,
  .tag-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .site-footer__inner { grid-template-columns: 1fr; }
  .site-footer__nav { grid-template-columns: repeat(3, 1fr); }
  .post-card--featured {
    grid-template-columns: 1fr;
  }
  .post-card--featured .post-card__media { min-height: 240px; }
  .tier--featured { transform: none; }
}

@media (max-width: 720px) {
  .wrap { padding: 0 16px; }
  .site-header__inner { gap: 12px; }
  .site-nav { display: none; }
  .site-header__menu { display: flex; }
  /* Hide the action buttons on mobile — the drawer has them.
     Keeps logo + hamburger visible without overflow. */
  .site-header__actions .btn { display: none; }
  .site-logo__name {
    /* Optionally shrink the wordmark on tight screens */
    font-size: 15px;
  }
  .post-grid,
  .post-grid--three,
  .terms-grid,
  .tier-grid,
  .tag-grid {
    grid-template-columns: 1fr;
  }
  .site-footer__nav { grid-template-columns: 1fr; }
  .archive-item { grid-template-columns: 60px 1fr; }
  .archive-item__tag { grid-column: 2; }
  .home-hero { padding-top: var(--space-md); }
  .page { padding: var(--space-md) 0 var(--space-lg); }
  .section-block { margin-top: var(--space-lg); }
  .billing-toggle { left: 0; transform: none; display: flex; justify-content: center; width: 100%; }
  .wr-to-top { right: 12px; bottom: 12px; width: 38px; height: 38px; }
  .account-card__row { grid-template-columns: 1fr; gap: 6px; }
  .account-card__edit { justify-self: start; }

  /* Tag archive hero: stack on mobile */
  .tag-hero {
    grid-template-columns: 1fr;
    text-align: center;
    padding: var(--space-sm);
  }
  .tag-hero__media {
    width: 100px;
    height: 100px;
    margin: 0 auto;
    padding: 14px;
  }

  /* Paywall: less side padding on mobile */
  .paywall { padding: 0 16px; }
  .paywall__inner { padding: var(--space-md); }

  /* Post header: less side padding */
  .post-header, .post-content, .post-footer { padding-left: 16px; padding-right: 16px; }
}

@media (max-width: 480px) {
  .home-hero__title { font-size: 38px; }
  .post-header__title { font-size: 32px; }
  .page-header__title { font-size: 36px; }
}
