/* Plain CSS3: custom properties, nesting-free, no build step.
   The look follows telescoped.com: dark indigo, lavender accents, Nunito, uppercase headings,
   small tracked "eyebrow" labels, pill buttons and bordered cards. */

@font-face {
  font-family: "Nunito"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(/static/fonts/nunito-latin.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Nunito"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url(/static/fonts/nunito-latin-ext.woff2) format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  color-scheme: dark;
  --bg: #16141f;          /* hsl(250 20% 10%) */
  --bg-deep: #120f1a;     /* sidebar */
  --surface: #1e1b29;     /* cards, hsl(250 18% 13%) */
  --surface-2: #2a2738;   /* inputs, rows */
  --line: #323041;        /* hsl(250 15% 22%) */
  --line-strong: #7264a2; /* outline buttons */
  --ink: #e4e4e7;
  --muted: #9797a3;
  --accent: #a78fef;      /* hsl(258 70% 75%) */
  --accent-ink: #16141f;
  --accent-soft: rgba(167, 143, 239, 0.14);
  --warn: #f2b35b;
  --danger: #ef6b6b;
  --radius: 12px;
  --space: 1rem;
  --tap: 44px; /* minimum touch target */
  font-family: "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0; min-height: 100vh; min-height: 100dvh; color: var(--ink); line-height: 1.5;
  background:
    radial-gradient(40rem 28rem at 85% -10%, rgba(124, 92, 230, 0.22), transparent 70%),
    radial-gradient(30rem 24rem at -10% 110%, rgba(124, 92, 230, 0.12), transparent 70%),
    var(--bg);
  background-attachment: fixed;
}
main {
  max-width: 40rem; margin: 0 auto;
  padding: calc(var(--space) * 2) max(var(--space), env(safe-area-inset-right)) calc(var(--space) * 3) max(var(--space), env(safe-area-inset-left));
}
a { color: var(--accent); }
[x-cloak] { display: none !important; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.muted { color: var(--muted); }
.error { margin: 0; color: var(--danger); }
.empty { margin: 0; color: var(--muted); }
p { margin: 0; }

h1 { margin: 0; font-size: clamp(2rem, 6vw, 2.5rem); line-height: 1.1; font-weight: 800; text-transform: uppercase; letter-spacing: 0.01em; }
.eyebrow { margin: 0; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; color: var(--accent); }

/* Header */
.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space);
  padding: max(calc(var(--space) * 0.9), env(safe-area-inset-top)) max(calc(var(--space) * 1.5), env(safe-area-inset-right)) calc(var(--space) * 0.9) max(calc(var(--space) * 1.5), env(safe-area-inset-left));
  border-bottom: 1px solid var(--line); background: rgba(22, 20, 31, 0.72);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  position: sticky; top: 0; z-index: 10;
}
.site-header nav { display: flex; align-items: center; gap: 0.75rem; min-width: 0; }
.brand { display: inline-flex; align-items: center; gap: 0.75rem; text-decoration: none; color: var(--ink); }
.brand img { height: 26px; width: auto; display: block; }
.brand-app { padding-left: 0.75rem; border-left: 1px solid var(--line); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; color: var(--accent); }
.who { color: var(--muted); font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Buttons: uppercase pills, solid or outlined, like the site. */
button, .btn {
  font: inherit; cursor: pointer; border: 1px solid transparent; border-radius: var(--radius);
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: var(--tap); padding: 0.55rem 1.25rem; text-decoration: none; -webkit-tap-highlight-color: transparent;
  font-size: 0.8rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  background: var(--accent); color: var(--accent-ink);
  transition: background-color 120ms, border-color 120ms, color 120ms, transform 80ms;
}
button:active, .btn:active { transform: scale(0.98); }
button:disabled { opacity: 0.45; cursor: default; transform: none; }
.btn-outline, button.ghost { background: transparent; color: var(--accent); border-color: var(--line-strong); }
.btn-outline:hover, button.ghost:hover { background: var(--accent-soft); }
.btn-sm { min-height: 36px; padding: 0.35rem 0.9rem; font-size: 0.72rem; }
button.icon {
  min-height: var(--tap); min-width: var(--tap); padding: 0; border: 0; background: transparent;
  color: var(--muted); font-size: 1.35rem; font-weight: 400; letter-spacing: 0; text-transform: none;
}
button.icon:hover { color: var(--danger); background: rgba(239, 107, 107, 0.1); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
kbd {
  font: 600 0.7rem ui-monospace, "SF Mono", monospace; letter-spacing: 0; text-transform: none;
  padding: 0.1em 0.4em; border: 1px solid currentColor; border-radius: 5px; opacity: 0.7;
}

input {
  font: inherit; font-size: 1rem; /* 16px, so iOS doesn't zoom in on focus */
  min-height: var(--tap); padding: 0.6rem 0.9rem; min-width: 0;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); color: var(--ink);
}
input::placeholder { color: var(--muted); }
input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[aria-invalid="true"] { border-color: var(--danger); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: calc(var(--radius) + 4px); padding: calc(var(--space) * 1.25); }

/* Sign in */
.login { max-width: 26rem; margin: 12vh auto 0; display: grid; gap: var(--space); text-align: center; justify-items: center; padding: calc(var(--space) * 2); }
.login h1 { font-size: 1.75rem; }
.login .btn { width: 100%; }

.mode-switch { white-space: nowrap; }

/* My day */
.today { display: grid; gap: calc(var(--space) * 1.25); }
.today-header { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space); }
.today-header > div { display: grid; gap: 0.35rem; }
.tasks-card { display: grid; gap: var(--space); }
.add-task { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.add-task input { flex: 1; }
.add-task .error { flex-basis: 100%; }
.tasks { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.5rem; }
.task {
  display: flex; justify-content: space-between; align-items: center; gap: 0.5rem;
  min-height: 52px; padding: 0.35rem 0.25rem 0.35rem 1rem;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius);
  overflow-wrap: anywhere;
}
.task .icon { opacity: 0.5; flex: none; }
.task:hover .icon, .task .icon:focus-visible { opacity: 1; }
.tasks:has(li) + .empty { display: none; }

