@import url("https://fonts.googleapis.com/css2?family=DM+Serif+Display&family=DM+Sans:wght@400;500;600;700&display=swap");

:root {
  --font-display: "DM Serif Display", Georgia, serif;
  --font-body: "DM Sans", system-ui, sans-serif;
  --text-h1: clamp(34px, 8.5vw, 50px);
  --text-h2: clamp(26px, 5.6vw, 34px);
  --text-h2-sm: clamp(25px, 5.4vw, 30px);
  --text-h3: 24px;
  --text-lead: 18px;
  --text-body: 16px;
  --text-ui: 15px;
  --text-small: 13px;
  --text-eyebrow: 12px;
  --ink: #1F2937;
  --ink-2: #374151;
  --ink-muted: #4B5563;
  --bg: #FFFFFF;
  --bg-soft: #F1F2F4;
  --hero: #24314D;
  --hero-text: #D9DFEA;
  --hero-label: #C7CFDD;
  --border: #ECEDEF;
  --border-input: #D1D5DB;
  --navy: #24314D; --on-navy: #FFFFFF;
  --plum: #4A2E4F; --on-plum: #FFFFFF;
  --forest: #2F4A3A; --on-forest: #FFFFFF;
  --sand: #E9DCC6; --on-sand: #2B2418;
  --sage: #C9D6C3; --on-sage: #1F2A1C;
  --sky: #D3E1EE; --on-sky: #18273A;
  --stone: #ECEAE6; --on-stone: #26231F;
  --btn-primary-bg: #1F2937; --btn-primary-text: #FFFFFF;
  --btn-save-bg: #B42318; --btn-save-text: #FFFFFF;
  --btn-secondary-bg: #FFFFFF; --btn-secondary-text: #1F2937; --btn-secondary-border: #D1D5DB;
  --btn-hero-bg: #E9DCC6; --btn-hero-text: #2B2418;
  --radius-pill: 999px;
  --radius-card: 16px;
  --radius-panel: 18px;
  --radius-tile: 14px;
  --container: 1080px;
  --container-narrow: 760px;
  --gutter: 24px;
  --section-gap: 48px;
  --tap-min: 44px;
  --input-h: 48px;
  --verse-ink: #3A4630;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; font-family: var(--font-body); color: var(--ink); background: var(--bg); line-height: 1.5; }
/* Footer sits at the bottom of short pages; long pages flow normally (no fixed positioning). */
body { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
body > main { flex: 1 0 auto; width: 100%; }
body > .site-header, body > .site-footer { flex-shrink: 0; }
a { color: var(--ink); }
a:hover { color: #000; }
img { max-width: 100%; height: auto; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -9999px; top: 0; background: #000; color: #fff; padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; top: 8px; }
.wrap { max-width: var(--container); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }
.wrap-narrow { max-width: var(--container-narrow); margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter); }

/* header */
.site-header { background: #fff; border-bottom: 1px solid var(--border); }
.site-header .inner { display: flex; flex-wrap: wrap; gap: 16px; align-items: center; justify-content: space-between; padding-top: 16px; padding-bottom: 16px; }
.brand { font-family: var(--font-display); font-size: 24px; color: var(--ink); text-decoration: none; }
.tnav { display: flex; flex-wrap: wrap; gap: 20px; font-size: var(--text-ui); font-weight: 500; }
.tnav a { text-decoration: none; min-height: var(--tap-min); display: inline-flex; align-items: center; }
.tnav a[aria-current="page"] { text-decoration: underline; text-underline-offset: 6px; font-weight: 700; }

/* heroes */
.hero { background: var(--hero); color: #fff; position: relative; overflow: hidden; }
.hero .inner { padding: 48px 0 44px; display: flex; flex-direction: column; gap: 16px; position: relative; z-index: 1; }
.hero.home .inner { padding: 56px 0 48px; gap: 20px; }
.hero .inner.with-mark {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 24px;
}
.hero .hero-copy { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.hero.home .hero-copy { gap: 20px; }
.hero-mark {
  display: none;
  width: min(420px, 42vw);
  max-width: 100%;
  height: auto;
  justify-self: end;
  pointer-events: none;
  user-select: none;
  /* navy plate already matches hero; slight soft edge */
  border-radius: 12px;
}
@media (min-width: 860px) {
  .hero .inner.with-mark {
    grid-template-columns: minmax(0, 1.2fr) minmax(180px, 0.7fr);
    align-items: center;
  }
  .hero.home .inner.with-mark {
    grid-template-columns: minmax(0, 1.25fr) minmax(200px, 360px);
    grid-template-rows: auto auto;
    column-gap: 20px;
    row-gap: 20px;
    align-items: center;
  }
  .hero.home .hero-main { grid-column: 1; grid-row: 1; }
  .hero.home .hero-mark { grid-column: 2; grid-row: 1; align-self: center; justify-self: end; }
  .hero.home .hero-writing { grid-column: 1 / -1; grid-row: 2; max-width: 100%; }
  .hero-mark { display: block; }
  .hero.home .hero-mark { width: min(340px, 32vw); }
  .hero.inner-page .hero-mark { width: min(340px, 36vw); opacity: 0.95; }
}
.hero h1, .page-h1 { margin: 0; font-family: var(--font-display); font-size: var(--text-h1); line-height: 1.08; font-weight: 400; max-width: 720px; }
.hero.inner-page h1 { font-size: clamp(34px, 8.5vw, 48px); }
.hero.legal h1 { font-size: clamp(34px, 8.5vw, 46px); }
.hero .lead { margin: 0; font-size: var(--text-lead); line-height: 1.5; color: var(--hero-text); max-width: 640px; }
.crumb { font-size: 14px; color: var(--hero-label); }
.crumb a { color: inherit; }
.hero-soft { background: var(--bg-soft); color: var(--ink); }
.hero-soft .crumb, .hero-soft .crumb a { color: var(--ink-muted); }
.hero-soft .lead { color: var(--ink-muted); }

/* forms */
.search-row { display: flex; flex-wrap: wrap; gap: 10px; max-width: 680px; }
.search-row input[type="search"], .search-row input[type="email"],
input[type="text"], input[type="email"], input[type="search"], select, textarea {
  font-family: inherit; font-size: 16px; color: var(--ink); border: 1px solid var(--border-input); background: #fff;
}
.search-row input[type="search"] {
  flex: 1 1 320px; min-width: 0; height: 52px; padding: 0 20px; border-radius: var(--radius-pill); border: 0;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: var(--tap-min);
  padding: 0 22px; border-radius: var(--radius-pill); border: 0; font-family: inherit; font-weight: 600; font-size: 15px;
  cursor: pointer; text-decoration: none; color: inherit;
}
.btn-hero { height: 52px; padding: 0 26px; background: var(--btn-hero-bg); color: var(--btn-hero-text); font-size: 16px; font-weight: 700; border: 0; border-radius: var(--radius-pill); cursor: pointer; }
.btn-primary { background: var(--btn-primary-bg); color: var(--btn-primary-text); }
.btn-save { background: var(--btn-save-bg); color: var(--btn-save-text); }
.btn-secondary { background: var(--btn-secondary-bg); color: var(--btn-secondary-text); border: 1px solid var(--btn-secondary-border); }
.btn-lg { height: 56px; padding: 0 34px; font-size: 17px; font-weight: 700; }
.pill {
  display: inline-flex; align-items: center; padding: 10px 18px; border-radius: var(--radius-pill);
  text-decoration: none; font-size: 15px; font-weight: 500; min-height: var(--tap-min);
}
.pill-white { background: #fff; color: var(--ink); }
.eyebrow { margin: 0; font-size: var(--text-eyebrow); letter-spacing: 0.08em; text-transform: uppercase; color: var(--hero-label); }

/* main sections */
.main { padding: 48px 0 56px; display: flex; flex-direction: column; gap: var(--section-gap); }
.main.tight { padding-top: 44px; gap: 40px; }
.section-head { display: flex; flex-wrap: wrap; gap: 8px; justify-content: space-between; align-items: baseline; }
h2, .h2 { margin: 0; font-family: var(--font-display); font-size: var(--text-h2); font-weight: 400; }
h3 { margin: 0; font-family: var(--font-display); font-size: var(--text-h3); font-weight: 400; }

.grid-occasions { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); gap: 16px; }
/* Same columns as .grid-occasions (300px min, 16px gap), but an incomplete last row is centered as a group.
   Column count n starts where n*300 + (n-1)*16 fits the container: 616px for 2, 932px for 3, 1248px for 4. */
.grid-occasions.center-last { display: flex; flex-wrap: wrap; justify-content: center; container-type: inline-size; }
.grid-occasions.center-last > * { flex: 0 0 100%; min-width: 0; }
@container (min-width: 616px) { .grid-occasions.center-last > * { flex-basis: calc((100% - 16px) / 2); } }
@container (min-width: 932px) { .grid-occasions.center-last > * { flex-basis: calc((100% - 32px) / 3); } }
@container (min-width: 1248px) { .grid-occasions.center-last > * { flex-basis: calc((100% - 48px) / 4); } }
.grid-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(160px, 100%), 1fr)); gap: 12px; }
.tile {
  display: flex; flex-direction: column; gap: 10px; padding: 24px; min-height: 180px;
  border-radius: var(--radius-card); text-decoration: none; box-sizing: border-box;
}
.tile .name { font-family: var(--font-display); font-size: 25px; }
.tile .quote { font-size: 15px; line-height: 1.5; }
.tile .meta { font-size: 13px; opacity: 0.9; }
.tile-sm {
  display: flex; flex-direction: column; justify-content: space-between; gap: 18px;
  min-height: 120px; padding: 20px; border-radius: var(--radius-tile); text-decoration: none;
}
.tile-sm .name { font-family: var(--font-display); font-size: 21px; }

.chips { display: flex; flex-wrap: wrap; gap: 10px; }
.panel { background: var(--bg-soft); border-radius: var(--radius-panel); padding: 28px; }
.panel-split { display: flex; flex-wrap: wrap; gap: 32px; align-items: center; }
.ad {
  height: 100px; border: 1px dashed var(--border-input); border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; letter-spacing: 0.08em; color: var(--ink-muted);
}

/* verse card preview (on-page) */
.verse-card {
  aspect-ratio: 2 / 3; max-width: 340px; width: 100%; border-radius: 14px; padding: 30px;
  display: flex; flex-direction: column; justify-content: space-between; color: #fff;
  background: var(--navy); background-size: cover; background-position: center; position: relative; overflow: hidden;
}
.verse-card.parchment {
  color: var(--verse-ink);
  background-image: url('/cards/blank-tall-parchment.jpg');
}
.verse-card .label { margin: 0; font-size: 12px; letter-spacing: 0.1em; opacity: 0.85; }
.verse-card .text { margin: 0; font-family: var(--font-display); font-size: 25px; line-height: 1.32; }
.verse-card .foot { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.verse-card .ref { font-weight: 600; font-size: 14px; }
.verse-card .site { font-size: 11px; opacity: 0.85; }

.actions { display: flex; flex-wrap: wrap; gap: 10px; }
.two-col { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); gap: 16px; }
.cta-row { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; justify-content: space-between; padding: 28px; border-radius: var(--radius-panel); background: var(--bg-soft); }

/* detail pages */
.verse-block {
  display: flex; flex-direction: column; gap: 14px; padding: 24px; border-radius: var(--radius-card);
  background: var(--bg-soft);
}
.verse-block blockquote {
  margin: 0; font-family: var(--font-display); font-size: clamp(20px, 4vw, 26px); line-height: 1.35; font-weight: 400;
}
.verse-block .meta-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.note-list { margin: 0; padding-left: 1.2em; color: var(--ink-2); }
.note-list li { margin: 0.4em 0; }
.card-line {
  padding: 14px 18px; border-radius: 12px; background: #fff; border: 1px solid var(--border);
  font-size: 15px; color: var(--ink-2);
}

/* random generator */
.gen-layout { display: flex; flex-wrap: wrap; gap: 40px; align-items: center; }
.gen-controls { flex: 1 1 360px; min-width: 0; display: flex; flex-direction: column; gap: 18px; }
.gen-card-wrap { flex: 0 1 380px; min-width: 0; display: flex; justify-content: center; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .field .lab { font-size: 14px; font-weight: 600; }
.field select, .field input {
  height: 46px; min-width: 180px; padding: 0 14px; border-radius: var(--radius-pill);
}
.toggle { display: flex; gap: 4px; padding: 4px; background: #fff; border: 1px solid var(--border-input); border-radius: var(--radius-pill); }
.toggle button {
  height: 36px; padding: 0 16px; border-radius: var(--radius-pill); border: 0; background: transparent;
  color: var(--ink); font-size: 14px; font-family: inherit; cursor: pointer;
}
.toggle button[aria-pressed="true"] { background: var(--btn-primary-bg); color: #fff; font-weight: 600; }

/* footer */
.site-footer { border-top: 1px solid var(--border); }
.site-footer .inner { padding-top: 28px; padding-bottom: 28px; display: flex; flex-direction: column; gap: 10px; font-size: 14px; color: var(--ink-muted); }
.fnav { display: flex; flex-wrap: wrap; gap: 18px; }
.fnav a { color: inherit; }
.fnav a[aria-current="page"] { font-weight: 700; color: var(--ink); }

/* letter jump */
.az { display: flex; flex-wrap: wrap; gap: 8px; }
.az a {
  width: 40px; height: 40px; border-radius: var(--radius-pill); background: #fff; color: var(--ink);
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none; font-weight: 600; font-size: 15px;
}
.letter-row { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; padding: 16px 0; border-top: 1px solid var(--border); }
.letter-row .letter { width: 48px; font-family: var(--font-display); font-size: var(--text-h2-sm); line-height: 1; }

.form-stack { display: flex; flex-direction: column; gap: 16px; }
.form-stack input, .form-stack select {
  height: 50px; padding: 0 18px; border-radius: var(--radius-pill); width: 100%;
}
.form-stack textarea { padding: 16px 18px; border-radius: 18px; width: 100%; resize: vertical; }
.version-choice { border: 0; margin: 0; padding: 0; min-width: 0; display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; }
.version-choice legend { padding: 0; margin: 0 0 6px; font-size: 14px; font-weight: 600; width: 100%; }
.version-choice label { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; font-size: 15px; cursor: pointer; }
.version-choice input[type="radio"], .form-stack .version-choice input[type="radio"] { width: 18px; height: 18px; padding: 0; margin: 0; flex: none; accent-color: var(--forest); }
.status { font-size: 14px; color: var(--ink-muted); }
.status.ok { color: var(--forest); }
.status.err { color: var(--btn-save-bg); }
/* Signup success: bold green, 6.4:1+ on white and the soft panel background. Errors stay red and regular weight. */
[data-signup] .status.ok { color: #166534; font-weight: 700; }

@media (max-width: 640px) {
  .tnav { gap: 14px; width: 100%; overflow-x: auto; flex-wrap: nowrap; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
  .verse-card .text { font-size: 22px; }
}

/* verse card preview (see card) */
.card-preview[hidden] { display: none !important; }
.card-preview {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(15, 23, 42, 0.55);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; overscroll-behavior: contain;
}
.card-preview .sheet {
  background: #fff; border-radius: 18px; padding: 20px;
  max-width: min(420px, 100%); width: 100%;
  display: flex; flex-direction: column; gap: 14px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.28);
}
.card-preview .sheet img {
  width: 100%; height: auto; border-radius: 14px; display: block;
  background: var(--bg-soft);
}
.card-preview .bar {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between;
}
.card-preview .bar .ref { font-size: 14px; font-weight: 600; color: var(--ink-2); }

.tr-links { display: inline-flex; gap: 6px; align-items: center; }
.tr-link {
  appearance: none; background: none; border: 0; padding: 0; margin: 0;
  font: inherit; font-weight: 600; font-size: 15px; color: var(--ink-muted);
  text-decoration: underline; text-underline-offset: 4px; cursor: pointer; min-height: 44px;
  display: inline-flex; align-items: center;
}
.tr-link[aria-pressed="true"] { color: var(--ink); text-decoration: none; cursor: default; }
.tr-link:hover { color: #000; }

.hero-mark--cutout {
  background: transparent;
  border-radius: 0;
  filter: drop-shadow(0 6px 18px rgba(0,0,0,0.22));
}
@media (min-width: 860px) {
  .hero.home .hero-mark--cutout { width: min(340px, 32vw); }
}
.hero-writing { display: flex; flex-direction: column; gap: 10px; min-width: 0; width: 100%; }
.hero.home .chips-nowrap {
  flex-wrap: wrap;
  overflow: visible;
  max-width: none;
  width: 100%;
}
.hero.home .chips-nowrap .pill { flex: 0 0 auto; white-space: nowrap; }

/* Transparent portrait marks retain their natural aspect ratio. */
@media (min-width: 860px) {
  .hero.inner-page .hero-mark { width: auto; height: 180px; max-width: 100%; object-fit: contain; border-radius: 0; opacity: 1; }
}

/* App screens (/app/confirm/, /app/unsubscribe/): navy band with a cream card, matching the site. */
.app-screen { background: var(--hero); padding: 48px 0 64px; display: flex; align-items: flex-start; }
.app-screen > .wrap { width: 100%; box-sizing: border-box; }
.app-card { max-width: 560px; margin: 0 auto; background: #FBF7EF; color: var(--ink); border-radius: var(--radius-panel); padding: 36px 32px; box-shadow: 0 20px 44px rgba(0,0,0,0.25); border-top: 6px solid var(--sand); }
.app-card--error { border-top-color: #B42318; }
.app-eyebrow { margin: 0 0 10px; font-size: var(--text-eyebrow); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-muted); }
.app-card h1 { margin: 0 0 14px; font-family: var(--font-display); font-weight: 400; font-size: clamp(30px, 7vw, 40px); line-height: 1.1; }
.app-text { margin: 0 0 24px; font-size: 17px; line-height: 1.6; color: var(--ink-2); }
.app-form { margin: 0 0 20px; }
.app-btn { height: 52px; padding: 0 30px; font-size: 16px; font-weight: 700; width: 100%; max-width: 320px; border: 0; cursor: pointer; }
.app-btn:focus-visible { outline: 3px solid var(--sand); outline-offset: 3px; }
.app-home { margin: 0; font-size: 15px; }
.app-home a { color: var(--ink); }
.site-footer .fnote { margin: 0; }
@media (max-width: 520px) { .app-screen { padding: 28px 0 40px; } .app-card { padding: 26px 20px; } .app-btn { max-width: none; } }
