/* The skin: base elements, type, cards, buttons, form controls, feedback. Every colour, font and
   radius comes from a token (tokens.css + the theme's inline overrides in base.html), so the same
   rules serve all 8 templates, light and dark. Layout lives in app.css and content.css. */

/* ---- The brand's faces, self-hosted (no request leaves the site) ---- */
@font-face {
  font-family: "Newsreader"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("../fonts/newsreader-latin-600.woff2") format("woff2");
}
@font-face {
  font-family: "EB Garamond"; font-style: normal; font-weight: 400 800; font-display: swap;
  src: url("../fonts/eb-garamond-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Zilla Slab"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("../fonts/zilla-slab-latin-700.woff2") format("woff2");
}
@font-face {
  font-family: "Nunito"; font-style: normal; font-weight: 200 1000; font-display: swap;
  src: url("../fonts/nunito-latin.woff2") format("woff2");
}
@font-face {
  font-family: "Public Sans"; font-style: normal; font-weight: 100 900; font-display: swap;
  src: url("../fonts/public-sans-latin.woff2") format("woff2");
}

/* ---- Card styles, chosen per theme on <html data-card> ---- */
:root[data-card="flat"] { --card-line: var(--line); }
:root[data-card="outlined"] { --card-line: var(--line-strong); }

/* ---- Base ---- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 var(--step-body)/1.55 var(--font-body);
  font-kerning: normal;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 {
  font-family: var(--font-heading);
  font-weight: var(--heading-weight);
  letter-spacing: var(--heading-tracking);
  color: var(--text-strong);
  line-height: 1.2;
  margin: 0 0 var(--space-3);
  text-wrap: balance;
}
h1 { font-size: calc(var(--step-h1) * var(--title-scale)); line-height: 1.08; }
/* Page titles follow the template (centred in Classic, Photo Album and Festive); titles inside a
   card or form stay at the card's left edge. */
main h1 { text-align: var(--title-align); }
main .card h1, main .settings-panel h1, main .invite-page h1, main .moment-form-card h1 { text-align: left; }
.pagehead, .page-head { flex-direction: var(--pagehead-dir); }
h2 { font-size: var(--step-h2); }
h3 { font-size: var(--step-name); }
/* Names and dates in the template's display face (feed cards, people, comments, events). */
.display-face { font-family: var(--font-heading); font-weight: var(--heading-weight); letter-spacing: var(--heading-tracking); color: var(--text-strong); }
small, .small { font-size: var(--step-small); }
a { color: var(--accent); text-underline-offset: 0.15em; }
/* Only plain text links darken on hover; component links (.brand, .nav-card, .tabs__link…) style
   their own hover in app.css/content.css. */
a:not([class]):hover, .link:hover { color: var(--accent-strong); }
::selection { background: var(--accent-soft); color: var(--text-strong); }
hr { border: 0; border-top: 1px solid var(--line); }

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

.muted { color: var(--muted); }
.error { color: var(--danger); }

/* ---- Cards ---- */
.card {
  background: var(--card-bg);
  border: var(--card-edge);
  border-radius: var(--card-radius);
  box-shadow: var(--card-elev);
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: var(--control-h); padding: 0 var(--space-5); text-align: center; line-height: 1.25;
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn:hover { background: var(--accent-soft); color: var(--text-strong); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn--primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); color: var(--on-accent); }
.btn--danger { background: var(--danger); border-color: var(--danger); color: var(--on-danger); }
.btn--danger:hover { background: var(--danger); color: var(--on-danger); filter: brightness(0.92); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.55; cursor: not-allowed; }
.btn:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* ---- Form controls: one style for every field of the family site ----
   Every text field, select and text area, wherever it sits (forms, search, comments, the recipe
   editor), gets the same control: the body face at 17px (never under 16px, so iOS never zooms),
   48px tall, the field line, a soft fill. File pickers get a real button; sliders take the accent. */
.field label { font-weight: 600; color: var(--text-strong); }
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]):not([type="hidden"]):not([type="submit"]):not([type="button"]):not([type="color"]),
select, textarea {
  min-height: var(--control-h);
  padding: var(--space-2) var(--space-3);
  background: var(--surface-2); color: var(--text);
  border: 1px solid var(--field-line); border-radius: var(--radius-sm);
  font: inherit; font-size: max(16px, 1em); line-height: 1.4;
  max-width: 100%;
}
textarea { line-height: 1.5; padding-block: var(--space-3); }
input[type="search"] { -webkit-appearance: none; appearance: none; }
::placeholder { color: var(--muted); opacity: 1; font-family: inherit; }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--focus); outline-offset: 1px; border-color: var(--accent);
}
select option { background: var(--surface); color: var(--text); }
input[type="checkbox"], input[type="radio"], input[type="range"], progress { accent-color: var(--accent); }
input[type="checkbox"], input[type="radio"] { width: 20px; height: 20px; }
.field .help { color: var(--muted); }
.field .error { color: var(--danger); }

/* File pickers without JavaScript: the native control, with its button drawn as a .btn */
input[type="file"] {
  max-width: 100%; min-height: var(--control-h);
  font: inherit; font-size: var(--step-small); color: var(--muted);
}
input[type="file"]::file-selector-button {
  min-height: var(--control-h); margin-right: var(--space-3); padding: 0 var(--space-4);
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text-strong);
  font: inherit; font-size: var(--step-body); font-weight: 600; cursor: pointer;
}
input[type="file"]::file-selector-button:hover { background: var(--accent-soft); }

/* Sliders: a 48px-tall hit area in the theme's accent (never the browser's blue) */
input[type="range"] { width: 100%; min-height: var(--control-h); margin: 0; background: transparent; cursor: pointer; }

/* Progress bars (uploads, story editor) */
progress { -webkit-appearance: none; appearance: none; border: 0; border-radius: 999px; background: var(--line); overflow: hidden; }
progress::-webkit-progress-bar { background: var(--line); border-radius: 999px; }
progress::-webkit-progress-value { background: var(--accent); border-radius: 999px; }
progress::-moz-progress-bar { background: var(--accent); border-radius: 999px; }

/* ---- Feedback ---- */
.messages li {
  background: var(--accent-soft); color: var(--text);
  border: 1px solid var(--line); border-left: 4px solid var(--accent);
  border-radius: var(--radius);
}
.messages .messages--success { background: var(--success-soft); border-left-color: var(--success); }
.messages .messages--warning { background: var(--warning-soft); border-left-color: var(--warning); }
.messages .messages--error { background: var(--danger-soft); border-left-color: var(--danger); }
.notice { background: var(--accent-soft); color: var(--text); border: 1px solid var(--line); border-radius: var(--radius); }
.notice--warning { background: var(--warning-soft); }
.badge { background: var(--accent-soft); color: var(--accent-strong); border-radius: 999px; }
.badge--success { background: var(--success-soft); color: var(--success); }
.badge--warning { background: var(--warning-soft); color: var(--warning); }
.badge--danger { background: var(--danger-soft); color: var(--danger); }
.avatar { background: var(--accent-soft); color: var(--accent-strong); }
