/* ==========================================================================
   Sancta — sanctaapp.com
   An heirloom, not an app.

   Every colour, rule, texture and mark on this page is authored here or in
   the HTML. The page fetches nothing from anywhere: no webfonts, no CDN, no
   analytics, no pixels. Tokens mirror packages/theme (docs/DESIGN.md §2).
   ========================================================================== */

/* --- tokens --------------------------------------------------------------- */

:root {
  /* paper */
  --paper: #FAF6EF;
  --linen: #F1EADD;
  --mat: #FFFCF5;
  --rule: #E5DCCB;

  /* ink */
  --ink: #2B2820;
  --faded: #6E675C;

  /* brass */
  --brass: #A8894E;
  --brass-deep: #7E6435;
  --flame: #D9A441;

  --btn-bg: #7E6435;
  --btn-bg-hover: #6A5329;
  --btn-ink: #FAF6EF;

  --shadow-rgb: 43, 40, 32;
  --grain: .045;

  /* type */
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* a strict scale — nothing between these steps */
  --step--1: 0.875rem;   /* metadata */
  --step-0: 1.0625rem;   /* body, 17px, as in the app */
  --step-1: 1.1875rem;   /* lede */
  --step-2: 1.375rem;    /* card titles */
  --step-3: clamp(1.5rem, 1.15rem + 1.5vw, 2rem);       /* section titles */
  --step-4: clamp(2rem, 1.25rem + 3.4vw, 3.25rem);      /* the promise */

  --measure: 34rem;
  --gutter: clamp(1.25rem, 5vw, 2.5rem);
  --page: 60rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #211D17;
    --linen: #2A251D;
    --mat: #2E2820;
    --rule: #3A342A;

    --ink: #EDE4D3;
    --faded: #A79B87;

    --brass: #B99A5B;
    --brass-deep: #D9BE86;
    --flame: #D9A441;

    --btn-bg: #B99A5B;
    --btn-bg-hover: #CBB075;
    --btn-ink: #211D17;

    --shadow-rgb: 0, 0, 0;
    --grain: .05;
  }
}

/* --- ground --------------------------------------------------------------- */

*, *::before, *::after { box-sizing: border-box; }

html {
  background-color: var(--paper);
  /* a slow warmth at the head of the page, as if a candle were just off-frame */
  background-image:
    radial-gradient(120% 55% at 50% -8%, rgba(217, 164, 65, .13), rgba(217, 164, 65, 0) 62%);
  background-repeat: no-repeat;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--serif);
  font-size: var(--step-0);
  line-height: 1.72;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* the grain: authored noise, laid behind the text rather than over it */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: var(--grain);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='g'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23g)'/%3E%3C/svg%3E"),
    repeating-linear-gradient(0deg, rgba(43, 40, 32, .022) 0 1px, rgba(43, 40, 32, 0) 1px 4px);
  background-size: 180px 180px, auto;
}

img, svg { max-width: 100%; }

/* --- shared type ---------------------------------------------------------- */

h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 600;
  line-height: 1.14;
  letter-spacing: -0.012em;
  margin: 0;
  text-wrap: balance;
}

p { margin: 0; }

.label {
  display: block;
  font-family: var(--sans);
  font-size: 0.6875rem;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: var(--faded);
  margin: 0;
}

em { font-style: italic; }
strong { font-weight: 600; }

