/* ============================================================
   iConfess — design system
   "Modern basilica": luminous paper, cathedral arches,
   stained-glass light, Newsreader × Poppins.
   ============================================================ */

:root {
  /* Brand */
  --purple: #6A1BD8;
  --blue: #0088FF;     /* mass */
  --orange: #FF9F0A;
  --danger: #E0483D;   /* warnings, destructive actions — iOS `Palette.danger500` */

  /* Derived purples */
  --purple-deep: #2A0B57;
  --purple-night: #1B0736;
  --purple-soft: color-mix(in oklab, var(--purple) 8%, white);
  --purple-mist: color-mix(in oklab, var(--purple) 4%, white);

  /* Neutrals, tinted toward the brand hue */
  --ink: #221338;
  --ink-2: color-mix(in oklab, var(--ink) 72%, white);
  --ink-3: color-mix(in oklab, var(--ink) 46%, white);
  --paper: #FDFCFE;
  --paper-2: #F7F4FC;
  --paper-3: #F1ECFA;
  --hairline: color-mix(in oklab, var(--purple) 14%, transparent);
  --hairline-2: color-mix(in oklab, var(--purple) 26%, transparent);

  /* On-dark */
  --moon: #F4EFFC;
  --moon-2: color-mix(in oklab, var(--moon) 68%, var(--purple-night));

  /* Type */
  --serif: "Newsreader", Georgia, serif;
  --sans: "Poppins", "Segoe UI", sans-serif;

  /* Rhythm */
  --space-hero: clamp(6rem, 12vw, 10rem);
  --space-section: clamp(4.5rem, 9vw, 8.5rem);
  --gutter: clamp(1.25rem, 4vw, 3rem);
  --measure: 34rem;

  /* Radii */
  --r-sm: 10px;
  --r-md: 18px;
  --r-lg: 28px;
  --r-arch: 999px 999px 0 0;

  /* Shadow — violet-tinted, never gray */
  --shadow-sm: 0 1px 2px rgba(42, 11, 87, 0.06), 0 4px 14px rgba(42, 11, 87, 0.06);
  --shadow-md: 0 2px 6px rgba(42, 11, 87, 0.07), 0 14px 38px rgba(42, 11, 87, 0.10);
  --shadow-lg: 0 4px 10px rgba(42, 11, 87, 0.08), 0 30px 70px rgba(42, 11, 87, 0.16);

  /* Motion */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur: 480ms;
}

/* ---------- Base ---------- */

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.65;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}

::selection { background: color-mix(in oklab, var(--purple) 22%, white); }

h1, h2, h3, h4 {
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-weight: 500;
  line-height: 1.04;
  letter-spacing: -0.015em;
  text-wrap: balance;
}

em, .swash {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 450;
}

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

a { color: inherit; }

button, input, textarea, select { font: inherit; color: inherit; }

button { cursor: pointer; background: none; border: none; }

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

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

/* ---------- Layout primitives ---------- */

.wrap {
  width: min(72rem, 100% - 2 * var(--gutter));
  margin-inline: auto;
}

.wrap--narrow { width: min(50rem, 100% - 2 * var(--gutter)); }

/* ---------- Type utilities ---------- */

.eyebrow {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--purple);
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.eyebrow::before {
  content: "";
  width: 2rem;
  height: 1px;
  background: var(--purple);
  opacity: 0.5;
}

.eyebrow--bare::before { display: none; }

.display {
  font-size: clamp(2.6rem, 6.5vw, 4.9rem);
}

.headline {
  font-size: clamp(2rem, 4.4vw, 3.3rem);
}

.lede {
  font-size: clamp(1.02rem, 1.4vw, 1.16rem);
  line-height: 1.7;
  color: var(--ink-2);
  max-width: var(--measure);
  font-weight: 300;
}

.lede strong { font-weight: 500; color: var(--ink); }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.92rem 1.7rem;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 220ms var(--ease-out), box-shadow 220ms var(--ease-out),
              background 220ms var(--ease-out), color 220ms var(--ease-out);
}

.btn svg { flex-shrink: 0; transition: transform 220ms var(--ease-out); }
.btn:hover svg.arrow { transform: translateX(3px); }

.btn--primary {
  background: var(--purple);
  color: white;
  box-shadow: 0 1px 2px rgba(42,11,87,.2), 0 10px 26px color-mix(in oklab, var(--purple) 32%, transparent);
}
.btn--primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(42,11,87,.2), 0 16px 34px color-mix(in oklab, var(--purple) 40%, transparent);
}
.btn--primary:active { transform: translateY(0); }

.btn--ghost {
  color: var(--ink);
  box-shadow: inset 0 0 0 1.5px var(--hairline-2);
}
.btn--ghost:hover {
  box-shadow: inset 0 0 0 1.5px var(--purple);
  color: var(--purple);
}

