/* Shared garden theme — the single source of truth for the whole product:
   public site, client portal, and the questionnaire app all link this so
   they read as one place. Coastal-rainforest calm: fir/moss greens over warm
   paper, rosegold highlights, a fireweed pink used lightly. Low-sensory by
   intent. Fonts: warm serif display, Bricolage Grotesque for UI, Atkinson
   Hyperlegible for body (legibility as identity). */

/* ---- fonts (self-hosted, zero external deps) ----------------------------- */
@font-face {
  font-family: 'Atkinson Hyperlegible';
  src: url('/fonts/atkinson-400.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Atkinson Hyperlegible';
  src: url('/fonts/atkinson-400i.woff2') format('woff2');
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: 'Atkinson Hyperlegible';
  src: url('/fonts/atkinson-700.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Bricolage Grotesque';
  src: url('/fonts/bricolage-500.woff2') format('woff2');
  font-weight: 500 700; font-style: normal; font-display: swap;
}
/* Fraunces — the display serif, self-hosted variable font (weight 400–600 with
   optical sizing). Two subsets, gated by unicode-range so only what's used loads. */
@font-face {
  font-family: 'Fraunces';
  src: url('/fonts/fraunces-latin.woff2') format('woff2');
  font-weight: 400 600; font-style: normal; font-display: swap;
  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: 'Fraunces';
  src: url('/fonts/fraunces-latin-ext.woff2') format('woff2');
  font-weight: 400 600; font-style: normal; font-display: swap;
  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;
}
/* Playwrite Canada — the flourish: TypeTogether's model of the cursive taught in
   Canadian schools, used for the home hero's title. Self-hosted latin subset;
   licence in /fonts/OFL-playwrite-ca.txt. `block`: the title only shows once
   the visitor has scrolled, so a short wait beats a flash of the fallback. */
@font-face {
  font-family: 'Playwrite CA';
  src: url('/fonts/playwrite-ca.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: block;
}

/* ---- tokens -------------------------------------------------------------- */
:root {
  /* light — a clearing at midday */
  --paper:    #eef0e5;
  --paper-2:  #e5e8d8;
  --card:     #faf9f1;
  --ink:      #22281c;
  --muted:    #59614f;
  --line:     #d5d6c4;

  --moss:     #2f4a31;
  --moss-deep:#20341f;
  --fern:     #557040;
  --lichen:   #dbe5c5;
  --lichen-2: #c8d7ab;

  --hero-1:   #2f4a31;
  --hero-2:   #1c3019;
  --hero-ink: #f1f1e4;

  --rose:      #b76e79;   /* rosegold — the highlight metal */
  --rose-soft: #e3b3a6;
  --pink:      #9c2f5d;   /* fireweed — used lightly */
  --pink-soft: #d98cae;

  --on-moss:  #f1f1e4;
  --on-rose:  #2c1519;
  --focus:    #9c2f5d;

  --shadow: 0 1px 2px rgba(32,52,31,.06), 0 8px 24px rgba(32,52,31,.07);
  --radius: 14px;

  --font-display: 'Fraunces', 'Iowan Old Style', 'Palatino Linotype', Palatino, 'Hoefler Text', Georgia, serif;
  --font-ui: 'Bricolage Grotesque', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-body: 'Atkinson Hyperlegible', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-flourish: 'Playwrite CA', 'Fraunces', Georgia, serif;   /* the hero title; falls back to the display serif */

  --measure: 42rem;
  --wide: 74rem;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    /* dark — the forest at dusk (OS default; the top-right toggle overrides) */
    --paper:    #12150e;
    --paper-2:  #171b10;
    --card:     #1b2015;
    --ink:      #e7e9dc;
    --muted:    #a1a892;
    --line:     #323726;

    --moss:     #86a86e;
    --moss-deep:#9cbe80;   /* filled-button hover: lighter here, since the page is dark (T-005) */
    --fern:     #9cbe80;
    --lichen:   #33422540;
    --lichen-2: #46592f;

    --hero-1:   #1f331d;
    --hero-2:   #0b1108;
    --hero-ink: #eef0e2;

    --rose:      #d99aa2;
    --rose-soft: #ecc4b8;
    --pink:      #e88bb2;
    --pink-soft: #c76c98;
    --on-moss:  #0e1409;
    --on-rose:  #2c1519;
    --focus:    #e88bb2;

    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 28px rgba(0,0,0,.34);
  }
}
/* explicit dark, chosen from the top-right toggle — wins over the OS default.
   (Values mirror the dark block above; keep the two in sync.) */
:root[data-theme="dark"] {
  --paper:    #12150e;
  --paper-2:  #171b10;
  --card:     #1b2015;
  --ink:      #e7e9dc;
  --muted:    #a1a892;
  --line:     #323726;
  --moss:     #86a86e;
  --moss-deep:#9cbe80;   /* filled-button hover: lighter here, since the page is dark (T-005) */
  --fern:     #9cbe80;
  --lichen:   #33422540;
  --lichen-2: #46592f;
  --hero-1:   #1f331d;
  --hero-2:   #0b1108;
  --hero-ink: #eef0e2;
  --rose:      #d99aa2;
  --rose-soft: #ecc4b8;
  --pink:      #e88bb2;
  --pink-soft: #c76c98;
  --on-moss:  #0e1409;
  --on-rose:  #2c1519;
  --focus:    #e88bb2;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 28px rgba(0,0,0,.34);
}

/* ---- base ---------------------------------------------------------------- */
* { box-sizing: border-box; margin: 0; }
html { font-size: 17px; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.65;
  text-underline-offset: 3px;
}

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 500;
  line-height: 1.14;
  letter-spacing: -0.005em;
  text-wrap: balance;
  color: var(--ink);
}
strong { font-weight: 700; }
a { color: var(--moss); text-decoration-color: color-mix(in srgb, var(--rose) 70%, transparent); text-decoration-thickness: 2px; }
a:hover { text-decoration-color: var(--rose); }

h1 { font-size: 1.7rem; }
h2 { font-size: 1.3rem; margin: 1.5rem 0 0.5rem; }
h3 { font-size: 1.1rem; margin: 1.1rem 0 0.4rem; }
p { margin: 0.7rem 0; }
.muted { color: var(--muted); }
.small { font-size: 0.88rem; }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 3px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.skip-link {
  position: absolute; left: -999px; top: 0;
  background: var(--card); color: var(--ink);
  padding: 0.6rem 1rem; z-index: 20; border-radius: 0 0 10px 0;
}
.skip-link:focus { left: 0; top: 0; }

.eyebrow {
  font-family: var(--font-ui);
  font-size: 0.76rem; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--pink);
  margin-bottom: 0.8rem;
}

