/* ==========================================================================
   Base: reset, typography, layout shell, buttons, notices, header/footer.
   Shared by the survey, privacy and admin pages.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--fs-md)/1.6 var(--font-sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--sage-ink); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--ink); }
h1, h2, h3 { font-family: var(--font-serif); font-weight: 500; letter-spacing: -0.02em; line-height: 1.15; margin: 0; }
p { margin: 0; }
code { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 0.92em; }

:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: 8px; }
.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; }
.skip-link { position: absolute; left: 16px; top: -60px; z-index: 50; padding: 10px 16px; border-radius: var(--r-pill); background: var(--primary); color: var(--on-primary); text-decoration: none; transition: top var(--t-fast); }
.skip-link:focus { top: 12px; }
.icon { width: 1.15em; height: 1.15em; flex: none; }
[hidden] { display: none !important; }

/* ---- Decorative background: soft festive glow + stars --------------------- */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(1200px 600px at 85% -10%, color-mix(in srgb, var(--gold-soft) 55%, transparent), transparent 70%),
    radial-gradient(900px 500px at -10% 30%, color-mix(in srgb, var(--sage-soft) 60%, transparent), transparent 70%);
}
.page-decor { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.decor-star { position: absolute; fill: var(--gold); opacity: .16; }
.decor-star-1 { width: 26px; top: 14%; left: 4%; }
.decor-star-2 { width: 16px; top: 62%; right: 5%; opacity: .2; }
.decor-star-3 { width: 12px; bottom: 9%; left: 12%; opacity: .14; }

/* ---- Header ------------------------------------------------------------- */
.site-header, main, .site-footer { position: relative; z-index: 1; }
.site-header {
  width: 100%; max-width: var(--maxw); margin: 0 auto;
  padding: 20px var(--gutter) 8px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); min-width: 0; }
.brand-mark { width: 44px; height: 44px; border-radius: 14px; background: var(--surface); box-shadow: var(--raised-sm), var(--card-glow); display: grid; place-items: center; flex: none; }
.brand-mark svg { width: 28px; height: 28px; }
.bm-tag { fill: var(--sage-strong); }
.bm-hole { fill: var(--surface); }
.bm-star { fill: var(--gold); }
.brand-text { font-family: var(--font-serif); font-size: 1.08rem; line-height: 1.15; letter-spacing: -0.01em; }
.brand-text em { font-style: italic; color: var(--sage-ink); }
.brand-text small { display: block; font-family: var(--font-sans); font-size: 0.68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-top: 3px; }

/* ---- Theme switch (Light / Dark / System) -------------------------------- */
.theme-switch { display: inline-flex; gap: 4px; padding: 5px; margin: 0; border: 0; border-radius: var(--r-pill); background: var(--surface); box-shadow: var(--inset-sm); }
.theme-switch label { position: relative; display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 6px 12px; border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 600; color: var(--muted); cursor: pointer; transition: color var(--t-fast), background var(--t-fast), box-shadow var(--t-fast); }
.theme-switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.theme-switch label:hover { color: var(--ink); }
.theme-switch label:has(input:checked) { background: var(--surface-hi); color: var(--ink); box-shadow: var(--raised-xs), var(--card-glow); }
.theme-switch label:has(input:focus-visible) { box-shadow: var(--focus-ring); }

/* ---- Buttons ------------------------------------------------------------ */
.btn {
  --btn-bg: var(--surface-hi);
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 12px 22px;
  border: 1px solid transparent; border-radius: var(--r-pill);
  background: var(--btn-bg); color: var(--ink);
  font-weight: 650; font-size: 0.95rem; line-height: 1.2; text-decoration: none;
  cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
  box-shadow: var(--raised-sm), var(--card-glow);
  transition: transform var(--t-fast) var(--ease), box-shadow var(--t-fast) var(--ease), background var(--t-fast), color var(--t-fast);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(1px); box-shadow: var(--inset-sm); }
.btn:focus-visible { box-shadow: var(--raised-sm), var(--focus-ring); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; transform: none; box-shadow: var(--inset-sm); }
.btn-primary { --btn-bg: var(--primary); color: var(--on-primary); box-shadow: var(--raised-sm); }
.btn-primary:hover { --btn-bg: var(--primary-hover); }
.btn-secondary { --btn-bg: var(--surface-hi); }
.btn-ghost { background: transparent; box-shadow: none; color: var(--ink-soft); }
.btn-ghost:hover { background: var(--surface-sunk); }
.btn-quiet { background: transparent; box-shadow: none; color: var(--sage-ink); padding-inline: 14px; }
.btn-quiet:hover { background: var(--sage-soft); }
.btn-danger { --btn-bg: var(--red); color: var(--on-danger); }
.btn-lg { min-height: 56px; padding: 15px 28px; font-size: 1.02rem; }
.btn-sm { min-height: 40px; padding: 8px 14px; font-size: var(--fs-sm); }
.link-button { background: none; border: 0; padding: 0; color: var(--red-ink); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; text-align: left; }

.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; display: inline-block; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Cards & notices ---------------------------------------------------- */
.card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--raised), var(--card-glow); padding: clamp(22px, 4.5vw, 48px); }
.kicker { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .14em; color: var(--gold-ink); margin-bottom: 12px; }
.badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: var(--r-pill); background: var(--gold-soft); color: var(--gold-ink); font-size: 0.7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--r-md); background: var(--surface-sunk); box-shadow: var(--inset-sm); font-size: var(--fs-sm); color: var(--ink-soft); margin: 18px 0; }
.notice p + p { margin-top: 6px; }
.notice-icon { color: var(--gold-ink); margin-top: 2px; }
.notice-warning { background: color-mix(in srgb, var(--gold-soft) 70%, var(--surface)); }
.notice-error { background: color-mix(in srgb, var(--red-soft) 80%, var(--surface)); }
.notice-error .notice-icon { color: var(--red-ink); }
.notice-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.fine-print { font-size: var(--fs-sm); color: var(--muted); display: flex; gap: 8px; align-items: flex-start; }
.fine-print .icon { margin-top: 3px; }

/* ---- Fields ------------------------------------------------------------- */
.field {
  width: 100%; min-height: 54px; padding: 14px 18px;
  border: 1.5px solid transparent; border-radius: var(--r-md);
  background: var(--surface-sunk); box-shadow: var(--inset);
  font-size: 1.05rem; color: var(--ink);
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.field::placeholder { color: color-mix(in srgb, var(--muted) 80%, transparent); }
.field:focus { outline: none; border-color: var(--sage-strong); box-shadow: var(--inset), 0 0 0 3px color-mix(in srgb, var(--sage-strong) 22%, transparent); }
.field[aria-invalid="true"] { border-color: var(--red); }
.field-error { display: flex; align-items: center; gap: 8px; margin-top: 14px; color: var(--red-ink); font-weight: 600; font-size: var(--fs-sm); }

/* ---- Footer ------------------------------------------------------------- */
.site-footer { width: 100%; max-width: var(--maxw); margin: auto auto 0; padding: 28px var(--gutter) 32px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px 20px; font-size: var(--fs-xs); color: var(--muted); }
.site-footer a { color: var(--muted); }

@media (max-width: 560px) {
  .theme-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .theme-switch label { padding: 6px 10px; min-width: 40px; justify-content: center; }
  .brand-text { font-size: 0.98rem; }
  .brand-text small { display: none; }
  .brand-mark { width: 40px; height: 40px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-delay: 0s !important; animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

@media (forced-colors: active) {
  .btn, .card, .option, .field { border: 1px solid CanvasText; }
}