.btn--moon {
  background: var(--moon);
  color: var(--purple-deep);
}
.btn--moon:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(0,0,0,.3); }

.btn--quiet {
  padding: 0.5rem 0.25rem;
  color: var(--purple);
  font-weight: 500;
  border-radius: 4px;
  gap: 0.4rem;
}
.btn--quiet:hover svg.arrow { transform: translateX(3px); }

.btn--sm { padding: 0.55rem 1.1rem; font-size: 0.84rem; }

/* ---------- Chips ---------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.32rem 0.85rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.chip--confession {
  background: color-mix(in oklab, var(--purple) 10%, white);
  color: color-mix(in oklab, var(--purple) 85%, black);
}

.chip--mass {
  background: color-mix(in oklab, var(--blue) 11%, white);
  color: color-mix(in oklab, var(--blue) 72%, black);
}

/* Adoration — the third service-category accent (ADR-004). Gold cannot be both
   vivid and legible, so the ink is mixed far darker than confession's or mass's. */
.chip--adoration {
  background: color-mix(in oklab, var(--orange) 16%, white);
  color: color-mix(in oklab, var(--orange) 50%, black);
}

.chip--flame {
  background: color-mix(in oklab, var(--orange) 15%, white);
  color: color-mix(in oklab, var(--orange) 55%, black);
}

.chip .dot {
  width: 6px; height: 6px; border-radius: 999px; background: currentColor;
}

/* ---------- Header ---------- */

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  transition: background 300ms var(--ease-out), box-shadow 300ms var(--ease-out),
              backdrop-filter 300ms var(--ease-out);
}

.site-header.is-scrolled {
  background: color-mix(in oklab, var(--paper) 86%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 1px 0 var(--hairline);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding-block: 1.05rem;
}

.wordmark {
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--ink);
  display: flex;
  align-items: baseline;
  line-height: 1;
}

.wordmark i {
  font-style: italic;
  font-weight: 500;
  color: var(--purple);
  margin-right: 0.02em;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(1.2rem, 3vw, 2.4rem);
}

.site-nav a:not(.btn) {
  font-size: 0.88rem;
  font-weight: 500;
  text-decoration: none;
  color: var(--ink-2);
  position: relative;
  padding-block: 0.3rem;
  transition: color 200ms;
}

.site-nav a:not(.btn):hover { color: var(--ink); }

.site-nav a:not(.btn)::after {
  content: "";
  position: absolute;
  left: 0; right: 100%; bottom: 0;
  height: 1.5px;
  background: var(--purple);
  transition: right 260ms var(--ease-out);
}

.site-nav a:not(.btn):hover::after,
.site-nav a[aria-current="page"]:not(.btn)::after { right: 0; }

.site-nav a[aria-current="page"]:not(.btn) { color: var(--ink); }

.nav-toggle { display: none; }

@media (max-width: 760px) {
  .site-nav {
    position: fixed;
    inset: 0;
    background: var(--paper);
    flex-direction: column;
    justify-content: center;
    gap: 2rem;
    font-size: 1.4rem;
    transform: translateY(-100%);
    transition: transform 420ms var(--ease-out);
    z-index: 90;
  }
  .site-nav.is-open { transform: translateY(0); }
  .site-nav a:not(.btn) { font-size: 1.3rem; }
  .nav-toggle {
    display: grid;
    place-items: center;
    width: 42px; height: 42px;
    border-radius: 999px;
    box-shadow: inset 0 0 0 1.5px var(--hairline-2);
    z-index: 95;
    position: relative;
  }
  .nav-toggle span, .nav-toggle span::before, .nav-toggle span::after {
    display: block;
    width: 16px; height: 1.6px;
    background: var(--ink);
    border-radius: 2px;
    transition: transform 300ms var(--ease-out), opacity 200ms;
    content: "";
    position: relative;
  }
  .nav-toggle span::before { position: absolute; top: -5px; }
  .nav-toggle span::after { position: absolute; top: 5px; }
  .nav-toggle.is-open span { background: transparent; }
  .nav-toggle.is-open span::before { transform: rotate(45deg); top: 0; }
  .nav-toggle.is-open span::after { transform: rotate(-45deg); top: 0; }
}

/* ---------- Footer ---------- */

.site-footer {
  background: var(--purple-night);
  color: var(--moon-2);
  padding: clamp(3.5rem, 7vw, 5.5rem) 0 2.5rem;
  position: relative;
  overflow: hidden;
}

.site-footer::before {
  /* faint rose-window glow */
  content: "";
  position: absolute;
  top: -40%; right: -10%;
  width: 46rem; height: 46rem;
  border-radius: 999px;
  background: radial-gradient(circle,
    color-mix(in oklab, var(--purple) 34%, transparent) 0%,
    transparent 62%);
  pointer-events: none;
}

