/* ============================================================
   Starwriter — a warm, editorial Ghost theme
   ============================================================ */

:root {
  --bg:            #FAF6EF;
  --bg-tint:       #F2EAE0;
  --surface:       #FFFFFF;
  --surface-2:     #F6EFE4;

  --text:          #241F2E;
  --text-secondary:#5B5468;
  --text-tertiary: #8A8394;

  --separator:     rgba(36,31,46,0.12);

  /* Accent follows Ghost's Settings -> Brand -> Accent color, with a warm gold fallback if unset. */
  --accent:        var(--ghost-accent-color, #A8722E);
  --accent-hover:  color-mix(in srgb, var(--accent) 85%, black);
  --accent-soft:   color-mix(in srgb, var(--accent) 12%, transparent);
  --accent-2:      #5B3A73;

  --shadow-sm: 0 1px 2px rgba(36,26,10,0.05), 0 1px 8px rgba(36,26,10,0.05);
  --shadow-md: 0 6px 20px rgba(36,26,10,0.08), 0 1px 4px rgba(36,26,10,0.05);
  --shadow-lg: 0 20px 50px rgba(36,26,10,0.14), 0 2px 10px rgba(36,26,10,0.06);

  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans:  "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --ease: cubic-bezier(0.25, 0.1, 0.25, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:            #15121D;
    --bg-tint:       #1B1726;
    --surface:       #201B2C;
    --surface-2:     #262138;

    --text:          #F3ECE1;
    --text-secondary:#B7ADC4;
    --text-tertiary: #8A8394;

    --separator:     rgba(255,255,255,0.10);

    --accent:        var(--ghost-accent-color, #D9A54A);
    --accent-hover:  color-mix(in srgb, var(--accent) 80%, white);
    --accent-soft:   color-mix(in srgb, var(--accent) 16%, transparent);
    --accent-2:      #A57FD6;

    --shadow-sm: 0 1px 2px rgba(0,0,0,0.5);
    --shadow-md: 0 8px 24px rgba(0,0,0,0.5);
    --shadow-lg: 0 24px 60px rgba(0,0,0,0.6);
  }
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }

body {
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  letter-spacing: -0.005em;
  background:
    radial-gradient(ellipse 900px 500px at 50% -10%, var(--accent-soft), transparent 60%),
    var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 200;
  background: var(--surface); color: var(--text); padding: 12px 18px; border-radius: 8px;
}
.skip-link:focus { left: 16px; top: 16px; }

.wrap { max-width: 1080px; margin: 0 auto; padding: 0 24px; }
.wrap--narrow { max-width: 720px; }

/* ── Type ──────────────────────────────────────────────────── */
h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}

.eyebrow, .sec-eyebrow {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 14px;
}

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--sans);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.006em;
  padding: 14px 28px;
  border-radius: 999px;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), transform 0.1s var(--ease), border-color 0.2s var(--ease);
  border: 1px solid transparent;
  cursor: pointer;
}
.btn:active { transform: scale(0.98); }
.btn--primary { background: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-hover); }
.btn--ghost { background: transparent; color: var(--text); border-color: var(--separator); }
.btn--ghost:hover { border-color: var(--accent); color: var(--accent); }

/* ── Header / Nav ──────────────────────────────────────────── */
.site-header {
  position: sticky; top: 0; z-index: 90;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
  backdrop-filter: saturate(160%) blur(18px);
  border-bottom: 1px solid var(--separator);
}
.nav-wrap {
  display: flex; align-items: center; justify-content: space-between;
  height: 72px;
}
.site-header--compact .nav-wrap { height: 60px; }

.site-brand { display: flex; align-items: center; gap: 10px; }
.site-brand-text {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text);
}
.site-logo { height: 32px; width: auto; }

.site-nav {
  display: flex; align-items: center; gap: 20px;
}
.site-nav ul.nav {
  display: flex;
  align-items: center;
  gap: 2px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-nav ul.nav li { display: block; }
.site-nav ul.nav a {
  display: inline-flex;
  align-items: center;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text-secondary);
  padding: 8px 14px;
  border-radius: 999px;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.site-nav ul.nav a:hover { color: var(--text); background: var(--fill, var(--accent-soft)); }
.site-nav ul.nav li.nav-current a { color: var(--accent); background: var(--accent-soft); }
.nav-subscribe {
  background: var(--accent);
  color: #fff !important;
  padding: 9px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 600 !important;
  white-space: nowrap;
  margin-left: 6px;
}
.nav-subscribe:hover { background: var(--accent-hover); }

.nav-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  padding: 8px;
  cursor: pointer;
}
.nav-toggle-bar { width: 22px; height: 2px; background: var(--text); border-radius: 2px; }

