/* The shared shell of schedule.valleyanesthesia.org (packages/shell).
   Sea blue on cool paper; one coded chip palette for shift types; Bricolage
   Grotesque for dates, numbers and headings, Atkinson Hyperlegible for reading.
   Values are the approved mockup's (owner, 2026-10-24). Status colours (ok, warn,
   no) are for rule results only, never decoration. Every Worker on the site
   vendors this file unchanged (SHELL.sha256); a Worker's own styles go in its
   own stylesheet, loaded after this one. */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("/assets/shell/fonts/bricolage-grotesque.ttf") format("truetype");
  font-weight: 200 800;
  font-stretch: 75% 100%;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("/assets/shell/fonts/atkinson-hyperlegible-regular.ttf")
    format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Atkinson Hyperlegible";
  src: url("/assets/shell/fonts/atkinson-hyperlegible-bold.ttf")
    format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --fg: #1b2430;
  --card: #ffffff;
  --sea: #1c4d8d;
  --sea-ink: #143a6b;
  --sea-soft: #e4ecf7;
  --sea-wash: #f3f6fb;
  --on-sea: #ffffff;
  --paper: #f7f8f5;
  --app-line: #e1e5de;
  --app-muted: #657079;
  --ok: #1f7a4d;
  --ok-soft: #e2f3e8;
  --warn: #8a5a12;
  --warn-soft: #fbefd3;
  --no: #b3261e;
  --no-soft: #fbe9e6;
  --c-on: #1c4d8d;
  --c-on-fg: #fff;
  --c-4665: #8a2f6b;
  --c-4665-fg: #fff;
  --c-dod: #157a7a;
  --c-dod-fg: #fff;
  --c-4330: #4b5d78;
  --c-4330-fg: #fff;
  --c-bk: #a8701a;
  --c-bk-fg: #fff;
  --c-peel: #eaf2e6;
  --c-peel-fg: #2f5a2f;
  --c-peel-line: #8bb08b;
  --c-post: #e4ecf7;
  --c-post-fg: #1c4d8d;
  --c-vac: #efe3bf;
  --c-vac-fg: #5c4a12;
  --c-cons: #e0a526;
  --c-cons-fg: #3f2a00;
  --today: #1c4d8d;
  --shadow: rgba(10, 20, 40, 0.18);
  /* One token per family, so the stack changes in one place. */
  --display:
    "Bricolage Grotesque", "Avenir Next Condensed", "Helvetica Neue", Arial,
    sans-serif;
  --body:
    "Atkinson Hyperlegible", "DM Sans", -apple-system, BlinkMacSystemFont,
    "Segoe UI", sans-serif;
  --shell-top-h: 58px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --fg: #e8ecf1;
    --card: #1b232d;
    --sea: #6f9fe0;
    --sea-ink: #a9c6f0;
    --sea-soft: #1e2c40;
    --sea-wash: #18212c;
    --on-sea: #0f1620;
    --paper: #111821;
    --app-line: #273140;
    --app-muted: #98a3ae;
    --ok: #5fc48e;
    --ok-soft: #163125;
    --warn: #e0b25a;
    --warn-soft: #3a2d12;
    --no: #f08a80;
    --no-soft: #3d1d1a;
    --c-on: #3d73c4;
    --c-4665: #b14a8f;
    --c-dod: #1f9a9a;
    --c-4330: #64789a;
    --c-bk: #c7892a;
    --c-peel: #1f2e22;
    --c-peel-fg: #a7d0a7;
    --c-peel-line: #4b7a4b;
    --c-post: #1e2c40;
    --c-post-fg: #a9c6f0;
    --c-vac: #3d3520;
    --c-vac-fg: #e6d6a2;
    --c-cons: #d9a12b;
    --c-cons-fg: #2b1d00;
    --today: #6f9fe0;
    --shadow: rgba(0, 0, 0, 0.5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --fg: #e8ecf1;
  --card: #1b232d;
  --sea: #6f9fe0;
  --sea-ink: #a9c6f0;
  --sea-soft: #1e2c40;
  --sea-wash: #18212c;
  --on-sea: #0f1620;
  --paper: #111821;
  --app-line: #273140;
  --app-muted: #98a3ae;
  --ok: #5fc48e;
  --ok-soft: #163125;
  --warn: #e0b25a;
  --warn-soft: #3a2d12;
  --no: #f08a80;
  --no-soft: #3d1d1a;
  --c-on: #3d73c4;
  --c-4665: #b14a8f;
  --c-dod: #1f9a9a;
  --c-4330: #64789a;
  --c-bk: #c7892a;
  --c-peel: #1f2e22;
  --c-peel-fg: #a7d0a7;
  --c-peel-line: #4b7a4b;
  --c-post: #1e2c40;
  --c-post-fg: #a9c6f0;
  --c-vac: #3d3520;
  --c-vac-fg: #e6d6a2;
  --c-cons: #d9a12b;
  --c-cons-fg: #2b1d00;
  --today: #6f9fe0;
  --shadow: rgba(0, 0, 0, 0.5);
}

