/*
 * Homeroom. The School look, from school-brand-kit (tokens.css): warm gray page, off-white cards with
 * 20px corners, Inter for reading, JetBrains Mono uppercase for labels and the wordmark, ink buttons,
 * one green for "yours / on", one red for "happening now".
 */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url(/fonts/inter-latin-wght.woff2) format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 100 800; font-display: swap; src: url(/fonts/jetbrains-mono-latin-wght.woff2) format("woff2"); }

:root {
  --bg: oklch(0.81 0.004 95);
  --card: oklch(0.96 0.006 95);
  --card-2: oklch(0.93 0.006 95);
  --ink: oklch(0.2 0.012 152);
  --ink-soft: oklch(0.45 0.01 152);
  --muted: oklch(0.5 0.008 152);
  --line: oklch(0.2 0.012 152 / 0.1);
  --line-strong: oklch(0.2 0.012 152 / 0.2);
  --green: oklch(0.86 0.24 150);
  --green-deep: oklch(0.56 0.18 150);
  --ring: oklch(0.86 0.24 150 / 0.45);
  --red: oklch(0.62 0.21 25);
  --radius: 20px;
  --sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --tabs-h: 64px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0; min-width: 320px; background: var(--bg); color: var(--ink);
  font: 15px/1.5 var(--sans); -webkit-font-smoothing: antialiased; -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none;
}
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; }
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--green-deep); outline-offset: 3px; }
img { display: block; }

.label { font: 500 11px/1.4 var(--mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }

/* --- Frame ---------------------------------------------------------------- */
.top {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  max-width: 34rem; margin: 0 auto; padding: calc(env(safe-area-inset-top) + 12px) 18px 10px;
  background: linear-gradient(var(--bg) 72%, transparent);
}
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; }
.brand img { width: 42px; height: 28px; mix-blend-mode: multiply; image-rendering: pixelated; }
.brand span { font: 700 19px/1 var(--mono); letter-spacing: -0.04em; text-transform: uppercase; }
.me-link { display: block; border-radius: 50%; }

main { max-width: 34rem; margin: 0 auto; padding: 6px 14px calc(var(--tabs-h) + env(safe-area-inset-bottom) + 28px); outline: none; }
main > * { animation: rise 0.28s var(--ease) both; }
main > *:nth-child(2) { animation-delay: 0.03s; }
main > *:nth-child(3) { animation-delay: 0.06s; }
main > *:nth-child(n + 4) { animation-delay: 0.09s; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.tabs {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 10px); transform: translateX(-50%); z-index: 6;
  display: grid; grid-template-columns: repeat(4, 1fr); width: min(calc(100% - 28px), 25rem); height: var(--tabs-h);
  padding: 6px; background: var(--ink); border-radius: 22px; box-shadow: 0 10px 30px oklch(0.2 0.012 152 / 0.28);
}
.tabs a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border-radius: 16px;
  text-decoration: none; color: oklch(0.96 0.006 95 / 0.62); transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.tabs svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabs span { font: 600 9.500px/1 var(--mono); letter-spacing: 0.1em; text-transform: uppercase; }
.tabs a[aria-current="page"] { background: var(--card); color: var(--ink); }

