/* The base: tokens, controls, the side panel and toasts; season.css is the calendar page. Colours are tokens so dark mode is one block. */
/* Self-hosted Crimson Pro for titles and reading text, so every phone sees the same page. */
@font-face { font-family: "Crimson Pro"; font-weight: 200 900; font-style: normal; font-display: swap; src: url("/assets/crimson-pro-53b45fc6.woff2") format("woff2"); }
@font-face { font-family: "Crimson Pro"; font-weight: 200 900; font-style: italic; font-display: swap; src: url("/assets/crimson-pro-italic-7eb0b6b4.woff2") format("woff2"); }
:root {
  --bg: #faf7f2;
  --surface: #ffffff;
  --sunk: #f1ece3;
  --ink: #23201b;
  --muted: #6d665b;
  --line: #e2dbcf;
  --accent: #2f5d50;
  --accent-ink: #ffffff;
  --accent-soft: #e3eeea;
  --accent-text: #2f5d50;
  --focus: #2f5d50;
  --warn: #a23b2a;
  --ok: #2f6b3a;
  --smile: #c08a2c;
  --smile-soft: #fbf1dc;
  --radius: 12px;
  --serif: "Crimson Pro", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #171614; --surface: #201f1c; --sunk: #2a2824; --ink: #ece8e0; --muted: #a59e92; --line: #38352f;
    --accent: #8cc4b2; --accent-text: #8cc4b2; --focus: #8cc4b2; --accent-ink: #10201b; --accent-soft: #1f322c; --warn: #f0927f; --ok: #8cc79a;
    --smile: #e2b562; --smile-soft: #2f2719;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--sans); }
/* Lucide icons (icon(:name)): sized by the text around them unless a control sets its own. */
.icon { width: 1em; height: 1em; flex: none; vertical-align: -.125em; }
a { color: var(--accent-text); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; margin: 0 0 .4em; }
h1 { font-size: clamp(28px, 6vw, 40px); }
h2 { font-size: clamp(20px, 5vw, 22px); }
img, video { max-width: 100%; }
.muted { color: var(--muted); }


form.inline { display: inline; }

.flash { padding: 10px 14px; border-radius: var(--radius); background: var(--accent-soft); }
.flash-alert { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); }


/* Shared controls */
.button, button:not(.link), input[type=submit] { font: 600 15px var(--sans); padding: 9px 16px; border-radius: 10px; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink); cursor: pointer; text-decoration: none; display: inline-block; }
.button.secondary, button.secondary { background: transparent; color: var(--accent-text); }
.button.danger, button.danger { background: transparent; border-color: var(--warn); color: var(--warn); }
button.link { font: inherit; background: none; border: 0; padding: 0; color: var(--muted); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
input[type=text], input[type=search], input[type=url], input[type=number], input[type=email], input[type=date], input[type=file], select, textarea {
  font: 16px var(--sans); color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; width: 100%; min-width: 0;
}
textarea { min-height: 90px; }
/* Safari draws search fields inset and rounded its own way; ours match the other fields. */
input[type=search] { -webkit-appearance: none; appearance: none; }
/* iOS draws date fields its own way: wider than their box, centred, and no height when empty. */
input[type=date] { -webkit-appearance: none; appearance: none; display: block; min-height: 42px; text-align: left; }
input[type=date]::-webkit-date-and-time-value { text-align: left; }
label { font-size: 14px; font-weight: 600; color: var(--muted); }
.field { display: grid; gap: 4px; margin-bottom: 12px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: end; }
.row > .field { flex: 1 1 180px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.errors { color: var(--warn); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Side panel: one <dialog> in the layout, filled from a page's <template>. */
.side-panel { margin: 0 0 0 auto; width: min(440px, 100vw); height: 100dvh; max-width: none; max-height: none; padding: 0 0 env(safe-area-inset-bottom); border: 0; overflow-y: auto; background: var(--surface); color: var(--ink); box-shadow: -12px 0 40px rgb(0 0 0 / .25); }
.side-panel[open] { animation: panel-in .22s ease-out; }
.side-panel::backdrop { background: rgb(0 0 0 / .35); }
/* The page stays put under an open panel; only the panel scrolls. */
html:has(.side-panel[open]) { overflow: hidden; }
@keyframes panel-in { from { transform: translateX(48px); opacity: 0; } }
/* On a phone it's a bottom sheet instead: up from the bottom, as tall as it needs, a swipe down closes it. */
@media (max-width: 640px) {
  .side-panel { margin: auto 0 0; width: 100%; height: fit-content; max-height: calc(100dvh - 40px - env(safe-area-inset-top)); border-radius: 20px 20px 0 0; box-shadow: 0 -12px 40px rgb(0 0 0 / .25); overscroll-behavior: contain; }
  .side-panel[open] { animation: sheet-in .28s cubic-bezier(.2, .8, .2, 1); }
  .side-panel::before { content: ""; display: block; width: 40px; height: 5px; margin: 8px auto -4px; border-radius: 3px; background: var(--line); }
}
@keyframes sheet-in { from { transform: translateY(100%); } }
@media (prefers-reduced-motion: reduce) { .side-panel[open] { animation: none; } }
.side-panel button.panel-close { position: absolute; top: 10px; right: 10px; z-index: 1; width: 44px; height: 44px; padding: 0; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font-size: 20px; cursor: pointer; }
.panel-body { display: grid; gap: 10px; padding: 20px; }
.panel-body > h2 { margin: 0; padding-right: 48px; font-size: clamp(22px, 6vw, 26px); overflow-wrap: anywhere; }
/* Back from a sheet that replaced another, e.g. the edit form to its gift. */
.panel-body .panel-back { justify-self: start; max-width: calc(100% - 44px); font-size: 14px; text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.panel-body .panel-back:hover { color: var(--ink); }
.panel-form { display: grid; gap: 10px; }
.panel-form .field { margin: 0; }
.panel-form input[type=submit] { justify-self: start; margin-top: 4px; }
/* A long form's button stays at the bottom of the panel while it scrolls. */
.panel-save { position: sticky; bottom: 0; z-index: 1; margin: 0 -20px -20px; padding: 12px 20px; background: var(--surface); border-top: 1px solid var(--line); }
.panel-save input[type=submit] { margin-top: 0; }
/* Forms shared with full pages lose their card frame inside the panel. */
.side-panel .card { border: 0; padding: 0; background: none; }
/* Toasts after a save, at the bottom (over a bottom sheet on a phone, and over the sticky filter bar), with Undo when there is one. */
.toasts { position: fixed; z-index: 5; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); transform: translateX(-50%); display: grid; gap: 8px; width: max-content; max-width: calc(100vw - 32px); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 14px; padding: 10px 16px; border-radius: 999px; background: var(--ink); color: var(--surface); font-size: 15px; box-shadow: 0 6px 20px rgb(0 0 0 / .25); pointer-events: auto; animation: toast-in .2s ease-out; }
.toast[hidden] { display: none; }
.toast-undo { display: contents; }
.toast .link { color: inherit; font-weight: 600; text-decoration: underline; }
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } }

