/* ==========================================================================
   BiteWindow foundation.
   Mobile-first: every base rule is the phone rule. Wider screens are additive
   via min-width queries only. Nothing here assumes a mouse or a wide viewport.
   ========================================================================== */

/* ------------------------------------------------------------- tokens --- */
:root {
  /* Water greens, taken from the email so mail and web never disagree. */
  --deep:        #0A4F24;
  --deep-2:      #0C6430;
  --trout:       #3F7A55;
  --sandy:       #7E9256;
  --amber:       #B07B2E;
  --rust:        #9A3B2B;

  --ink:         #14201B;
  --ink-2:       #3A4A43;
  --ink-3:       #667A72;
  --line:        #DCDDD3;
  --line-2:      #EAEAE1;
  --paper:       #F7F5EF;
  --card:        #FFFFFF;
  --card-2:      #FBFAF5;
  --tint:        #E9F1EA;

  --focus:       #0C6430;

  /* Fluid type. Editorial serif for display, system sans for everything else -
     no webfont request, so first paint is immediate on a phone on 4G. */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  --step--1: clamp(0.80rem, 0.78rem + 0.10vw, 0.86rem);
  --step-0:  clamp(1.00rem, 0.97rem + 0.15vw, 1.08rem);
  --step-1:  clamp(1.18rem, 1.10rem + 0.40vw, 1.40rem);
  --step-2:  clamp(1.42rem, 1.25rem + 0.85vw, 1.90rem);
  --step-3:  clamp(1.70rem, 1.38rem + 1.60vw, 2.60rem);
  --step-4:  clamp(2.05rem, 1.50rem + 2.70vw, 3.60rem);

  --sp-1: 0.25rem; --sp-2: 0.5rem;  --sp-3: 0.75rem; --sp-4: 1rem;
  --sp-5: 1.5rem; --sp-6: 2rem;    --sp-7: 3rem;    --sp-8: 4.5rem;

  --radius:   14px;
  --radius-s: 9px;
  --radius-l: 22px;

  --shadow-1: 0 1px 2px rgba(20, 32, 27, 0.06), 0 2px 8px rgba(20, 32, 27, 0.05);
  --shadow-2: 0 2px 6px rgba(20, 32, 27, 0.08), 0 12px 28px rgba(20, 32, 27, 0.09);

  --wrap: 74rem;
  /* Respect the notch on iPhones without leaving a gutter on Android. */
  --gutter: max(1rem, env(safe-area-inset-left));

  --tap: 44px;  /* never ship an interactive target smaller than this */
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --deep:   #4FA96C;
    --deep-2: #63C083;
    --trout:  #6FB98A;
    --sandy:  #A8B87C;
    --amber:  #D9A855;
    --rust:   #E0705C;

    --ink:    #E8EFE9;
    --ink-2:  #B4C4BB;
    --ink-3:  #8A9C93;
    --line:   #2A3831;
    --line-2: #223029;
    --paper:  #0D1512;
    --card:   #14201B;
    --card-2: #182620;
    --tint:   #1B2C23;

    --focus:  #63C083;
    --shadow-1: 0 1px 2px rgba(0,0,0,0.4), 0 2px 8px rgba(0,0,0,0.3);
    --shadow-2: 0 2px 6px rgba(0,0,0,0.45), 0 12px 28px rgba(0,0,0,0.4);
  }
}
:root[data-theme="dark"] {
  --deep: #4FA96C; --deep-2: #63C083; --trout: #6FB98A; --sandy: #A8B87C;
  --amber: #D9A855; --rust: #E0705C;
  --ink: #E8EFE9; --ink-2: #B4C4BB; --ink-3: #8A9C93;
  --line: #2A3831; --line-2: #223029;
  --paper: #0D1512; --card: #14201B; --card-2: #182620; --tint: #1B2C23;
  --focus: #63C083;
  --shadow-1: 0 1px 2px rgba(0,0,0,0.4), 0 2px 8px rgba(0,0,0,0.3);
  --shadow-2: 0 2px 6px rgba(0,0,0,0.45), 0 12px 28px rgba(0,0,0,0.4);
}

/* -------------------------------------------------------------- reset --- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: var(--step-0);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-wrap: break-word;
}
img, svg, video { max-width: 100%; height: auto; display: block; }
h1, h2, h3, h4 { font-family: var(--font-display); line-height: 1.12; margin: 0 0 var(--sp-3); font-weight: 600; letter-spacing: -0.012em; }
h1 { font-size: var(--step-4); }
h2 { font-size: var(--step-3); }
h3 { font-size: var(--step-2); }
h4 { font-size: var(--step-1); }
p, ul, ol { margin: 0 0 var(--sp-4); }
a { color: var(--deep); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--deep-2); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
hr { border: 0; border-top: 1px solid var(--line); margin: var(--sp-6) 0; }

/* ------------------------------------------------------------ layout --- */
.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.wrap--narrow { max-width: 46rem; }
.wrap--mid { max-width: 60rem; }
.site-main { flex: 1 0 auto; padding-block: var(--sp-5) var(--sp-8); }
.stack > * + * { margin-top: var(--sp-4); }
.stack-lg > * + * { margin-top: var(--sp-6); }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--deep); color: #fff; padding: var(--sp-3) var(--sp-4); border-radius: 0 0 var(--radius-s) 0;
}
.skip-link:focus { left: 0; }
.u-visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ------------------------------------------------------------ header --- */
.site-head {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: saturate(1.6) blur(10px);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.site-head__inner {
  display: flex; align-items: center; gap: var(--sp-3);
  min-height: 58px; flex-wrap: wrap;
}
/* min-height, not padding: the wordmark must clear 44px as a touch target
   without adding vertical space that would grow the sticky header. */
.brand { display: inline-flex; align-items: center; min-height: var(--tap); gap: var(--sp-2); text-decoration: none; color: var(--ink); margin-right: auto; }
.brand__mark { width: 30px; height: 30px; flex: none; }
.brand__ring { fill: none; stroke: var(--deep); stroke-width: 2; opacity: 0.9; }
.brand__wave { fill: none; stroke: var(--deep); stroke-width: 2.2; stroke-linecap: round; }
.brand__dot { fill: var(--amber); }
.brand__text { font-family: var(--font-display); font-size: var(--step-1); font-weight: 600; letter-spacing: -0.02em; }

.nav-toggle {
  width: var(--tap); height: var(--tap); display: grid; place-items: center;
  background: none; border: 1px solid var(--line); border-radius: var(--radius-s);
  color: var(--ink); cursor: pointer; flex: none;
}
.nav-toggle__bars, .nav-toggle__bars::before, .nav-toggle__bars::after {
  display: block; width: 18px; height: 2px; background: currentColor; border-radius: 2px;
  transition: transform 0.18s ease, opacity 0.18s ease;
}
.nav-toggle__bars { position: relative; }
.nav-toggle__bars::before, .nav-toggle__bars::after { content: ''; position: absolute; left: 0; }
.nav-toggle__bars::before { top: -6px; }
.nav-toggle__bars::after { top: 6px; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars { background: transparent; }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars::before { transform: translateY(6px) rotate(45deg); }
.nav-toggle[aria-expanded="true"] .nav-toggle__bars::after { transform: translateY(-6px) rotate(-45deg); }

/* Phone: the nav is a disclosure panel below the bar. */
.site-nav { display: none; width: 100%; flex-direction: column; padding-bottom: var(--sp-3); gap: 2px; }
.site-nav.is-open { display: flex; }
.site-nav a, .site-nav .linklike {
  display: flex; align-items: center; min-height: var(--tap);
  padding: 0 var(--sp-3); border-radius: var(--radius-s);
  text-decoration: none; color: var(--ink-2); font-weight: 500;
}
.site-nav a:hover, .site-nav .linklike:hover { background: var(--tint); color: var(--ink); }
.site-nav a.is-current { color: var(--deep); background: var(--tint); font-weight: 600; }
/* Qualified with the element the class always sits on, so these outrank
   `.site-nav a:hover` on their own. Written as a bare class it lost the
   background half of that contest and won only the colour half through
   !important - which left white text on the pale hover tint, i.e. the Sign in
   button vanishing under the pointer. */
.site-nav a.site-nav__cta { background: var(--deep); color: #fff; justify-content: center; font-weight: 600; }
.site-nav a.site-nav__cta:hover { background: var(--deep-2); color: #fff; }
.site-nav__form { margin: 0; }
.linklike { background: none; border: 0; font: inherit; color: var(--ink-2); cursor: pointer; width: 100%; text-align: left; }

/* `no-js` is the pre-paint state: it ships on <html> and the hashed boot script
   in layout.ejs removes it before first paint. If script never runs, the class
   stays and the nav degrades to a plain list rather than a permanently
   collapsed panel with a button that cannot open it. layout.ejs carries a
   <noscript> copy of this for browsers where script is disabled outright. */
.no-js .site-nav { display: flex; }
.no-js .nav-toggle { display: none; }

@media (min-width: 48rem) {
  .site-head__inner { flex-wrap: nowrap; min-height: 68px; }
  .nav-toggle { display: none; }
  .site-nav {
    display: flex !important; flex-direction: row; align-items: center;
    width: auto; padding-bottom: 0; gap: var(--sp-1);
  }
  .site-nav a, .site-nav .linklike { min-height: 38px; padding: 0 var(--sp-3); width: auto; }
  .site-nav__cta { padding-inline: var(--sp-4); }
}

/* ------------------------------------------------------------ footer --- */
.site-foot { border-top: 1px solid var(--line); background: var(--card-2); padding-block: var(--sp-6); padding-bottom: calc(var(--sp-6) + env(safe-area-inset-bottom)); }
.site-foot__inner { display: grid; gap: var(--sp-4); }
.site-foot__brand { margin: 0; font-family: var(--font-display); font-size: var(--step-1); }
.site-foot__links { display: flex; flex-wrap: wrap; gap: 0 var(--sp-4); }
.site-foot__links a { color: var(--ink-2); text-decoration: none; min-height: var(--tap); display: inline-flex; align-items: center; }
.site-foot__links a:hover { color: var(--deep); text-decoration: underline; }
.site-foot__fine { margin: 0; color: var(--ink-3); font-size: var(--step--1); max-width: 60ch; }

/* ------------------------------------------------------------- cards --- */
.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: var(--sp-4); box-shadow: var(--shadow-1);
}
@media (min-width: 40rem) { .card { padding: var(--sp-5); } }
.card--flush { padding: 0; overflow: hidden; }
.card__head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-3); }
.card__title { margin: 0; font-size: var(--step-1); }

.grid { display: grid; gap: var(--sp-4); }
@media (min-width: 44rem) { .grid--2 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 60rem) { .grid--3 { grid-template-columns: repeat(3, 1fr); } }

/* ------------------------------------------------------------ pieces --- */
.eyebrow {
  font-family: var(--font-sans); font-size: var(--step--1); font-weight: 700;
  letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-3); margin: 0 0 var(--sp-2);
}
.lede { font-size: var(--step-1); color: var(--ink-2); max-width: 62ch; }