.site-footer .wordmark { color: var(--moon); font-size: 1.7rem; }
.site-footer .wordmark i { color: color-mix(in oklab, var(--purple) 45%, var(--moon)); }

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, minmax(8rem, 1fr));
  gap: 2.5rem;
  position: relative;
}

@media (max-width: 760px) {
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .footer-grid > :first-child { grid-column: 1 / -1; }
}

.footer-col h4 {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: color-mix(in oklab, var(--moon) 46%, var(--purple-night));
  margin-bottom: 1.1rem;
}

.footer-col a {
  display: block;
  font-size: 0.9rem;
  text-decoration: none;
  padding-block: 0.28rem;
  color: var(--moon-2);
  transition: color 200ms;
}
.footer-col a:hover { color: var(--moon); }

.footer-verse {
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.15rem;
  line-height: 1.55;
  color: var(--moon);
  max-width: 24rem;
  margin-top: 1.2rem;
}

.footer-verse cite {
  display: block;
  font-family: var(--sans);
  font-style: normal;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-top: 0.8rem;
  color: color-mix(in oklab, var(--moon) 50%, var(--purple-night));
}

.footer-base {
  margin-top: clamp(2.5rem, 5vw, 4rem);
  padding-top: 1.6rem;
  border-top: 1px solid color-mix(in oklab, var(--moon) 12%, transparent);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: color-mix(in oklab, var(--moon) 44%, var(--purple-night));
  position: relative;
}

/* ---------- The arch ---------- */

.arch {
  border-radius: var(--r-arch);
  overflow: hidden;
}

/* Stained-glass light: layered translucent brand-color washes */
.glass-light {
  background:
    radial-gradient(120% 90% at 18% 8%,  color-mix(in oklab, var(--purple) 42%, transparent) 0%, transparent 55%),
    radial-gradient(110% 80% at 85% 18%, color-mix(in oklab, var(--blue) 30%, transparent) 0%, transparent 52%),
    radial-gradient(120% 100% at 70% 95%, color-mix(in oklab, var(--orange) 30%, transparent) 0%, transparent 56%),
    radial-gradient(100% 100% at 25% 90%, color-mix(in oklab, var(--purple) 26%, transparent) 0%, transparent 50%),
    linear-gradient(170deg, #F3EDFB 0%, #EDE4FA 100%);
}

/* ---------- Section scaffolding ---------- */

.section { padding-block: var(--space-section); position: relative; }

.section--tint { background: var(--paper-2); }

.section-head {
  display: grid;
  gap: 1.4rem;
  max-width: 46rem;
  margin-bottom: clamp(2.6rem, 6vw, 4.5rem);
}

/* ---------- Cards & surfaces ---------- */

.surface {
  background: white;
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

/* ---------- Reveal on scroll ---------- */

html.js .reveal {
  opacity: 0;
  transform: translateY(26px);
  transition: opacity 700ms var(--ease-out), transform 700ms var(--ease-out);
  transition-delay: var(--reveal-delay, 0ms);
}

html.js .reveal.is-visible { opacity: 1; transform: none; }

/* ---------- Forms ---------- */

.field {
  width: 100%;
  padding: 0.85rem 1.1rem;
  border-radius: var(--r-sm);
  border: 1.5px solid var(--hairline-2);
  background: white;
  transition: border-color 200ms, box-shadow 200ms;
  font-size: 0.95rem;
}

.field:focus {
  outline: none;
  border-color: var(--purple);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--purple) 12%, transparent);
}

textarea.field { resize: vertical; min-height: 6.5rem; line-height: 1.6; }

/* ---------- Checkbox glyph ---------- */

.fc-check {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  border-radius: 6px;
  border: 1.5px solid var(--hairline-2);
  display: grid;
  place-items: center;
  color: white;
  transition: background 200ms, border-color 200ms;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  bottom: 1.6rem;
  left: 50%;
  transform: translate(-50%, 140%);
  background: var(--ink);
  color: var(--paper);
  font-size: 0.88rem;
  font-weight: 500;
  padding: 0.8rem 1.5rem;
  border-radius: 999px;
  box-shadow: var(--shadow-md);
  transition: transform 420ms var(--ease-out);
  z-index: 200;
  max-width: min(90vw, 30rem);
  text-align: center;
}

.toast.is-shown { transform: translate(-50%, 0); }

/* ---------- Confirm dialog ---------- */

.ic-dialog-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-items: center;
  padding: var(--gutter);
  background: color-mix(in oklab, var(--purple-night) 38%, transparent);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  opacity: 0;
  transition: opacity 280ms var(--ease-out);
}

.ic-dialog-overlay.is-shown { opacity: 1; }

