/* Palette taken from the printed Family Weekly System: navy, gold, and the purple/teal group colours. */

:root {
  color-scheme: light;
  --bg: #faf8f3;
  --surface: #ffffff;
  --surface-alt: #f2efe7;
  --text: #1c2a33;
  --text-muted: #5b6770;
  --border: #e3ded2;
  --navy: #1b3a4f;
  --on-navy: #ffffff;
  --gold: #d89a3a;
  --folder: #1b3a4f; /* selected day tab and the line it sits on */

  --family-bg: #fcefc9;
  --family-edge: #d89a3a;
  --kids-bg: #efe6f8;
  --kids-edge: #7b4fa8;
  --parents-bg: #dcece8;
  --parents-edge: #2f7d6d;
  --solo-bg: #ffffff;

  --now: #c4572b;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.06), 0 2px 8px rgba(0, 0, 0, 0.05);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #11181d;
    --surface: #1a242b;
    --surface-alt: #222e36;
    --text: #e8ecef;
    --text-muted: #9aa7b0;
    --border: #2d3a43;
    --navy: #0d2433;
    --family-bg: #3a3020;
    --kids-bg: #2e2540;
    --parents-bg: #1d3532;
    --solo-bg: #1a242b;
    --kids-edge: #b08ad8;
    --parents-edge: #5fb8a5;
    --now: #f08a5d;
    --folder: #2f6385;
    --shadow: none;
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #11181d;
  --surface: #1a242b;
  --surface-alt: #222e36;
  --text: #e8ecef;
  --text-muted: #9aa7b0;
  --border: #2d3a43;
  --navy: #0d2433;
  --family-bg: #3a3020;
  --kids-bg: #2e2540;
  --parents-bg: #1d3532;
  --solo-bg: #1a242b;
  --kids-edge: #b08ad8;
  --parents-edge: #5fb8a5;
  --now: #f08a5d;
  --folder: #2f6385;
  --shadow: none;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 var(--sans);
  min-height: 100vh;
}

a { color: inherit; }

.app-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: var(--navy);
  color: var(--on-navy);
}

.app-bar { transition: transform 200ms ease; }
.bar-hidden .app-bar { transform: translateY(-100%); }

.brand {
  font: 600 1.15rem var(--serif);
  text-decoration: none;
  border-left: 4px solid var(--gold);
  padding-left: 10px;
}

main {
  overflow-x: clip; /* keeps the swipe slide-in from adding a sideways scrollbar */
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 16px calc(40px + env(safe-area-inset-bottom));
}

h1, h2 { font-family: var(--serif); margin: 0; }

.muted { color: var(--text-muted); }

.demo-notice {
  margin: 0 0 16px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px dashed var(--family-edge);
  background: var(--family-bg);
  font-size: 0.9rem;
}

/* People picker */

.picker-title { font-size: 1.6rem; margin: 8px 0 4px; }

.people-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-top: 20px;
}

@media (min-width: 560px) {
  .people-grid { grid-template-columns: repeat(3, 1fr); }
}

.person-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 20px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none;
}

.person-card:hover, .person-card:focus-visible { border-color: var(--gold); }

.person-card .name { font-weight: 600; font-size: 1.1rem; }

.avatar {
  display: inline-grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--avatar);
  color: #fff;
  font: 600 1.4rem var(--serif);
  flex: none;
}

.avatar.small { width: 30px; height: 30px; font-size: 0.9rem; }

/* Family guides: tiles on the home screen and their pages */

.icon { width: 24px; height: 24px; fill: currentColor; flex: none; }

.guides-title { font-size: 1.2rem; max-width: 480px; margin: 28px auto 12px; } /* lines up with the centered tiles */

/* Two tiles side by side, centered under the name cards; capped so they don't stretch on wide screens. */
.guide-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  max-width: 480px;
  margin: 0 auto;
}

.guide-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 18px 12px;
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none;
}

.guide-tile:hover, .guide-tile:focus-visible { border-color: var(--gold); }
.guide-tile .name { display: block; font-weight: 600; font-size: 1.05rem; }
.guide-tile .summary { display: block; font-size: 0.85rem; margin-top: 2px; }

.guide-badge {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--navy);
  color: var(--gold);
  flex: none;
}

.guide-intro { margin: 0 0 16px; }

.guide-items { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

.guide-item {
  display: flex;
  gap: 14px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--parents-edge);
  border-radius: 12px;
}

.guide-item-icon {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--parents-bg);
  color: var(--parents-edge);
  flex: none;
}

.guide-item .title { font-weight: 600; }
.guide-item .text { font-size: 0.925rem; color: var(--text-muted); margin-top: 2px; }

.guide-footer {
  margin: 16px 0 0;
  padding: 12px 14px;
  border-radius: 10px;
  border-left: 4px solid var(--gold);
  background: var(--family-bg);
  font-size: 0.95rem;
}

.guide-checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }

.guide-checklist li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
}

.guide-checklist .icon { color: var(--parents-edge); width: 20px; height: 20px; }

/* Person switcher and day tabs */

.switcher, .day-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  scrollbar-width: none;
  margin: 0 -16px;
  padding: 2px 16px 10px;
}

.switcher::-webkit-scrollbar, .day-tabs::-webkit-scrollbar { display: none; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: none;
  padding: 4px 14px 4px 4px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  text-decoration: none;
  font-size: 0.95rem;
}

.chip[aria-current="page"] {
  border-color: var(--text);
  font-weight: 600;
}

/* Day tabs styled like folder tabs: they overlap slightly, and the selected one is taller and
   joins the navy line under the row, like the front folder in a drawer. */
.day-tabs {
  gap: 0;
  align-items: flex-end;
  padding: 6px 16px 0;
}