/* ---- buttons (shared component) ------------------------------------------ */
/* Applies to bare <button> too, so the portal/dashboard get it without extra
   classes; apps with their own button styling (the battery) override below. */
button, .btn {
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-ui); font-weight: 600; font-size: 0.98rem;
  min-height: 48px;
  padding: 0.7rem 1.5rem;
  border-radius: 999px;
  border: 1.5px solid var(--moss);
  background: transparent;
  color: var(--moss);
  text-decoration: none;
  cursor: pointer;
}
.btn:hover { background: color-mix(in srgb, var(--moss) 10%, transparent); }
.btn-primary { background: var(--moss); border-color: var(--moss); color: var(--on-moss); }
.btn-primary:hover { background: var(--moss-deep); border-color: var(--moss-deep); }
.btn-rose { background: var(--rose); border-color: var(--rose); color: var(--on-rose); }
.btn-rose:hover { background: var(--rose-soft); border-color: var(--rose-soft); }
button:disabled, .btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ---- form controls (shared) ---------------------------------------------- */
label { font-family: var(--font-ui); font-weight: 600; font-size: 0.92rem; }
input, textarea, select {
  font: inherit;
  width: 100%;
  min-height: 48px;
  padding: 0.65rem 0.85rem;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
}
input:focus, textarea:focus, select:focus { border-color: var(--fern); }
textarea { min-height: 8rem; resize: vertical; }

/* ---- cards --------------------------------------------------------------- */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.3rem 1.5rem;
  box-shadow: var(--shadow);
}

/* ---- light/dark toggle (injected top-right by /theme-toggle.js) ----------- */
.theme-toggle {
  position: fixed; top: 0.7rem; right: 0.7rem; z-index: 60;
  width: 42px; height: 42px; min-height: 0; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: color-mix(in srgb, var(--card) 82%, transparent);
  color: var(--moss);
  cursor: pointer;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  box-shadow: var(--shadow);
}
.theme-toggle:hover { border-color: var(--fern); background: var(--card); }
.theme-toggle svg { display: block; }
.theme-toggle .i-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .i-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .i-sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .i-moon { display: block; }
}
@media print { .theme-toggle { display: none; } }

/* ---- label/value summary: intake form copy (public form, portal, dashboard) */
.summary-dl {
  display: grid; grid-template-columns: minmax(8rem, 30%) 1fr;
  gap: 0.45rem 0.9rem; margin: 0.4rem 0 0;
}
.summary-dl dt {
  font-family: var(--font-ui); font-weight: 600; font-size: 0.8rem;
  letter-spacing: 0.04em; text-transform: uppercase; color: var(--fern);
  margin: 0; padding-top: 0.1rem;
}
.summary-dl dd {
  margin: 0; font-size: 0.97rem; white-space: pre-line; overflow-wrap: anywhere;
  padding-bottom: 0.45rem; border-bottom: 1px solid var(--line);
}
@media (max-width: 30rem) {
  .summary-dl { grid-template-columns: 1fr; gap: 0.1rem 0; }
  .summary-dl dd { margin-bottom: 0.5rem; }
}