.pill {
  display: inline-flex; align-items: center; gap: var(--sp-1);
  padding: 3px 10px; border-radius: 999px;
  font-size: var(--step--1); font-weight: 700; letter-spacing: 0.03em;
  background: var(--tint); color: var(--deep); white-space: nowrap;
}
.swatch { width: 0.85em; height: 0.85em; border-radius: 3px; flex: none; border: 1px solid rgba(0,0,0,0.15); }

/* ------------------------------------------------------------ buttons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  min-height: var(--tap); padding: 0 var(--sp-5);
  border: 1px solid transparent; border-radius: var(--radius-s);
  background: var(--deep); color: #fff;
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  transition: background 0.15s ease, transform 0.06s ease;
}
.btn:hover { background: var(--deep-2); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn.is-busy { opacity: 0.55; pointer-events: none; }
.btn--ghost { background: transparent; color: var(--deep); border-color: var(--line); }
.btn--ghost:hover { background: var(--tint); color: var(--deep); }
.btn--danger { background: var(--rust); }
.btn--danger:hover { background: var(--rust); filter: brightness(1.08); }
.btn--sm { min-height: 36px; padding: 0 var(--sp-3); font-size: var(--step--1); }
/* On a phone a primary action should span the thumb-reachable width. */
.btn--block { width: 100%; }
@media (min-width: 40rem) { .btn--block { width: auto; } }
.btn-row { display: flex; flex-wrap: wrap; gap: var(--sp-3); }

/* ------------------------------------------------------------- forms --- */
.field { display: block; margin-bottom: var(--sp-4); }
.field__label { display: block; font-weight: 600; margin-bottom: var(--sp-2); }
.field__hint { display: block; color: var(--ink-3); font-size: var(--step--1); margin-top: var(--sp-1); }
.field__error { display: block; color: var(--rust); font-size: var(--step--1); margin-top: var(--sp-1); font-weight: 600; }

