/* Reivery — "The Candle"
   Ground near-black, ink parchment, accent old gold.
   Court colors appear only inside their own court's section. */

:root {
  --ground:   #0E0C0A;
  --surface:  #1A1612;
  --ink:      #E9DEC7;
  --muted:    #A39478;
  --gold:     #B08D57;
  --gold-dim: rgba(176, 141, 87, .35);

  --fire:  #C9782E;
  --earth: #5E7A4C;
  --air:   #D9B44A;
  --water: #3F6B8C;

  --display: "Cormorant Garamond", "Cormorant", Garamond, Georgia, serif;
  --body:    "EB Garamond", Garamond, Georgia, serif;

  --candle: 2.2s;          /* candle-slow */
  --ease:   cubic-bezier(.25, .1, .25, 1);
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.125rem;      /* 18px */
  line-height: 1.6;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

:focus-visible {
  outline: 1px solid var(--gold);
  outline-offset: 4px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip {
  position: absolute;
  left: 1rem; top: -3rem;
  padding: .5rem 1rem;
  background: var(--surface);
  color: var(--ink);
  z-index: 10;
}
.skip:focus { top: 1rem; }

/* ---------- I. The Candle ---------- */

.candle {
  min-height: min(100svh, 64rem);   /* fill the screen, but don't strand the seal below a void on tall displays */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(1.5rem, 4vh, 2.75rem);
  padding: clamp(2.5rem, 7vh, 5rem) 1rem 3rem;
  text-align: center;
  /* the room is lit from the card outward */
  background:
    radial-gradient(ellipse 60% 45% at 50% 42%, rgba(201, 120, 46, .07), transparent 70%),
    var(--ground);
}

.wordmark {
  margin: 0;
  font-family: var(--display);
  font-weight: 300;
  font-size: clamp(1.6rem, 6vw, 2.6rem);
  letter-spacing: .55em;
  margin-right: -.55em;     /* balance the trailing tracking */
  text-transform: uppercase;
  color: var(--ink);
}

/* The hero frame: shaped to the painting (1248 × 1824), so nothing is cropped — her lamp stays in */
.hero { margin: 0; }

.frame {
  position: relative;
  width: min(72vw, 21rem, calc(56svh * 1248 / 1824));
  aspect-ratio: 1248 / 1824;
  padding: 6px;
  border: 1px solid var(--gold-dim);
  background: var(--surface);
  box-shadow:
    0 0 0 6px var(--ground),
    0 0 0 7px rgba(176, 141, 87, .18),
    0 30px 80px -20px rgba(0, 0, 0, .9),
    0 0 120px -10px rgba(201, 120, 46, .12);
}

.frame picture,
.frame img,
.frame-empty {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.frame-empty {
  display: grid;
  place-items: end center;
  padding-bottom: 12%;
  background:
    radial-gradient(ellipse 55% 40% at 50% 38%, rgba(201, 120, 46, .16), transparent 70%),
    linear-gradient(#15110D, #0B0907);
  font-family: var(--display);
  font-style: italic;
  font-size: 1.1rem;
  letter-spacing: .08em;
  color: var(--muted);
}

.soul {
  margin: 0;
  max-width: 30ch;
  font-family: var(--display);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.35rem, 4.6vw, 1.9rem);
  line-height: 1.3;
  color: var(--ink);
}

.soul .nw { white-space: nowrap; }

/* Send me word: a quiet gold link on a thin underline */
.word {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .9rem;
  width: min(100%, 26rem);
}

.word-send {
  padding: .5rem 1.4rem .55rem;
  border-bottom: 1px solid var(--gold-dim);
  color: var(--gold);
  font-family: var(--display);
  font-size: 1rem;
  letter-spacing: .32em;
  margin-right: -.32em;
  text-transform: uppercase;
  text-decoration: none;
  transition: color .6s var(--ease), border-color .6s var(--ease);
}
.word-send:hover,
.word-send:focus-visible { color: var(--ink); border-bottom-color: var(--gold); }

.word-note {
  margin: 0;
  max-width: 30ch;
  font-style: italic;
  font-size: .95rem;
  line-height: 1.45;
  color: var(--muted);
}

/* ---------- The seal ---------- */

.seal {
  display: flex;
  justify-content: center;
  padding: 1rem 1rem 0;
}

.seal img {
  width: clamp(10rem, 56vw, 18rem);
  height: auto;
  border: 1px solid rgba(176, 141, 87, .18);
  opacity: .9;
}

/* ---------- II. The deck ---------- */

.deck {
  max-width: 60rem;
  margin: 0 auto;
  padding: clamp(3rem, 10vh, 6rem) 1rem clamp(4rem, 12vh, 7rem);
  text-align: center;
}

.eyebrow {
  margin: 0 0 1rem;
  font-family: var(--display);
  font-size: .85rem;
  letter-spacing: .4em;
  text-transform: uppercase;
  color: var(--muted);
}

.deck h2 {
  margin: 0;
  font-family: var(--display);
  font-weight: 300;
  font-size: clamp(2.1rem, 7vw, 3.4rem);
  line-height: 1.1;
  letter-spacing: .04em;
}

.deck-sub {
  margin: .5rem 0 0;
  font-family: var(--display);
  font-size: clamp(1.15rem, 3.5vw, 1.4rem);
  color: var(--gold);
}

.specs {
  margin: 1.5rem auto 0;
  padding-top: 1.25rem;
  width: min(100%, 22rem);
  border-top: 1px solid var(--gold-dim);
  font-size: .9rem;
  letter-spacing: .14em;
  color: var(--muted);
}

/* Three doorways */
.doors {
  display: grid;
  gap: 1.25rem;
  margin-top: clamp(2.5rem, 7vh, 4rem);
}

@media (min-width: 46rem) {
  .doors { grid-template-columns: repeat(3, 1fr); }
}

.door {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .4rem;
  padding: 2rem 1.25rem 1.75rem;
  text-decoration: none;
  border: 1px solid rgba(176, 141, 87, .22);
  outline: 1px solid rgba(176, 141, 87, .08);
  outline-offset: 5px;
  background: linear-gradient(180deg, rgba(26, 22, 18, .9), rgba(14, 12, 10, .9));
  transition: border-color .8s var(--ease), background .8s var(--ease);
}

.door:hover,
.door:focus-visible {
  border-color: var(--gold);
}

/* Court color lives only inside its court: a hairline of Fire on its door */
.door--fire::before {
  content: "";
  position: absolute;
  top: -1px; left: 30%; right: 30%;
  height: 1px;
  background: var(--fire);
  opacity: .8;
}

.door-name {
  font-family: var(--display);
  font-size: 1.6rem;
  font-weight: 400;
  line-height: 1.2;
}

.door-line {
  font-style: italic;
  font-size: 1rem;
  color: var(--muted);
}

.door-soon {
  margin-top: .75rem;
  font-family: var(--display);
  font-size: .75rem;
  letter-spacing: .3em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: .7;
}

.door[aria-disabled="true"] { cursor: default; }

/* ---------- Footer ---------- */

.foot {
  padding: 2rem 1rem 2.5rem;
  border-top: 1px solid rgba(176, 141, 87, .12);
  text-align: center;
  font-size: .85rem;
  letter-spacing: .14em;
  color: var(--muted);
}
.foot p { margin: 0; }
.foot a {
  color: var(--gold);
  text-decoration: none;
  border-bottom: 1px solid var(--gold-dim);
  transition: color .6s var(--ease), border-color .6s var(--ease);
}
.foot a:hover { color: var(--ink); border-bottom-color: var(--gold); }

/* ---------- Motion: candle-slow, gentle ---------- */

.rise {
  opacity: 0;
  animation: rise var(--candle) var(--ease) var(--d, 0s) forwards;
}

.hero.rise {
  animation: candle 2.8s var(--ease) var(--d, 0s) forwards;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* the card comes up as if a candle is brought closer */
@keyframes candle {
  0%   { opacity: 0;  filter: brightness(.2); }
  60%  { opacity: 1;  filter: brightness(.75); }
  100% { opacity: 1;  filter: brightness(1); }
}

@media (prefers-reduced-motion: reduce) {
  .rise, .hero.rise { animation: none; opacity: 1; }
}

/* ---------- The candle: opt-in music ---------- */

.candle-btn {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right));
  bottom: max(1rem, env(safe-area-inset-bottom));
  z-index: 20;
  width: 2.75rem;
  height: 2.75rem;
  padding: .3rem;
  border: 1px solid rgba(176, 141, 87, .25);
  border-radius: 50%;
  background: rgba(14, 12, 10, .8);
  cursor: pointer;
  transition: border-color .6s var(--ease), box-shadow 1.2s var(--ease);
}
.candle-btn:hover { border-color: var(--gold); }
.candle-btn svg { display: block; width: 100%; height: 100%; }
.cb-body  { fill: none; stroke: var(--muted); stroke-width: 1.2; }
.cb-wick  { stroke: var(--muted); stroke-width: 1.2; }
.cb-base  { stroke: var(--muted); stroke-width: 1.2; stroke-linecap: round; }
.cb-flame { fill: #F3C67A; opacity: 0; transform-origin: 12px 15px; transform: scale(.4); transition: opacity 1.2s var(--ease), transform 1.2s var(--ease); }

.candle-btn.is-lit { border-color: rgba(201, 120, 46, .6); box-shadow: 0 0 22px -4px rgba(201, 120, 46, .45); }
.candle-btn.is-lit .cb-flame { opacity: 1; transform: scale(1); animation: flicker 3.2s ease-in-out infinite; }
.candle-btn.is-waiting .cb-flame { opacity: .35; transform: scale(.7); }

@keyframes flicker {
  0%, 100% { transform: scale(1) skewX(0deg); }
  30%      { transform: scale(.94, 1.04) skewX(-2deg); }
  60%      { transform: scale(1.03, .97) skewX(1.5deg); }
}
@media (prefers-reduced-motion: reduce) { .candle-btn.is-lit .cb-flame { animation: none; } }

.music-credit { margin-top: .5rem !important; font-size: .75rem; letter-spacing: .06em; opacity: .75; }
.music-credit a { color: inherit; }