/* --- Pieces --------------------------------------------------------------- */
.card { background: var(--card); border-radius: var(--radius); padding: 22px 20px; margin: 0 0 12px; }
.card h2 { font-weight: 700; font-size: 20px; line-height: 1.2; letter-spacing: -0.015em; }
.page-title { padding: 10px 6px 14px; }
.page-title h1 { font-weight: 800; font-size: 32px; line-height: 1.05; letter-spacing: -0.03em; margin-top: 6px; }
.lede { color: var(--ink-soft); margin-top: 8px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px; border-radius: 12px;
  border: 1.5px solid var(--ink); background: var(--ink); color: var(--card); cursor: pointer; text-decoration: none;
  font: 700 12px/1 var(--mono); letter-spacing: 0.14em; text-transform: uppercase;
  transition: background 0.16s var(--ease), border-color 0.16s var(--ease), color 0.16s var(--ease), transform 0.16s var(--ease);
}
.btn:hover { background: var(--green); border-color: var(--green); color: var(--ink); }
.btn:active { transform: scale(0.97); }
.btn.quiet { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn.quiet:hover { border-color: var(--ink); background: transparent; }
.btn.wide { width: 100%; }

.avatar {
  width: 44px; height: 44px; border-radius: 50%; flex: none; object-fit: cover; background: var(--ink); color: var(--card);
  display: grid; place-items: center; font: 700 14px/1 var(--mono); letter-spacing: 0.02em;
}
.avatar.sm { width: 34px; height: 34px; font-size: 12px; }
.avatar.lg { width: 72px; height: 72px; font-size: 22px; }

.tag { display: inline-block; padding: 3px 8px; border-radius: 999px; border: 1px solid var(--line-strong); font: 600 10px/1.3 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-soft); vertical-align: 2px; }
.tag.now { border-color: transparent; background: var(--red); color: #fff; }
.sub-head { padding: 10px 6px 8px; }
.ml { margin-left: 8px; }
.mt { margin-top: 16px; }
.mt-s { margin-top: 8px; }
.lede.tight { margin: 0 0 14px; }
.empty { padding: 28px 8px; text-align: center; color: var(--ink-soft); }

/* --- Home ----------------------------------------------------------------- */
.next { position: relative; overflow: hidden; }
.next .when { display: flex; align-items: center; gap: 8px; margin: 10px 0 6px; font: 600 13px/1.4 var(--mono); letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-soft); }
.next h2 { font-size: 26px; font-weight: 800; letter-spacing: -0.025em; line-height: 1.1; padding-right: 56px; }
.next .where { color: var(--ink-soft); margin-top: 6px; }
.next .save { position: absolute; top: 20px; right: 18px; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 0 0 12px; }
.tile {
  display: flex; flex-direction: column; justify-content: space-between; min-height: 112px; padding: 16px 16px 14px; border-radius: var(--radius);
  background: var(--card); text-decoration: none; transition: transform 0.16s var(--ease), background 0.16s var(--ease);
}
.tile:active { transform: scale(0.97); }
.tile .num { font: 800 34px/1 var(--sans); letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.tile.ink { background: var(--ink); color: var(--card); }
.tile.ink .label { color: oklch(0.96 0.006 95 / 0.7); }
.tile .label { display: flex; justify-content: space-between; align-items: center; }
.tile .label::after { content: "→"; font-size: 14px; letter-spacing: 0; }

/* --- Schedule ------------------------------------------------------------- */
.seg { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; background: var(--card-2); border-radius: 14px; margin: 0 0 10px; }
.seg a { text-align: center; padding: 11px 8px; border-radius: 11px; text-decoration: none; color: var(--ink-soft); font: 700 11px/1 var(--mono); letter-spacing: 0.14em; text-transform: uppercase; transition: background 0.2s var(--ease), color 0.2s var(--ease); }
.seg a[aria-current="true"] { background: var(--ink); color: var(--card); }

.search { position: relative; margin: 0 0 10px; }
.search input { width: 100%; height: 46px; padding: 0 14px 0 40px; border: 0; border-radius: 14px; background: var(--card); font-size: 16px; }
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: 2px solid var(--green-deep); outline-offset: 0; }
.search svg { position: absolute; left: 13px; top: 13px; width: 20px; height: 20px; fill: none; stroke: var(--muted); stroke-width: 1.8; stroke-linecap: round; }

.strip { display: flex; gap: 8px; overflow-x: auto; margin: 0 -14px 12px; padding: 2px 14px; scrollbar-width: none; scroll-snap-type: x proximity; }
.strip::-webkit-scrollbar { display: none; }
.chip {
  flex: none; scroll-snap-align: start; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 52px; padding: 8px 10px; border: 0; border-radius: 14px;
  background: var(--card); cursor: pointer; transition: background 0.2s var(--ease), color 0.2s var(--ease);
}
.chip b { font: 800 18px/1 var(--sans); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.chip span { font: 600 10px/1.2 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.chip.flat { flex-direction: row; min-width: 0; padding: 0 14px; height: 38px; font: 600 13px/1 var(--sans); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--card); }
.chip[aria-pressed="true"] span { color: oklch(0.96 0.006 95 / 0.7); }

.day { background: var(--card); border-radius: var(--radius); margin: 0 0 12px; padding: 6px 0; scroll-margin-top: 76px; }
.day > .label { display: flex; justify-content: space-between; padding: 14px 20px 8px; }
.day > .label b { color: var(--ink); font-weight: 700; }
.ev { display: grid; grid-template-columns: 66px 1fr auto; gap: 12px; align-items: start; padding: 14px 14px 14px 20px; border-top: 1px solid var(--line); }
.ev .t { font: 600 12px/1.45 var(--mono); letter-spacing: 0.02em; text-transform: uppercase; padding-top: 2px; font-variant-numeric: tabular-nums; }
.ev .t small { display: block; font-size: 11px; font-weight: 500; color: var(--muted); }
.ev h3 { font-size: 16px; font-weight: 650; line-height: 1.3; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.ev .meta { margin-top: 3px; font-size: 13.500px; color: var(--ink-soft); overflow-wrap: anywhere; }
.ev .meta a { text-underline-offset: 2px; }
.ev.is-now h3::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 7px; border-radius: 50%; background: var(--red); vertical-align: 2px; animation: pulse 1.800s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.35; } }

