/* ==========================================================================
   The Fox Reads — night shrine
   Ground: deep night navy, indigo radial wash. Reading surfaces: warm paper.
   Accents: vermilion #c84022 scarce (begin/draw/seal); lit indigo #7c82e6.
   ========================================================================== */

:root {
  --night:      #12111f;
  --night-2:    #1a1830;
  --bone:       #e7e2d7;
  --bone-dim:   #a8a4b8;
  --paper:      #f4eddd;
  --paper-ink:  #37304a;
  --indigo:     #7c82e6;
  --indigo-deep:#25236b;
  --vermilion:  #e04a2a;
  --vermilion-hot:#ff6a42;
  --hairline:   rgba(200, 196, 228, 0.16);
  --shadow:     0 14px 34px rgba(0, 0, 0, 0.45);
  --serif:      "Cormorant Garamond", "Lora", Georgia, serif;
  --body-serif: "Lora", Georgia, serif;
  --sans:       "Karla", system-ui, sans-serif;

  --eye: #ffd9a8;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background:
    radial-gradient(ellipse 120% 70% at 18% -10%, rgba(124, 130, 230, 0.14), transparent 55%),
    radial-gradient(ellipse 90% 55% at 85% 105%, rgba(37, 35, 107, 0.5), transparent 60%),
    var(--night);
  background-attachment: fixed;
  color: var(--bone);
  font-family: var(--body-serif);
  font-size: 16.5px;
  line-height: 1.65;
  min-height: 100vh;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
}
.skip:focus {
  left: 8px;
  top: 8px;
  background: var(--paper);
  color: var(--night);
  padding: 6px 12px;
  z-index: 50;
}

/* utility: hidden must always win over display rules */
.hidden { display: none !important; }

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

.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--hairline);
  background: rgba(10, 9, 18, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 10;
}
.nav-link { color: var(--ink-warm, #e7e2d7); text-shadow: 0 1px 2px rgba(0,0,0,0.6); }
.nav-link:hover { color: #fff; background: rgba(124, 130, 230, 0.18); }

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: 0;
  color: var(--bone);
  cursor: pointer;
  font-family: var(--sans);
  font-size: 15.5px;
  letter-spacing: 0.04em;
  padding: 6px 4px;
}
.brand-mark { width: 26px; height: 26px; color: var(--vermilion); --eye: #ffd9a8; }
.brand:hover .brand-mark { color: var(--vermilion-hot); }

.site-nav { display: flex; gap: 6px; }

.nav-link {
  background: none;
  border: 0;
  color: var(--bone-dim);
  font-family: var(--sans);
  font-size: 14.5px;
  padding: 8px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.nav-link:hover { color: var(--bone); background: rgba(124, 130, 230, 0.12); }

/* ---------- views ---------- */

main { padding: 0 18px 60px; }

.view { max-width: 920px; margin: 0 auto; padding: 34px 0 10px; }
.view.hidden { display: none; }

.narrow { max-width: 560px; margin: 0 auto; }

h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(30px, 5vw, 44px);
  line-height: 1.12;
  margin: 10px 0 18px;
  color: var(--bone);
}

.kicker {
  font-family: var(--sans);
  font-size: 14px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--indigo);
  margin: 0 0 6px;
  font-weight: 500;
}

.lede {
  font-size: 17.5px;
  color: var(--bone-dim);
  margin: 0 0 22px;
  max-width: 46ch;
}

.center { text-align: center; margin-left: auto; margin-right: auto; }

.hint {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--bone-dim);
  margin: 12px 0 0;
}

/* ---------- letter ---------- */

.letter-sign { color: var(--bone); margin-top: 18px; }

/* ---------- forms ---------- */

.field-label {
  display: block;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--bone-dim);
  margin: 4px 0 8px;
}

textarea, input[type="text"] {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  color: var(--bone);
  font-family: var(--body-serif);
  font-size: 16.5px;
  padding: 12px 14px;
  resize: vertical;
}
textarea:focus, input[type="text"]:focus {
  outline: none;
  border-color: var(--indigo);
  box-shadow: 0 0 0 3px rgba(124, 130, 230, 0.18);
}
textarea::placeholder, input[type="text"]::placeholder { color: rgba(168, 164, 184, 0.55); }

