/* ── FLOTSAMANCY — standalone divination page ───────────────
   Estuary palette, stacked the way the water stratifies:
   Deep Water ground + Oyster Fog text carry ~70%,
   Brackish Teal is the signature, Marsh & Violet are seasoning. */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
button { font-family: inherit; cursor: pointer; }

:root {
  --deep:        #101B1D;  /* Deep Water — sediment, ground */
  --deep-soft:   #142527;
  --deep-raised: #1a3134;

  --fog:         #CFD6D0;  /* Oyster Fog — surface, light neutral */
  --fog-dim:     rgba(207, 214, 208, 0.14);

  --marsh:       #8FA791;  /* Marsh Grass — bridge accent */
  --marsh-dim:   rgba(143, 167, 145, 0.28);

  --teal:        #2E5D5B;  /* Brackish Teal — the signature */
  --teal-bright: #3E7D7A;
  --teal-glow:   rgba(62, 125, 122, 0.4);
  --teal-dim:    rgba(46, 93, 91, 0.45);

  --violet:      #4A3F5C;  /* Bruised Violet — seasoning, never a co-star */
  --violet-soft: #8F81A5;
  --violet-dim:  rgba(74, 63, 92, 0.5);

  --text-hi:     #CFD6D0;
  --text-mid:    #93A99C;
  --text-lo:     #56706B;

  --font-d: 'Cinzel', Georgia, serif;
  --font-b: 'Cormorant Garamond', Georgia, serif;

  --card-w: clamp(140px, 26vw, 210px);
}

html { background: var(--deep); }

body {
  min-height: 100vh;
  font-family: var(--font-b);
  font-size: 18px;
  color: var(--text-hi);
  background:
    radial-gradient(ellipse 90% 55% at 50% -10%, rgba(46, 93, 91, 0.30), transparent 65%),
    radial-gradient(ellipse 70% 45% at 85% 100%, rgba(74, 63, 92, 0.28), transparent 60%),
    var(--deep);
  overflow-x: hidden;
}

/* ── STARFIELD (adrift) ─────────────────────────────────── */
#stars { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.star {
  position: absolute;
  border-radius: 50%;
  background: var(--fog);
  opacity: 0.7;
  animation:
    twinkle var(--tw, 4s) ease-in-out infinite,
    drift var(--dr, 70s) ease-in-out infinite alternate;
}
@keyframes twinkle {
  0%, 100% { opacity: 0.12; }
  50%      { opacity: 0.75; }
}
@keyframes drift {
  to { translate: var(--dx, 12px) var(--dy, -16px); }
}

.shooting-star { position: fixed; z-index: 0; pointer-events: none; }
.shooting-star .streak {
  display: block;
  width: 140px; height: 2px;
  border-radius: 999px;
  background: linear-gradient(to left, var(--fog), transparent);
  box-shadow: 0 0 8px rgba(207, 214, 208, 0.55);
  opacity: 0;
  animation: shoot 1.4s ease-out forwards;
}
@keyframes shoot {
  0%   { opacity: 0; transform: translateX(0); }
  8%   { opacity: 0.9; }
  100% { opacity: 0; transform: translateX(340px); }
}

header, main, footer { position: relative; z-index: 1; }

/* ── MASTHEAD ───────────────────────────────────────────── */
.masthead { text-align: center; padding: 52px 20px 8px; }
.brand-mark {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  font-family: var(--font-d);
  font-size: 13px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  text-decoration: none;
  /* Bruised Violet, lifted just enough to read against Deep Water */
  color: var(--violet-soft);
  text-shadow: 0 0 14px var(--violet-dim);
  animation: brandPulse 4.5s ease-in-out infinite;
}
.brand-mark:hover { color: #b3a6c9; }
@keyframes brandPulse {
  0%, 100% { text-shadow: 0 0 8px rgba(74, 63, 92, 0.35); opacity: 0.82; }
  50%      { text-shadow: 0 0 22px rgba(143, 129, 165, 0.75), 0 0 40px rgba(74, 63, 92, 0.5); opacity: 1; }
}
.masthead h1 {
  font-family: var(--font-d);
  font-weight: 400;
  font-size: clamp(30px, 7vw, 54px);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--fog);
  text-shadow: 0 0 34px var(--teal-glow);
}
.tagline {
  margin-top: 8px;
  font-style: italic;
  font-size: 19px;
  color: var(--text-mid);
  letter-spacing: 0.08em;
}

