/* ==================================================================
   DIVINE CROSS CODES — foundations
   Navy, gold and cream. Built large and calm for readers aged 50+:
   18px base type, 56px touch targets, high contrast, generous space.
   ================================================================== */

:root {
  /* --- surface ---------------------------------------------------- */
  --navy-950: #060B16;
  --navy-900: #08101F;
  --navy-850: #0B1628;
  --navy-800: #0E1B32;
  --navy-750: #132441;
  --navy-700: #1A2E52;
  --navy-600: #233C68;
  --navy-500: #31507F;

  /* --- gold ------------------------------------------------------- */
  --gold-300: #F3E2A8;
  --gold-400: #E8C766;
  --gold-500: #D4AF37;
  --gold-600: #B08D2B;
  --gold-700: #7E641F;

  /* --- text ------------------------------------------------------- */
  --cream: #F6F1E4;
  --cream-2: #E3DCC9;
  --muted: #AFBBD2;
  --muted-2: #8494B0;
  --ink: #17202E;

  /* --- semantic --------------------------------------------------- */
  --bg: var(--navy-900);
  --bg-raised: var(--navy-800);
  --card: var(--navy-750);
  --card-2: var(--navy-700);
  --line: rgba(212, 175, 55, 0.18);
  --line-soft: rgba(255, 255, 255, 0.08);
  --accent: var(--gold-500);
  --accent-soft: rgba(212, 175, 55, 0.12);
  --danger: #E8836F;
  --success: #7FC79A;

  /* --- shape and depth -------------------------------------------- */
  --r-sm: 10px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 28px;
  --shadow-1: 0 2px 10px rgba(0, 0, 0, 0.28);
  --shadow-2: 0 10px 34px rgba(0, 0, 0, 0.42);
  --shadow-gold: 0 8px 26px rgba(212, 175, 55, 0.22);

  /* --- rhythm ------------------------------------------------------ */
  --gap-1: 0.5rem;
  --gap-2: 0.85rem;
  --gap-3: 1.25rem;
  --gap-4: 1.75rem;
  --gap-5: 2.5rem;
  --tap: 56px;

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

  --shell: 560px;
  --nav-h: 78px;

  color-scheme: dark;
}

/* Adjustable text size — Profile → Text Size. Everything is in rem. */
html { font-size: 18px; }
html[data-text-size="2"] { font-size: 20px; }
html[data-text-size="3"] { font-size: 22.5px; }

/* Night mode dims the whole environment for evening prayer. */
html[data-night="true"] {
  --bg: var(--navy-950);
  --bg-raised: var(--navy-900);
  --card: #0D1A2F;
  --card-2: #122340;
  --cream: #E4DDCC;
  --muted: #94A2BC;
  --accent: var(--gold-600);
  --gold-500: #B99A34;
  --gold-400: #CBAE55;
}

/* ------------------------------------------------------------------ *
 * Reset
 * ------------------------------------------------------------------ */

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

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--cream);
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-wrap: break-word;
}

body.is-locked { overflow: hidden; }

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.01em;
}

p { margin: 0; }

a { color: var(--gold-400); text-decoration: none; }
a:hover { color: var(--gold-300); }

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

button { cursor: pointer; }

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

ul, ol { margin: 0; padding: 0; list-style: none; }

hr {
  border: 0;
  border-top: 1px solid var(--line-soft);
  margin: var(--gap-3) 0;
}

/* ------------------------------------------------------------------ *
 * Focus — always visible, never subtle
 * ------------------------------------------------------------------ */

:focus-visible {
  outline: 3px solid var(--gold-400);
  outline-offset: 3px;
  border-radius: 6px;
}

.sr-only {
  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: fixed;
  left: 50%;
  top: 0;
  /* Translating by its own height keeps it hidden whatever the text size. */
  transform: translate(-50%, -120%);
  z-index: 200;
  background: var(--gold-500);
  color: var(--navy-900);
  padding: 0.9rem 1.4rem;
  border-radius: 0 0 var(--r-md) var(--r-md);
  font-weight: 700;
  white-space: nowrap;
  transition: transform 0.16s ease;
}
.skip-link:focus { transform: translate(-50%, 0); }

/* ------------------------------------------------------------------ *
 * Type scale
 * ------------------------------------------------------------------ */

.t-display {
  font-family: var(--serif);
  font-size: 2rem;
  line-height: 1.18;
  font-weight: 500;
  color: var(--cream);
}

.t-title {
  font-family: var(--serif);
  font-size: 1.5rem;
  line-height: 1.25;
  font-weight: 500;
}

.t-heading {
  font-size: 1.15rem;
  font-weight: 650;
  line-height: 1.3;
}

/* These labels are sometimes written on a <span> inside a flex row; they must
   still stack rather than run on. */
span.t-heading, span.t-eyebrow, span.t-title { display: block; }

.t-body { font-size: 1rem; line-height: 1.65; }

.t-small { font-size: 0.86rem; line-height: 1.55; }

.t-muted { color: var(--muted); }

.t-eyebrow {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--gold-500);
}

.t-serif { font-family: var(--serif); }

.t-center { text-align: center; }

.t-gold { color: var(--gold-400); }

/* ------------------------------------------------------------------ *
 * Layout shell
 * ------------------------------------------------------------------ */

#app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.shell {
  width: 100%;
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0 1.15rem;
}

#view {
  flex: 1;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px) + 1.5rem);
}

#view.is-immersive { padding-bottom: 2rem; }

.stack   { display: flex; flex-direction: column; gap: var(--gap-3); }
.stack-2 { display: flex; flex-direction: column; gap: var(--gap-2); }
.stack-4 { display: flex; flex-direction: column; gap: var(--gap-4); }
.row {
  display: flex;
  align-items: center;
  gap: var(--gap-2);
}
.row--between { justify-content: space-between; }
.row--wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }

.section { margin-top: var(--gap-4); }
.section__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--gap-2);
  margin-bottom: var(--gap-2);
}

.divider-ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  margin: var(--gap-4) 0;
  color: var(--gold-600);
}
.divider-ornament::before,
.divider-ornament::after {
  content: "";
  height: 1px;
  flex: 1;
  max-width: 88px;
  background: linear-gradient(90deg, transparent, var(--gold-700), transparent);
}

/* ------------------------------------------------------------------ *
 * Icons
 * ------------------------------------------------------------------ */

.icon { flex: none; }

.icon-btn {
  width: var(--tap);
  height: var(--tap);
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--cream);
  flex: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.icon-btn:hover {
  background: var(--accent-soft);
  border-color: var(--gold-600);
}

/* ------------------------------------------------------------------ *
 * Motion
 * ------------------------------------------------------------------ */

@keyframes fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

@keyframes breathe {
  0%, 100% { transform: scale(1);    opacity: 0.55; }
  50%      { transform: scale(1.09); opacity: 0.95; }
}

.animate-in { animation: fade-up 0.34s cubic-bezier(0.22, 0.9, 0.3, 1) both; }

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

/* ------------------------------------------------------------------ *
 * Desktop — keep the calm phone measure, add breathing room
 * ------------------------------------------------------------------ */

@media (min-width: 900px) {
  :root { --shell: 620px; }
  body {
    background:
      radial-gradient(1100px 620px at 50% -12%, rgba(212, 175, 55, 0.08), transparent 62%),
      var(--bg);
  }
}
