/* ═══════════════════════════════════════════════════════════════════════
   Selah — paper, ink, and one gilt line.
   Cream + blue, elegant serif, Crossway flavor. Not the worship app's dark UI.
   ═══════════════════════════════════════════════════════════════════════ */

:root {
  --paper:      #EEE6D3;
  --paper-hi:   #F4EEDF;
  --panel:      #E8E0CC;
  --desk:       #DCD1B8;
  --ink:        #22262D;
  --ink-soft:   #574F41;
  --meta:       #8B7F66;
  --rule:       rgba(34, 38, 45, 0.16);
  --rule-soft:  rgba(34, 38, 45, 0.09);
  --blue:       #274A6D;
  --blue-deep:  #1B3A58;
  --rust:       #8A5A43;
  --gilt:       #A6874E;
  --gilt-soft:  rgba(166, 135, 78, 0.55);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Baskerville",
           "Noto Serif", Georgia, "Times New Roman", serif;
  --maxw: 440px;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--desk);
  color: var(--ink);
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern" 1, "liga" 1, "onum" 1;
  font-kerning: normal;
}

.page {
  max-width: var(--maxw);
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--paper);
  background-image:
    radial-gradient(120% 90% at 50% 0%, var(--paper-hi) 0%, var(--paper) 46%, #E7DFCB 100%);
  box-shadow: 0 0 0 1px rgba(34,38,45,0.05), 0 24px 60px -30px rgba(27,42,58,0.45);
  padding: calc(env(safe-area-inset-top) + 32px) 34px calc(env(safe-area-inset-bottom) + 44px);
  display: flex;
  flex-direction: column;
  gap: 30px;
  position: relative;
}
.page::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg,
    transparent 0%, var(--gilt-soft) 18%, var(--gilt) 50%, var(--gilt-soft) 82%, transparent 100%);
}

/* running head, like the top of a book leaf */
.runhead {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 11.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--meta);
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule);
}
.runhead .mark { font-weight: 600; color: var(--blue-deep); }
.runhead .folio { font-variant-numeric: oldstyle-nums; letter-spacing: 0.14em; }
.runhead .menu {
  appearance: none; border: none; background: transparent;
  font-family: var(--serif); color: var(--meta); cursor: pointer;
  font-size: 15px; line-height: 1; padding: 0 0 0 12px; letter-spacing: 0;
}
.runhead .menu:hover, .runhead .menu:focus-visible { color: var(--blue-deep); outline: none; }

.dateblock { margin-top: 4px; text-align: center; }
.weekday {
  font-size: 40px; line-height: 1.0; letter-spacing: 0.004em; font-weight: 500;
  text-wrap: balance;
  font-feature-settings: "kern" 1, "liga" 1, "dlig" 1, "onum" 1;
}
.longdate { font-size: 16px; font-style: italic; color: var(--meta); margin-top: 6px; letter-spacing: 0.01em; }

/* printer's ornament */
.fleuron {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  color: var(--gilt); margin: -6px 0 -2px;
}
.fleuron::before, .fleuron::after {
  content: ""; height: 1px; width: 46px;
  background: linear-gradient(90deg, transparent, var(--gilt-soft));
}
.fleuron::after { transform: scaleX(-1); }
.fleuron span {
  width: 6px; height: 6px; transform: rotate(45deg); background: var(--gilt);
  box-shadow: 0 0 0 3px var(--paper), 0 0 0 4px var(--gilt-soft);
}

.day { display: flex; flex-direction: column; gap: 22px; }

.block {
  display: flex; flex-direction: column; gap: 8px;
  padding-bottom: 22px; border-bottom: 1px solid var(--rule-soft);
}
.block:last-of-type { border-bottom: none; padding-bottom: 4px; }

.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.tag { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--blue); white-space: nowrap; }
.tag.baseline, .tag.meeting { color: var(--meta); }
.tag.table { color: var(--rust); font-style: italic; letter-spacing: 0.12em; }
.tag.added { color: var(--gilt); }
.when { font-size: 12.5px; font-style: italic; color: var(--meta); font-variant-numeric: oldstyle-nums; white-space: nowrap; }

.title { font-size: 21px; line-height: 1.15; margin: 0; font-weight: 500; text-wrap: balance; }
.title[contenteditable]:empty::before { content: attr(data-ph); color: var(--meta); font-style: italic; }
.title[contenteditable]:focus-visible { outline: none; }

.reflection { margin-top: 2px; }
.reflection p { margin: 0; font-size: 16.5px; line-height: 1.62; color: var(--ink-soft); }
.reflection .prompt { font-style: italic; color: var(--meta); cursor: text; }
.reflection textarea {
  width: 100%; border: none; background: transparent; resize: none;
  font-family: var(--serif); font-size: 16.5px; line-height: 1.62; color: var(--ink);
  padding: 0; margin: 0; outline: none; overflow: hidden;
}
.reflection textarea::placeholder { color: var(--meta); font-style: italic; }

.addrow { display: flex; justify-content: center; }
.add {
  appearance: none; background: transparent; border: 1px solid var(--rule);
  border-radius: 999px; color: var(--meta); font-family: var(--serif);
  font-size: 13px; letter-spacing: 0.06em; padding: 9px 18px; cursor: pointer;
  transition: color .25s ease, border-color .25s ease, background .25s ease;
}
.add:hover, .add:focus-visible {
  color: var(--blue-deep); border-color: var(--blue); background: rgba(39,74,109,0.05); outline: none;
}