/* ── CONTROLS ───────────────────────────────────────────── */
.controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 34px 20px 10px;
}
.spread-picker { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.spread-choice {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 10px 22px;
  background: var(--deep-soft);
  border: 1px solid var(--teal-dim);
  border-radius: 10px;
  color: var(--text-mid);
  transition: border-color 0.25s, color 0.25s, box-shadow 0.25s;
}
.spread-choice .n    { font-family: var(--font-d); font-size: 22px; }
.spread-choice .name { font-size: 14px; letter-spacing: 0.14em; text-transform: uppercase; }
.spread-choice:hover { border-color: var(--marsh); color: var(--text-hi); }
.spread-choice.active {
  border-color: var(--teal-bright);
  color: var(--fog);
  box-shadow: 0 0 18px var(--teal-glow), inset 0 0 14px rgba(46, 93, 91, 0.25);
}

#draw-btn {
  font-family: var(--font-d);
  font-size: 19px;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--deep);
  background: linear-gradient(160deg, var(--fog), var(--marsh));
  border: none;
  border-radius: 999px;
  padding: 14px 44px;
  white-space: nowrap;
  box-shadow: 0 0 28px var(--teal-glow);
  transition: transform 0.2s, box-shadow 0.2s;
}
@media (max-width: 420px) {
  #draw-btn { font-size: 15px; letter-spacing: 0.16em; padding: 12px 22px; }
}
#draw-btn:hover  { transform: translateY(-2px); box-shadow: 0 0 42px var(--teal-glow); }
#draw-btn:active { transform: translateY(0); }

#deck-status { font-style: italic; color: var(--text-lo); font-size: 16px; min-height: 1.4em; }

/* ── SPREAD ─────────────────────────────────────────────── */
.spread {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: flex-start;
  gap: clamp(14px, 3vw, 30px);
  padding: 30px 18px 10px;
  min-height: 40px;
}

.slot {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  width: clamp(170px, 30vw, 280px);
  /* everything washed up bobs a little */
  animation: bob var(--bob, 8s) ease-in-out infinite alternate;
}
/* a lone message deserves more of the surface */
.spread[data-n="1"] .slot { width: clamp(220px, 70vw, 440px); }
@keyframes bob {
  from { transform: translateY(3px)   rotate(var(--tilt1, -1.1deg)); }
  to   { transform: translateY(-15px) rotate(var(--tilt2,  1.3deg)); }
}
.slot-label {
  font-family: var(--font-d);
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--marsh);
  opacity: 0;
  animation: labelIn 0.6s ease forwards;
}
@keyframes labelIn { to { opacity: 1; } }

/* each drawn piece surfaces from the deep at its own natural shape */
.flotsam {
  width: 100%;
  animation: surface 1.5s cubic-bezier(0.2, 0.6, 0.25, 1) backwards;
}
.flotsam a { display: block; border-radius: 12px; }
.flotsam a:focus-visible { outline: 2px solid var(--teal-bright); outline-offset: 4px; }
.flotsam img,
.flotsam svg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 70vh;
  object-fit: contain;
  border-radius: 12px;
  border: 1px solid var(--teal-dim);
  background: var(--deep-raised);
  box-shadow: 0 10px 34px rgba(0, 0, 0, 0.55), 0 0 22px rgba(46, 93, 91, 0.18);
}
@keyframes surface {
  from { opacity: 0; transform: translateY(64px) scale(0.97); filter: blur(10px); }
  to   { opacity: 1; transform: translateY(0)    scale(1);    filter: blur(0); }
}

.card-caption {
  font-size: 15px;
  font-style: italic;
  color: var(--text-mid);
  text-align: center;
  line-height: 1.35;
  min-height: 2.7em;
  opacity: 0;
  transition: opacity 0.5s 0.35s;
}
.slot.revealed .card-caption { opacity: 1; }
.card-caption a { color: var(--marsh); text-decoration: none; border-bottom: 1px dotted var(--marsh-dim); }
.card-caption a:hover { color: var(--fog); border-color: var(--fog); }

/* ── SONG ───────────────────────────────────────────────── */
.song {
  max-width: 640px;
  margin: 36px auto 0;
  padding: 0 20px;
  text-align: center;
}
.song.hidden { display: none; }
.song h2 {
  font-family: var(--font-d);
  font-weight: 400;
  font-size: 17px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--marsh);
  margin-bottom: 18px;
}
.player-shroud {
  border: 1px solid var(--teal-dim);
  border-radius: 14px;
  overflow: hidden;
  background: var(--deep-soft);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}
.player-shroud iframe { display: block; width: 100%; }
#song-note { margin-top: 12px; font-style: italic; color: var(--text-lo); font-size: 16px; }

/* ── FOOTER ─────────────────────────────────────────────── */
footer {
  text-align: center;
  padding: 60px 20px 40px;
  color: var(--text-lo);
  font-size: 15px;
  font-style: italic;
}
footer .kin { margin-top: 14px; }
footer .kin a {
  color: var(--marsh);
  text-decoration: none;
  font-family: var(--font-d);
  font-style: normal;
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  border-bottom: 1px dotted var(--marsh-dim);
}
footer .kin a:hover { color: var(--fog); border-color: var(--fog); }
footer .fine { margin-top: 10px; font-size: 13px; opacity: 0.7; }

@media (prefers-reduced-motion: reduce) {
  .flotsam, .slot, .slot-label, .star, .brand-mark, .shooting-star .streak { animation: none !important; }
  .slot-label, .flotsam { opacity: 1; }
  .shooting-star { display: none; }
}