@media (max-width: 46rem) {
  .nav-toggle { display: flex; }
  .site-nav {
    position: absolute;
    top: 100%; left: 0; right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    background: var(--surface);
    border-bottom: 1px solid var(--separator);
    padding: 12px 24px 20px;
    display: none;
    box-shadow: var(--shadow-md);
  }
  .site-nav.is-open { display: flex; }
  .site-nav ul.nav {
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
  }
  .site-nav ul.nav a { padding: 12px 14px; border-radius: 10px; }
  .nav-subscribe { margin: 8px 0 0; text-align: center; }
}

/* ── Hero ──────────────────────────────────────────────────── */
.hero { padding: 90px 0 60px; text-align: center; }
.hero-headline {
  font-size: clamp(38px, 6.4vw, 64px);
  line-height: 1.08;
  max-width: 18ch;
  margin: 0 auto 20px;
}
.hero-headline em { font-style: italic; color: var(--accent); }
.hero-standfirst {
  font-size: clamp(17px, 2vw, 20px);
  color: var(--text-secondary);
  max-width: 46ch;
  margin: 0 auto 32px;
  line-height: 1.55;
}
.hero-ctas { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }

/* ── Sections ──────────────────────────────────────────────── */
.section { padding: 76px 0; }
.section--tinted { background: var(--bg-tint); }
.sec-title {
  font-size: clamp(28px, 4.4vw, 40px);
  line-height: 1.12;
  margin-bottom: 16px;
  max-width: 22ch;
}
.sec-lead {
  font-size: 18px;
  color: var(--text-secondary);
  max-width: 52ch;
  line-height: 1.55;
  margin-bottom: 30px;
}

/* ── Offers grid (homepage "pick your door") ──────────────── */
.offers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 20px;
  margin-top: 36px;
}

/* ── Feature card — shared by Offers, Author Services and Starpath grids ── */
.feature-card {
  display: block;
  background: var(--surface);
  border: 1px solid var(--separator);
  border-radius: 20px;
  box-shadow: var(--shadow-sm);
  padding: 30px 28px;
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.25s var(--ease);
}
.feature-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); border-color: var(--accent-soft); }
.feature-card-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  object-fit: cover;
  margin-bottom: 18px;
}
.feature-card-mark {
  display: block;
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--accent-soft);
  margin-bottom: 18px;
}
.feature-card-title {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 21px;
  color: var(--text);
  margin-bottom: 8px;
}
.feature-card-desc {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.55;
}

/* ── Books grid & book card ────────────────────────────────── */
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 28px;
  margin: 36px 0 30px;
}
.books-grid--wide { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.book-card-link { display: block; }
.book-cover-wrap { margin-bottom: 14px; }
.book-cover {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: var(--shadow-md);
  transition: transform 0.3s var(--ease), box-shadow 0.3s var(--ease);
}
.book-card:hover .book-cover { transform: translateY(-4px) rotate(-0.6deg); box-shadow: var(--shadow-lg); }
.book-cover--placeholder {
  display: flex; align-items: center; justify-content: center;
  text-align: center;
  background: linear-gradient(160deg, var(--accent-2), var(--accent));
  color: #fff;
  font-family: var(--serif);
  font-size: 18px;
  padding: 20px;
}
.book-card-title {
  font-size: 17px;
  line-height: 1.3;
  margin-bottom: 4px;
}
.book-card-tagline {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ── Posts grid & post card ───────────────────────────────── */
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 24px;
  margin: 36px 0 30px;
}
.post-card {
  background: var(--surface);
  border: 1px solid var(--separator);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease);
}
.post-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }
.post-card-image-wrap { aspect-ratio: 16 / 10; overflow: hidden; }
.post-card-image { width: 100%; height: 100%; object-fit: cover; }
.post-card-body { padding: 22px 24px; }
.post-card--noimage .post-card-body { padding-top: 26px; }
.post-card-title {
  font-size: 20px;
  line-height: 1.25;
  margin-bottom: 8px;
}
.post-card-excerpt {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 14px;
}
.post-card-meta {
  font-size: 13px;
  color: var(--text-tertiary);
  display: flex; align-items: center; gap: 6px;
}

.badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  padding: 5px 11px;
  border-radius: 999px;
  margin-bottom: 12px;
}
.badge--book { background: var(--accent-soft); color: var(--accent); }
.badge--tag {
  background: var(--surface-2);
  color: var(--text-secondary);
  text-transform: none;
  font-weight: 500;
  margin-right: 6px;
}