.mood { display: grid; gap: 0.9rem; }
.mood h2 { margin: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chips form { display: contents; }
.chip {
  min-height: var(--tap); padding: 0.4rem 1rem; border-radius: 999px;
  background: var(--surface-2); color: var(--ink); border: 1px solid var(--line);
  font-size: 0.95rem; font-weight: 600; letter-spacing: 0; text-transform: none;
}
.chip:hover { border-color: var(--line-strong); }
button.chip.ghost { color: var(--muted); background: transparent; border-color: var(--line); }
.chip.selected { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); }
span.chip { display: inline-flex; align-items: center; gap: 0.35rem; }
.custom-mood { display: grid; grid-template-columns: 5rem 1fr auto; gap: 0.5rem; align-items: end; }
.custom-mood label { display: grid; gap: 0.3rem; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.emoji-input { width: 100%; text-align: center; font-size: 1.35rem; padding: 0.35rem; }

/* Phones: full-width controls, big targets, nothing hover-only. */
@media (max-width: 560px) {
  main { padding-top: calc(var(--space) * 1.25); }
  .site-header { padding-left: max(var(--space), env(safe-area-inset-left)); padding-right: max(var(--space), env(safe-area-inset-right)); }
  .brand img { height: 22px; }
  .brand-app, .who { display: none; }
  .today-header { align-items: center; }
  .mode-switch .mode-long { display: none; }
  .card { padding: var(--space); border-radius: var(--radius); }
  .chips { display: grid; grid-template-columns: 1fr 1fr; }
  .chips .chip { width: 100%; justify-content: flex-start; }
  .custom-mood { grid-template-columns: 4.5rem 1fr; }
  .custom-mood button { grid-column: 1 / -1; }
}
@media (hover: none) {
  .task .icon { opacity: 0.8; }
  .kbd-hint, .timer-keys { display: none !important; }
}

/* Meeting mode: full viewport, big type, for a shared screen. */
body:has(.meeting) .site-header { display: none; }
body:has(.meeting) main { max-width: none; padding: 0; }
.meeting {
  min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(14rem, 19rem) 1fr; grid-template-rows: auto 1fr;
  grid-template-areas: "rail timer" "rail stage";
}
.rail {
  grid-area: rail; display: flex; flex-direction: column; gap: calc(var(--space) * 1.25);
  padding: calc(var(--space) * 1.5); padding-left: max(calc(var(--space) * 1.5), env(safe-area-inset-left));
  border-right: 1px solid var(--line); background: var(--bg-deep);
}
.rail .brand img { height: 22px; }
.rail .mode-switch { width: 100%; justify-content: space-between; }
.people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.25rem; flex: 1; }
.people button {
  width: 100%; justify-content: flex-start; border: 0; background: transparent; color: var(--ink);
  padding: 0.5rem 0.75rem; font-size: 1.05rem; font-weight: 600; letter-spacing: 0; text-transform: none;
}
.people button:hover { background: var(--surface); }
.people .tick { display: inline-block; width: 1.1em; color: var(--accent); visibility: hidden; }
.people .done .tick { visibility: visible; }
.people .done button { color: var(--muted); }
.people .current button { background: var(--accent-soft); color: var(--ink); box-shadow: inset 3px 0 0 var(--accent); }
.rail-actions { display: grid; gap: 0.5rem; }

