:root {
  --bg: #f4f2ee;
  --surface: #fffdf9;
  --ink: #1d1b1f;
  --muted: #6f6a72;
  --faint: #b9b3b0;
  --line: #e2ddd6;
  --accent: #f08a1c;
  --accent-2: #1c4fd1;
  --gradient: linear-gradient(100deg, var(--accent-2) 10%, #8a7a9a 50%, var(--accent) 90%);
  --shadow: 0 12px 40px rgb(40 30 20 / 0.14);
  color-scheme: light;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "DM Sans", system-ui, sans-serif;
  font-size: 18px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

button { font: inherit; color: inherit; }

/* Countdown: fills the first screen, controls tucked in the bottom corners. */

.hero {
  position: relative;
  height: 100svh;
  overflow: hidden;
  display: grid;
  place-items: center;
  padding: 24px 16px 96px;
}

.now { position: relative; text-align: center; }

.eyebrow {
  margin: 0;
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  font-weight: 600;
}

.countdown {
  margin: 0;
  font-size: clamp(4rem, min(22vw, 30svh), 15rem);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.045em;
  font-variant-numeric: tabular-nums;
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  padding: 0.04em 0.06em 0.08em;
}

.countdown.idle {
  background: none;
  color: var(--faint);
  font-size: clamp(4rem, 15vw, 10rem);
}

.caption {
  margin: 0.25rem 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2.2vw, 1.25rem);
}

.corner {
  position: absolute;
  bottom: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.corner.left { left: 24px; }
/* Wide screens: the schedule button and the Brief are placed on their own, not as a row. */
.corner.left { display: contents; }
.corner.left > .pill { position: absolute; left: 24px; bottom: 24px; }
.corner.right { right: 24px; }

.disclaimer {
  position: absolute;
  top: 20px;
  right: 24px;
  max-width: calc(100% - 32px);
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  text-align: right;
}

.pill {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 0.95rem;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}

.pill, .lunch button, .download {
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease, scale 120ms ease-out;
}

.pill:active, .lunch button:active, .download:active { scale: 0.97; }

@media (hover: hover) and (pointer: fine) {
  .pill:hover { border-color: var(--faint); }
  .lunch button:not([aria-pressed="true"]):hover { background: color-mix(in srgb, var(--ink) 8%, transparent); }
}

@media (prefers-reduced-motion: reduce) {
  .pill, .lunch button, .download { transition-property: background-color, color, border-color; }
}
body:has(.sheet:popover-open) [popovertarget="schedule"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.lunch {
  display: inline-flex;
  align-items: center;
  height: 40px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}

.lunch-label {
  padding: 0 8px 0 12px;
  color: var(--ink);
  font-size: 0.95rem;
}

.lunch button {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  background: none;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.seg { position: relative; display: inline-flex; }

/* The dark highlight slides between A, B and C (each button is 32px wide). */
.seg::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 32px;
  border-radius: 999px;
  background: var(--ink);
  translate: calc(var(--i, 0) * 32px) 0;
  transition: translate 200ms cubic-bezier(0.77, 0, 0.175, 1);
}

.lunch button { position: relative; }
.lunch button[aria-pressed="true"] { color: var(--bg); }

@media (prefers-reduced-motion: reduce) {
  .seg::before { transition: none; }
}

/* Today's schedule: opens above the "View schedule" button. */

.sheet {
  position: fixed;
  inset: auto auto 76px 24px;
  margin: 0;
  width: min(340px, calc(100vw - 32px));
  max-height: calc(100svh - 120px);
  overflow: auto;
  padding: 20px 20px 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
  /* Grows out of the "View schedule" button; closing is quicker than opening. */
  transform-origin: bottom left;
  transition: opacity 120ms ease-out, scale 120ms ease-out, overlay 120ms allow-discrete, display 120ms allow-discrete;
}

.sheet:popover-open {
  transition-duration: 180ms;
  @starting-style {
    opacity: 0;
    scale: 0.95;
  }
}

.sheet:not(:popover-open) {
  opacity: 0;
  scale: 0.95;
}

@media (prefers-reduced-motion: reduce) {
  .sheet { transition-property: opacity, overlay, display; }
  .sheet:not(:popover-open), .sheet:popover-open { scale: 1; }
}

.sheet h2 {
  margin: 0 0 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}

.blocks {
  list-style: none;
  margin: 0;
  padding: 0;
}

.blocks li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 7px 10px;
  margin: 0 -10px;
  border-radius: 10px;
  font-size: 0.95rem;
  font-variant-numeric: tabular-nums;
}

.blocks .times { white-space: nowrap; }
.blocks .done { color: var(--faint); }
.blocks .done .times { color: inherit; }
.blocks .current { background: color-mix(in srgb, var(--accent-2) 14%, transparent); color: var(--accent-2); font-weight: 600; }
.blocks .next { font-weight: 600; }

/* Bearkat Brief: pinned to the bottom centre, between the corner controls. */

.brief {
  position: absolute;
  bottom: 24px;
  left: 50%;
  translate: -50% 0;
  width: min(380px, calc(100vw - 32px));
  text-align: left;
}

/* Dropdown bar: the header stays put and the links open above it, so
   closing drops the header down to the bottom. */
.brief summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 0;
  list-style: none;
  cursor: pointer;
}

.brief summary::-webkit-details-marker { display: none; }

/* Wide screens too short for the open list to clear the countdown (app.js adds .brief-card):
   it opens as a card over the countdown instead. */
.brief-card .brief[open] {
  padding: 0 16px 4px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
}


.brief .chev {
  flex: none;
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  rotate: -135deg;
  translate: 0 2px;
  transition: rotate 0.15s;
}

.brief:not([open]) .chev { rotate: 45deg; translate: 0 -2px; }

.brief h2 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--ink);
}