a { color: var(--brass-deep); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { color: var(--ink); }

/* --- focus, and getting past the top ------------------------------------- */

:focus-visible {
  outline: 2px solid var(--brass-deep);
  outline-offset: 3px;
  border-radius: 2px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 10;
  background: var(--mat);
  color: var(--ink);
  border: 1px solid var(--rule);
  padding: 0.75rem 1.25rem;
  font-family: var(--sans);
  font-size: var(--step--1);
  text-decoration: none;
}
.skip-link:focus {
  left: var(--gutter);
  top: 1rem;
}

/* --- masthead ------------------------------------------------------------- */

.masthead {
  padding: clamp(2.5rem, 6vw, 4.5rem) var(--gutter) 0;
}

.masthead-inner {
  max-width: var(--page);
  margin: 0 auto;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: clamp(0.75rem, 2vw, 1.1rem);
  color: inherit;
  text-decoration: none;
}

.mark { display: block; flex: none; overflow: visible; }

.brand-text { display: block; }

.wordmark {
  display: block;
  font-family: var(--serif);
  font-size: 1.875rem;
  font-weight: 600;
  letter-spacing: 0.015em;
  line-height: 1.1;
}

.brand .label { margin-top: 0.35rem; }

/* --- hero ----------------------------------------------------------------- */

.hero {
  max-width: var(--page);
  margin: 0 auto;
  padding: clamp(3.5rem, 11vw, 7.5rem) var(--gutter) clamp(3rem, 9vw, 6rem);
}

.hero h1 {
  font-size: var(--step-4);
  line-height: 1.07;
  max-width: 21ch;
}

.hero .lede {
  margin-top: clamp(1.5rem, 3vw, 2.25rem);
  max-width: var(--measure);
  font-size: var(--step-1);
  line-height: 1.66;
  color: var(--faded);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: clamp(1.25rem, 3vw, 2rem);
  margin-top: clamp(2rem, 4vw, 2.75rem);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 0.8rem 1.75rem;
  border: 1px solid transparent;
  border-radius: 2px;
  background: var(--btn-bg);
  color: var(--btn-ink);
  font-family: var(--sans);
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .3s ease;
}
.btn:hover { background: var(--btn-bg-hover); color: var(--btn-ink); }
.btn[disabled] { opacity: .6; cursor: default; }

.quiet-link {
  font-family: var(--serif);
  font-size: var(--step-0);
  color: var(--faded);
  text-decoration-color: var(--rule);
}
.quiet-link:hover { color: var(--ink); text-decoration-color: var(--brass); }

/* --- sections ------------------------------------------------------------- */

.section {
  max-width: var(--page);
  margin: 0 auto;
  padding: clamp(3.5rem, 9vw, 6rem) var(--gutter);
  border-top: 1px solid var(--rule);
  scroll-margin-top: 2rem;
}

.section-head { max-width: var(--measure); }
.section-head .label { margin-bottom: 0.9rem; }
.section-head h2 { font-size: var(--step-3); }

.section-lede {
  margin-top: 1.15rem;
  color: var(--faded);
  font-size: var(--step-1);
  line-height: 1.65;
}

/* the arch, used as a section marker */
.arch-mark {
  display: block;
  width: 22px;
  height: 29px;
  margin-bottom: 1.4rem;
  border: 1.5px solid var(--brass);
  border-bottom: 0;
  border-radius: 11px 11px 0 0;
  opacity: .9;
}

/* --- the four cards, matted ---------------------------------------------- */

.cards {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(1.25rem, 2.5vw, 1.75rem);
  margin-top: clamp(2.5rem, 5vw, 3.5rem);
}

/* four cards want a quarto, not a row of three and an orphan */
@media (min-width: 42rem) {
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.card {
  background: var(--mat);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: clamp(1.5rem, 3vw, 2.1rem);
  box-shadow:
    0 1px 2px rgba(var(--shadow-rgb), .05),
    0 16px 34px -26px rgba(var(--shadow-rgb), .55);
}

.card .label { margin-bottom: 0.85rem; }
.card h3 { font-size: var(--step-2); }
.card p:last-child { margin-top: 0.9rem; color: var(--faded); }

/* --- the faith register --------------------------------------------------- */

.year-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(2.5rem, 5vw, 3.5rem);
  align-items: start;
  margin-top: clamp(2.5rem, 5vw, 3.5rem);
}

@media (min-width: 54rem) {
  .year-layout { grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); }
}

.notes { margin: 0; }

.notes dt {
  font-family: var(--serif);
  font-size: var(--step-1);
  font-weight: 600;
  line-height: 1.3;
  padding-top: 1.4rem;
  border-top: 1px solid var(--rule);
}
.notes dt:first-child { padding-top: 0; border-top: 0; }

.notes dd {
  margin: 0.6rem 0 1.6rem;
  max-width: var(--measure);
  color: var(--faded);
}

.aside {
  max-width: var(--measure);
  padding-top: 1.4rem;
  border-top: 1px solid var(--rule);
  color: var(--faded);
  font-size: var(--step--1);
  line-height: 1.75;
}

/* the matted plate — a print, laid on paper */
.plate { margin: 0; }

.mat {
  background: var(--mat);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: clamp(1.1rem, 2.5vw, 1.6rem);
  box-shadow:
    0 1px 2px rgba(var(--shadow-rgb), .06),
    0 20px 40px -28px rgba(var(--shadow-rgb), .6);
}

.engraving {
  display: block;
  width: 100%;
  height: auto;
  background: var(--linen);
  border: 1px solid var(--rule);
}

.plate figcaption {
  margin-top: 1rem;
  color: var(--faded);
  font-size: var(--step--1);
  line-height: 1.7;
}

/* --- the pledge ----------------------------------------------------------- */

.pledge {
  margin: clamp(2.5rem, 5vw, 3.5rem) 0 0;
  max-width: var(--measure);
  padding-left: clamp(1.25rem, 3vw, 2rem);
  border-left: 1.5px solid var(--brass);
}