.stage { grid-area: stage; padding: calc(var(--space) * 1.5) calc(var(--space) * 3) calc(var(--space) * 3); view-transition-name: stage; }
.slot { display: grid; gap: calc(var(--space) * 1.5); max-width: 60rem; }
.person-header { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0.5rem 1.5rem; }
.person-header h1 { font-size: clamp(2.5rem, 5vw, 4rem); }
.person-mood { font-size: clamp(1.25rem, 2vw, 1.75rem); font-weight: 600; color: var(--muted); }
.person-mood .emoji { font-size: 1.3em; }
.tasks.big { gap: 0.6rem; }
.tasks.big .task { font-size: clamp(1.35rem, 2.2vw, 2.1rem); padding: 0.7rem 0.5rem 0.7rem 1.25rem; background: var(--surface); }
.slot .add-task { max-width: 36rem; }

.topbar { grid-area: timer; display: flex; justify-content: flex-end; padding: calc(var(--space) * 1.5) calc(var(--space) * 3) 0; }
.timer { display: grid; justify-items: end; gap: 0.35rem; }
button.timer-time {
  min-height: 0; padding: 0 0.1em; border: 0; border-radius: var(--radius); background: transparent; color: var(--ink);
  font-size: clamp(3rem, 6vw, 4.75rem); font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em; text-transform: none;
}
@media (hover: hover) { button.timer-time:hover { background: var(--accent-soft); } }
button.timer-time[aria-pressed="true"] { opacity: 0.55; }
.timer-note { min-height: 1.4em; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.2em; text-transform: uppercase; }
.steppers { display: flex; gap: 0.25rem; margin-bottom: -0.5rem; }
/* Quiet, icon-only steppers for touch screens: the arrow keys do the same. */
button.step {
  min-width: var(--tap); padding: 0; border: 0; background: transparent; color: var(--muted);
  font-size: 1.35rem; font-weight: 600; letter-spacing: 0;
}
@media (hover: hover) { button.step:hover { color: var(--accent); background: var(--accent-soft); } }
button.step:disabled { opacity: 0.3; }
.timer-keys { font-size: 0.8rem; display: flex; gap: 0.3rem; align-items: center; }
.timer.warn .timer-time, .timer.warn .timer-note { color: var(--warn); }
.timer.over .timer-time, .timer.over .timer-note { color: var(--danger); }
.timer-note { color: var(--muted); }

/* Narrow screens: the sidebar becomes a compact bar above the person, so the steppers and the
   order stay on top of the tasks. */
@media (max-width: 720px) {
  /* minmax(0, 1fr): a long order scrolls inside its bar instead of widening the page. */
  .meeting { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto 1fr; grid-template-areas: "timer" "rail" "stage"; }
  .rail {
    flex-direction: row; flex-wrap: wrap; align-items: center; gap: 0.5rem;
    padding: 0.75rem var(--space); border-right: 0; border-bottom: 1px solid var(--line);
  }
  .rail .brand { display: none; }
  .steppers { margin: 0; order: 1; }
  .people { order: 2; flex: 1 1 0; flex-direction: row; overflow-x: auto; min-width: 0; scrollbar-width: none; }
  .people li { flex: none; }
  .people button { width: auto; padding: 0.4rem 0.75rem; font-size: 0.95rem; }
  .rail-actions { order: 3; flex-basis: 100%; grid-template-columns: repeat(3, 1fr); }
  .rail .mode-switch { justify-content: center; }
  .stage, .topbar { padding-left: var(--space); padding-right: var(--space); }
  .topbar { padding-top: var(--space); justify-content: center; }
  .timer { justify-items: center; }
}

