/* Entry 026 — The tail end
   Series: Soulware.
   Scene art direction: late light over open water at the end of a clear day. The sea is
   time; one frosted panel floats close, counting a love. One accent — a low amber-gold —
   is reserved for the evenings you have left: a little held warmth on a wide cold sea.
   Display: Marcellus (the soul); Hanken Grotesk (the machine). Radius 18px. */

.tail-scene {
  display: grid;
  place-items: center;
  min-height: 780px;
  padding: 120px 32px;
  border-color: rgba(20, 30, 26, 0.7);
  /* background-first: a real dusk-sea photograph carries the mood; a cool scrim deepens
     the water and keeps the panel legible, warming slightly toward the low sun on the right. */
  background-image:
    linear-gradient(180deg, rgba(16, 24, 21, 0.62) 0%, rgba(18, 26, 22, 0.30) 46%, rgba(12, 19, 16, 0.72) 100%),
    radial-gradient(120% 90% at 86% 64%, rgba(120, 78, 36, 0.34), transparent 60%),
    url("../../public/media/backgrounds/warm-13-kellen.jpg");
  background-size: cover, cover, cover;
  background-position: center, center, center 38%;
  background-repeat: no-repeat, no-repeat, no-repeat;
}

/* mid layer — the low sun's warmth spilled across the water behind the panel */
.seaglow {
  position: absolute;
  z-index: 0;
  right: 8%;
  top: 50%;
  width: min(720px, 80%);
  height: 420px;
  transform: translateY(-50%);
  background: radial-gradient(58% 58% at 60% 50%, rgba(231, 164, 78, 0.20), transparent 72%);
  filter: blur(54px);
  pointer-events: none;
  transition: opacity 900ms ease;
}

/* ------------------------------------------------------------------ */
/* THE COMPONENT — one frosted-glass panel that counts a love          */
/* ------------------------------------------------------------------ */

.tally {
  position: relative;
  z-index: 2;
  width: min(560px, 100%);
  display: grid;
  gap: 22px;
  padding: 40px 42px 30px;
  border-radius: 18px;
  font-family: "Hanken Grotesk", var(--ui-sans);
  /* deep, cool frosted glass — a still pane held over warm water */
  background:
    linear-gradient(168deg, rgba(58, 74, 70, 0.30), rgba(16, 26, 23, 0.46));
  border: 1px solid rgba(214, 226, 220, 0.20);
  box-shadow:
    0 1px 0 rgba(228, 236, 232, 0.26) inset,
    0 0 0 1px rgba(10, 16, 14, 0.22),
    0 60px 130px rgba(8, 16, 14, 0.62),
    0 16px 50px rgba(60, 40, 18, 0.24);
  backdrop-filter: blur(26px) saturate(1.2);
  -webkit-backdrop-filter: blur(26px) saturate(1.2);
  color: #f1ece4;
  transition: filter 700ms ease, opacity 700ms ease;
}

