/* Divine Key — site styles
   The colours are sampled from the app: its sky runs from dawn orange down to plum,
   cards are parchment, the accent is ember and the tab bar is night. */

@font-face {
  font-family: "Lora";
  src: url("assets/fonts/lora-variable.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Lora";
  src: url("assets/fonts/lora-italic-variable.woff2") format("woff2");
  font-weight: 400 700;
  font-style: italic;
  font-display: swap;
}

:root {
  --dawn: #EF8A5E;
  --ember: #D95B4F;
  --ember-deep: #9C3127;      /* ember, dark enough for small text on parchment */
  --plum: #692C4D;
  --night: #3A1C3E;
  --parchment: #F9ECE4;
  --parchment-dim: #F4DACF;   /* quieter text on the dark part of the sky */
  --ink: #2A1330;
  --ink-soft: #5A3A52;
  --gold: #EFB153;

  --serif: "Lora", Georgia, "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --gutter: clamp(1.25rem, 5vw, 4rem);
}

/* ── Base ─────────────────────────────────────────────── */

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

html {
  background: var(--dawn);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, p, dl, dd, ul, figure, fieldset { margin: 0; }
ul { padding: 0; list-style: none; }
img { display: block; max-width: 100%; height: auto; }
a { color: inherit; text-underline-offset: 0.2em; }

::selection { background: var(--ember); color: #fff; }

:focus-visible {
  outline: 3px solid var(--focus, currentColor);
  outline-offset: 4px;
  border-radius: 0.35rem;
}

/* The falling characters sit above the section backgrounds and below the content. */
#rain {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.wrap {
  position: relative;
  z-index: 1;
  width: min(100% - 2 * max(var(--gutter), env(safe-area-inset-left), env(safe-area-inset-right)), 70rem);
  margin-inline: auto;
}

/* ── Type ─────────────────────────────────────────────── */

h1 {
  font-weight: 700;
  font-size: clamp(3.25rem, 1.6rem + 9.6vw, 9rem);
  line-height: 0.93;
  letter-spacing: -0.028em;
}

h2 {
  max-width: 15em;
  font-weight: 700;
  font-size: clamp(2rem, 1.35rem + 3.2vw, 3.5rem);
  line-height: 1.06;
  letter-spacing: -0.018em;
  text-wrap: balance;
}

h3 {
  font-weight: 700;
  font-size: 1.3rem;
  line-height: 1.25;
  text-wrap: balance;
}

p, dd { text-wrap: pretty; }

.lead {
  max-width: 33em;
  margin-top: 1.25rem;
  font-size: clamp(1.1875rem, 1.08rem + 0.5vw, 1.4rem);
  line-height: 1.5;
  text-wrap: pretty;
}

.nb { white-space: nowrap; }

h1 + .lead { margin-top: clamp(2rem, 3.6vw, 3rem); }

/* ── Buttons ──────────────────────────────────────────── */

.cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem 1.5rem;
  margin-top: 2.25rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3.5rem;
  padding: 0.85rem 1.75rem;
  border-radius: 1.125rem;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font: 600 1.0625rem/1.2 var(--sans);
  text-decoration: none;
  box-shadow: 0 0.9rem 1.9rem -1rem rgba(42, 19, 48, 0.8);
  transition: transform 0.16s ease;
}
.btn[href]:hover { transform: translateY(-2px); }
.btn[href]:active { transform: none; }
.btn:focus-visible { border-radius: 1.125rem; }

.cta-note { font: 400 0.95rem/1.4 var(--sans); }

.live-only { display: none; }
.is-live .live-only { display: inline; }
.is-live .soon-only { display: none; }

.js-only { display: none; }
.js .js-only { display: block; }

/* ── Phone ────────────────────────────────────────────── */

.phone {
  --w: 17rem;
  position: relative;
  flex: none;
  width: var(--w);
  padding: calc(var(--w) * 0.034);
  border-radius: calc(var(--w) * 0.168);
  background: #1C0C20;
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.14),
    0 calc(var(--w) * 0.12) calc(var(--w) * 0.24) calc(var(--w) * -0.1) rgba(42, 19, 48, 0.75);
}
.phone img {
  width: 100%;
  border-radius: calc(var(--w) * 0.134);
  background: var(--dawn);
}
.phone::after {
  content: "";
  position: absolute;
  top: calc(var(--w) * 0.058);
  left: 50%;
  width: calc(var(--w) * 0.27);
  height: calc(var(--w) * 0.078);
  border-radius: 99rem;
  background: #120815;
  transform: translateX(-50%);
}

/* ── Opening ──────────────────────────────────────────── */