input[type="text"], input[type="email"], input[type="date"], input[type="number"],
input[type="search"], input[type="time"], select, textarea {
  width: 100%; min-height: var(--tap);
  padding: 0.6rem var(--sp-3);
  border: 1px solid var(--line); border-radius: var(--radius-s);
  background: var(--card); color: var(--ink);
  /* 16px minimum or iOS Safari zooms the whole page on focus. */
  font: inherit; font-size: max(16px, var(--step-0));
}
textarea { min-height: 7rem; resize: vertical; line-height: 1.55; }
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath fill='%23667A72' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right var(--sp-3) center; background-size: 12px;
  padding-right: var(--sp-6);
}
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--deep); }
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] { border-color: var(--rust); }

/* Checkbox / radio rendered as a full-width tappable card - the pattern the
   location and day pickers use. */
.choice { display: block; position: relative; }
.choice input { position: absolute; opacity: 0; width: 0; height: 0; }
.choice__box {
  display: flex; align-items: center; gap: var(--sp-3);
  min-height: var(--tap); padding: var(--sp-3);
  border: 1.5px solid var(--line); border-radius: var(--radius-s);
  background: var(--card); cursor: pointer;
  transition: border-color 0.14s ease, background 0.14s ease;
}
.choice__box::before {
  content: ''; width: 22px; height: 22px; flex: none;
  border: 2px solid var(--ink-3); border-radius: 6px; background: var(--card);
  transition: background 0.14s ease, border-color 0.14s ease;
}
.choice input[type="radio"] + .choice__box::before { border-radius: 50%; }
.choice input:checked + .choice__box {
  border-color: var(--deep); background: var(--tint);
}
.choice input:checked + .choice__box::before {
  background: var(--deep) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23fff' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round' d='M3 8.5l3.2 3.2L13 5'/%3E%3C/svg%3E") center/14px no-repeat;
  border-color: var(--deep);
}
.choice input:focus-visible + .choice__box { outline: 3px solid var(--focus); outline-offset: 2px; }
.choice__text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.choice__name { font-weight: 600; }
.choice__note { color: var(--ink-3); font-size: var(--step--1); }
.choice-grid { display: grid; gap: var(--sp-2); }
@media (min-width: 40rem) { .choice-grid--2 { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 34rem) { .choice-grid--days { grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); } }

/* ------------------------------------------------------- scroll rails --- */
/* Wide content (day strips, tables, charts) scrolls inside its own rail.
   The page body itself must never scroll sideways. */
.rail {
  display: flex; gap: var(--sp-2);
  overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch;
  padding-bottom: var(--sp-2); margin-inline: calc(var(--gutter) * -1);
  padding-inline: var(--gutter);
  scrollbar-width: thin;
}
.rail > * { scroll-snap-align: start; flex: none; }
.rail::-webkit-scrollbar { height: 6px; }
.rail::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

table { width: 100%; border-collapse: collapse; font-size: var(--step--1); }
th, td { text-align: left; padding: var(--sp-2) var(--sp-3); border-bottom: 1px solid var(--line-2); vertical-align: top; }
th { font-weight: 700; color: var(--ink-2); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }

/* ------------------------------------------------------------- flash --- */
.flash {
  margin: var(--sp-4) 0 0; padding: var(--sp-3) var(--sp-4);
  border-radius: var(--radius-s); border-left: 4px solid var(--deep);
  background: var(--tint); color: var(--ink); font-weight: 500;
}
.flash--error { border-left-color: var(--rust); background: color-mix(in srgb, var(--rust) 12%, var(--card)); }
.flash--warn  { border-left-color: var(--amber); background: color-mix(in srgb, var(--amber) 14%, var(--card)); }
.flash--ok    { border-left-color: var(--deep); }

.empty {
  text-align: center; padding: var(--sp-7) var(--sp-4);
  border: 1px dashed var(--line); border-radius: var(--radius); color: var(--ink-3);
}

/* ------------------------------------------------------------ utility --- */
.u-mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.u-muted { color: var(--ink-3); }
.u-small { font-size: var(--step--1); }
.u-nowrap { white-space: nowrap; }
.u-center { text-align: center; }
.u-mt-0 { margin-top: 0; } .u-mb-0 { margin-bottom: 0; }
@media (max-width: 39.999rem) { .u-hide-phone { display: none !important; } }
@media print { .site-head, .site-foot, .nav-toggle, .btn { display: none !important; } }
