/* Entry 025 — The echo
   Series: Last Screens.
   Scene art direction: a bedroom at 2 a.m., near-black, the room dissolved to warm
   shadow except one low amber lamp-pool upper-left. A single frosted message thread
   floats in the dark. One accent: the COOL screen-blue of the messages that come
   *back* — her replies arrive the wrong temperature, tender in content, cold in colour.
   Two voices: Cormorant Garamond italic for her returning voice (the soul), Sora for
   the machine chrome and your own typing. Distinct from 017's warm-amber last-thread. */

.echo-scene {
  display: grid;
  place-items: center;
  min-height: 780px;
  padding: 120px 32px;
  border-color: rgba(14, 9, 7, 0.7);
  /* background-first: a real photograph (one warm bloom in near-black) carries the
     mood; a warm scrim keeps the darks above pure black and the panel legible. */
  background-image:
    linear-gradient(180deg, rgba(18, 11, 8, 0.62) 0%, rgba(20, 12, 9, 0.30) 46%, rgba(12, 7, 5, 0.74) 100%),
    url("../../public/media/backgrounds/dark-warm-04-bhautik.jpg");
  background-size: cover, cover;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
}

/* mid layer — the lamp's warm spill, blurred into the dark room */
.lampglow {
  position: absolute;
  z-index: 0;
  left: 34%;
  top: 30%;
  width: min(720px, 92%);
  height: 520px;
  transform: translate(-50%, -50%);
  background:
    radial-gradient(58% 58% at 50% 50%, rgba(221, 150, 110, 0.22), rgba(150, 86, 60, 0.08) 56%, transparent 74%);
  filter: blur(60px);
  pointer-events: none;
  transition: opacity 900ms ease;
}

/* the cool counter-glow that breathes in once the echo wakes */
.echo-scene::after {
  content: "";
  position: absolute;
  z-index: 0;
  left: 56%;
  bottom: 10%;
  width: min(620px, 80%);
  height: 360px;
  transform: translate(-50%, 0);
  background: radial-gradient(60% 60% at 50% 60%, rgba(122, 167, 214, 0.0), transparent 72%);
  filter: blur(58px);
  pointer-events: none;
  transition: background 1100ms ease;
}
.echo-scene:has(.thread-card[data-state="echoing"])::after {
  background: radial-gradient(60% 60% at 50% 60%, rgba(122, 167, 214, 0.16), transparent 72%);
}

[hidden] { display: none !important; }

/* ------------------------------------------------------------------ */
/* THE COMPONENT — one frosted-glass message thread                    */
/* ------------------------------------------------------------------ */

.thread-card {
  position: relative;
  z-index: 2;
  width: min(560px, 100%);
  display: grid;
  gap: 22px;
  padding: 30px 28px 26px;
  border-radius: 26px;
  font-family: "Sora", var(--ui-sans);
  color: #f4ece6;
  /* warm frosted glass: a thin warm film over the photograph */
  background:
    linear-gradient(168deg, rgba(244, 224, 210, 0.10), rgba(30, 18, 13, 0.30));
  border: 1px solid rgba(240, 214, 196, 0.18);
  box-shadow:
    0 1px 0 rgba(252, 236, 224, 0.22) inset,
    0 0 0 1px rgba(8, 5, 4, 0.24),
    0 64px 140px rgba(6, 4, 3, 0.70),
    0 18px 54px rgba(120, 60, 36, 0.20);
  backdrop-filter: blur(30px) saturate(1.25);
  -webkit-backdrop-filter: blur(30px) saturate(1.25);
  transition: filter 700ms ease;
}

/* ---- header: who, and the quiet status line ---- */
.thread-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(240, 214, 196, 0.12);
}

.avatar {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-family: "Cormorant Garamond", "Newsreader", Georgia, serif;
  font-size: 22px;
  font-weight: 500;
  color: #f6e7dd;
  background: radial-gradient(120% 120% at 30% 25%, rgba(221, 150, 110, 0.55), rgba(120, 62, 42, 0.4));
  box-shadow: inset 0 0 0 1px rgba(252, 236, 224, 0.18), 0 6px 18px rgba(120, 60, 36, 0.3);
}