/* Base */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body.shell {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--fg);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.5;
}
.shell h1,
.shell h2,
.shell h3 {
  font-family: var(--display);
  font-optical-sizing: auto;
  letter-spacing: -0.01em;
  line-height: 1.1;
  text-wrap: balance;
  margin: 0;
}
.shell h1 {
  font-size: clamp(26px, 6vw, 40px);
  font-weight: 750;
  letter-spacing: -0.02em;
}
.shell h2 {
  font-size: 24px;
  font-weight: 650;
}
.shell h3 {
  font-size: 16px;
  font-weight: 650;
}
.shell p {
  margin: 0;
}
.shell a {
  color: var(--sea);
}
.shell img,
.shell svg {
  max-width: 100%;
}
[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid var(--sea);
  outline-offset: 2px;
}
#main:focus {
  outline: none;
}

.shell-skip {
  position: absolute;
  left: 12px;
  top: -100px;
  z-index: 50;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--card);
  color: var(--sea);
  font-weight: 700;
}
.shell-skip:focus {
  top: calc(env(safe-area-inset-top, 0px) + 8px);
}

/* Top bar: VAA app switcher, the site's name, the account menu. */
.shell-top {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: calc(var(--shell-top-h) + env(safe-area-inset-top, 0px));
  padding: calc(env(safe-area-inset-top, 0px) + 8px)
    max(14px, env(safe-area-inset-right, 0px)) 10px
    max(14px, env(safe-area-inset-left, 0px));
  background: var(--paper);
  border-bottom: 1px solid var(--app-line);
}
.shell-apps {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 1px solid var(--app-line);
  border-radius: 11px;
  background: var(--card);
  color: var(--app-muted);
}
.shell-apps svg {
  width: 16px;
  height: 16px;
}
.shell-apps:hover {
  color: var(--sea);
  border-color: var(--sea);
}
.shell-brand {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.05;
  text-decoration: none;
}
.shell-brand small {
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--app-muted);
}
.shell-brand span {
  font-family: var(--display);
  font-weight: 750;
  font-size: 18px;
  color: var(--sea);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.shell-account {
  position: relative;
  margin-left: auto;
}
.shell-me {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--sea-soft);
  color: var(--sea-ink);
  font: 700 13px/1 var(--body);
  cursor: pointer;
}
.shell-me[aria-expanded="true"] {
  background: var(--sea);
  color: var(--on-sea);
}
.shell-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 30;
  min-width: 232px;
  max-width: calc(100vw - 28px);
  display: grid;
  padding: 6px;
  background: var(--card);
  border: 1px solid var(--app-line);
  border-radius: 14px;
  box-shadow: 0 18px 40px -18px var(--shadow);
}
.shell-menu-name {
  padding: 10px 12px 8px;
  font-family: var(--display);
  font-weight: 700;
  font-size: 16px;
  border-bottom: 1px solid var(--app-line);
  margin-bottom: 4px;
  overflow-wrap: anywhere;
}
.shell-menu a {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 10px;
  color: var(--fg);
  font-weight: 700;
  text-decoration: none;
}
.shell-menu a:hover {
  background: var(--sea-wash);
  color: var(--sea);
}

/* The page */
#main {
  display: block;
  padding: 14px max(16px, env(safe-area-inset-right, 0px)) 24px
    max(16px, env(safe-area-inset-left, 0px));
}
.shell-with-tabs #main {
  padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
}