/* ---- tabs (the portal hub and the dashboard's client hub; shared/tabs.js) --- */
.tabs {
  display: flex; flex-wrap: wrap; gap: 0.1rem 1.1rem;
  border-bottom: 1px solid var(--line); margin: 0.6rem 0 1rem;
}
.tabs a {
  font-family: var(--font-ui); font-weight: 600; font-size: 0.95rem;
  color: var(--muted); text-decoration: none;
  padding: 0.55rem 0.1rem; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs a:hover { color: var(--ink); border-bottom-color: var(--lichen-2); }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--rose); }

/* ---- month calendar (shared/calendar.js) ---------------------------------- */
.cal { width: 100%; border-collapse: collapse; table-layout: fixed; margin: 0.5rem 0; font-family: var(--font-ui); }
.cal caption { caption-side: top; text-align: left; }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; padding-bottom: 0.6rem; font-weight: 600; }
.cal-nav { min-height: 0; width: 36px; height: 36px; padding: 0; border-radius: 999px; font-size: 1.25rem; line-height: 1; }
.cal th {
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted);
  padding: 0.3rem 0; text-align: center; border-bottom: 1px solid var(--line);
}
.cal td {
  vertical-align: top; height: 4.6rem; padding: 0.25rem; font-size: 0.82rem;
  border-bottom: 1px solid var(--line); border-right: 1px solid color-mix(in srgb, var(--line) 60%, transparent);
}
.cal td:last-child { border-right: 0; }
.cal-num { display: inline-grid; place-items: center; width: 1.6rem; height: 1.6rem; font-weight: 600; color: var(--muted); border-radius: 999px; }
.cal-day.is-out .cal-num { opacity: 0.4; }
.cal-day.is-today .cal-num { color: var(--on-moss); background: var(--moss); }
.cal-ev {
  display: block; margin-top: 0.2rem; padding: 0.15rem 0.35rem;
  border-radius: 6px; border-left: 3px solid var(--fern);
  background: var(--lichen); color: var(--ink); text-decoration: none;
  font-size: 0.76rem; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
a.cal-ev:hover { background: var(--lichen-2); }
.cal-ev.is-cancelled { text-decoration: line-through; opacity: 0.6; border-left-color: var(--muted); }
@media (max-width: 40rem) {   /* on a phone the chips become marks under the day */
  .cal td { height: 3.4rem; padding: 0.15rem; }
  .cal-ev { font-size: 0; height: 6px; padding: 0; border-left: 0; background: var(--fern); margin-top: 0.3rem; }
  .cal-ev.is-cancelled { background: var(--muted); }
}

/* ---- files with thumbnails, phone rows, feed links (the hub) --------------- */
.file-list { list-style: none; padding: 0; margin: 0; }
.file-row { display: flex; gap: 0.9rem; align-items: center; padding: 0.6rem 0; border-bottom: 1px solid var(--line); }
.file-row:last-child { border-bottom: 0; }
.thumb {
  width: 64px; height: 64px; flex: 0 0 64px; border-radius: 10px; object-fit: cover;
  background: var(--paper-2); border: 1px solid var(--line);
  display: grid; place-items: center;
  font-family: var(--font-ui); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.04em; color: var(--muted);
}
.phone-row { display: flex; gap: 0.5rem; align-items: center; margin: 0.35rem 0; }
.phone-row input { margin: 0; }
.phone-row .label { flex: 0 0 8rem; }
.phone-row button { min-height: 0; width: 40px; padding: 0.35rem 0; flex: 0 0 40px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
@media (max-width: 30rem) { .field-grid { grid-template-columns: 1fr; } }
.prefs { border: 0; padding: 0; margin: 0.9rem 0 0; }
.prefs legend { font-family: var(--font-ui); font-weight: 600; font-size: 0.92rem; padding: 0; margin-bottom: 0.3rem; }
.prefs label { display: inline-flex; align-items: center; gap: 0.4rem; margin: 0 1.1rem 0.4rem 0; font-weight: 500; }
.prefs input { width: auto; min-height: 0; margin: 0; accent-color: var(--moss); }
.feed-url { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; margin: 0.6rem 0; }
.feed-url code {
  background: var(--paper-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 0.4rem 0.6rem; font-size: 0.8rem; overflow-wrap: anywhere; user-select: all;
}
.add-to-cal { margin: 0.3rem 0 0; }
.add-to-cal a { margin-right: 0.15rem; }
@media print { .tabs, .cal-nav, .feed-url button { display: none; } }