.save {
  width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--line-strong); background: transparent; cursor: pointer; display: grid; place-items: center; flex: none;
  transition: background 0.2s var(--ease), border-color 0.2s var(--ease), transform 0.2s var(--ease);
}
.save svg { width: 20px; height: 20px; fill: none; stroke: var(--ink); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.save .plus { transition: transform 0.3s var(--ease), opacity 0.2s; }
.save .tick { stroke-dasharray: 20; stroke-dashoffset: 20; transition: stroke-dashoffset 0.3s var(--ease) 0.08s; }
.save[aria-pressed="true"] { background: var(--green); border-color: var(--green); }
.save[aria-pressed="true"] .plus { transform: rotate(90deg) scale(0.2); opacity: 0; transform-origin: center; }
.save[aria-pressed="true"] .tick { stroke-dashoffset: 0; }
.save.pop { animation: pop 0.42s var(--ease); }
@keyframes pop { 0% { transform: scale(1); } 35% { transform: scale(1.22); box-shadow: 0 0 0 8px var(--ring); } 100% { transform: scale(1); box-shadow: 0 0 0 16px transparent; } }

/* --- People --------------------------------------------------------------- */
.person { display: flex; gap: 14px; align-items: flex-start; padding: 16px 20px; border-top: 1px solid var(--line); }
.list { background: var(--card); border-radius: var(--radius); margin: 0 0 12px; overflow: hidden; }
.list > :first-child { border-top: 0; }
.person h3 { font-size: 16px; font-weight: 650; letter-spacing: -0.01em; }
.person p { font-size: 14px; color: var(--ink-soft); overflow-wrap: anywhere; }
.person .ask { margin-top: 4px; color: var(--ink); }
.person .ask::before { content: "Ask me about  "; font: 500 10px/1 var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }

/* --- Rules ---------------------------------------------------------------- */
.rules { counter-reset: rule; }
.rules h2 { margin: 26px 0 4px; font: 500 11px/1.4 var(--mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.rules h2:first-child { margin-top: 0; }
.rules p { margin: 0 0 12px; color: var(--ink-soft); }
.rules .rule { counter-increment: rule; display: grid; grid-template-columns: 34px 1fr; gap: 6px; padding: 13px 0; border-top: 1px solid var(--line); font-size: 16px; line-height: 1.4; }
.rules .rule::before { content: counter(rule, decimal-leading-zero); font: 600 12px/1.9 var(--mono); color: var(--green-deep); }
.rules-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 18px; }

/* --- Forms ---------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 8px; margin: 0 0 22px; }
.field input[type="text"] { width: 100%; font-size: 16px; background: transparent; border: 0; border-bottom: 1.5px solid var(--line-strong); border-radius: 0; padding: 9px 2px; }
.field input[type="text"]:focus, textarea:focus { outline: none; border-color: var(--green-deep); }
textarea { width: 100%; min-height: 55vh; font: 14px/1.6 var(--mono); background: transparent; border: 1.5px solid var(--line-strong); border-radius: 10px; padding: 12px 14px; resize: vertical; }
.check { display: flex; gap: 12px; align-items: flex-start; margin: 0 0 22px; }
.check input { width: 20px; height: 20px; margin-top: 1px; accent-color: var(--ink); flex: none; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.who { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.who p { color: var(--ink-soft); font-size: 14px; overflow-wrap: anywhere; }

/* --- Sign-in -------------------------------------------------------------- */
.signin { min-height: calc(100dvh - 40px); display: grid; place-items: center; padding: 20px 6px; }
.signin .card { width: 100%; padding: 40px 26px 30px; text-align: center; }
.signin .mark { width: 126px; height: 84px; margin: 0 auto 18px; mix-blend-mode: multiply; image-rendering: pixelated; }
.signin h1 { font: 700 34px/1 var(--mono); letter-spacing: -0.045em; text-transform: uppercase; }
.signin .lede { margin: 12px auto 28px; max-width: 26ch; }
.signin .note { margin-top: 16px; font-size: 13px; color: var(--muted); }
.signin .err { margin: 0 0 16px; padding: 10px 12px; border-radius: 10px; background: oklch(0.62 0.21 25 / 0.1); color: oklch(0.45 0.18 25); font-size: 14px; }

.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabs-h) + env(safe-area-inset-bottom) + 24px); z-index: 8; transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  padding: 10px 16px; border-radius: 999px; background: var(--ink); color: var(--card); font-size: 14px; white-space: nowrap; transition: opacity 0.2s, transform 0.25s var(--ease);
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* --- The entrance --------------------------------------------------------- */
.splash { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; background: var(--bg); perspective: 900px; }
.splash-in { display: flex; flex-direction: column; align-items: center; transform-style: preserve-3d; }
.doors { display: flex; width: 170px; height: 170px; transform-style: preserve-3d; }
.door { width: 85px; height: 170px; mix-blend-mode: multiply; image-rendering: pixelated; opacity: 0; }
.door-l { transform-origin: 0 50%; }
.door-r { transform-origin: 100% 50%; }
.word { display: flex; margin-top: 18px; font: 700 34px/1 var(--mono); letter-spacing: -0.045em; }
.word span { opacity: 0; transform: translateY(10px); }
.bell { width: 0; height: 3px; margin-top: 12px; border-radius: 2px; background: var(--green-deep); }
.sub { margin-top: 12px; font: 500 11px/1.4 var(--mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); opacity: 0; }