/* the one emphasized element: the required evening sign-off */
.signoff {
  margin-top: 4px;
  background: linear-gradient(rgba(39,74,109,0.055), rgba(39,74,109,0.055));
  border: 1px solid rgba(39,74,109,0.18); border-radius: 3px;
  padding: 22px 22px 20px; display: flex; flex-direction: column; gap: 10px;
  scroll-margin-top: 20px;
}
.signoff .cue { font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--blue); font-variant-numeric: oldstyle-nums; }
.signoff h2 { margin: 0; font-size: 23px; font-weight: 500; }
.signoff .prompt { margin: 0; font-size: 16px; font-style: italic; line-height: 1.55; color: var(--ink-soft); }
.signoff textarea {
  width: 100%; min-height: 92px; margin-top: 4px; border: none;
  border-top: 1px solid rgba(39,74,109,0.18); background: transparent; resize: none;
  font-family: var(--serif); font-size: 16.5px; line-height: 1.6; color: var(--ink);
  padding-top: 12px; outline: none;
}
.signoff textarea::placeholder { color: var(--meta); font-style: italic; }
.signoff-actions { display: flex; align-items: center; justify-content: flex-end; gap: 14px; margin-top: 2px; }
.signoff .saved { font-size: 12.5px; font-style: italic; color: var(--meta); margin-right: auto; opacity: 0; transition: opacity .4s ease; }
.signoff .saved.show { opacity: 1; }
.signoff button {
  appearance: none; border: 1px solid rgba(166,135,78,0.45);
  background: linear-gradient(var(--blue-deep), #16324c); color: var(--paper-hi);
  font-family: var(--serif); font-size: 12.5px; letter-spacing: 0.16em; text-transform: uppercase;
  padding: 11px 24px; border-radius: 2px; cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
  transition: background .25s ease, transform .1s ease, box-shadow .25s ease;
}
.signoff button:hover { background: linear-gradient(#16314b, #102638); box-shadow: inset 0 1px 0 rgba(255,255,255,0.12), 0 2px 10px -6px rgba(27,42,58,0.6); }
.signoff button:active { transform: translateY(1px); }
.signoff button:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }
.signoff button[disabled] { opacity: .5; cursor: default; }
.signoff .pushlink {
  appearance: none; background: transparent; border: none; color: var(--blue);
  font-family: var(--serif); font-size: 12.5px; letter-spacing: 0.04em; cursor: pointer;
  text-transform: none; padding: 0; box-shadow: none;
  text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--gilt-soft);
}
.signoff .pushlink:hover { color: var(--blue-deep); background: transparent; }
.signoff .pushlink[disabled] { color: var(--meta); text-decoration: none; opacity: 1; }

/* the calm closing state after sign-off */
.sealed { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 18px; padding: 40px 10px 24px; }
.sealed .line { font-size: 25px; font-style: italic; color: var(--ink); text-wrap: balance; }
.sealed .sub { font-size: 14px; color: var(--meta); letter-spacing: 0.02em; }
.sealed .reopen {
  appearance: none; background: transparent; border: none; color: var(--blue);
  font-family: var(--serif); font-size: 13px; letter-spacing: 0.06em; cursor: pointer;
  text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--gilt-soft);
}
.sealed .reopen:hover, .sealed .reopen:focus-visible { color: var(--blue-deep); outline: none; }

/* ── login gate ─────────────────────────────────────────────────────────── */
.gate { justify-content: center; gap: 26px; min-height: 100dvh; }
.gate .brand { text-align: center; }
.gate .brand .mark { font-size: 46px; letter-spacing: 0.02em; }
.gate .brand .tagline { font-size: 15px; font-style: italic; color: var(--meta); margin-top: 8px; }
.gate #slot { display: flex; flex-direction: column; }
.gate form { display: flex; flex-direction: column; gap: 14px; }
.gate label { font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--meta); }
.gate input[type="email"] {
  font-family: var(--serif); font-size: 17px; color: var(--ink);
  background: var(--paper-hi); border: 1px solid var(--rule);
  border-radius: 3px; padding: 13px 14px; outline: none; width: 100%;
}
.gate input[type="email"]:focus-visible { border-color: var(--blue); }
.gate .remember { display: flex; align-items: center; gap: 9px; font-size: 14px; color: var(--ink-soft); font-style: italic; }
.gate button {
  appearance: none; border: 1px solid rgba(166,135,78,0.45);
  background: linear-gradient(var(--blue-deep), #16324c); color: var(--paper-hi);
  font-family: var(--serif); font-size: 13px; letter-spacing: 0.16em; text-transform: uppercase;
  padding: 13px; border-radius: 2px; cursor: pointer; box-shadow: inset 0 1px 0 rgba(255,255,255,0.08);
}
.gate button:hover { background: linear-gradient(#16314b, #102638); }
.gate .note { text-align: center; font-size: 14px; color: var(--ink-soft); line-height: 1.5; min-height: 1.2em; }
.gate .note.err { color: var(--rust); }

/* quiet entrance */
@media (prefers-reduced-motion: no-preference) {
  .runhead, .dateblock, .fleuron, .block, .addrow, .signoff, .sealed, .gate > * {
    animation: rise .6s cubic-bezier(.2,.7,.2,1) both;
  }
  .dateblock { animation-delay: .05s; }
  .fleuron { animation-delay: .09s; }
  .day .block:nth-child(1) { animation-delay: .12s; }
  .day .block:nth-child(2) { animation-delay: .19s; }
  .day .block:nth-child(3) { animation-delay: .26s; }
  .day .block:nth-child(4) { animation-delay: .33s; }
  .day .block:nth-child(n+5) { animation-delay: .4s; }
  .addrow { animation-delay: .44s; }
  .signoff { animation-delay: .5s; }
}
@keyframes rise { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: none; } }
