/* Narwhal's Crew — crew web app. Brand tokens from ~/Claude/narwhals-brand-spec.md
   (navy #204a5e, cyan #40b9d0, foam #fef6f6, red #ef4440). No Acumin licence file
   in a sibling repo → the system font stack. Kisna is never used on the web app.
   Dark Mode surfaces are flat (no textures). Mobile-first; no horizontal scroll. */
:root {
  --ink: #093543; --navy: #204a5e; --cyan: #40b9d0; --cyan-dim: #2a98ae; --cyan-tint: #e3f3f7;
  --slate: #598c9f; --foam: #fef6f6; --beige: #f0e6e6; --red: #ef4440;
  --bg: var(--foam); --card: #ffffff; --text: #0d2a35; --muted: #4a6870; --line: var(--beige);
  --hero-bg: var(--navy); --hero-text: var(--foam); --accent: var(--cyan-dim);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1a21; --card: #12262f; --text: #e8eef0; --muted: #9db4bc; --line: #1f3a45;
    --hero-bg: #06495e; --hero-text: #fef6f6; --accent: var(--cyan);
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow-x: hidden;
}
.cw-top { background: var(--navy); color: var(--foam); padding: calc(env(safe-area-inset-top) + 12px) 16px 12px; }
.cw-brand { font-size: 17px; letter-spacing: .01em; }
.cw-brand b { color: var(--cyan); font-weight: 700; }
.cw-main { max-width: 560px; margin: 0 auto; padding: 16px 16px calc(env(safe-area-inset-bottom) + 32px); }
h1 { font-size: 24px; line-height: 1.2; margin: 0 0 8px; }
h2.cw-week { font-size: 15px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 24px 0 8px; }
.cw-week-h { text-transform: none; letter-spacing: 0; font-weight: 400; }
h3.cw-sub { font-size: 14px; color: var(--muted); margin: 12px 0 4px; }
p { margin: 0 0 10px; }
.cw-muted { color: var(--muted); }
.cw-small { font-size: 14px; }
.cw-center { text-align: center; }
.cw-card { background: var(--card); border-radius: 14px; padding: 16px; margin: 0 0 12px; box-shadow: 0 1px 2px rgba(9, 53, 67, .08); }
.cw-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 4px 0 12px; }
.cw-head h1 { margin: 0; }
.cw-link { color: var(--accent); text-decoration: none; font-size: 16px; white-space: nowrap; }
.cw-link:hover { color: var(--red); }

.cw-hero { background: var(--hero-bg); color: var(--hero-text); padding: 20px; }
.cw-eyebrow { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--cyan); margin-bottom: 4px; }
.cw-hero-day { font-size: 20px; font-weight: 600; }
.cw-hero-time { font-size: 30px; font-weight: 700; line-height: 1.15; margin: 2px 0 4px; }
.cw-hero-meta { font-size: 16px; opacity: .9; }
.cw-hero .cw-shift-note { color: var(--hero-text); opacity: .75; }

.cw-seg { display: flex; gap: 6px; overflow-x: auto; margin: 0 0 12px; padding-bottom: 2px; }
.cw-seg-btn { flex: 0 0 auto; border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 999px;
  padding: 7px 14px; font: inherit; font-size: 15px; cursor: pointer; }
.cw-seg-btn.on { background: var(--navy); border-color: var(--navy); color: var(--foam); }

.cw-day { padding: 12px 16px; }
.cw-day-label { font-weight: 600; margin-bottom: 6px; }
.cw-shift { border-left: 4px solid var(--cyan); padding: 2px 0 2px 10px; margin: 6px 0; }
.cw-shift-time { font-weight: 600; }
.cw-shift-meta, .cw-roster-meta { color: var(--muted); font-size: 15px; }
.cw-shift-note { font-size: 14px; color: var(--muted); font-style: italic; margin-top: 2px; }

.cw-fold summary { cursor: pointer; font-weight: 600; list-style: none; }
.cw-fold summary::-webkit-details-marker { display: none; }
.cw-fold summary::after { content: '›'; float: right; transition: transform .15s; }
.cw-fold[open] summary::after { transform: rotate(90deg); }
.cw-roster { display: flex; flex-direction: column; padding: 8px 0; border-top: 1px solid var(--line); }
.cw-roster-name { font-weight: 500; }
.cw-fold summary + .cw-roster, .cw-fold summary + .cw-sub { margin-top: 8px; }