.btn-row { display: flex; gap: 12px; margin-top: 22px; flex-wrap: wrap; }

.btn {
  display: inline-block;
  border: 0;
  border-radius: 999px;
  font-family: var(--sans);
  font-size: 15.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  padding: 12px 26px;
  cursor: pointer;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--indigo); outline-offset: 3px; }

.btn-vermilion {
  background: var(--vermilion);
  color: #fff4ec;
  box-shadow: 0 6px 22px rgba(224, 74, 42, 0.35);
}
.btn-vermilion:hover { background: var(--vermilion-hot); }

.btn-indigo {
  background: rgba(124, 130, 230, 0.16);
  color: var(--bone);
  border: 1px solid rgba(124, 130, 230, 0.45);
}
.btn-indigo:hover { background: rgba(124, 130, 230, 0.26); }

.btn-ghost {
  background: none;
  color: var(--bone-dim);
  border: 1px solid var(--hairline);
}
.btn-ghost:hover { color: var(--bone); border-color: rgba(200, 196, 228, 0.3); }

.link-plain {
  background: none;
  border: 0;
  padding: 0;
  color: var(--indigo);
  font: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- spread choices ---------- */

.spread-list { display: grid; gap: 12px; }

.spread-choice {
  text-align: left;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 16px 18px;
  cursor: pointer;
  color: var(--bone);
  font-family: var(--body-serif);
}
.spread-choice:hover { border-color: rgba(124, 130, 230, 0.5); background: rgba(124, 130, 230, 0.08); }
.spread-name { display: block; font-family: var(--serif); font-size: 21px; font-weight: 600; }
.spread-desc { display: block; font-size: 15.5px; color: var(--bone-dim); margin-top: 3px; }

/* ---------- shuffle ---------- */

.fox-anchor { display: flex; justify-content: center; margin: 6px 0 10px; }
.fox-small { width: 108px; height: auto; opacity: 0.92; }

.deck-stack {
  position: relative;
  width: 190px;
  height: 300px;
  margin: 26px auto 18px;
  cursor: pointer;
  outline: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
}
.deck-stack.shuffling { cursor: grabbing; }

.deck-card {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  background: linear-gradient(150deg, #f6efe0, #e8dfca);
  border: 1px solid rgba(0, 0, 0, 0.25);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
}

/* deck centered, 4 cards now */
.deck-stack { margin: 30px auto 20px; }
.deck-card-4 {
  position: absolute;
  inset: 0;
  border-radius: 10px;
  z-index: 0;
  background: linear-gradient(150deg, #efe6d4, #d9cdb4);
  transform: translate(0, -8px) rotate(0deg);
}
.deck-stack.shuffling .deck-card-4 { animation: riffle-a 0.26s ease-in-out infinite alternate; }

.card-moon {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 62%;
  height: 62%;
  color: var(--indigo-deep);
  pointer-events: none;
  opacity: 0.9;
}

/* classic card-back frame on every card in the stack */
.deck-card::after {
  content: "";
  position: absolute;
  inset: 9px;
  border: 1px solid rgba(37, 35, 107, 0.22);
  border-radius: 6px;
}

.deck-card-1 { transform: translate(0,0) rotate(0deg); z-index: 3; }
.deck-card-2 { transform: translate(7px, -5px) rotate(2.2deg); z-index: 2; }
.deck-card-3 { transform: translate(-7px, -3px) rotate(-2.4deg); z-index: 1; background: linear-gradient(150deg, #ede4d0, #ddd2b8); }

.deck-stack.shuffling .deck-card-1 { animation: riffle-a 0.28s ease-in-out infinite alternate; }
.deck-stack.shuffling .deck-card-2 { animation: riffle-b 0.34s ease-in-out infinite alternate; }
.deck-stack.shuffling .deck-card-3 { animation: riffle-c 0.30s ease-in-out infinite alternate; }

@keyframes riffle-a { from { transform: translate(0,0) rotate(0deg); } to { transform: translate(14px, 6px) rotate(7deg); } }
@keyframes riffle-b { from { transform: translate(7px,-5px) rotate(2.2deg); } to { transform: translate(-12px, 8px) rotate(-6deg); } }
@keyframes riffle-c { from { transform: translate(-7px,-3px) rotate(-2.4deg); } to { transform: translate(10px, -8px) rotate(5deg); } }

.deck-label {
  position: absolute;
  left: 0; right: 0;
  bottom: -34px;
  text-align: center;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--bone-dim);
  pointer-events: none;
}

.shuffle-state {
  text-align: center;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--indigo);
  min-height: 22px;
  margin: 44px 0 0;
}

.btn-draw-anchor { text-align: center; }

#btn-draw { display: block; margin: 16px auto 0; }

/* ---------- reading ---------- */

.question-echo {
  font-family: var(--body-serif);
  font-style: italic;
  font-size: 18px;
  color: var(--bone-dim);
  margin: 0 0 26px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 26px;
  margin: 8px 0 30px;
}
#view-reading .cards { max-width: 1080px; }
#view-reading .cards:has(.card:nth-child(4)) { max-width: 980px; }

.card {
  background: var(--paper);
  border-radius: 6px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  transition: transform 0.5s ease;
}

.card img {
  display: block;
  width: 100%;
  margin: 0;
  border-radius: 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
}
.card.reversed img { transform: rotate(180deg); }
.card.reversed img { transition: transform 0.5s ease; }

.card-body { padding: 10px 16px 16px; }

.card-name { margin: 6px 0 2px; font-family: var(--serif); font-size: 20px; font-weight: 600; color: var(--indigo-deep); }
.card-name .card-orientation { font-size:  14.5px; font-weight: 400; color: #8a7f66; }

.card-pos {
  font-family: var(--sans);
  font-size: 13.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #8a7f66;
  margin: 8px 0 0;
}

.card-verdict {
  font-family: var(--body-serif);
  font-size: 15.5px;
  line-height: 1.6;
  color: var(--paper-ink);
  margin: 8px 0 0;
}

/* vermilion tap = the one focal accent in the flow */
.card-verdict-mark {
  display: inline-block;
  width: 11px; height: 11px;
  border-radius: 2px;
  background: var(--indigo-deep);
  margin-right: 8px;
  transform: rotate(45deg);
}

.synth-block {
  max-width: 720px;
  border-top: 1px solid var(--hairline);
  padding-top: 18px;
}
.block-label {
  font-family: var(--sans);
  font-size: 14px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--indigo);
  margin: 0 0 8px;
  font-weight: 500;
}
.synth {
  font-family: var(--body-serif);
  font-size: 17px;
  line-height: 1.7;
  color: var(--bone);
  margin: 0;
}

.aside-block {
  display: flex;
  gap: 16px;
  align-items: center;
  max-width: 640px;
  margin: 26px auto 0;
  background: rgba(124, 130, 230, 0.08);
  border: 1px solid rgba(124, 130, 230, 0.3);
  border-radius: 12px;
  padding: 16px 20px;
}
.aside-body { flex: 1; min-width: 0; }
.aside-text {
  font-family: var(--body-serif);
  font-style: italic;
  font-size: 16px;
  color: var(--bone-dim);
  margin: 10px 0 0;
  border-top: 1px solid var(--hairline);
  padding-top: 10px;
}
.aside-block .synth { font-size: 16.5px; }
.aside-block .fox-small { width: 84px; flex: 0 0 84px; opacity: 0.95; margin: 0; }

/* ---------- book ---------- */

.book-list { display: grid; gap: 16px; margin-bottom: 8px; }

.book-entry {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 16px 18px;
}
.book-entry .entry-date {
  font-family: var(--sans);
  font-size: 13.5px;
  color: var(--bone-dim);
  margin: 0 0 4px;
}
.book-entry .entry-question {
  font-family: var(--body-serif);
  font-style: italic;
  font-size: 16.5px;
  color: var(--bone);
  margin: 0 0 8px;
}
.book-entry .entry-cards { font-family: var(--sans); font-size: 14px; color: var(--bone-dim); margin: 0; }
.book-entry:not(.book-entry-empty):hover { border-color: rgba(124, 130, 230, 0.45); }
.book-entry-empty { color: var(--bone-dim); }

/* ---------- about ---------- */

.about-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 18px 20px;
  margin: 0 0 14px;
}
.about-card p { margin: 0 0 10px; max-width: 56ch; }
.about-card p:last-child { margin-bottom: 0; }

.check-row {
  display: flex;
  gap: 12px;
  align-items: baseline;
  cursor: pointer;
  font-size: 16.5px;
}
.check-row input { width: 18px; height: 18px; accent-color: var(--vermilion); }
.check-sub { color: var(--bone-dim); font-size: 14.5px; }

/* ---------- footer ---------- */

.site-footer {
  max-width: 920px;
  margin: 30px auto 0;
  padding: 18px 18px 30px;
  border-top: 1px solid var(--hairline);
  font-family: var(--sans);
  font-size: 14.5px;
  color: var(--bone-dim);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}
.site-footer p { margin: 0 0 4px; }
.footer-disclaim { color: rgba(168, 164, 184, 0.7); }
@media (max-width: 640px) {
  /* falls to two stacked lines on narrow screens rather than truncating */
  .site-footer { flex-direction: column; align-items: flex-start; gap: 4px; }
}

/* ---------- fox flicker (the deck breathes) ---------- */

.fox-small { filter: drop-shadow(0 6px 18px rgba(0,0,0,0.4)); }
@keyframes breathe {
  0%, 100% { opacity: 0.92; transform: translateY(0); }
  50%      { opacity: 1;    transform: translateY(-2px); }
}
.fox-anchor .fox-small { animation: breathe 5.5s ease-in-out infinite; }

/* ---------- responsive ---------- */

@media (max-width: 760px) {
  .cards { gap: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  .fox-anchor .fox-small { animation: none; }
  .deck-stack.shuffling .deck-card-1,
  .deck-stack.shuffling .deck-card-2,
  .deck-stacking .deck-card-3,
  .card img { transition: none; }
}

/* ---------- readability floor ---------- */

/* PLAN: nothing that carries content below ~14px. */
.footer-disclaim { font-size: 14px; }
.deck-label, .hint, .shuffle-state, .book-entry .entry-date { font-size: 14px; }
.card-pos { font-size: 14px; }


/* ---------- CHΛOS signatures: sans wherever the mark appears ---------- */

.chaos-sig,
.letter-sign strong {
  font-family: "Roboto", var(--sans);
  font-size: 15.5px;
  letter-spacing: 0.12em;
  font-weight: 500;
}

.chaos-link {
  color: inherit;
  text-decoration: none;
  border-bottom: 0;
}
.chaos-link .chaos-sig {
  font-size: inherit;
  font-weight: 500;
  color: var(--vermilion);
}
.chaos-link:hover .chaos-sig {
  color: var(--vermilion-hot);
}


/* ---------- the moon ---------- */

.moon-disc {
  position: fixed;
  top: -70px;
  right: -90px;
  width: 320px;
  height: 320px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 34%,
    #f2ecda 0%, #e8e2d0 42%, #cdc6ae 78%, #b8b096 100%);
  box-shadow:
    0 0 90px rgba(232, 226, 208, 0.22),
    0 0 240px rgba(232, 226, 208, 0.08);
  z-index: 0;
  opacity: 0.9;
  pointer-events: none;
}

/* everything after the moon in the DOM must stack above it */
.masthead, main, .site-footer { position: relative; z-index: 1; }
.moon-disc::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(circle at 62% 58%, rgba(160, 152, 128, 0.5) 0 14px, transparent 15px),
    radial-gradient(circle at 34% 66%, rgba(160, 152, 128, 0.4) 0 9px, transparent 10px),
    radial-gradient(circle at 55% 30%, rgba(160, 152, 128, 0.35) 0 7px, transparent 8px);
}

@media (max-width: 760px) {
  .moon-disc { width: 190px; height: 190px; top: -50px; right: -60px; }
}