/* Tab bar: fixed at the bottom on phones. */
.shell-tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 2px;
  padding: 8px max(6px, env(safe-area-inset-right, 0px))
    calc(8px + env(safe-area-inset-bottom, 0px))
    max(6px, env(safe-area-inset-left, 0px));
  background: var(--card);
  border-top: 1px solid var(--app-line);
}
.shell-tab {
  min-height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 4px 0;
  border-radius: 10px;
  color: var(--app-muted);
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
}
.shell-tab svg {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}
.shell-tab:hover {
  color: var(--fg);
}
.shell-tab[aria-current="page"] {
  color: var(--sea);
}
.shell-tab.live {
  background: var(--c-cons);
  color: var(--c-cons-fg);
  margin: 0 2px;
}
.shell-tab.live[aria-current="page"] {
  color: var(--c-cons-fg);
  box-shadow: inset 0 0 0 2px var(--c-cons-fg);
}

/* Desktop: the tabs sit in the middle of the top bar as segmented tabs. */
@media (min-width: 900px) {
  :root {
    --shell-top-h: 60px;
  }
  .shell-top {
    background: var(--card);
    padding-left: 20px;
    padding-right: 20px;
  }
  .shell-with-tabs #main {
    padding-bottom: 32px;
  }
  #main {
    padding: 20px 24px 32px;
  }
  .shell-tabs {
    left: 50%;
    right: auto;
    bottom: auto;
    top: calc(env(safe-area-inset-top, 0px) + (var(--shell-top-h) - 44px) / 2);
    z-index: 21;
    transform: translateX(-50%);
    display: flex;
    gap: 4px;
    padding: 4px;
    background: var(--paper);
    border: 0;
    border-radius: 14px;
  }
  .shell-tab {
    min-height: 36px;
    flex-direction: row;
    padding: 0 18px;
    font-size: 14px;
  }
  .shell-tab svg {
    display: none;
  }
  .shell-tab[aria-current="page"] {
    background: var(--card);
    color: var(--fg);
    box-shadow: 0 1px 2px var(--shadow);
  }
  .shell-tab.live {
    margin: 0;
  }
  /* The open seasonal tab keeps its marigold; the card colour would leave
     dark-on-dark text in dark mode. */
  .shell-tab.live[aria-current="page"] {
    background: var(--c-cons);
    color: var(--c-cons-fg);
    box-shadow:
      inset 0 0 0 2px var(--c-cons-fg),
      0 1px 2px var(--shadow);
  }
}

/* Buttons: one primary action per screen. */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 16px;
  border: 1px solid var(--app-line);
  border-radius: 12px;
  background: var(--card);
  color: var(--fg);
  font: 700 15px/1.2 var(--body);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
.btn.primary {
  background: var(--sea);
  border-color: var(--sea);
  color: var(--on-sea);
}
.btn.primary:hover {
  background: var(--sea-ink);
  border-color: var(--sea-ink);
}
.btn.quiet {
  border-color: transparent;
  background: transparent;
  color: var(--sea);
}
.btn.ghost {
  border-color: var(--app-line);
  color: var(--app-muted);
}
.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
}
.btnrow {
  display: grid;
  gap: 8px;
}
.btnrow.two {
  grid-template-columns: 1fr 1fr;
}

/* Notices: the result of a rule check, or plain information. */
.notice {
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 13px;
}
.notice b {
  font-size: 13px;
}
.notice.ok {
  background: var(--ok-soft);
  color: var(--ok);
}
.notice.warn {
  background: var(--warn-soft);
  color: var(--warn);
}
.notice.info {
  background: var(--sea-soft);
  color: var(--sea-ink);
}
.notice.no {
  background: var(--no-soft);
  color: var(--no);
}

