/* Ozzily: page theme and the live surface. The engine (scrollcraft.css) is
   untouched; everything bespoke lives here. */

:root {
  --sc-canvas:     #FDF4F1;
  --sc-surface:    #FFFDF9;
  --sc-ink:        #3B2E5A;
  --sc-ink-soft:   #66568A;
  --sc-accent:     #FF9F43;
  --sc-accent-ink: #2F2449;
  --sc-font-display: "Plus Jakarta Sans", system-ui, sans-serif;
  --sc-font-text:    "Plus Jakarta Sans", system-ui, sans-serif;
  --sc-shadow-color: 262 40% 18%;

  /* Written every frame by day.js from the clock. These are 7:02 am. */
  --sky-top: #F4B78A;
  --sky-low: #FCE3C6;
  --night: 0;

  --oz-bubble: #F1E9F7;
  --me-bubble: #3B2E5A;
  --night-ground: #241B36;
}

body { background: var(--sc-canvas); color: var(--sc-ink); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ------------------------------------------------------------------ stage */
/* No position here: the engine makes the stage sticky, and that is the pin. */
.day__stage { overflow: hidden; height: 100svh; }

.sky {
  position: absolute; inset: 0; z-index: 0;
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-low) 78%);
}
.sky__horizon {
  position: absolute; inset: auto 0 0 0; height: 26%;
  background: linear-gradient(180deg, transparent, color-mix(in oklab, var(--sky-low) 70%, #fff 30%));
  opacity: calc(1 - var(--night) * 0.8);
}
.sky__sun, .sky__moon { position: absolute; left: 0; top: 0; will-change: transform; }
.sky__sun { filter: drop-shadow(0 18px 40px hsl(28 90% 45% / 0.28)); }
.sky__pupils { transition: transform 260ms var(--sc-ease-out); }
.sky__moon {
  width: 92px; height: 92px; border-radius: 50%;
  background: radial-gradient(circle at 36% 34%, #FFF8EA 0 46%, #F3E3C4 70%, #E5CFA6 100%);
  box-shadow: 0 0 0 14px hsl(40 80% 90% / 0.06), 0 0 0 34px hsl(40 80% 90% / 0.035);
  opacity: 0;
}
.sky__stars {
  position: absolute; inset: 0; opacity: calc(var(--night) * 0.9);
  background-image:
    radial-gradient(1.4px 1.4px at 12% 18%, #fff 50%, transparent 51%),
    radial-gradient(1.1px 1.1px at 23% 42%, #fff 50%, transparent 51%),
    radial-gradient(1.6px 1.6px at 37% 12%, #fff 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 58% 26%, #fff 50%, transparent 51%),
    radial-gradient(1.3px 1.3px at 71% 9%,  #fff 50%, transparent 51%),
    radial-gradient(1.1px 1.1px at 83% 34%, #fff 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 91% 16%, #fff 50%, transparent 51%),
    radial-gradient(1.1px 1.1px at 6% 61%,  #fff 50%, transparent 51%),
    radial-gradient(1.2px 1.2px at 48% 55%, #fff 50%, transparent 51%),
    radial-gradient(1.3px 1.3px at 95% 58%, #fff 50%, transparent 51%);
}
.sky__cloud {
  position: absolute; border-radius: 50%; will-change: transform;
  background: radial-gradient(closest-side, hsl(30 100% 99% / 0.85), hsl(30 100% 99% / 0) 100%);
  opacity: calc(0.9 - var(--night) * 0.75);
}
.sky__cloud--far  { width: 620px; height: 150px; top: 14%; left: 0; opacity: calc(0.55 - var(--night) * 0.45); }
.sky__cloud--near { width: 900px; height: 230px; top: 64%; left: 0; }

/* ---------------------------------------------------------------- layout */
.day__layout {
  position: relative; z-index: 2; height: 100%;
  display: grid; align-items: center; justify-content: center;
  grid-template-columns: minmax(12rem, 15rem) auto minmax(13rem, 16.5rem);
  gap: clamp(2rem, 4.5vw, 5rem);
  padding: var(--sc-5) var(--sc-gutter);
}

/* ------------------------------------------------------------------ rail */
.rail { align-self: center; }
.rail__intro {
  margin: 0 0 var(--sc-6); font-size: var(--sc-t-sm); line-height: 1.55; max-width: 26ch;
  color: var(--rail-ink, var(--sc-ink)); text-wrap: pretty;
  padding: var(--sc-3) var(--sc-4); border-radius: var(--sc-r-md);
  background: var(--rail-plate, hsl(30 100% 99% / 0.72));
  box-shadow: var(--sc-e1);
  transition: background-color 420ms var(--sc-ease-out), color 420ms var(--sc-ease-out);
}
.rail__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.rail__list a {
  display: grid; grid-template-columns: 3.4rem 1fr; align-items: baseline; gap: var(--sc-3);
  padding: 0.55rem var(--sc-4); border-radius: var(--sc-r-pill);
  color: var(--rail-ink, var(--sc-ink)); text-decoration: none; font-size: var(--sc-t-sm);
  background: transparent;
  transition: background-color 180ms var(--sc-ease-out), color 180ms var(--sc-ease-out);
}
.rail__list time { font-weight: 700; font-variant-numeric: tabular-nums; }
.rail__list span { font-weight: 500; }
.rail__list a.is-past span { opacity: 0.78; }
.rail__list a.is-now { background: var(--rail-plate, hsl(30 100% 99% / 0.82)); box-shadow: var(--sc-e1); }
@media (hover: hover) and (pointer: fine) {
  .rail__list a:hover { background: var(--rail-plate, hsl(30 100% 99% / 0.6)); }
}
.rail__list a:active { transform: translateY(1px); }
.is-night { --rail-ink: #FDF4F1; --rail-plate: hsl(262 32% 26% / 0.86); }

/* ----------------------------------------------------------------- phone */
.phone {
  width: clamp(20rem, 25vw, 23.5rem);
  height: min(47rem, calc(100svh - 3rem));
  padding: 11px; border-radius: 52px;
  background: linear-gradient(160deg, #3A2E55, #221A35);
  box-shadow:
    inset 0 1px 0 hsl(0 0% 100% / 0.14),
    0 2px 4px hsl(var(--sc-shadow-color) / 0.18),
    0 22px 44px -10px hsl(var(--sc-shadow-color) / 0.36),
    0 60px 90px -30px hsl(var(--sc-shadow-color) / 0.35);
}
.phone__screen {
  position: relative; height: 100%; border-radius: 42px; overflow: hidden;
  display: flex; flex-direction: column;
  background:
    linear-gradient(180deg, color-mix(in oklab, var(--sky-low) 16%, #FFFBF6), #FFFBF6 40%);
}
.phone__status {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 26px 4px; font-size: 0.82rem; font-weight: 700; color: var(--sc-ink);
}
.phone__icons { display: inline-flex; gap: 6px; align-items: center; fill: currentColor; color: var(--sc-ink); }
.clock { font-variant-numeric: tabular-nums; }

.thread__head {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--sc-3);
  padding: var(--sc-2) var(--sc-4) var(--sc-3);
  border-bottom: 1px solid hsl(262 30% 30% / 0.08);
}
.avatar { width: 40px; height: 40px; border-radius: 50%; background: #FFF1E2; padding: 3px; }
.thread__who h1 { margin: 0; font-size: 1rem; font-weight: 800; letter-spacing: -0.01em; line-height: 1.2; }
.thread__who p  { margin: 0; font-size: 0.74rem; color: var(--sc-ink-soft); line-height: 1.3; }
.mini { display: none; align-items: center; gap: 6px; font-size: 0.8rem; font-weight: 700; }
.mini svg { transform: rotate(-90deg); }
.mini .ring__track, .mini .ring__fill { stroke-width: 4.5; }

.thread { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.thread__list {
  list-style: none; margin: 0; padding: var(--sc-3) var(--sc-4) var(--sc-4);
  display: flex; flex-direction: column; gap: 6px;
  will-change: transform; transition: transform 380ms var(--sc-ease-out);
}
.thread.is-free { overflow-y: auto; overscroll-behavior: contain; }
.thread.is-free .thread__list { transform: none !important; transition: none; }

.day-mark {
  align-self: center; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--sc-ink-soft); margin: var(--sc-1) 0 var(--sc-2);
}

.msg { max-width: 82%; display: grid; gap: 3px; }
.msg p {
  margin: 0; padding: 0.6rem 0.85rem; border-radius: 20px;
  font-size: 0.9rem; line-height: 1.45; text-wrap: pretty;
}
.msg time { font-size: 0.68rem; font-weight: 600; color: var(--sc-ink-soft); padding: 0 0.5rem; font-variant-numeric: tabular-nums; }
.msg--oz { align-self: flex-start; }
.msg--oz p { background: var(--oz-bubble); color: var(--sc-ink); border-bottom-left-radius: 6px; }
.msg--me { align-self: flex-end; justify-items: end; }
.msg--me p { background: var(--me-bubble); color: #FFF7EE; border-bottom-right-radius: 6px; }
.msg--peak p { background: #FFE9CF; }
.msg--photo { max-width: 72%; }
.msg--photo figure { margin: 0; border-radius: 20px; border-bottom-right-radius: 6px; overflow: hidden; box-shadow: var(--sc-e1); }
.msg--photo img { display: block; width: 100%; height: auto; }
.msg--demo p { background: #E8F1E2; }
.msg--cta a {
  display: inline-block; margin-top: 2px; padding: 0.55rem 1rem; border-radius: var(--sc-r-pill);
  background: var(--sc-accent); color: var(--sc-accent-ink); font-weight: 800; font-size: 0.88rem; text-decoration: none;
}

.chips { display: flex; gap: 6px; padding-top: 4px; }
.chip {
  font: inherit; font-size: 0.8rem; font-weight: 700; cursor: pointer;
  padding: 0.42rem 0.8rem; min-height: 34px; border-radius: var(--sc-r-pill);
  border: 1.5px solid hsl(262 30% 30% / 0.22); background: #FFFDF9; color: var(--sc-ink);
  transition: background-color 150ms var(--sc-ease-out), border-color 150ms var(--sc-ease-out), transform 120ms var(--sc-ease-out);
}
.chip[aria-pressed="true"] { background: var(--sc-ink); border-color: var(--sc-ink); color: #FFF7EE; }
@media (hover: hover) and (pointer: fine) { .chip:hover { border-color: var(--sc-ink); } }
.chip:active { transform: scale(0.97); }

.typing { align-self: flex-end; display: inline-flex; gap: 4px; padding: 0.7rem 0.85rem; border-radius: 20px; border-bottom-right-radius: 6px; background: hsl(262 30% 30% / 0.1); }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--sc-ink-soft); animation: ozDot 1.1s infinite ease-in-out; }
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes ozDot { 0%, 60%, 100% { transform: translateY(0); opacity: 0.45; } 30% { transform: translateY(-4px); opacity: 1; } }

/* Scroll state. Without JS, every message simply shows. */
.js:not(.day-static) .thread__list > [data-at]:not(.is-in),
.js:not(.day-static) .typing:not(.is-in) { display: none; }
.js:not(.day-static) .thread__list > .is-in { animation: ozIn 260ms var(--sc-ease-out) both; }
@keyframes ozIn { from { opacity: 0; transform: translateY(8px) scale(0.98); } to { opacity: 1; transform: none; } }
.day-static .typing { display: none; }

.compose {
  display: grid; grid-template-columns: 1fr auto; gap: var(--sc-2); align-items: center;
  padding: var(--sc-2) var(--sc-3) var(--sc-1);
  border-top: 1px solid hsl(262 30% 30% / 0.08);
}
.compose input {
  font: inherit; font-size: 0.92rem; min-width: 0; height: 40px; padding: 0 1rem;
  border-radius: var(--sc-r-pill); border: 1.5px solid hsl(262 30% 30% / 0.18); background: #fff; color: var(--sc-ink);
  transition: border-color 150ms var(--sc-ease-out);
}
.compose input::placeholder { color: var(--sc-ink-soft); }
.compose input:disabled { background: hsl(262 30% 30% / 0.04); }
.compose button {
  width: 40px; height: 40px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; background: var(--sc-ink); color: #FFF7EE;
  transition: transform 120ms var(--sc-ease-out), opacity 150ms var(--sc-ease-out);
}
.compose button:disabled { opacity: 0.35; cursor: default; }
.compose button:not(:disabled):active { transform: scale(0.94); }
.compose.is-live input { border-color: var(--sc-accent); }
.compose__note { margin: 0; padding: 4px var(--sc-4) 14px; font-size: 0.68rem; line-height: 1.35; color: var(--sc-ink-soft); text-align: center; }

/* --------------------------------------------------------------- inspect */
.inspect {
  align-self: center; justify-self: start;
  width: 100%; padding: var(--sc-5); border-radius: 28px;
  background: var(--sc-surface); color: var(--sc-ink);
  box-shadow: var(--sc-edge), var(--sc-e2);
  transition: background-color 420ms var(--sc-ease-out), color 420ms var(--sc-ease-out);
}
.inspect__label { margin: 0 0 var(--sc-3); font-size: 0.78rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; color: var(--sc-ink-soft); }
.ring { display: grid; place-items: center; position: relative; margin-bottom: var(--sc-4); }
.ring svg { transform: rotate(-90deg); }
.ring__track { fill: none; stroke: #F3E3D8; stroke-width: 11; }
.ring__fill {
  fill: none; stroke: var(--sc-accent); stroke-width: 11; stroke-linecap: round;
  stroke-dasharray: 100; stroke-dashoffset: 100;
  transition: stroke-dashoffset 900ms var(--sc-ease-out);
}
.ring__num { position: absolute; margin: 0; display: grid; justify-items: center; line-height: 1.1; }
.ring__num b { font-size: 2.3rem; font-weight: 800; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.ring__num span { font-size: 0.72rem; color: var(--sc-ink-soft); font-weight: 600; max-width: 9ch; text-align: center; }
.inspect__stats { margin: 0 0 var(--sc-4); display: grid; gap: 0; }
.inspect__stats > div { display: flex; justify-content: space-between; align-items: baseline; gap: var(--sc-3); padding: 0.6rem 0; border-top: 1px solid hsl(262 30% 30% / 0.1); }
.inspect__stats dt { font-size: 0.84rem; color: var(--sc-ink-soft); font-weight: 600; }
.inspect__stats dd { margin: 0; font-size: 0.9rem; font-weight: 800; text-align: right; font-variant-numeric: tabular-nums; }
.inspect__stats small { display: block; font-size: 0.72rem; font-weight: 600; color: var(--sc-ink-soft); }
.inspect__foot { margin: 0 0 var(--sc-4); font-size: 0.72rem; line-height: 1.45; color: var(--sc-ink-soft); }
.inspect__cta {
  display: inline-flex; align-items: center; min-height: 44px; padding: 0 1.15rem; border-radius: var(--sc-r-pill);
  background: var(--sc-accent); color: var(--sc-accent-ink); font-weight: 800; font-size: 0.9rem; text-decoration: none;
  box-shadow: 0 6px 16px -6px hsl(28 90% 45% / 0.55);
  transition: transform 140ms var(--sc-ease-out), box-shadow 140ms var(--sc-ease-out);
}
@media (hover: hover) and (pointer: fine) { .inspect__cta:hover { transform: translateY(-1px); box-shadow: 0 10px 20px -8px hsl(28 90% 45% / 0.6); } }
.inspect__cta:active { transform: translateY(1px); }

.is-night .inspect { --sc-ink: #FDF4F1; --sc-ink-soft: #CDBFE6; background: #33284A; color: var(--sc-ink); }
.is-night .inspect .ring__track { stroke: #4A3D66; }

/* ------------------------------------------------------------------ close */
.card-sec {
  position: relative; z-index: 2;
  background: var(--night-ground);
  padding: var(--sc-8) var(--sc-gutter) var(--sc-7);
  display: grid; justify-items: center;
}
.card {
  width: min(100%, 36rem);
  padding: clamp(1.5rem, 4vw, 2.75rem); border-radius: 32px;
  background: var(--sc-surface); color: var(--sc-ink);
  box-shadow: var(--sc-edge), 0 30px 60px -24px hsl(262 50% 6% / 0.6);
}
.card__head { display: grid; grid-template-columns: auto 1fr; gap: var(--sc-4); align-items: center; margin-bottom: var(--sc-6); }
.card__avatar { width: 72px; height: 72px; border-radius: 50%; background: #FFF1E2; padding: 6px; }
.card h2 { margin: 0 0 var(--sc-1); font-size: var(--sc-t-xl); font-weight: 800; letter-spacing: var(--sc-track-snug); line-height: 1.1; }
.card__head p { margin: 0; font-size: var(--sc-t-sm); line-height: 1.5; color: var(--sc-ink-soft); text-wrap: pretty; }
.plans { list-style: none; margin: 0 0 var(--sc-5); padding: 0; display: grid; gap: var(--sc-2); }
.plans li {
  display: grid; grid-template-columns: 1fr auto; gap: 2px var(--sc-4); align-items: baseline;
  padding: var(--sc-4); border-radius: 18px; background: #FBF1EA;
}
.plans__name { font-weight: 800; }
.plans__price { font-size: var(--sc-t-sm); color: var(--sc-ink-soft); font-variant-numeric: tabular-nums; }
.plans__price b { font-size: 1.45rem; color: var(--sc-ink); letter-spacing: -0.02em; }
.plans__note { grid-column: 1 / -1; font-size: 0.82rem; color: var(--sc-ink-soft); }
.cta {
  display: flex; justify-content: center; align-items: center; min-height: 54px; margin-bottom: var(--sc-5);
  border-radius: var(--sc-r-pill); background: var(--sc-accent); color: var(--sc-accent-ink);
  font-weight: 800; font-size: 1.05rem; text-decoration: none;
  box-shadow: 0 10px 24px -10px hsl(28 90% 45% / 0.65);
  transition: transform 140ms var(--sc-ease-out), box-shadow 140ms var(--sc-ease-out);
}
@media (hover: hover) and (pointer: fine) { .cta:hover { transform: translateY(-1px); box-shadow: 0 14px 28px -10px hsl(28 90% 45% / 0.7); } }
.cta:active { transform: translateY(1px); }
.card__small { margin: 0 0 var(--sc-3); font-size: 0.78rem; line-height: 1.55; color: var(--sc-ink-soft); text-wrap: pretty; }
.card__small a, .card__foot a { color: var(--sc-ink); text-underline-offset: 3px; }
.card__foot {
  display: flex; flex-wrap: wrap; gap: var(--sc-2) var(--sc-4); align-items: center;
  margin-top: var(--sc-5); padding-top: var(--sc-4); border-top: 1px solid hsl(262 30% 30% / 0.1);
  font-size: 0.78rem; color: var(--sc-ink-soft);
}
.card__foot span { margin-left: auto; }

/* focus, everywhere */
a:focus-visible, button:focus-visible, input:focus-visible {
  outline: 3px solid #C2620A; outline-offset: 3px;
}
.is-night .rail a:focus-visible { outline-color: #FFC170; }

/* ----------------------------------------------------- reduced / static */
.day-static .day__stage { height: auto; overflow: visible; }
.day-static .day__layout { height: auto; align-items: start; padding-block: var(--sc-7); }
.day-static .rail, .day-static .inspect { align-self: start; }
.day-static .phone { height: auto; }
.day-static .thread { overflow: visible; }
.day-static .sky__sun, .day-static .sky__moon { display: none; }
.day-static .sky { position: fixed; }

/* ----------------------------------------------------------------- medium */
@media (max-width: 1080px) {
  .day__layout { grid-template-columns: minmax(11rem, 13rem) auto; }
  .inspect { display: none; }
  .mini { display: inline-flex; }
}

/* ------------------------------------------------------------------ phone
   On a phone the page IS the phone: no frame, the thread fills the screen,
   and the sky becomes the thread's own wallpaper. */
@media (max-width: 760px) {
  .day__layout { display: block; padding: 0; }
  .rail { display: none; }
  .phone { width: 100%; height: 100svh; padding: 0; border-radius: 0; background: none; box-shadow: none; }
  .day-static .phone { height: auto; }
  .phone__screen {
    border-radius: 0;
    background: linear-gradient(180deg, color-mix(in oklab, var(--sky-top) 55%, #FFFBF6), color-mix(in oklab, var(--sky-low) 45%, #FFFBF6));
  }
  .phone__status { display: none; }
  .thread__head {
    padding: calc(var(--sc-3) + env(safe-area-inset-top)) var(--sc-4) var(--sc-3);
    background: hsl(30 100% 99% / 0.92); border-bottom-color: hsl(262 30% 30% / 0.1);
  }
  .thread__head .clock { display: none; }
  .msg { max-width: 86%; }
  .msg p { font-size: 0.95rem; }
  .msg time, .day-mark { background: hsl(30 100% 99% / 0.78); border-radius: var(--sc-r-pill); padding: 1px 8px; justify-self: start; }
  .msg--me time { justify-self: end; }
  .compose { background: hsl(30 100% 99% / 0.94); padding-bottom: var(--sc-1); }
  .compose__note { background: hsl(30 100% 99% / 0.94); padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .sky__sun { width: 112px; height: 112px; }
  .sky { opacity: 0.0; }
  .chip { min-height: 40px; padding-inline: 1rem; }
  .card-sec { padding-top: var(--sc-7); }
  .card__foot span { margin-left: 0; }
}