/* ── About teaser (home) ──────────────────────────────────── */
.about-teaser-inner {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 44px;
  align-items: center;
}
.about-teaser-photo {
  aspect-ratio: 1;
  border-radius: 50%;
  background: linear-gradient(160deg, var(--accent-2), var(--accent));
  object-fit: cover;
  width: 100%;
}
@media (max-width: 46rem) {
  .about-teaser-inner { grid-template-columns: 1fr; text-align: center; }
  .about-teaser-photo { width: 140px; margin: 0 auto; }
}

/* ── About page header photo ──────────────────────────────── */
.about-photo {
  width: 120px; aspect-ratio: 1; border-radius: 50%;
  background: linear-gradient(160deg, var(--accent-2), var(--accent));
  object-fit: cover;
  margin: 0 auto 24px;
}

/* ── Archive / generic page header ────────────────────────── */
.archive-header { padding: 70px 0 20px; text-align: center; }
.archive-title { font-size: clamp(32px, 5vw, 48px); line-height: 1.1; max-width: 24ch; margin: 0 auto 14px; }
.archive-desc { font-size: 18px; color: var(--text-secondary); max-width: 52ch; margin: 0 auto; }
.author-header .author-photo { width: 88px; height: 88px; border-radius: 50%; object-fit: cover; margin: 0 auto 20px; }
.page-intro { margin: 0 auto 20px; text-align: left; }
.empty-note { color: var(--text-tertiary); font-style: italic; padding: 20px 0 60px; }

/* ── Services grid ─────────────────────────────────────────── */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin: 40px 0 70px;
}

/* ── Process strip ─────────────────────────────────────────── */
.process-strip { padding: 20px 0 70px; text-align: center; }
.process-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 32px;
  margin-top: 36px;
  text-align: left;
}
.process-no {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 700;
  font-size: 14px;
  margin-bottom: 14px;
}
.process-step h4 { font-size: 17px; margin-bottom: 6px; }
.process-step p { font-size: 15px; color: var(--text-secondary); line-height: 1.5; }

/* ── Starpath CTA block ─────────────────────────────────────── */
.starpath-cta { text-align: center; padding: 10px 0 20px; }

/* ── Closing CTA ───────────────────────────────────────────── */
.closing-cta { text-align: center; padding: 80px 0; }
.closing-cta-inner .sec-title,
.closing-cta-inner .sec-lead { margin-inline: auto; }

/* ── Single post / page ────────────────────────────────────── */
.post-header { padding: 60px 0 30px; text-align: center; }
.post-title { font-size: clamp(32px, 5.6vw, 52px); line-height: 1.1; margin-bottom: 16px; }
.post-standfirst { font-size: 19px; color: var(--text-secondary); line-height: 1.5; margin-bottom: 20px; }
.post-meta {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 14px; color: var(--text-tertiary);
}
.post-meta-avatar { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.dot { color: var(--text-tertiary); }

.post-feature-image { margin: 0 auto 50px; max-width: 1080px; }
.post-feature-image img { border-radius: 16px; box-shadow: var(--shadow-md); }

/* ── Book detail hero ──────────────────────────────────────── */
.book-detail-hero {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 48px;
  align-items: center;
  padding: 60px 0 50px;
}
.book-detail-cover img,
.book-detail-cover .book-cover { border-radius: 10px; box-shadow: var(--shadow-lg); }
.book-detail-info .post-title,
.book-detail-info .post-standfirst { text-align: left; }
.book-detail-ctas { margin-top: 22px; }
@media (max-width: 46rem) {
  .book-detail-hero { grid-template-columns: 1fr; text-align: center; padding-top: 40px; }
  .book-detail-cover { max-width: 220px; margin: 0 auto; }
  .book-detail-info .post-title,
  .book-detail-info .post-standfirst { text-align: center; }
}

/* ── Course lesson list ───────────────────────────────────────── */
.lesson-list { margin: 50px 0; }
.lessons {
  list-style: none;
  counter-reset: lesson;
  border-top: 1px solid var(--separator);
  margin-top: 24px;
}
.lesson-row { counter-increment: lesson; border-bottom: 1px solid var(--separator); }
.lesson-row a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 6px;
  transition: background 0.2s var(--ease);
}
.lesson-row a:hover { background: var(--bg-tint); }
.lesson-row a::before {
  content: counter(lesson, decimal-leading-zero);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  color: var(--text-tertiary);
  margin-right: 14px;
}
.lesson-title { font-weight: 600; color: var(--text); flex: 1; }
.lesson-row--locked .lesson-title { color: var(--text-secondary); }
.lesson-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-tertiary);
  white-space: nowrap;
}
.lesson-lock { font-size: 13px; }