/* Shift chips (inside calendar days) and pills (in lists). */
.chip {
  position: relative;
  width: 100%;
  padding: 4px 3px;
  border-radius: 5px;
  font-family: var(--body);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.01em;
  text-align: center;
  white-space: nowrap;
}
.pill {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}
.chip.on,
.pill.on {
  background: var(--c-on);
  color: var(--c-on-fg);
}
.chip.c4665,
.pill.c4665 {
  background: var(--c-4665);
  color: var(--c-4665-fg);
}
.chip.dod,
.pill.dod {
  background: var(--c-dod);
  color: var(--c-dod-fg);
}
.chip.c4330,
.pill.c4330 {
  background: var(--c-4330);
  color: var(--c-4330-fg);
}
.chip.bk,
.pill.bk {
  background: var(--c-bk);
  color: var(--c-bk-fg);
}
.chip.peel,
.pill.peel {
  background: var(--c-peel);
  color: var(--c-peel-fg);
  border: 1px solid var(--c-peel-line);
}
.chip.post,
.pill.post {
  background: var(--c-post);
  color: var(--c-post-fg);
}
.chip.vac,
.pill.vac {
  background: var(--c-vac);
  color: var(--c-vac-fg);
}
.chip.cons,
.pill.cons {
  background: var(--c-cons);
  color: var(--c-cons-fg);
}
.pill.ok {
  background: var(--ok-soft);
  color: var(--ok);
}
.pill.warn {
  background: var(--warn-soft);
  color: var(--warn);
}
.pill.no {
  background: var(--no-soft);
  color: var(--no);
}
.pill.quiet {
  background: var(--sea-soft);
  color: var(--sea-ink);
}
/* A shift that changed hands carries the trade mark. */
.chip.tr::after {
  content: "\21C4";
  position: absolute;
  top: -7px;
  right: -3px;
  width: 14px;
  height: 14px;
  border: 1px solid var(--app-line);
  border-radius: 50%;
  background: var(--card);
  color: var(--fg);
  font-size: 9px;
  line-height: 12px;
}
.chip.ghost {
  opacity: 0.35;
}

/* Sheet: a bottom sheet on phones, a centred dialog on desktop. Use it on a
   <dialog class="sheet"> opened with showModal(). */
.sheet {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 40;
  width: 100%;
  max-width: none;
  max-height: min(88vh, 88dvh);
  margin: 0;
  overflow: auto;
  display: grid;
  gap: 14px;
  padding: 10px max(16px, env(safe-area-inset-right, 0px))
    calc(20px + env(safe-area-inset-bottom, 0px))
    max(16px, env(safe-area-inset-left, 0px));
  background: var(--card);
  color: var(--fg);
  border: 0;
  border-top: 1px solid var(--app-line);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -18px 40px -20px var(--shadow);
}
dialog.sheet:not([open]) {
  display: none;
}
.sheet::backdrop {
  background: rgba(15, 25, 40, 0.42);
}
.sheet .grab {
  width: 40px;
  height: 4px;
  margin: 0 auto;
  border-radius: 2px;
  background: var(--app-line);
}
.sheet h3 {
  font-size: 24px;
  font-weight: 750;
  letter-spacing: -0.015em;
  line-height: 1.1;
}
.sheet h3 small {
  display: block;
  margin-top: 3px;
  font-family: var(--body);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--app-muted);
}
@media (min-width: 900px) {
  .sheet {
    inset: 50% auto auto 50%;
    width: min(560px, calc(100vw - 48px));
    max-height: min(80vh, 760px);
    padding: 20px 24px 24px;
    border: 1px solid var(--app-line);
    border-radius: 24px;
    transform: translate(-50%, -50%);
    box-shadow: 0 30px 60px -30px var(--shadow);
  }
  .sheet .grab {
    display: none;
  }
}

/* A page that can't open (errorPage). */
.shell-error {
  max-width: 34rem;
  margin: 40px auto;
  display: grid;
  gap: 14px;
}
.shell-error .btn {
  display: inline-flex;
}

/* Motion answers the person: the sheet rises, the menu drops in. */
@media (prefers-reduced-motion: no-preference) {
  .sheet[open] {
    animation: shell-rise 0.22s ease-out;
  }
  .shell-menu:not([hidden]) {
    animation: shell-drop 0.14s ease-out;
  }
  @media (min-width: 900px) {
    .sheet[open] {
      animation-name: shell-fade;
    }
  }
}
@keyframes shell-rise {
  from {
    transform: translateY(24px);
    opacity: 0;
  }
}
@keyframes shell-drop {
  from {
    transform: translateY(-4px);
    opacity: 0;
  }
}
@keyframes shell-fade {
  from {
    opacity: 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