.brief ul {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
}

.brief li + li { border-top: 1px solid var(--line); }

.brief a {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  text-decoration: none;
  font-size: 0.95rem;
  font-weight: 500;
}

.brief a:hover .title { text-decoration: underline; text-underline-offset: 3px; }

.brief .arrow { color: var(--muted); }

.updated {
  margin: 6px 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
}

/* Only with ?now=…: jump the fake clock to useful moments. */

.devbar {
  position: fixed;
  top: 12px;
  left: 50%;
  translate: -50% 0;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 4px;
  max-width: calc(100vw - 32px);
  padding: 4px;
  border: 1px dashed var(--faint);
  border-radius: 12px;
  background: var(--surface);
  font-size: 0.75rem;
}

.devbar[hidden] { display: none; }

.devbar a {
  padding: 3px 8px;
  border-radius: 8px;
  text-decoration: none;
}

.devbar a[aria-current] { background: var(--ink); color: var(--bg); }

/* Medium and narrow: the Brief becomes a pill next to View schedule and opens a card like it,
   and the lunch picker drops its label so everything fits one row. */

@media (max-width: 900px) {
  .corner.left { display: flex; }
  .corner.left > .pill { position: static; }
  .lunch-label { display: none; }

  .brief { position: static; translate: none; width: auto; }

  .brief summary {
    justify-content: center;
    height: 40px;
    padding: 0 16px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease, scale 120ms ease-out;
  }

  .brief summary:active { scale: 0.97; }
  .brief .chev { display: none; }
  .brief h2 { font-size: 0.95rem; font-weight: 500; }
  .brief[open] summary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
  .brief[open] h2 { color: var(--bg); }

  .brief-body {
    position: fixed;
    inset: auto auto 76px 24px;
    width: min(340px, calc(100vw - 32px));
    max-height: calc(100svh - 120px);
    overflow: auto;
    padding: 12px 20px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
    box-shadow: var(--shadow);
    transform-origin: bottom left;
    animation: card-in 180ms ease-out;
  }

  .brief ul { margin: 0; }
}

@keyframes card-in {
  from { opacity: 0; scale: 0.95; }
}

@media (max-width: 900px) and (hover: hover) and (pointer: fine) {
  .brief summary:hover { border-color: var(--faint); }
}

@media (max-width: 900px) and (prefers-reduced-motion: reduce) {
  .brief-body { animation-name: card-fade; }
  @keyframes card-fade { from { opacity: 0; } }
}

/* Phones: one row. The pills lose their first word and the Mac app link goes (it's for Macs). */

@media (max-width: 620px) {
  .hero { padding-bottom: 96px; }
  .corner.left { left: 16px; }
  .corner.right { right: 16px; }
  .disclaimer { top: 12px; right: 16px; }
  .corner.right .pill { display: none; }
  .long { display: none; }
  .cap { text-transform: capitalize; }
  .sheet, .brief-body { inset: auto auto 76px 16px; }
}

/* Mac app page */

.page {
  max-width: 640px;
  margin: 0 auto;
  padding: 32px 16px 80px;
}

.page .back { color: var(--muted); font-size: 0.9rem; text-decoration: none; }

.page h1 {
  margin: 40px 0 8px;
  font-size: clamp(2.25rem, 7vw, 3.25rem);
  line-height: 1.1;
  letter-spacing: -0.03em;
}

.page h1 span {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.page .lead { color: var(--muted); margin: 0 0 28px; }

.download {
  display: inline-flex;
  align-items: center;
  height: 52px;
  padding: 0 26px;
  border-radius: 999px;
  background: var(--gradient);
  color: #fff;
  font-weight: 600;
  text-decoration: none;
}

.page .note { color: var(--muted); font-size: 0.85rem; margin: 12px 0 0; }

.page h2 { margin: 56px 0 4px; font-size: 1.4rem; }

.steps { padding-left: 1.3em; }
.steps li { margin: 0 0 20px; padding-left: 4px; }
.steps img {
  display: block;
  max-width: 100%;
  margin-top: 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
}