.splash.go .door { animation: door-in 0.5s steps(5, end) both; }
.splash.go .door-r { animation-delay: 0.08s; }
.splash.go .word span { animation: letter 0.36s var(--ease) both; }
.splash.go .word span:nth-child(1) { animation-delay: 0.3s; }
.splash.go .word span:nth-child(2) { animation-delay: 0.345s; }
.splash.go .word span:nth-child(3) { animation-delay: 0.39s; }
.splash.go .word span:nth-child(4) { animation-delay: 0.435s; }
.splash.go .word span:nth-child(5) { animation-delay: 0.48s; }
.splash.go .word span:nth-child(6) { animation-delay: 0.525s; }
.splash.go .word span:nth-child(7) { animation-delay: 0.57s; }
.splash.go .word span:nth-child(8) { animation-delay: 0.615s; }
.splash.go .bell { animation: bell 0.42s var(--ease) 0.82s both; }
.splash.go .sub { animation: fade 0.3s ease 0.95s both; }
/* Then the doors swing open and you walk through. */
.splash.open { animation: through 0.7s cubic-bezier(0.6, 0, 0.3, 1) both; pointer-events: none; }
.splash.open .word span { opacity: 1; transform: none; animation: none; }
.splash.open .door { opacity: 1; animation: none; transition: transform 0.6s cubic-bezier(0.5, 0, 0.2, 1); }
.splash.open .door-l { transform: rotateY(-82deg); }
.splash.open .door-r { transform: rotateY(82deg); }
.splash.open .word, .splash.open .sub { animation: leave 0.22s ease both; }
.splash.open .bell { width: 168px; animation: leave 0.22s ease both; }
@keyframes door-in { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes letter { to { opacity: 1; transform: none; } }
@keyframes bell { to { width: 168px; } }
@keyframes fade { to { opacity: 1; } }
@keyframes leave { from { opacity: 1; } to { opacity: 0; } }
@keyframes through { 0% { opacity: 1; transform: scale(1); } 45% { opacity: 1; } 100% { opacity: 0; transform: scale(2.400); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-delay: 0s !important; transition-duration: 0.01ms !important; }
}
@media (min-width: 40rem) {
  .page-title h1 { font-size: 38px; }
}