.who { display: grid; gap: 1px; margin-right: auto; }

.who .name {
  font-family: "Cormorant Garamond", "Newsreader", Georgia, serif;
  font-size: 23px;
  font-weight: 500;
  letter-spacing: 0.01em;
  color: #f7efe9;
}

.who .status {
  font-size: 11px;
  letter-spacing: 0.06em;
  color: rgba(232, 210, 196, 0.5);
  transition: color 500ms ease;
}
.thread-card[data-state="echoing"] .who .status {
  color: rgba(169, 203, 233, 0.82);
}

/* the rest button — a quiet, always-available out */
.rest-btn {
  flex: none;
  font-family: "Sora", var(--ui-sans);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: rgba(238, 216, 202, 0.62);
  background: transparent;
  border: 1px solid rgba(240, 214, 196, 0.2);
  border-radius: 999px;
  padding: 7px 14px;
  cursor: pointer;
  transition: color 200ms ease, border-color 200ms ease, background 200ms ease;
}
.rest-btn:hover {
  color: #f6ece5;
  border-color: rgba(240, 214, 196, 0.42);
  background: rgba(240, 214, 196, 0.06);
}

/* ---- the thread ---- */
.thread-scroll {
  display: grid;
  gap: 10px;
  max-height: 340px;
  overflow-y: auto;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(240, 214, 196, 0.25) transparent;
}
.thread-scroll::-webkit-scrollbar { width: 6px; }
.thread-scroll::-webkit-scrollbar-thumb {
  background: rgba(240, 214, 196, 0.22); border-radius: 999px;
}

.msg {
  max-width: 80%;
  display: grid;
  gap: 5px;
  animation: rise 460ms cubic-bezier(0.2, 0.6, 0.2, 1) both;
}
.msg p {
  margin: 0;
  padding: 11px 15px;
  font-size: 14.5px;
  line-height: 1.4;
  border-radius: 18px;
}

/* you — warm paper, right-aligned, your own machine-sans voice */
.msg.you { justify-self: end; text-align: left; }
.msg.you p {
  background: linear-gradient(180deg, rgba(247, 234, 223, 0.95), rgba(236, 216, 200, 0.92));
  color: #2a1d15;
  border-bottom-right-radius: 6px;
  box-shadow: 0 8px 22px rgba(60, 30, 18, 0.28);
}

/* her real, past message — quiet warm glass, left */
.msg.them.past { justify-self: start; }
.msg.them.past p {
  background: rgba(60, 40, 30, 0.42);
  color: rgba(244, 226, 214, 0.86);
  border: 1px solid rgba(240, 214, 196, 0.14);
  border-bottom-left-radius: 6px;
}

/* her ECHO — the generated voice. cold screen-blue glass, serif italic.
   the one wrong-temperature thing in a warm room. */
.msg.them.echo { justify-self: start; }
.msg.them.echo p {
  font-family: "Cormorant Garamond", "Newsreader", Georgia, serif;
  font-style: italic;
  font-size: 18px;
  line-height: 1.34;
  padding: 12px 17px;
  color: #eef4fc;
  background: linear-gradient(168deg, rgba(122, 167, 214, 0.20), rgba(34, 52, 84, 0.40));
  border: 1px solid rgba(169, 203, 233, 0.42);
  border-bottom-left-radius: 6px;
  box-shadow:
    0 0 0 1px rgba(20, 30, 50, 0.18),
    0 10px 30px rgba(60, 110, 180, 0.30),
    0 0 22px rgba(122, 167, 214, 0.22);
}