.cw-banner { background: #fff4d6; color: #5a4300; border-radius: 10px; padding: 8px 12px; font-size: 15px; }
@media (prefers-color-scheme: dark) { .cw-banner { background: #3a3000; color: #ffe9a8; } }
.cw-hint { background: var(--cyan-tint); color: var(--ink); border-radius: 12px; padding: 12px 14px; margin: 0 0 12px; font-size: 15px; }
@media (prefers-color-scheme: dark) { .cw-hint { background: #123844; color: var(--text); } }
.cw-foot { text-align: center; margin-top: 16px; }

.cw-btn { display: inline-block; border: 0; border-radius: 12px; background: var(--navy); color: var(--foam); font: inherit; font-weight: 600;
  padding: 12px 18px; min-height: 44px; cursor: pointer; }
.cw-btn:hover { background: var(--red); }
.cw-btn:disabled { opacity: .6; cursor: default; }
.cw-btn-quiet { background: transparent; color: var(--accent); border: 1px solid var(--line); }
.cw-btn-quiet:hover { background: transparent; color: var(--red); }
.cw-btn-danger { background: var(--red); }
.cw-error { color: var(--red); margin-top: 10px; }

#pin-form { display: flex; flex-direction: column; gap: 12px; margin-top: 12px; }
#pin { font: inherit; font-size: 28px; letter-spacing: .4em; text-align: center; padding: 12px; border-radius: 12px;
  border: 2px solid var(--line); background: var(--bg); color: var(--text); width: 100%; }
#pin:focus { outline: none; border-color: var(--cyan); }

.cw-toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-weight: 500; }
.cw-toggle input { width: 22px; height: 22px; accent-color: var(--cyan-dim); }

.cw-off { color: var(--muted); font-size: 15px; }
.cw-today { box-shadow: 0 0 0 2px var(--cyan) inset; }
.cw-past { opacity: .6; }
[hidden] { display: none !important; }

/* ---------- motion + haptics pass (plan ~/.claude/plans/crew-motion.md) ----------
   Springs, never linear; transform/opacity only (no layout shift); nothing loops
   (except the Refresh spinner while a request is in flight); nothing over 400 ms
   except the one-shot confetti (≤ 1.4 s). Reduce Motion: see the block at the end. */
:root { --spring: cubic-bezier(.2, .8, .2, 1); --cyan-wash: rgba(64, 185, 208, .28); }

@keyframes cw-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes cw-rise-sm { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* #1 invite / signed-out card */
body[data-state="link"] .cw-main > .cw-card,
body[data-state="signed-out"] .cw-main > .cw-card { animation: cw-rise 250ms var(--spring) both; }

/* #6 first-paint entrance (JS adds .cw-enter with a 30 ms stagger, max 10 cards) */
.cw-enter { animation: cw-rise 180ms var(--spring) both; }

/* #8 store switch crossfade */
.cw-body { transition: opacity 180ms var(--spring); }
.cw-body.cw-out { opacity: 0; transition-duration: 100ms; }

/* #14 press feel */
.cw-btn, .cw-seg-btn, .cw-fold summary { transition: transform 120ms var(--spring); }
.cw-btn:active, .cw-seg-btn:active, .cw-fold summary:active { transform: scale(.97); }
.cw-btn:disabled:active { transform: none; }

/* #9 fold content fades in on open */
.cw-fold summary { -webkit-tap-highlight-color: transparent; }
.cw-fold[open] > :not(summary) { animation: cw-rise-sm 180ms var(--spring) both; }

/* #15 offline banner + Home Screen hint */
.cw-rise { animation: cw-rise 250ms var(--spring) both; }

/* #7 hero "in 3 h" chip */
.cw-hero-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; }
.cw-chip { display: inline-block; font-size: 14px; font-weight: 600; line-height: 1; padding: 5px 10px; border-radius: 999px;
  background: rgba(64, 185, 208, .2); color: var(--hero-text); white-space: nowrap; }
.cw-chip-t { display: inline-block; transition: opacity 150ms ease; font-variant-numeric: tabular-nums; }
.cw-chip-t.cw-swap { opacity: 0; }

/* #10 + #12 one-time cyan wash on a changed / pushed-to day (animation, so it plays once) */
@keyframes cw-wash { from { background-color: var(--cyan-wash); } to { background-color: var(--card); } }
.cw-changed { animation: cw-wash 400ms ease-out both; }

/* #10 Refresh spinner (same size as the label: no layout shift) */
@keyframes cw-spin { to { transform: rotate(360deg); } }
.cw-btn.cw-busy { position: relative; color: transparent !important; opacity: 1; }
.cw-btn.cw-busy::after { content: ''; position: absolute; left: 50%; top: 50%; width: 16px; height: 16px; margin: -10px 0 0 -10px;
  border: 2px solid var(--accent); border-right-color: transparent; border-radius: 50%; animation: cw-spin 700ms linear infinite; }

/* #10 "Updated" toast */
@keyframes cw-toast-in { from { opacity: 0; transform: translate(-50%, 16px); } to { opacity: 1; transform: translate(-50%, 0); } }
.cw-toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 20px); transform: translate(-50%, 0);
  background: var(--navy); color: var(--foam); padding: 9px 18px; border-radius: 999px; font-size: 15px; font-weight: 600;
  box-shadow: 0 6px 20px rgba(9, 53, 67, .25); z-index: 30; animation: cw-toast-in 250ms var(--spring) both;
  transition: opacity 250ms var(--spring), transform 250ms var(--spring); }
.cw-toast.cw-leave { opacity: 0; transform: translate(-50%, 16px); }

/* #11 "Your schedule's out" banner */
@keyframes cw-drop { from { opacity: 0; transform: translateY(-16px); } to { opacity: 1; transform: none; } }
.cw-cele { position: fixed; left: 12px; right: 12px; max-width: 536px; margin: 0 auto; z-index: 40; display: flex; align-items: stretch;
  background: var(--navy); color: var(--foam); border-radius: 14px; box-shadow: 0 10px 30px rgba(9, 53, 67, .3);
  animation: cw-drop 250ms var(--spring) both; transition: opacity 250ms var(--spring), transform 250ms var(--spring); }
.cw-cele.cw-leave { opacity: 0; transform: translateY(-16px); }
.cw-cele-go { flex: 1 1 auto; min-width: 0; text-align: left; background: none; border: 0; color: inherit; font: inherit; font-weight: 600;
  padding: 14px 4px 14px 16px; cursor: pointer; }
.cw-cele-x { flex: 0 0 44px; background: none; border: 0; color: var(--cyan); font: inherit; font-size: 24px; line-height: 1; cursor: pointer; }
@media (prefers-color-scheme: dark) { .cw-cele, .cw-toast { background: #06495e; box-shadow: 0 0 0 1px #1f5a6e; } }

/* #11 confetti: one burst, removed on animationend */
.cw-confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 50; }
@keyframes cw-burst {
  0% { transform: translate3d(0, 0, 0) rotate(0); opacity: 1; animation-timing-function: cubic-bezier(.2, .8, .4, 1); }
  28% { transform: translate3d(calc(var(--dx) * .45), var(--up), 0) rotate(calc(var(--rot) * .3)); opacity: 1;
    animation-timing-function: cubic-bezier(.5, 0, .9, .6); }
  100% { transform: translate3d(var(--dx), 105vh, 0) rotate(var(--rot)); opacity: .85; }
}
.cw-bit { position: absolute; width: 8px; height: 12px; border-radius: 2px; box-shadow: 0 0 0 .5px rgba(9, 53, 67, .25);
  animation: cw-burst 1200ms both; will-change: transform; }
.cw-bit-round { width: 9px; height: 9px; border-radius: 50%; }

/* #3–#5 PIN page */
@keyframes cw-shake {
  0%, 100% { transform: none; border-color: var(--red); }
  15% { transform: translateX(-9px); } 30% { transform: translateX(8px); } 45% { transform: translateX(-6px); }
  60% { transform: translateX(4px); } 75% { transform: translateX(-2px); border-color: var(--red); }
}
#pin.cw-shake { animation: cw-shake 400ms var(--spring); border-color: var(--red); }
#pin-error.cw-in { animation: cw-rise-sm 200ms var(--spring) both; }
@keyframes cw-pop { 0% { transform: scale(.4); } 55% { transform: scale(1.25); } 80% { transform: scale(.92); } 100% { transform: scale(1); } }
@keyframes cw-ok { 0% { transform: scale(.97); } 60% { transform: scale(1.03); } 100% { transform: none; } }
.cw-btn.cw-ok, .cw-btn.cw-ok:hover { background: var(--cyan-dim); opacity: 1; animation: cw-ok 400ms var(--spring); }
.cw-check { display: inline-block; font-weight: 700; animation: cw-pop 400ms var(--spring) both; }

/* iOS haptic switch (see buzz() in app.js): off-screen, clickable, never seen or focused */
.cw-hapt { position: fixed; left: -200px; top: 0; width: 1px; height: 1px; overflow: hidden; opacity: 0; pointer-events: none; }

/* Reduce Motion: every movement becomes an instant change; no confetti (the banner still shows). */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0s !important;
    transition-duration: .001ms !important; transition-delay: 0s !important; }
  .cw-confetti { display: none !important; }
  .cw-btn.cw-busy::after { animation: none !important; border-right-color: var(--accent); opacity: .6; }
}