.ic-dialog {
  background: var(--paper);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  padding: clamp(1.6rem, 4vw, 2.2rem);
  width: min(100%, 27rem);
  transform: translateY(16px);
  transition: transform 360ms var(--ease-out);
}

.ic-dialog-overlay.is-shown .ic-dialog { transform: none; }

.ic-dialog h3 { font-size: 1.5rem; margin-bottom: 0.7rem; }

.ic-dialog p { font-size: 0.92rem; color: var(--ink-2); line-height: 1.6; }

.ic-dialog__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.6rem;
}

/* ---------- First run (ADR-037, spec/features/web-first-run.md) ----------
   A wider dialog than .ic-dialog's 27rem: pane 2 carries three destination
   rows, and every value here is a token. */

.ic-firstrun { width: min(100%, 33rem); }

.ic-firstrun .eyebrow { margin-bottom: 0.75rem; }

.ic-firstrun h3 { font-family: var(--serif); line-height: 1.15; }

.ic-firstrun p + p { margin-top: 0.7rem; }

.ic-firstrun__link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 1rem;
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--purple);
  text-decoration: none;
}

.ic-firstrun__link:hover { text-decoration: underline; }

.ic-firstrun__dests {
  display: grid;
  gap: 0.55rem;
  margin-top: 1.2rem;
}

.ic-firstrun__dest {
  display: grid;
  gap: 0.15rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  background: var(--purple-mist);
  text-decoration: none;
  transition: border-color 200ms var(--ease-out), background 200ms var(--ease-out);
}

.ic-firstrun__dest:hover {
  border-color: var(--hairline-2);
  background: var(--purple-soft);
}

.ic-firstrun__dest strong {
  font-family: var(--sans);
  font-size: 0.94rem;
  color: var(--ink);
}

.ic-firstrun__dest span {
  font-size: 0.84rem;
  color: var(--ink-2);
  line-height: 1.5;
}

.ic-firstrun__actions { align-items: center; }

/* The dots take the leading space so the buttons stay right-aligned with the
   rest of the dialog vocabulary. */
.ic-firstrun__dots {
  display: flex;
  gap: 0.35rem;
  margin-right: auto;
}

.ic-firstrun__dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--hairline-2);
  transition: background 200ms var(--ease-out), width 200ms var(--ease-out);
}

.ic-firstrun__dot.is-on { width: 18px; background: var(--purple); }

/* ---------- Page hero (inner pages) ---------- */

.page-hero {
  padding-top: calc(var(--space-hero) + 1rem);
  padding-bottom: clamp(3rem, 6vw, 5rem);
  position: relative;
  overflow: hidden;
}

.page-hero__glow {
  position: absolute;
  top: -30%;
  right: -12%;
  width: 52rem;
  height: 52rem;
  border-radius: 999px;
  pointer-events: none;
  opacity: 0.5;
  background:
    radial-gradient(circle at 40% 40%, color-mix(in oklab, var(--purple) 16%, transparent) 0%, transparent 58%),
    radial-gradient(circle at 66% 60%, color-mix(in oklab, var(--blue) 10%, transparent) 0%, transparent 52%);
}

.page-hero .eyebrow { margin-bottom: 1.4rem; }
.page-hero .lede { margin-top: 1.6rem; }

/* ---------- Segmented control ---------- */

.seg {
  display: inline-flex;
  padding: 4px;
  gap: 4px;
  background: var(--paper-3);
  border-radius: 999px;
}

.seg button {
  padding: 0.6rem 1.5rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--ink-3);
  transition: color 200ms, background 240ms var(--ease-out), box-shadow 240ms;
}

.seg button:hover { color: var(--ink); }

.seg button.is-active {
  background: white;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

/* ---------- Progress hairline ---------- */

.progress-line {
  height: 3px;
  border-radius: 999px;
  background: var(--paper-3);
  overflow: hidden;
}

.progress-line > i {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--purple), color-mix(in oklab, var(--purple) 60%, var(--blue)));
  transition: width 500ms var(--ease-out);
}

/* ---------- Small helpers ---------- */

.muted { color: var(--ink-3); }
.center { text-align: center; }

/* "Kind and number" (ADR-013) — the count qualifying a marked matter, in the
   examination summary and the walkthrough's list-sins step. Shared, so it is
   here rather than in either page. Deliberately quiet: it sits beside the
   statement and must never compete with it, because the matter is what is
   confessed and the number only qualifies it. */
.count-note {
  color: var(--ink-3);
  font-size: 0.86rem;
  white-space: nowrap;
}

.roman {
  font-family: var(--serif);
  font-weight: 500;
  font-style: italic;
  color: var(--purple);
}

hr.rule {
  border: none;
  height: 1px;
  background: var(--hairline);
  margin-block: clamp(2rem, 5vw, 3.5rem);
}