/* the seam under each echo — its machine scaffolding, hidden until asked for */
.msg.them.echo .stamp {
  font-family: "Sora", var(--ui-sans);
  font-style: normal;
  font-size: 10.5px;
  letter-spacing: 0.03em;
  line-height: 1.45;
  color: rgba(169, 203, 233, 0.66);
  padding-left: 4px;
  max-width: 38ch;
  display: none;
}
.thread-card[data-seams="on"] .msg.them.echo .stamp { display: block; }

/* the typing tell — cold blue, the wrong light arriving */
.typing {
  justify-self: start;
  display: inline-flex;
  gap: 5px;
  padding: 13px 17px;
  border-radius: 18px;
  border-bottom-left-radius: 6px;
  background: linear-gradient(168deg, rgba(122, 167, 214, 0.16), rgba(34, 52, 84, 0.34));
  border: 1px solid rgba(169, 203, 233, 0.34);
  box-shadow: 0 0 18px rgba(122, 167, 214, 0.2);
  animation: rise 320ms ease both;
}
.typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: #a9cbe9;
  box-shadow: 0 0 8px rgba(169, 203, 233, 0.8);
  animation: blink 1.2s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: 0.18s; }
.typing span:nth-child(3) { animation-delay: 0.36s; }

/* divider for the true last message */
.seam {
  display: grid;
  place-items: center;
  margin: 6px 0;
}
.seam span {
  font-family: "Cormorant Garamond", "Newsreader", Georgia, serif;
  font-style: italic;
  font-size: 13px;
  letter-spacing: 0.02em;
  color: rgba(232, 210, 196, 0.5);
  position: relative;
  padding: 0 14px;
}
.seam span::before, .seam span::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 34px;
  height: 1px;
  background: rgba(240, 214, 196, 0.22);
}
.seam span::before { right: 100%; }
.seam span::after { left: 100%; }

