/* Family page demo (/demo). Builds on site.css. */

.tone-ok { --tone: var(--teal); --tone-bg: var(--ok-bg); --tone-ink: var(--ok); }
.tone-bad { --tone: #b4412b; --tone-bg: var(--bad-bg); --tone-ink: var(--bad); }
.tone-warn, .tone-wait { --tone: #c98a2b; --tone-bg: #f6ecd7; --tone-ink: var(--warn); }
.tone-idle { --tone: #8e97a5; --tone-bg: var(--sage); --tone-ink: var(--ink-2); }

/* ---- intro and plan switch ---- */
.demo-intro { display: flex; flex-direction: column; gap: 16px; padding-top: 20px; padding-bottom: 40px; }
.demo-intro h1 { font-size: clamp(38px, 5.6vw, 58px); }
.plan-switch { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.plan-switch-label { font-size: 15px; font-weight: 700; }
.switch { display: flex; flex-wrap: wrap; gap: 4px; align-self: flex-start; padding: 4px; border: 1px solid rgba(243, 245, 241, 0.25); border-radius: 12px; background: rgba(243, 245, 241, 0.06); }
.switch label { position: relative; flex: 1 1 auto; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.switch span { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 16px; border-radius: 9px; font-size: 16px; font-weight: 700; color: var(--on-navy); }
.switch label:hover span { background: rgba(243, 245, 241, 0.1); }
.switch input:checked + span { background: var(--amber); color: var(--navy); }
.switch input:focus-visible + span { outline: 3px solid var(--amber); outline-offset: 2px; }
.plan-desc { font-size: 16px; color: var(--on-navy-2); }

/* ---- time bar ---- */
.stepbar { position: sticky; top: 0; z-index: 20; background: rgba(243, 245, 241, 0.97); border-bottom: 1px solid var(--line); }
@supports (backdrop-filter: blur(8px)) { .stepbar { background: rgba(243, 245, 241, 0.88); backdrop-filter: blur(8px); } }
.stepbar-row { display: flex; align-items: center; gap: 8px; padding-top: 8px; }
.step-arrow {
  display: grid;
  place-items: center;
  flex: 0 0 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--navy);
  cursor: pointer;
}
.step-arrow.next { background: var(--navy); border-color: var(--navy); color: var(--on-navy); }
.step-arrow:hover:not(:disabled) { border-color: var(--navy); }
.step-arrow.next:hover:not(:disabled) { background: #22304f; }
.step-arrow:disabled { opacity: 0.35; cursor: default; }
.step-arrow:focus-visible { outline: 3px solid var(--amber); outline-offset: 2px; }
.stops { position: relative; display: flex; flex: 1; min-width: 0; margin: 0; padding: 0; list-style: none; overflow-x: auto; scrollbar-width: none; }
.stops::-webkit-scrollbar { display: none; }
.stops li { position: relative; flex: 1 0 96px; }
.stops li::before, .stops li::after { content: ""; position: absolute; top: 19px; width: 50%; height: 2px; background: var(--line); }
.stops li::before { left: 0; }
.stops li::after { right: 0; }
.stops li:first-child::before, .stops li:last-child::after { display: none; }
.stops li[data-state="past"]::before, .stops li[data-state="past"]::after, .stops li[data-state="current"]::before { background: var(--navy); }
.stop {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: 100%;
  padding: 11px 4px 8px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--ink-2);
  font: inherit;
  cursor: pointer;
}
.stop-dot { width: 16px; height: 16px; margin-bottom: 3px; border: 2px solid var(--tone); border-radius: 999px; background: var(--paper); transition: transform 0.15s ease; }
.stop-time { font-family: var(--mono); font-size: 13px; white-space: nowrap; }
.stop-label { font-size: 13px; line-height: 1.25; color: var(--muted); text-align: center; }
.stop:hover .stop-label { color: var(--navy); }
.stop[aria-current="step"] .stop-dot { transform: scale(1.3); background: var(--tone); box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--tone); }
.stop[aria-current="step"] .stop-time { color: var(--navy); font-weight: 500; }
.stop[aria-current="step"] .stop-label { color: var(--navy); font-weight: 700; }
.stop:focus-visible { outline: 3px solid var(--amber); outline-offset: -3px; }
.caption { min-height: 2.9em; padding: 2px 0 12px; font-size: 16px; line-height: 1.45; color: var(--ink-2); }
.caption strong { margin-right: 4px; font-family: var(--mono); font-weight: 500; color: var(--navy); }
@media (prefers-reduced-motion: reduce) { .stop-dot { transition: none; } }
@media (max-width: 560px) {
  .caption { min-height: 4.4em; font-size: 15px; }
  .stop-label { font-size: 12px; }
  /* Fade the edges so moments cut off by the scroll look deliberate. */
  .stops { -webkit-mask-image: linear-gradient(to right, transparent, #000 18px, #000 calc(100% - 18px), transparent); mask-image: linear-gradient(to right, transparent, #000 18px, #000 calc(100% - 18px), transparent); }
}

/* ---- layout ---- */
.demo { padding-top: 28px; padding-bottom: 64px; }
.noscript { margin-bottom: 20px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
.demo-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "head" "now" "phone" "today" "problems" "week" "more";
  gap: 16px;
}
.fam-head { grid-area: head; }
.now { grid-area: now; }
.phone-col { grid-area: phone; }
#today { grid-area: today; }
#problems { grid-area: problems; }
#week { grid-area: week; }
.more { grid-area: more; display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 16px; align-items: start; }
@media (min-width: 960px) {
  .demo-grid {
    grid-template-columns: minmax(0, 1fr) 360px;
    grid-template-areas: "head phone" "now phone" "today phone" "problems phone" "week phone" "more phone";
    column-gap: 40px;
    align-items: start;
  }
  .phone-col { position: sticky; top: calc(var(--bar-h, 120px) + 20px); }
}

/* ---- family page ---- */
.fam-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 16px; }
.fam-head h2 { margin-top: 4px; font-size: clamp(32px, 4vw, 42px); }
.fam-sub { margin-top: 6px; color: var(--ink-2); }
.fam-head .sample-stamp { font-size: 12px; }
.fam-card { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); }
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; margin-bottom: 10px; }
.card-head h3 { font-size: 20px; }
.card-meta { font-family: var(--mono); font-size: 13px; color: var(--muted); }

.now { border-left: 6px solid var(--tone); background: var(--tone-bg); }
.now.tone-idle { background: var(--card); }
.now-label { font-family: var(--mono); font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.now h3 { margin: 6px 0 8px; font-family: var(--serif-display); font-weight: 400; font-size: clamp(28px, 3.4vw, 36px); line-height: 1.1; }
.now p { color: var(--ink-2); }
.now .now-action { margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(21, 33, 58, 0.14); color: var(--navy); font-weight: 700; }

.pill[class*="tone-"] { background: var(--tone-bg); color: var(--tone-ink); }

.shifts { margin: 0; padding: 0; list-style: none; }
.shifts li { display: grid; gap: 3px; padding: 14px 0 12px; border-top: 1px solid var(--line-soft); }
.shifts li:last-child { padding-bottom: 0; }
.shift-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.shift-when { font-family: var(--mono); font-size: 14px; color: var(--ink-2); }
.shift-name { font-weight: 700; }
.shift-detail { font-size: 15px; color: var(--ink-2); }
.shift-note { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; padding-left: 12px; border-left: 2px solid var(--line); font-family: var(--serif); font-style: italic; font-size: 15px; color: var(--ink-2); }
.note-by { font-family: var(--mono); font-style: normal; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

.quiet { display: flex; align-items: center; gap: 8px; color: var(--ink-2); }
.quiet svg { flex-shrink: 0; color: var(--teal); }
.problem { display: grid; gap: 12px; }
.problem-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; }
.log-mini { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.log-mini li { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 10px; font-size: 15px; color: var(--ink-2); }
.log-mini time { padding-top: 2px; font-family: var(--mono); font-size: 13px; color: var(--muted); }
.problem-status { padding-top: 10px; border-top: 1px solid var(--line-soft); font-size: 15px; font-weight: 700; }

.week { font-size: 15px; }
.week th[scope="row"] { padding-right: 12px; font-size: 14px; font-weight: 400; color: var(--muted); white-space: nowrap; border-bottom: 1px solid var(--line-soft); }
.week .wday { font-weight: 700; color: var(--navy); }
.week td { padding-top: 9px; padding-bottom: 9px; }
.week tr.is-today th, .week tr.is-today td { border-bottom: 0; }
.week tr.is-today th .wday { color: var(--teal); }
.who { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.who svg { color: var(--teal); }
.flag { padding: 2px 7px; border-radius: 999px; background: var(--tone-bg); color: var(--tone-ink); font-family: var(--mono); font-size: 11px; letter-spacing: 0.04em; text-transform: uppercase; white-space: nowrap; }

.big { font-family: var(--mono); font-size: 26px; line-height: 1.15; }
.big-sub { margin-bottom: 10px; font-size: 14px; color: var(--muted); }
#month p + .fine { margin-top: 10px; }
.people { margin: 0 0 10px; padding: 0; list-style: none; }
.people li { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line-soft); font-size: 15px; }
.people li > span:first-child { display: flex; flex-direction: column; }
.people .when { font-size: 13px; color: var(--muted); }
.people .count { font-family: var(--mono); font-size: 13px; white-space: nowrap; color: var(--ink-2); }
.people .count.missed { color: var(--bad); }

/* ---- phone ---- */
.phone-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.phone { width: 100%; max-width: 380px; padding: 9px; border-radius: 36px; background: var(--navy); box-shadow: 0 24px 48px rgba(14, 23, 41, 0.22); }
.screen { display: flex; flex-direction: column; overflow: hidden; border-radius: 28px; background: #ffffff; }
.statusbar { display: flex; align-items: center; justify-content: space-between; padding: 10px 22px 2px; font-family: var(--sans); font-size: 14px; font-weight: 700; color: var(--navy); }
.statusbar svg { color: var(--navy); }
.screen-top { display: flex; align-items: center; gap: 10px; padding: 8px 16px 12px; border-bottom: 1px solid var(--line-soft); }
.avatar { display: grid; place-items: center; width: 38px; height: 38px; flex-shrink: 0; border-radius: 999px; background: var(--navy); }
.screen-top strong { display: block; font-size: 16px; line-height: 1.2; }
.screen-top .sub { font-size: 13px; color: var(--muted); }
/* Texts sit at the bottom like a real thread; margin-top: auto (not justify-content) keeps older ones scrollable. */
.thread {
  --fit: calc(100vh - var(--bar-h, 120px) - 340px);
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: clamp(220px, var(--fit), 360px);
  max-height: clamp(220px, var(--fit), 470px);
  margin: 0;
  padding: 12px;
  overflow-y: auto;
  list-style: none;
  background: #f6f7f5;
}
.thread > :first-child { margin-top: auto; }
.thread .sep { align-self: center; padding: 6px 0 2px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.bubble { align-self: flex-start; max-width: 92%; padding: 9px 13px 8px; border-radius: 18px 18px 18px 6px; background: #e4e8e3; color: var(--navy); font-size: 15px; line-height: 1.42; }
.bubble time { display: block; margin-top: 4px; font-family: var(--mono); font-size: 11px; color: var(--muted); }
.bubble.is-new { animation: arrive 0.45s ease-out both; }
@keyframes arrive { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.composer { margin: 10px 12px 14px; padding: 9px 14px; border: 1px solid var(--line); border-radius: 999px; font-size: 14px; color: #8a929c; }
.rules { max-width: 380px; font-size: 14px; color: var(--ink-2); }
.rules-title { font-weight: 700; color: var(--navy); }
.rules ul { margin: 4px 0 6px; padding-left: 18px; }
@media (max-width: 959px) {
  .phone-col { align-items: center; }
  .phone-col .eyebrow, .rules { align-self: stretch; max-width: none; }
  .thread { min-height: 0; max-height: none; }
}

/* ---- closing call to action ---- */
.demo-fine { margin-top: 18px; }
