/* stoke.to — embers under a night sky. Tokens first; everything derives.
   No control chrome exists: the card is the interface (see app.ts). */

:root {
  --night: #10141f;
  --night-2: #1a2030;
  --ember: #ff9d5c;
  --ember-deep: #e2622b;
  --ash: #9aa3b5;
  --paper: #f2ede4;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  /* Hold progress, written by app.ts; the card warms as the ember gathers. */
  --gather: 0;
}

* {
  box-sizing: border-box;
  margin: 0;
}

html,
body {
  height: 100%;
}

body {
  background: radial-gradient(120% 90% at 50% 110%, var(--night-2) 0%, var(--night) 60%);
  color: var(--paper);
  font-family: var(--sans);
  overflow: hidden;
}

#sky {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

.wordmark {
  position: fixed;
  top: 1.25rem;
  left: 1.5rem;
  z-index: 1;
  font-family: var(--serif);
  font-size: 1.05rem;
  letter-spacing: 0.14em;
  color: color-mix(in srgb, var(--ember) 55%, transparent);
  pointer-events: none;
}

/* The whole viewport takes the gesture — there is no smaller target to find. */
.stage {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 1.5rem;
  touch-action: none;
  cursor: grab;
  -webkit-user-select: none;
  user-select: none;
}

.stage:active {
  cursor: grabbing;
}

.card {
  max-width: 34rem;
  text-align: center;
  opacity: 0;
  transform: translateY(0.5rem);
  transition: opacity 600ms ease, transform 600ms ease, filter 300ms ease;
  filter: drop-shadow(0 0 calc(var(--gather) * 26px) color-mix(in srgb, var(--ember) 60%, transparent));
}

.card.lit {
  opacity: 1;
  transform: none;
}

/* While the finger is down the card tracks it 1:1 — no easing in the way. */
.card.dragging {
  transition: filter 300ms ease;
}

/* Arrival hint: the card drifts once, teaching the gesture without a word. */
.card.hinting {
  animation: drift 900ms ease-in-out;
}

@keyframes drift {
  0%,
  100% {
    transform: none;
  }
  50% {
    transform: translateX(-14px);
  }
}

/* Taken: one flare as the ember leaves with you. */
.card.taken {
  animation: taken 700ms ease-out;
}

@keyframes taken {
  0% {
    filter: drop-shadow(0 0 0 transparent);
  }
  30% {
    filter: drop-shadow(0 0 30px color-mix(in srgb, var(--ember) 85%, transparent));
    transform: translateY(-6px) scale(1.015);
  }
  100% {
    filter: drop-shadow(0 0 0 transparent);
    transform: none;
  }
}

/* The ember sank back: the hold was heard, but nothing left with you. */
.card.sank {
  animation: sank 700ms ease-out;
}

@keyframes sank {
  0%,
  100% {
    filter: drop-shadow(0 0 0 transparent);
    opacity: 1;
  }
  40% {
    filter: drop-shadow(0 0 12px color-mix(in srgb, var(--ember-deep) 40%, transparent));
    opacity: 0.72;
    transform: translateY(3px);
  }
}

/* The one word on the card that answers to touch: it tunes the trail to its
   own kind. Styled as part of the writing, never as a control. */
.category {
  display: inline-block;
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ember-deep);
  margin-bottom: 1.25rem;
  cursor: pointer;
  transition: color 300ms ease, text-shadow 300ms ease;
}

.category:hover {
  color: var(--ember);
}

/* Tuned: this kind is lit, and the trail holds to it. */
.category.tuned {
  color: var(--ember);
  text-shadow: 0 0 14px color-mix(in srgb, var(--ember) 65%, transparent);
}

/* Kept: these words already have a star in your sky. */
.card.kept .quote {
  text-shadow: 0 0 26px color-mix(in srgb, var(--ember) 22%, transparent);
}

.quote {
  font-family: var(--serif);
  font-size: clamp(1.5rem, 4.5vw, 2.3rem);
  line-height: 1.35;
  font-weight: 400;
}

.author {
  margin-top: 1.5rem;
  font-size: 0.95rem;
  color: var(--ash);
  font-style: italic;
}

/* Present to assistive tech and to the keyboard, invisible to the world. */
.sr-only button {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.sr-only button:focus-visible {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  width: auto;
  height: auto;
  clip: auto;
  padding: 0.55rem 1.3rem;
  border-radius: 999px;
  border: 1px solid var(--ember);
  background: var(--night);
  color: var(--ember);
  font-family: var(--sans);
  font-size: 0.9rem;
  outline: none;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--ember) 40%, transparent);
}

@media (prefers-reduced-motion: reduce) {
  .card,
  .card.hinting,
  .card.taken,
  .card.sank {
    transition: none;
    animation: none;
  }
}