.pledge blockquote { margin: 0; }

.pledge blockquote p {
  font-size: var(--step-2);
  line-height: 1.5;
  font-style: italic;
  letter-spacing: -0.008em;
}

.pledge figcaption {
  margin-top: 1.1rem;
  font-family: var(--sans);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: var(--faded);
}

.promises {
  list-style: none;
  margin: clamp(2.25rem, 4vw, 3rem) 0 0;
  padding: 0;
  max-width: calc(var(--measure) + 4rem);
}

.promises li {
  padding: 1.25rem 0 1.25rem 1.75rem;
  border-top: 1px solid var(--rule);
  color: var(--faded);
  position: relative;
}
.promises li:first-child { border-top: 0; padding-top: 0; }
.promises li:last-child { padding-bottom: 0; }

.promises li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 1.9rem;
  width: 8px;
  height: 11px;
  border: 1.25px solid var(--brass);
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
}
.promises li:first-child::before { top: 0.65rem; }

.promises strong { color: var(--ink); font-weight: 600; }

/* --- the waiting list ----------------------------------------------------- */

.waitlist-card {
  margin-top: clamp(2.25rem, 4vw, 3rem);
  max-width: 32rem;
  background: var(--mat);
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: clamp(1.5rem, 4vw, 2.25rem);
  box-shadow:
    0 1px 2px rgba(var(--shadow-rgb), .05),
    0 18px 36px -28px rgba(var(--shadow-rgb), .55);
}

.waitlist-form {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.waitlist-form[hidden] { display: none; }

.field { display: block; }
.field .label { margin-bottom: 0.6rem; }

input[type="email"],
input[type="text"] {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: 0.75rem 0.9rem;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-bottom: 1.5px solid var(--brass);
  border-radius: 2px;
  font-family: var(--serif);
  font-size: var(--step-0);
  line-height: 1.5;
}

input[type="email"]::placeholder { color: var(--faded); opacity: .75; }

input[type="email"]:focus-visible {
  outline: 2px solid var(--brass-deep);
  outline-offset: 2px;
}

.waitlist-form .btn { align-self: flex-start; }

/* a quiet trap for machines; never shown, never in the tab order */
.decoy {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.form-status {
  margin-top: 1.25rem;
  font-size: var(--step-0);
  line-height: 1.6;
  color: var(--faded);
}
.form-status:empty { display: none; }
.form-status[data-state="kept"] { color: var(--ink); }
.form-status[data-state="trouble"] { color: var(--ink); }
.form-status[data-state="kept"]::before,
.form-status[data-state="trouble"]::before {
  content: "";
  display: block;
  width: 22px;
  height: 1px;
  margin-bottom: 0.9rem;
  background: var(--brass);
}

.note {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
  color: var(--faded);
  font-size: var(--step--1);
  line-height: 1.7;
}

/* --- colophon ------------------------------------------------------------- */

.colophon {
  max-width: var(--page);
  margin: 0 auto;
  padding: clamp(3rem, 7vw, 4.5rem) var(--gutter) clamp(3.5rem, 8vw, 5rem);
  border-top: 1px solid var(--rule);
  text-align: center;
}

.colophon-mark .mark { margin: 0 auto 0.9rem; }

.wordmark-small { font-size: 1.375rem; }

.colophon-mark .label { margin-top: 0.5rem; }

.colophon-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem clamp(1.25rem, 4vw, 2.25rem);
  margin-top: clamp(1.75rem, 4vw, 2.5rem);
  padding-top: clamp(1.75rem, 4vw, 2.5rem);
  border-top: 1px solid var(--rule);
}

.colophon-links a {
  font-family: var(--sans);
  font-size: var(--step--1);
  color: var(--faded);
  text-decoration-color: var(--rule);
}
.colophon-links a:hover { color: var(--ink); text-decoration-color: var(--brass); }

.colophon-note {
  margin: 1.5rem auto 0;
  max-width: 40rem;
  color: var(--faded);
  font-size: var(--step--1);
  line-height: 1.7;
}
.colophon-note:last-child { margin-top: 0.75rem; }

/* --- the settle ----------------------------------------------------------- */

.has-js .reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .85s ease, transform .85s ease;
}
.has-js .reveal.is-in {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .has-js .reveal,
  .has-js .reveal.is-in {
    opacity: 1;
    transform: none;
    transition: none;
  }
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* --- print (a page about a printed book ought to print) ------------------- */

@media print {
  html, body { background: #fff; color: #000; }
  body::before, .arch-mark, .actions, #waiting-list { display: none; }
  .section { border-top: 1px solid #ccc; page-break-inside: avoid; }
  .card, .mat, .waitlist-card { box-shadow: none; }
}