/* ---- the offer ---- */
.offer {
  display: grid;
  gap: 16px;
  padding-top: 18px;
  border-top: 1px solid rgba(240, 214, 196, 0.12);
  animation: rise 520ms cubic-bezier(0.2, 0.6, 0.2, 1) both;
}
.offer-line {
  margin: 0;
  font-family: "Cormorant Garamond", "Newsreader", Georgia, serif;
  font-size: 21px;
  line-height: 1.32;
  color: #f4e7dd;
  text-wrap: balance;
}
.offer-line b { font-weight: 600; color: #fff3ea; }

.offer-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.btn {
  font-family: "Sora", var(--ui-sans);
  font-size: 13.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  border-radius: 999px;
  padding: 12px 22px;
  cursor: pointer;
  transition: transform 180ms ease, background 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
}

/* Let her reply — the warm reach. you offer warmth; she returns cold. */
.btn-let {
  border: 1px solid rgba(247, 196, 160, 0.5);
  background: linear-gradient(180deg, #e7a274, #cd7058);
  color: #2a160d;
  box-shadow: 0 12px 30px rgba(150, 78, 48, 0.4);
}
.btn-let:hover { transform: translateY(-2px); box-shadow: 0 18px 42px rgba(150, 78, 48, 0.5); }

/* Leave it as it was — a calm ghost */
.btn-leave {
  border: 1px solid rgba(240, 214, 196, 0.22);
  background: rgba(240, 214, 196, 0.04);
  color: rgba(240, 222, 210, 0.8);
}
.btn-leave:hover { border-color: rgba(240, 214, 196, 0.46); color: #f6ece5; }

/* ---- compose ---- */
.compose { display: grid; gap: 13px; animation: rise 520ms ease both; }

.prompts { display: flex; flex-wrap: wrap; gap: 8px; }
.prompts button {
  font-family: "Sora", var(--ui-sans);
  font-size: 12px;
  color: rgba(240, 222, 210, 0.78);
  background: rgba(240, 214, 196, 0.05);
  border: 1px solid rgba(240, 214, 196, 0.18);
  border-radius: 999px;
  padding: 7px 13px;
  cursor: pointer;
  transition: border-color 180ms ease, color 180ms ease, background 180ms ease;
}
.prompts button:hover {
  border-color: rgba(169, 203, 233, 0.5);
  color: #eef4fc;
  background: rgba(122, 167, 214, 0.08);
}

.compose-bar {
  display: flex;
  gap: 9px;
  align-items: center;
}
.compose-bar input {
  flex: 1;
  font-family: "Sora", var(--ui-sans);
  font-size: 14px;
  color: #f6ece5;
  background: rgba(20, 13, 9, 0.5);
  border: 1px solid rgba(240, 214, 196, 0.2);
  border-radius: 999px;
  padding: 12px 18px;
  outline: none;
  transition: border-color 180ms ease;
}
.compose-bar input::placeholder { color: rgba(232, 210, 196, 0.4); }
.compose-bar input:focus { border-color: rgba(169, 203, 233, 0.55); }

.send {
  flex: none;
  width: 44px; height: 44px;
  border-radius: 50%;
  font-size: 17px;
  color: #eef4fc;
  background: linear-gradient(180deg, rgba(122, 167, 214, 0.4), rgba(60, 92, 140, 0.5));
  border: 1px solid rgba(169, 203, 233, 0.5);
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(60, 110, 180, 0.32);
  transition: transform 160ms ease, box-shadow 200ms ease;
}
.send:hover { transform: translateY(-1px); box-shadow: 0 12px 30px rgba(60, 110, 180, 0.45); }

.seams-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-self: start;
  font-family: "Sora", var(--ui-sans);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: rgba(169, 203, 233, 0.7);
  cursor: pointer;
  user-select: none;
}
.seams-toggle input {
  appearance: none; -webkit-appearance: none;
  width: 34px; height: 18px;
  border-radius: 999px;
  background: rgba(60, 40, 30, 0.6);
  border: 1px solid rgba(240, 214, 196, 0.22);
  position: relative; cursor: pointer;
  transition: background 220ms ease, border-color 220ms ease;
}
.seams-toggle input::after {
  content: "";
  position: absolute; top: 1px; left: 1px;
  width: 14px; height: 14px; border-radius: 50%;
  background: #e8d2c4;
  transition: transform 220ms ease, background 220ms ease;
}
.seams-toggle input:checked {
  background: rgba(122, 167, 214, 0.4);
  border-color: rgba(169, 203, 233, 0.6);
}
.seams-toggle input:checked::after { transform: translateX(16px); background: #cfe3f6; }

/* ---- rested: the thread quiets, the true ending stands ---- */
.thread-card[data-state="rested"] { filter: saturate(0.86) brightness(0.96); }
.thread-card[data-state="rested"] .thread-scroll { opacity: 0.5; max-height: 150px; }
.echo-scene:has(.thread-card[data-state="rested"]) .lampglow { opacity: 0.62; }

.rested {
  display: grid;
  gap: 8px;
  padding-top: 18px;
  border-top: 1px solid rgba(240, 214, 196, 0.12);
  animation: rise 600ms cubic-bezier(0.2, 0.6, 0.2, 1) both;
}
.rested-line {
  margin: 0;
  font-family: "Cormorant Garamond", "Newsreader", Georgia, serif;
  font-size: 25px;
  font-weight: 500;
  color: #f5e8de;
}
.rested-sub {
  margin: 0;
  font-family: "Cormorant Garamond", "Newsreader", Georgia, serif;
  font-style: italic;
  font-size: 16px;
  line-height: 1.45;
  max-width: 46ch;
  color: rgba(238, 220, 208, 0.72);
}

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

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes blink {
  0%, 80%, 100% { opacity: 0.35; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}
@media (prefers-reduced-motion: reduce) {
  .msg, .offer, .compose, .rested, .typing { animation: none; }
  .typing span { animation: none; }
}

/* ---- small screens ---- */
@media (max-width: 720px) {
  .echo-scene { padding: 72px 14px; min-height: 0; }
  .thread-card { padding: 24px 18px 22px; border-radius: 22px; gap: 18px; }
  .msg { max-width: 88%; }
  .offer-line { font-size: 19px; }
}