.hero {
  overflow: clip;
  background: linear-gradient(180deg, #EF8A5E 0%, #E8855C 60%, #E3815E 100%);
  color: var(--ink);
  --btn-bg: var(--night);
  --btn-fg: var(--parchment);
  --focus: var(--night);
}
.hero .wrap { padding-top: max(1.25rem, env(safe-area-inset-top)); }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  font-weight: 700;
  font-size: 1.25rem;
  letter-spacing: -0.01em;
  text-decoration: none;
}
.brand img {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 22.5%;
  box-shadow: 0 0.4rem 1rem -0.4rem rgba(58, 28, 62, 0.65);
}

.hero-grid {
  display: grid;
  gap: 3rem;
  padding-top: clamp(2.5rem, 9vw, 5.5rem);
}
.hero-phone {
  --w: min(70vw, 18rem);
  justify-self: center;
  /* on small screens only the top of the screenshot shows, fading into the sky */
  margin-bottom: calc(var(--w) * -0.85);
  -webkit-mask-image: linear-gradient(180deg, #000 30%, transparent 57%);
  mask-image: linear-gradient(180deg, #000 30%, transparent 57%);
  -webkit-mask-clip: no-clip;
  mask-clip: no-clip;
}

/* The headline arrives the way the app's welcome does: characters settle into words.
   If script.js never runs, the failsafe animation shows the headline anyway. */
.js #headline { opacity: 0; animation: headline-failsafe 0s linear 2.5s forwards; }
.js #headline.is-ready { opacity: 1; animation: none; }
@keyframes headline-failsafe { to { opacity: 1; } }

.ch { position: relative; color: transparent; transition: color 0.3s ease; }
.ch::before {
  content: attr(data-g);
  position: absolute;
  left: 50%;
  bottom: 0.36em;
  transform: translateX(-50%);
  font: 600 0.4em/1 var(--mono);
  letter-spacing: 0;
  color: var(--ink);
  opacity: 0.55;
}
.ch.is-set { color: inherit; }
.ch.is-set::before { content: none; }

@media (max-width: 30rem) {
  .cta { flex-direction: column; align-items: stretch; }
  .closing .cta { align-items: center; }
}

@media (min-width: 56rem) {
  .hero-grid {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: clamp(2rem, 6vw, 5rem);
    padding-block: clamp(2rem, 5vw, 4rem) clamp(4rem, 8vw, 6.5rem);
  }
  .hero-phone {
    --w: clamp(15rem, min(25vw, 36svh), 21rem);
    margin-bottom: 0;
    -webkit-mask-image: none;
    mask-image: none;
  }
}

/* ── Shared section spacing ───────────────────────────── */

.band { padding-block: clamp(4.5rem, 11vw, 8.5rem); }

/* ── What an interpretation looks like ────────────────── */

.sample {
  /* stays light for the first 26rem, where the heading and intro sit in dark ink */
  background: linear-gradient(180deg, #E3815E 0, #D5775D 26rem, #B5625B 62%, #994E55 100%);
  color: var(--ink);
  --focus: var(--night);
}

.sample-grid {
  display: grid;
  gap: 1.25rem;
  align-items: start;
  margin-top: clamp(2.5rem, 6vw, 4.5rem);
}
.sample-side { display: flex; flex-direction: column; gap: 1.25rem; min-width: 0; }

.card {
  min-width: 0;
  padding: 1.5rem;
  border: 0;
  border-radius: 1.75rem;
  background: var(--parchment);
  color: var(--ink);
  box-shadow: 0 1.5rem 3rem -1.75rem rgba(58, 28, 62, 0.6);
}

.entry-kind {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font: 600 0.95rem/1 var(--sans);
  color: var(--ember-deep);
}
.entry-kind svg { width: 1.2rem; height: 1.2rem; }
.entry-text { margin-top: 0.8rem; line-height: 1.55; }

.sources legend {
  float: left;
  width: 100%;
  margin-bottom: 1rem;
  padding: 0;
  font: 700 1.35rem/1.2 var(--serif);
}
.source {
  position: relative;
  clear: both;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  margin-top: 0.6rem;
  padding: 0.95rem 1rem;
  border-radius: 1.1rem;
  background: #F7DFD7;
  box-shadow: inset 0 0 0 1px rgba(217, 91, 79, 0.4);
  cursor: pointer;
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}
.source input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: inherit;
}
.source-name {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.5rem;
  font: 600 1.0625rem/1.25 var(--sans);
}
.source-desc {
  display: block;
  margin-top: 0.3rem;
  font: 400 0.9rem/1.45 var(--sans);
  color: var(--ink-soft);
}
.pill {
  padding: 0.3rem 0.55rem;
  border-radius: 99rem;
  background: rgba(217, 91, 79, 0.16);
  color: var(--ember-deep);
  font: 600 0.72rem/1 var(--sans);
  white-space: nowrap;
}
.check {
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  box-shadow: inset 0 0 0 1.5px rgba(42, 19, 48, 0.4);
  transition: background-color 0.2s ease, box-shadow 0.2s ease;
}
.check::after {
  content: "";
  width: 0.8rem;
  height: 0.45rem;
  border: solid #fff;
  border-width: 0 0 2.5px 2.5px;
  transform: translateY(-0.08rem) rotate(-45deg) scale(0);
  transition: transform 0.2s ease;
}
.source input:checked ~ .check { background: var(--ember); box-shadow: none; }
.source input:checked ~ .check::after { transform: translateY(-0.08rem) rotate(-45deg) scale(1); }
.source input:disabled ~ .check { opacity: 0.55; }
.source input:focus-visible ~ .check { outline: 3px solid var(--night); outline-offset: 3px; }
.source:has(input:not(:checked)) { background: none; box-shadow: inset 0 0 0 1px rgba(42, 19, 48, 0.22); }
.source:has(input:disabled) { cursor: default; }

.hint {
  clear: both;
  margin-top: 0.9rem;
  font: 400 0.875rem/1.4 var(--sans);
  color: var(--ink-soft);
}

.works {
  clear: both;
  margin-top: 1rem;
  padding-top: 0.9rem;
  border-top: 1px solid rgba(42, 19, 48, 0.14);
  font: 400 0.9rem/1.5 var(--sans);
}
.works summary { font-weight: 600; cursor: pointer; }
.works ul { display: grid; gap: 0.35rem; margin-top: 0.7rem; color: var(--ink-soft); }

.sheet {
  min-width: 0;
  padding: clamp(1.5rem, 4.5vw, 3.25rem);
  border-radius: 2rem;
  background: var(--parchment);
  color: var(--ink);
  box-shadow: 0 2.5rem 5rem -2.5rem rgba(42, 19, 48, 0.7);
}
.sheet-label, .question-label {
  font: 600 0.875rem/1.2 var(--sans);
  color: var(--ember-deep);
}
.summary {
  margin-top: 1rem;
  font-weight: 500;
  font-size: clamp(1.25rem, 1.1rem + 0.7vw, 1.55rem);
  line-height: 1.42;
  text-wrap: pretty;
}

/* Each source's section folds away when its source is unticked. */
.reading {
  display: grid;
  grid-template-rows: 1fr;
  transition: grid-template-rows 0.4s ease, opacity 0.3s ease, visibility 0s;
}
.reading > div { min-height: 0; overflow: hidden; }
.reading > div::before {
  content: "";
  display: block;
  height: 1px;
  margin-block: 1.75rem 1.5rem;
  background: rgba(42, 19, 48, 0.14);
}
.reading.is-off {
  grid-template-rows: 0fr;
  opacity: 0;
  visibility: hidden;
  transition: grid-template-rows 0.4s ease, opacity 0.25s ease, visibility 0s 0.4s;
}
.reading p { max-width: 38em; margin-top: 0.6rem; }

.refs { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.9rem; }
.refs li {
  padding: 0.4rem 0.65rem;
  border-radius: 0.6rem;
  background: #F3DAD0;
  font: 500 0.8125rem/1.2 var(--sans);
}

/* The small divider from the app's "Before You Begin" screen. */
.ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.8rem;
  margin-block: 2.25rem 1.5rem;
  color: var(--ember);
}
.ornament::before, .ornament::after {
  content: "";
  width: 3.25rem;
  height: 1px;
  background: currentColor;
  opacity: 0.7;
}
.ornament span {
  width: 0.45rem;
  height: 0.45rem;
  background: currentColor;
  transform: rotate(45deg);
}

.question-label { text-align: center; }
.question {
  max-width: 24em;
  margin: 0.8rem auto 0;
  font-style: italic;
  font-size: clamp(1.3rem, 1.15rem + 0.8vw, 1.7rem);
  line-height: 1.35;
  text-align: center;
  text-wrap: balance;
}
.sheet-note {
  margin-top: 2.25rem;
  padding-top: 1.1rem;
  border-top: 1px solid rgba(42, 19, 48, 0.14);
  font: 400 0.8125rem/1.5 var(--sans);
  color: var(--ink-soft);
}

@media (min-width: 60rem) {
  .sample-grid {
    grid-template-columns: minmax(19rem, 24rem) minmax(0, 1fr);
    gap: 1.75rem;
    align-items: stretch;
  }
  .sheet { align-self: start; }
}
@media (min-width: 60rem) and (min-height: 44rem) {
  .sources { position: sticky; top: 1.25rem; }
}

/* ── Discernment ──────────────────────────────────────── */

.discern {
  background: linear-gradient(180deg, #994E55 0%, #854053 50%, #73334E 100%);
  color: var(--parchment);
  --focus: var(--parchment);
}
.discern-grid { display: grid; gap: 2.75rem; }
.discern-phone { --w: min(62vw, 16rem); justify-self: center; }

.cite { margin-top: 1rem; font-style: italic; font-size: 1rem; }

.limits-intro { font: 600 1rem/1.4 var(--sans); }
.limits { display: grid; gap: 0 2.5rem; margin-top: 1.25rem; }
.limits > div { padding-block: 1.15rem; border-top: 1px solid rgba(249, 236, 228, 0.3); }
.limits dt { font-weight: 700; font-size: 1.2rem; line-height: 1.3; }
.limits dd { margin-top: 0.4rem; font-size: 1.0625rem; line-height: 1.55; color: var(--parchment-dim); }

.discern h3 { margin-top: 2.5rem; font-size: 1.45rem; }
.ai-note { max-width: 36em; margin-top: 0.6rem; }

@media (min-width: 40rem) {
  .limits { grid-template-columns: 1fr 1fr; }
}

@media (min-width: 56rem) {
  .discern-grid {
    grid-template-columns: auto minmax(0, 1fr);
    grid-template-areas: "phone head" "phone body";
    gap: 2.5rem clamp(3rem, 7vw, 6rem);
    align-items: start;
  }
  .discern-head { grid-area: head; }
  .discern-body { grid-area: body; }
  .discern-phone { grid-area: phone; --w: clamp(15rem, 23vw, 18rem); }
}
@media (min-width: 56rem) and (min-height: 46rem) {
  .discern-phone { position: sticky; top: 2rem; }
}

/* ── The journal ──────────────────────────────────────── */

.keep {
  overflow: clip;
  background: linear-gradient(180deg, #73334E 0%, #5E2849 100%);
  color: var(--parchment);
  --focus: var(--parchment);
}
.keep-grid { display: grid; gap: 3.5rem; }

.features { max-width: 34rem; margin-top: 2.25rem; }
.features > div {
  display: grid;
  gap: 0.15rem 1.5rem;
  padding-block: 0.95rem;
  border-top: 1px solid rgba(249, 236, 228, 0.3);
}
.features dt { font-weight: 700; }
.features dd { color: var(--parchment-dim); }

.phones { display: flex; justify-content: center; align-items: flex-start; }
.phones .phone { --w: min(42vw, 13.5rem); }
.phones .phone:first-child { z-index: 1; }
.phones .phone + .phone {
  margin-top: calc(var(--w) * 0.32);
  margin-left: calc(var(--w) * -0.035);
}

@media (min-width: 40rem) {
  .features > div { grid-template-columns: 11rem minmax(0, 1fr); }
}
@media (min-width: 56rem) {
  .keep-grid {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: clamp(2.5rem, 6vw, 5rem);
  }
  .phones .phone { --w: clamp(12rem, 17vw, 16rem); }
}

/* ── Closing ──────────────────────────────────────────── */

.closing {
  padding-block: clamp(5rem, 12vw, 9rem) calc(2.5rem + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, #5E2849 0%, #3A1C3E 75%);
  color: var(--parchment);
  text-align: center;
  --btn-bg: var(--parchment);
  --btn-fg: var(--ink);
  --focus: var(--gold);
}
.closing-icon {
  width: 7rem;
  height: 7rem;
  margin-inline: auto;
  border-radius: 22.5%;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.14),
    0 1.5rem 4rem -1rem rgba(239, 177, 83, 0.45);
}
.closing h2 { margin: 2rem auto 0; }
.closing .cta { flex-direction: column; justify-content: center; }
.closing .ornament { margin-top: 3.5rem; color: var(--gold); }
.maranatha {
  padding-left: 0.32em;   /* balances the letter-spacing so the word sits centred */
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--gold);
}
.colophon {
  display: grid;
  gap: 0.75rem;
  max-width: 36rem;
  margin: 4rem auto 0;
  padding-top: 2rem;
  border-top: 1px solid rgba(249, 236, 228, 0.2);
  font: 400 0.9rem/1.55 var(--sans);
  color: var(--parchment-dim);
}
.colophon a { display: inline-block; padding-block: 0.6rem; }

/* ── Not-found page ───────────────────────────────────── */

.lost {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100svh;
  padding-block: 4rem;
  background: linear-gradient(180deg, #EF8A5E 0%, #E3815E 100%);
  color: var(--ink);
  --btn-bg: var(--night);
  --btn-fg: var(--parchment);
  --focus: var(--night);
}
.lost h1 { font-size: clamp(2.5rem, 1.5rem + 6vw, 5rem); line-height: 1; }

/* ── Less motion for people who ask for it ────────────── */

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