/* ── Prose / Koenig content ────────────────────────────────── */
.gh-content { font-size: 18px; line-height: 1.7; color: var(--text); }
.gh-content > * + * { margin-top: 1.4em; }
.gh-content h2 { font-size: 30px; margin-top: 1.8em; }
.gh-content h3 { font-size: 24px; margin-top: 1.6em; }
.gh-content p { color: var(--text); }
.gh-content a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.gh-content strong { color: var(--text); }
.gh-content ul, .gh-content ol { padding-left: 1.4em; }
.gh-content li + li { margin-top: 0.5em; }
.gh-content blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 22px;
  font-family: var(--serif);
  font-style: italic;
  font-size: 22px;
  color: var(--text-secondary);
}
.gh-content figcaption { font-size: 14px; color: var(--text-tertiary); text-align: center; margin-top: 8px; }
.gh-content hr { border: none; border-top: 1px solid var(--separator); margin: 2.6em 0; }
.gh-content img { border-radius: 12px; }

.gh-content .kg-width-wide {
  width: 1080px;
  max-width: calc(100vw - 48px);
  margin-left: 50%;
  transform: translateX(-50%);
}
.gh-content .kg-width-full {
  width: 100vw;
  max-width: 100vw;
  margin-left: 50%;
  transform: translateX(-50%);
}
.gh-content .kg-width-full img,
.gh-content .kg-width-wide img { border-radius: 0; width: 100%; }
.gh-content code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.88em;
}
.gh-content pre {
  background: var(--surface-2);
  padding: 20px;
  border-radius: 12px;
  overflow-x: auto;
}
.gh-content pre code { background: none; padding: 0; }

.gh-content .kg-callout-card {
  display: flex; gap: 14px;
  background: var(--accent-soft);
  border-radius: 14px;
  padding: 20px 22px;
}
.gh-content .kg-bookmark-card a {
  display: flex; flex-wrap: wrap;
  border: 1px solid var(--separator);
  border-radius: 14px;
  overflow: hidden;
  text-decoration: none;
}
.gh-content .kg-bookmark-content { padding: 20px; flex: 1 1 60%; }
.gh-content .kg-bookmark-title { font-weight: 600; color: var(--text); }
.gh-content .kg-bookmark-description { color: var(--text-secondary); font-size: 14px; margin-top: 6px; }
.gh-content .kg-bookmark-thumbnail { flex: 1 1 35%; }
.gh-content .kg-bookmark-thumbnail img { width: 100%; height: 100%; object-fit: cover; border-radius: 0; }

.gh-content .kg-btn-card { text-align: center; }
.gh-content .kg-btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff !important;
  padding: 13px 26px; border-radius: 999px;
  font-weight: 600; text-decoration: none !important;
}
.gh-content .kg-btn:hover { background: var(--accent-hover); }

/* ── Author card / post footer ────────────────────────────── */
.post-footer { margin-top: 60px; padding-top: 40px; border-top: 1px solid var(--separator); }
.author-card { display: flex; gap: 16px; align-items: center; margin-bottom: 40px; }
.author-card-photo { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; }
.author-card-name { font-weight: 600; margin-bottom: 4px; }
.author-card-bio { font-size: 14px; color: var(--text-secondary); }
.post-cta {
  background: var(--bg-tint);
  border-radius: 16px;
  padding: 28px 30px;
  text-align: center;
}
.post-cta p { color: var(--text-secondary); margin-bottom: 16px; }

/* ── Error page ────────────────────────────────────────────── */
.error-page { text-align: center; padding: 120px 0; }
.error-page .archive-desc { margin-bottom: 30px; }

/* ── Footer ────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--separator);
  background: var(--bg-tint);
  padding: 56px 0 0;
}
.footer-wrap {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 30px;
  padding-bottom: 40px;
}
.footer-brand { font-family: var(--serif); font-size: 19px; font-weight: 600; }
.footer-tagline { font-size: 14px; color: var(--text-secondary); margin-top: 10px; line-height: 1.5; max-width: 34ch; }
.footer-nav, .footer-social { display: flex; flex-direction: column; gap: 10px; font-size: 14px; }
.footer-nav a, .footer-social a { color: var(--text-secondary); }
.footer-nav a:hover, .footer-social a:hover { color: var(--accent); }
.footer-bottom {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  border-top: 1px solid var(--separator);
  padding: 18px 0;
  font-size: 13px;
  color: var(--text-tertiary);
}
@media (max-width: 46rem) {
  .footer-wrap { grid-template-columns: 1fr; }
}
.footer-version { opacity: 0.6; font-variant-numeric: tabular-nums; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; scroll-behavior: auto !important; }
}
