/* Little Letters · In the Wild, C and D (Phase 05.1): A Little Forecast and Tiny Controls.
   Loaded after wild.css, which supplies the paper tokens (--cotton, --kraft, --grain, --lift),
   the washi strip and the desk placement (.artifact--forecast, .artifact--controls).
   Motion is short, plays once per action, and only when the visitor welcomes it. */

/* C. A Little Forecast --------------------------------------------------- */

/* A small weather card for how the day feels. Each forecast tints the paper; the ink stays graphite. */
.forecast {
  --sky: #FBF1D3;          /* sunny: butter */
  --tint: #F2D58E;
  --tint-ink: #8A6A2A;
  position: relative;
  display: grid;
  gap: 4px;
  padding: 26px 22px 18px;
  background-color: var(--sky);
  background-image: var(--grain);
  border: 1px solid rgba(52, 52, 47, 0.12);
  border-radius: 14px 12px 15px 13px;
  box-shadow: var(--lift);
  color: var(--graphite);
  font-family: var(--letters);
}

.forecast[data-weather="cloudy"] { --sky: #EEEAE3; --tint: #D9D3C8; --tint-ink: #64635B; }
.forecast[data-weather="rainy"]  { --sky: #E4EAEE; --tint: #A9BBC8; --tint-ink: #4F6577; }
.forecast[data-weather="cozy"]   { --sky: #E6E2E8; --tint: #BDB4C6; --tint-ink: #5F566B; }

/* A hairline frame inside the edge, like a printed card. */
.forecast::before {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(52, 52, 47, 0.1);
  border-radius: 9px 8px 10px 8px;
  pointer-events: none;
}

.fc-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  font: 600 10.5px/1.4 var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--graphite-soft);
}

.fc-when {
  font: 400 16px/1 var(--letters);
  letter-spacing: 0;
  text-transform: none;
}

.fc-stage {
  display: grid;
  place-items: center;
  height: 112px;
  margin: 2px 0 0;
}

/* The drawings: one pencil weight, round ends, the colour only where it is needed. */
.fc-art {
  width: 150px;
  height: 104px;
  overflow: visible;
  fill: none;
  stroke: var(--graphite);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fc-scene { display: none; }
.forecast[data-weather="sunny"] .fc-scene--sunny,
.forecast[data-weather="cloudy"] .fc-scene--cloudy,
.forecast[data-weather="rainy"] .fc-scene--rainy,
.forecast[data-weather="cozy"] .fc-scene--cozy { display: inline; }

.fc-sun { fill: #F2D58E; }
.fc-face { stroke-width: 1.5; }
.fc-rays { stroke: #C79A3E; }
.fc-cloud { fill: var(--paper); }
.fc-cloud--back { fill: #E3DDD3; stroke: var(--graphite-soft); }
.fc-scene--rainy .fc-cloud { fill: #DCE4EA; }
.fc-drops { stroke: #6E8799; stroke-width: 1.8; }
.fc-moon { fill: #CFC7D8; }
.fc-stars { stroke: #8F84A0; stroke-width: 1.5; }

.fc-scene, .fc-rays, .fc-cloud, .fc-drops path, .fc-moon, .fc-stars path {
  transform-box: fill-box;
  transform-origin: center;
}

.fc-message {
  font-size: 34px;
  line-height: 1.1;
  text-wrap: balance;
}

.fc-sub {
  margin-top: 4px !important;
  font-size: 20px;
  line-height: 1.25;
  color: var(--graphite-soft);
}

/* Four small paper tabs. The chosen one sits forward, on paper, with its colour showing. */
.fc-picks {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  margin-top: 16px !important;
  padding: 12px 0 0;
  border-top: 1px dashed rgba(52, 52, 47, 0.2);
  list-style: none;
}

.fc-pick {
  display: grid;
  justify-items: center;
  gap: 2px;
  width: 100%;
  min-height: 56px;
  padding: 7px 2px 5px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--graphite-soft);
  font: 400 17px/1 var(--letters);
}

.fc-pick:hover { border-color: rgba(52, 52, 47, 0.18); background: rgba(255, 252, 246, 0.45); }
.fc-pick:active { background: rgba(255, 252, 246, 0.8); }

.fc-pick[aria-pressed="true"] {
  border-color: rgba(52, 52, 47, 0.28);
  background: var(--paper);
  color: var(--graphite);
  box-shadow: 0 1px 0 rgba(52, 52, 47, 0.08);
}

.fc-pick-icon {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.fc-pick[aria-pressed="true"] .fc-pick-icon { fill: var(--tint); stroke: var(--tint-ink); }
.fc-pick[aria-pressed="true"] .fc-pick-icon path + path { fill: none; }  /* rays, drops and stars stay lines */

@media (forced-colors: active) {
  .fc-pick[aria-pressed="true"] { border: 2px solid Highlight; }
}

/* Sage tape across the top edge, tipped against the card's own lean. */
.washi--forecast {
  --tape: #A7B09A;
  --tape-alpha: 0.52;
  --tape-rot: 7deg;
  top: -14px;
  left: 50%;
  width: 86px;
  height: 23px;
  transform: translateX(-50%) rotate(var(--tape-rot));
}


/* D. Tiny Controls ---------------------------------------------------- */

/* A kraft board with three controls pressed into it. "cozy" turns it to evening paper. */
.tiny {
  --board: var(--kraft);
  --board-ink: var(--kraft-ink);
  --board-soft: rgba(74, 67, 54, 0.74);
  --groove: rgba(74, 67, 54, 0.16);
  --bead: var(--paper);
  position: relative;
  display: grid;
  gap: 22px;
  padding: 30px clamp(22px, 6%, 34px) 26px;
  background: var(--grain), var(--board);
  border-radius: 6px;
  box-shadow: 0 1px 1px rgba(52, 52, 47, 0.06), 0 10px 22px -18px rgba(52, 52, 47, 0.32);
  color: var(--board-ink);
  font-family: var(--letters);
}

.tiny[data-mood="cozy"] {
  --board: #4A443B;
  --board-ink: #F5ECDC;
  --board-soft: rgba(245, 236, 220, 0.76);
  --groove: rgba(0, 0, 0, 0.26);
  --bead: #F5ECDC;
}

/* A stitched frame, like the jar label that lived here before. */
.tiny::before {
  content: "";
  position: absolute;
  inset: 9px;
  border: 1.5px dashed color-mix(in srgb, var(--board-ink) 28%, transparent);
  border-radius: 3px;
  pointer-events: none;
}

.tiny-title {
  font-weight: 400;
  font-size: clamp(30px, 7vw, 36px);
  line-height: 1.1;
}

.tiny-part {
  display: grid;
  gap: 6px;
}

.tiny-label {
  font: 600 11px/1.4 var(--sans);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--board-soft);
}

/* How loud: the word grows from a whisper to a shout. Its box never changes height. */
.tiny-word {
  display: flex;
  align-items: center;
  height: 64px;
  line-height: 1;
  white-space: nowrap;
}

.tiny-word[data-level="1"] { font-size: 20px; opacity: 0.62; }
.tiny-word[data-level="2"] { font-size: 27px; opacity: 0.8; }
.tiny-word[data-level="3"] { font-size: 35px; }
.tiny-word[data-level="4"] { font-size: 44px; }
.tiny-word[data-level="5"] { font-size: 54px; color: var(--terracotta-ink); }
.tiny[data-mood="cozy"] .tiny-word[data-level="5"] { color: #E7B9A9; }

/* A groove pressed into the board and a paper bead that sits in it. Scoped past the Playground's slider. */
.tiny input.tiny-range {
  width: 100%;
  height: 44px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
}

.tiny input.tiny-range::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 8px;
  background:
    radial-gradient(circle, color-mix(in srgb, var(--board-ink) 45%, transparent) 0 1.5px, transparent 2px) 4px 50% / calc((100% - 8px) / 4) 8px repeat-x,
    var(--groove);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.18);
}
.tiny input.tiny-range::-moz-range-track {
  height: 8px;
  border-radius: 8px;
  background: var(--groove);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.18);
}
.tiny input.tiny-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 28px;
  height: 28px;
  margin-top: -10px;
  border: 1.5px solid color-mix(in srgb, var(--board-ink) 55%, transparent);
  border-radius: 50%;
  background: radial-gradient(circle, var(--terracotta) 0 3px, transparent 3.5px), var(--bead);
  box-shadow: 0 2px 0 rgba(52, 52, 47, 0.18), 0 4px 8px -4px rgba(52, 52, 47, 0.4);
}
.tiny input.tiny-range::-moz-range-thumb {
  width: 25px;
  height: 25px;
  border: 1.5px solid color-mix(in srgb, var(--board-ink) 55%, transparent);
  border-radius: 50%;
  background: radial-gradient(circle, var(--terracotta) 0 3px, transparent 3.5px), var(--bead);
  box-shadow: 0 2px 0 rgba(52, 52, 47, 0.18), 0 4px 8px -4px rgba(52, 52, 47, 0.4);
}
.tiny input.tiny-range:active::-webkit-slider-thumb { transform: scale(1.08); box-shadow: 0 1px 0 rgba(52, 52, 47, 0.18); }
.tiny input.tiny-range:active::-moz-range-thumb { transform: scale(1.08); }

.tiny-ends {
  display: flex;
  justify-content: space-between;
  margin-top: -8px !important;
  font-size: 16px;
  color: var(--board-soft);
}

/* The mood switch: a small pill with a knob that slides from sun to evening. */
.tiny-switch-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 21px;
}

.tiny-switch {
  position: relative;
  flex: none;
  width: 60px;
  min-height: 0;
  height: 34px;
  padding: 0;
  border: 1.5px solid color-mix(in srgb, var(--board-ink) 50%, transparent);
  border-radius: 999px;
  background: var(--groove);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.16);
}

/* 44 px of touch target around the 34 px pill. */
.tiny-switch::before {
  content: "";
  position: absolute;
  inset: -6px -2px;
}

.tiny-switch:hover { border-color: var(--board-ink); background: var(--groove); }
.tiny-switch:active { background: var(--groove); }

.tiny-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: #F2D58E;
  box-shadow: 0 1px 0 rgba(52, 52, 47, 0.2), 0 0 0 4px rgba(242, 213, 142, 0.25);
}

.tiny-switch[aria-checked="true"] .tiny-knob {
  transform: translateX(26px);
  background: #F5ECDC;
  box-shadow: inset -6px -3px 0 0 #C9BBA4, 0 1px 0 rgba(0, 0, 0, 0.25);
}

.tiny-side { color: var(--board-soft); }
.tiny[data-mood="sunny"] .tiny-side:first-child,
.tiny[data-mood="cozy"] .tiny-side:last-child { color: var(--board-ink); }

/* Press gently: a paper button with a little depth, and a folded note tucked behind it. */
.tiny-surprise { gap: 0; justify-items: start; }

.tiny-press {
  min-height: 48px;
  padding: 8px 22px 10px;
  border: 1.5px solid color-mix(in srgb, var(--board-ink) 55%, transparent);
  border-radius: 14px 16px 15px 13px;
  background: var(--paper);
  color: var(--graphite);
  box-shadow: 0 3px 0 color-mix(in srgb, var(--board-ink) 40%, transparent);
  font: 400 23px/1.1 var(--letters);
}

.tiny-press:hover { border-color: var(--board-ink); background: var(--paper); }
.tiny-press:active { background: var(--ivory); transform: translateY(2px); box-shadow: 0 1px 0 color-mix(in srgb, var(--board-ink) 40%, transparent); }

.tiny-slip-holder {
  width: 100%;
  min-height: 0;
}

.tiny-slip {
  position: relative;
  max-width: 100%;
  margin: 14px 0 0 10px !important;
  padding: 14px 18px 14px 20px;
  background:
    linear-gradient(100deg, transparent 49.6%, rgba(52, 52, 47, 0.07) 50%, transparent 52%),
    var(--grain), var(--cotton);
  border: 1px solid rgba(228, 221, 209, 0.9);
  border-radius: 2px;
  box-shadow: var(--lift);
  color: var(--graphite);
  font-size: 23px;
  line-height: 1.25;
  transform: rotate(-1.6deg);
  transform-origin: 30% 0;
}

.tiny-slip:empty { display: none; }

@media (forced-colors: active) {
  .tiny-knob { forced-color-adjust: none; background: CanvasText; }
}

/* Terracotta tape, the two top corners, as the menu had. */
.washi--tiny {
  --tape: #B98D80;
  --tape-alpha: 0.58;
  --tape-rot: 9deg;
  top: -16px;
  left: auto;
  right: 26px;
  width: 58px;
  height: 22px;
  transform: rotate(var(--tape-rot));
}

.washi--tiny-left {
  --tape: #B98D80;
  --tape-alpha: 0.58;
  --tape-rot: -5deg;
  top: -14px;
  left: 30px;
  width: 52px;
  height: 22px;
  transform: rotate(var(--tape-rot));
}


/* Motion ---------------------------------------------------------------- */

@media (prefers-reduced-motion: no-preference) {
  .forecast { transition: background-color 360ms ease; }
  .fc-pick { transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease; }

  /* One small moment per forecast, played once when it is chosen. */
  .forecast.is-arriving .fc-words { animation: fc-words 420ms cubic-bezier(0.22, 0.7, 0.25, 1) both; }
  .forecast.is-arriving .fc-scene--sunny { animation: fc-rise 700ms cubic-bezier(0.22, 0.8, 0.3, 1) both; }
  .forecast.is-arriving .fc-rays { animation: fc-rays 800ms cubic-bezier(0.3, 1.2, 0.5, 1) 120ms both; }
  .forecast.is-arriving .fc-scene--cloudy .fc-cloud { animation: fc-drift 900ms cubic-bezier(0.22, 0.7, 0.25, 1) both; }
  .forecast.is-arriving .fc-scene--cloudy .fc-cloud--back { animation-duration: 1100ms; animation-delay: 80ms; }
  .forecast.is-arriving .fc-drops path { animation: fc-drop 560ms cubic-bezier(0.4, 0, 0.6, 1) both; }
  .forecast.is-arriving .fc-drops path:nth-child(2) { animation-delay: 90ms; }
  .forecast.is-arriving .fc-drops path:nth-child(3) { animation-delay: 170ms; }
  .forecast.is-arriving .fc-drops path:nth-child(4) { animation-delay: 60ms; }
  .forecast.is-arriving .fc-drops path:nth-child(5) { animation-delay: 240ms; }
  .forecast.is-arriving .fc-drops path:nth-child(6) { animation-delay: 300ms; }
  .forecast.is-arriving .fc-moon { animation: fc-sway 900ms cubic-bezier(0.3, 1.3, 0.5, 1) both; }
  .forecast.is-arriving .fc-stars path { animation: fc-twinkle 900ms ease-out both; }
  .forecast.is-arriving .fc-stars path:nth-child(3),
  .forecast.is-arriving .fc-stars path:nth-child(4) { animation-delay: 160ms; }
  .forecast.is-arriving .fc-stars path:nth-child(5),
  .forecast.is-arriving .fc-stars path:nth-child(6) { animation-delay: 300ms; }

  .tiny { transition: background-color 320ms ease, color 320ms ease; }
  .tiny-word { transition: font-size 220ms cubic-bezier(0.3, 1.3, 0.5, 1), opacity 180ms ease, color 180ms ease; }
  .tiny-knob { transition: transform 260ms cubic-bezier(0.3, 1.4, 0.5, 1), background-color 260ms ease, box-shadow 260ms ease; }
  .tiny-press { transition: transform 90ms ease, box-shadow 90ms ease; }
  .tiny-slip.is-new { animation: slip-out 460ms cubic-bezier(0.22, 0.9, 0.3, 1) both; }
}

@keyframes fc-words {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
/* sunny: the sun comes up a little, and its rays open out. */
@keyframes fc-rise {
  from { transform: translateY(10px); }
  to { transform: none; }
}
@keyframes fc-rays {
  from { opacity: 0; transform: scale(0.7) rotate(-14deg); }
  to { opacity: 1; transform: none; }
}
/* cloudy: the clouds drift in from the left and settle. */
@keyframes fc-drift {
  from { opacity: 0; transform: translateX(-14px); }
  to { opacity: 1; transform: none; }
}
/* rainy: the drops fall once. */
@keyframes fc-drop {
  from { opacity: 0; transform: translateY(-9px); }
  to { opacity: 1; transform: none; }
}
/* cozy: the moon rocks gently into place; the stars light up one by one. */
@keyframes fc-sway {
  0% { transform: rotate(-16deg); }
  60% { transform: rotate(4deg); }
  100% { transform: none; }
}
@keyframes fc-twinkle {
  0% { opacity: 0; transform: scale(0.4); }
  55% { opacity: 1; transform: scale(1.25); }
  100% { opacity: 1; transform: none; }
}

/* The note slides out from under the button and unfolds as it lands. */
@keyframes slip-out {
  from { opacity: 0; transform: translateY(-14px) rotate(0deg) scaleY(0.4); }
  60% { opacity: 1; }
  to { opacity: 1; transform: rotate(-1.6deg); }
}