/* View transitions. htmx 4 wraps swaps in document.startViewTransition (transitions: true in
   the layout), and meeting mode wraps changing person in one.
   Switching modes is one choreographed transition: the logo and the mode button exist on both
   screens and morph into place; everything else enters or leaves. `:only-child` means "this
   part is only on one side of the transition", so those enter/leave animations run only when
   switching modes, never when moving between people. */
:root { --ease-out: cubic-bezier(0.22, 1, 0.36, 1); --ease-in: cubic-bezier(0.55, 0, 1, 0.45); --vt: 420ms; }

.brand img { view-transition-name: brand; }
.mode-switch { view-transition-name: mode-switch; }
.site-header { view-transition-name: site-header; }
.today { view-transition-name: today; }
.rail { view-transition-name: rail; }
.topbar { view-transition-name: timer; }
.task { view-transition-name: match-element; view-transition-class: task; }

::view-transition-old(root), ::view-transition-new(root) { animation-duration: 180ms; }

/* Shared elements glide between their spots. */
::view-transition-group(brand), ::view-transition-group(mode-switch) {
  animation-duration: var(--vt); animation-timing-function: var(--ease-out);
  z-index: 2; /* above the sidebar fading in; they'd otherwise stack in the old page's order */
}
/* The logo is the same on both screens: move it, don't cross-fade it (a cross-fade dims it). */
::view-transition-old(brand) { animation: none; opacity: 0; }
::view-transition-new(brand) { animation: none; }
/* The button's label changes: the old one leaves quickly, then the new one arrives. */
::view-transition-old(mode-switch), ::view-transition-new(mode-switch) { height: 100%; object-fit: cover; mix-blend-mode: normal; }
::view-transition-old(mode-switch) { animation: 160ms var(--ease-in) both fade-out; }
::view-transition-new(mode-switch) { animation: 260ms var(--ease-out) 160ms both fade-in; }

/* Entering and leaving parts. */
::view-transition-new(rail):only-child { animation: var(--vt) var(--ease-out) both rail-in; }
::view-transition-old(rail):only-child { animation: 260ms var(--ease-in) both rail-out; }
::view-transition-new(stage):only-child { animation: var(--vt) var(--ease-out) 140ms both rise-in; }
::view-transition-old(stage):only-child { animation: 150ms var(--ease-in) both sink-out; }
::view-transition-new(timer):only-child { animation: var(--vt) var(--ease-out) 140ms both pop-in; }
::view-transition-old(timer):only-child { animation: 140ms var(--ease-in) both fade-out; }
::view-transition-new(today):only-child { animation: var(--vt) var(--ease-out) 140ms both rise-in; }
::view-transition-old(today):only-child { animation: 150ms var(--ease-in) both sink-out; }
::view-transition-new(site-header):only-child { animation: 320ms var(--ease-out) both header-in; }
::view-transition-old(site-header):only-child { animation: 220ms var(--ease-in) both header-out; }
::view-transition-group(.task) { animation-duration: 220ms; animation-timing-function: var(--ease-out); }
::view-transition-new(.task):only-child { animation: 320ms var(--ease-out) 160ms both rise-in; }
::view-transition-old(.task):only-child { animation: 120ms var(--ease-in) both fade-out; }

/* Moving between people in a meeting: the stage slides a little. */
::view-transition-old(stage) { animation: 160ms ease-in both slide-out; }
::view-transition-new(stage) { animation: 200ms ease-out both slide-in; }

@keyframes rail-in { from { opacity: 0; transform: translateX(-24px); } }
@keyframes rail-out { to { opacity: 0; transform: translateX(-24px); } }
@keyframes rise-in { from { opacity: 0; transform: translateY(16px) scale(0.985); } }
@keyframes sink-out { to { opacity: 0; transform: translateY(8px) scale(0.985); } }
@keyframes pop-in { from { opacity: 0; transform: scale(0.94); } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes header-in { from { opacity: 0; transform: translateY(-100%); } }
@keyframes header-out { to { opacity: 0; transform: translateY(-100%); } }
@keyframes slide-out { to { opacity: 0; transform: translateY(-12px); } }
@keyframes slide-in { from { opacity: 0; transform: translateY(12px); } }

/* Real (non-htmx) page loads animate too, where the browser supports it. */
@media (prefers-reduced-motion: no-preference) {
  @view-transition { navigation: auto; }
}
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
  button:active, .btn:active { transform: none; }
}