/* person tabs — machine chrome, small and recessive */
.tally-people {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.who {
  font-family: "Hanken Grotesk", var(--ui-sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(226, 224, 214, 0.62);
  background: rgba(232, 236, 230, 0.05);
  border: 1px solid rgba(214, 226, 220, 0.16);
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
  transition: color 180ms ease, background 200ms ease, border-color 200ms ease;
}

.who:hover { color: #f3efe7; border-color: rgba(231, 164, 78, 0.4); }

.who.is-on {
  color: #14100a;
  background: linear-gradient(180deg, #f3d3a0, #e7a44e);
  border-color: rgba(231, 164, 78, 0.6);
  box-shadow: 0 6px 18px rgba(231, 164, 78, 0.26);
}

/* the head — name in the soul serif */
.tally-head {
  margin: 4px 0 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.tally-name {
  font-family: "Marcellus", "Newsreader", Georgia, serif;
  font-size: clamp(30px, 4.4vw, 42px);
  letter-spacing: 0.01em;
  color: #f6f1ea;
}

.tally-sub {
  font-family: "Hanken Grotesk", var(--ui-sans);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: rgba(220, 222, 212, 0.55);
}

/* the hero line — the arithmetic, said plainly, in the soul serif */
.tally-line {
  margin: 0;
  font-family: "Marcellus", "Newsreader", Georgia, serif;
  font-size: clamp(23px, 3vw, 31px);
  line-height: 1.22;
  letter-spacing: 0.004em;
  color: #f4ece1;
  text-wrap: balance;
  min-height: 2.2em;
}

.tally-line .count {
  color: #f4bd72;
  font-style: normal;
}

/* the field of marks — a small warm remainder against the dim spent past */
.marks {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  align-content: flex-start;
  min-height: 96px;
  padding: 2px 0;
  transition: filter 600ms ease, opacity 600ms ease;
}

/* the [hidden] attribute must beat the display:flex rules below */
.marks[hidden],
.marks-collapsed[hidden] { display: none; }

.mark {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex: none;
}

/* spent — the years already behind the glass */
.mark.spent {
  background: rgba(225, 228, 220, 0.10);
  box-shadow: inset 0 0 0 1px rgba(225, 228, 220, 0.07);
}

/* left — the evenings you still have, lit like the last warmth on the water */
.mark.left {
  background: radial-gradient(circle at 38% 34%, #ffe2b0, #e7a44e 70%);
  box-shadow: 0 0 9px rgba(231, 164, 78, 0.55), 0 0 2px rgba(246, 201, 122, 0.9);
  animation: ignite 480ms cubic-bezier(0.2, 0.6, 0.2, 1) both;
}

/* planned — a maybe you turned into a date: ringed, brighter */
.mark.planned {
  background: radial-gradient(circle at 38% 34%, #fff3dd, #f3b65e 68%);
  box-shadow: 0 0 0 2px rgba(255, 240, 214, 0.8), 0 0 14px rgba(246, 201, 122, 0.8);
}

@keyframes ignite {
  from { opacity: 0; transform: scale(0.4); }
  to   { opacity: 1; transform: scale(1); }
}

/* collapsed state — when the evenings outrun counting */
.marks-collapsed {
  display: flex;
  align-items: baseline;
  gap: 14px;
  flex-wrap: wrap;
  min-height: 96px;
  align-content: center;
  padding-top: 18px;
}

.marks-collapsed .big {
  font-family: "Marcellus", "Newsreader", Georgia, serif;
  font-size: clamp(48px, 8vw, 76px);
  line-height: 0.9;
  color: #f4bd72;
  text-shadow: 0 0 24px rgba(231, 164, 78, 0.4);
}

.marks-collapsed .big-label {
  font-family: "Newsreader", Georgia, serif;
  font-style: italic;
  font-size: 16px;
  color: rgba(228, 224, 214, 0.7);
  max-width: 22ch;
}

/* the dial — the move that puts the number back in your hands */
.dial {
  display: grid;
  gap: 9px;
  padding-top: 6px;
  border-top: 1px solid rgba(214, 226, 220, 0.14);
}

.dial-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(220, 222, 212, 0.5);
}

.cadence {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(231, 164, 78, 0.7), rgba(225, 228, 220, 0.16));
  outline: none;
  cursor: pointer;
}

.cadence::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 34%, #fff1d8, #e7a44e 72%);
  border: 1px solid rgba(255, 240, 214, 0.7);
  box-shadow: 0 4px 14px rgba(231, 164, 78, 0.45);
  cursor: pointer;
}

.cadence::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 34%, #fff1d8, #e7a44e 72%);
  border: 1px solid rgba(255, 240, 214, 0.7);
  box-shadow: 0 4px 14px rgba(231, 164, 78, 0.45);
  cursor: pointer;
}

.dial-val {
  font-family: "Newsreader", Georgia, serif;
  font-style: italic;
  font-size: 16px;
  color: rgba(236, 230, 220, 0.85);
}

/* foot — turn the number into a plan */
.tally-foot {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.plan {
  font-family: "Hanken Grotesk", var(--ui-sans);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.005em;
  color: #14100a;
  background: linear-gradient(180deg, #f6ddb2, #e7a44e);
  border: 1px solid rgba(231, 164, 78, 0.6);
  border-radius: 999px;
  padding: 12px 22px;
  cursor: pointer;
  transition: transform 180ms ease, box-shadow 200ms ease;
}

.plan:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(231, 164, 78, 0.36); }

.plan-note {
  font-family: "Newsreader", Georgia, serif;
  font-style: italic;
  font-size: 15px;
  color: rgba(244, 222, 188, 0.92);
  animation: fade 460ms ease both;
}

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* the look-away — a first-class way out, off by default */
.lookaway {
  justify-self: start;
  margin-top: 2px;
  font-family: "Hanken Grotesk", var(--ui-sans);
  font-size: 12.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: rgba(220, 222, 212, 0.5);
  background: none;
  border: none;
  border-bottom: 1px solid rgba(214, 226, 220, 0.22);
  padding: 2px 0 3px;
  cursor: pointer;
  transition: color 200ms ease, border-color 200ms ease;
}

.lookaway:hover { color: #f1ece4; border-color: rgba(231, 164, 78, 0.5); }

/* unobtrusive photo attribution */
.scene-credit {
  position: absolute;
  right: 16px;
  bottom: 13px;
  z-index: 3;
  font-family: var(--ui-sans);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(228, 232, 224, 0.34);
  pointer-events: none;
}

/* ---- resting state: looked away. The marks soften to a wordless warm wash. ---- */
.tally[data-state="resting"] .marks,
.tally[data-state="resting"] .marks-collapsed {
  filter: blur(9px) saturate(1.1);
  opacity: 0.6;
}

.tally[data-state="resting"] .dial,
.tally[data-state="resting"] .tally-foot { display: none; }

.tally[data-state="resting"] .lookaway { color: #f1ece4; border-color: rgba(231, 164, 78, 0.5); }

.tail-scene:has(.tally[data-state="resting"]) .seaglow { opacity: 0.7; }

/* ---- small screens ---- */
@media (max-width: 720px) {
  .tail-scene { padding: 64px 16px; min-height: 0; }
  .tally { padding: 30px 24px 24px; gap: 18px; }
  .marks { min-height: 80px; }
}