.day-tab {
  position: relative;
  z-index: 1;
  flex: 1 0 auto;
  min-width: 46px;
  margin-left: -6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 7px 6px 5px;
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 10px 10px 0 0;
  background: var(--surface-alt);
  color: var(--text-muted);
  box-shadow: 2px -1px 3px rgba(0, 0, 0, 0.06);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}

.day-tab:first-child { margin-left: 0; }

.day-tab .dot {
  width: 6px;
  height: 6px;
  margin-top: 4px;
  border-radius: 50%;
  background: transparent;
}

.day-tab.today .dot { background: var(--gold); }

.day-tab[aria-current="page"] {
  z-index: 3;
  padding-top: 12px;
  border-color: var(--folder);
  background: var(--folder);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.18);
}

/* The name and day rows stay pinned under the app bar while the schedule scrolls. */
.person-nav {
  position: sticky;
  top: var(--bar-h, 56px);
  transition: top 200ms ease;
  z-index: 5;
  margin: 0 -16px;
  padding: 4px 16px 0;
  background: var(--bg);
  border-bottom: 3px solid var(--folder);
}

/* Day header */

.day-head { margin: 14px 0 12px; }

.eyebrow {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--parents-edge);
  font-weight: 700;
}

.day-head h1 { font-size: 1.9rem; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }

.today-badge {
  font: 600 0.75rem var(--sans);
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--gold);
  color: #1c2a33;
}

.day-head .summary { margin: 4px 0 0; font-size: 0.9rem; }

.targets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
}

.targets li {
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--surface-alt);
  font-size: 0.85rem;
}

.targets strong { font-weight: 600; }

/* Now / next */

.now-card {
  margin: 16px 0;
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--navy);
  color: var(--on-navy);
}

.now-card .label {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 700;
}

.now-card .title { font: 600 1.25rem var(--serif); margin: 2px 0; }

.now-card .next { margin-top: 10px; padding-top: 10px; border-top: 1px solid rgba(255, 255, 255, 0.2); font-size: 0.9rem; }

/* Timeline */

.timeline { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }

.block {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border-left: 5px solid var(--edge, var(--border));
  background: var(--block-bg, var(--solo-bg));
  box-shadow: var(--shadow);
  scroll-margin-top: calc(var(--sticky-h, 160px) + 8px);
}

.block.family { --block-bg: var(--family-bg); --edge: var(--family-edge); }
.block.kids { --block-bg: var(--kids-bg); --edge: var(--kids-edge); }
.block.parents { --block-bg: var(--parents-bg); --edge: var(--parents-edge); }
.block.solo { --edge: var(--person-color); }

.block .time { font-size: 0.85rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.block .length { font-size: 0.75rem; color: var(--text-muted); }
.block .title { font-weight: 600; }
.block .detail { font-size: 0.875rem; color: var(--text-muted); margin-top: 2px; }

.tag {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: 2px;
  background: rgba(0, 0, 0, 0.07);
}

.block.past { opacity: 0.55; }

.block.now {
  outline: 2px solid var(--now);
  outline-offset: 2px;
}

.block.now .tag.now-tag { background: var(--now); color: #fff; }

@media (max-width: 380px) {
  .block { grid-template-columns: 1fr; gap: 4px; }
}

/* Lists below the timeline */

.section { margin-top: 24px; }
.section h2 { font-size: 1.15rem; margin-bottom: 8px; }

.plain-list { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }

.plain-list li {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.95rem;
}

.notes li { border-left: 4px solid var(--gold); }

.empty { padding: 24px; text-align: center; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
  font-size: 0.8rem;
}

.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

.swipe-hint { display: none; }
@media (hover: none) and (pointer: coarse) {
  .swipe-hint { display: inline; }
}

/* Person and guide pages have no app bar: the pinned rows start at the top, below the
   phone's status bar when running as a home-screen app. */
.no-app-bar .app-bar { display: none; }
.no-app-bar .person-nav { top: 0; padding-top: calc(8px + env(safe-area-inset-top)); }

.switcher-row { display: flex; align-items: center; gap: 8px; }
.switcher-row .switcher {
  flex: 1;
  min-width: 0;
  margin-left: 0;
  padding-left: 2px;
  /* fade the names as they scroll under the left edge, next to the home button */
  -webkit-mask-image: linear-gradient(to right, transparent 0, #000 14px);
  mask-image: linear-gradient(to right, transparent 0, #000 14px);
}

.home-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  margin-bottom: 8px; /* line up with the name chips, which sit above the row's bottom padding */
  border-radius: 50%;
  background: var(--folder); /* navy in light mode, a brighter blue in dark mode */
  color: #fff;
  flex: none;
}
.home-button .icon { width: 22px; height: 22px; }

.guide-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 10px;
  margin-bottom: 14px;
}
.guide-nav .home-button { margin-bottom: 0; }
.guide-nav h1 { font-size: 1.5rem; }
.guide-hint { margin-top: 20px; text-align: center; font-size: 0.85rem; }

/* While the app bar is hidden, the pinned rows sit at the very top. */
.bar-hidden .person-nav { top: 0; }

@media (prefers-reduced-motion: reduce) {
  .app-bar, .person-nav { transition: none; }
}

/* Swipe: only the day's schedule slides in, with no fade, so nothing above it blinks. */
@media (prefers-reduced-motion: no-preference) {
  .day-content.slide-next { animation: slide-in-next 180ms ease-out; }
  .day-content.slide-prev { animation: slide-in-prev 180ms ease-out; }
}
@keyframes slide-in-next { from { transform: translateX(32px); } to { transform: none; } }
@keyframes slide-in-prev { from { transform: translateX(-32px); } to { transform: none; } }

a:focus-visible, button:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
