/* ==========================================================================
   Shared look for every page: fonts, header + nav, hero, buttons, cards,
   dialogs, forms, toast. Colors come from config.js (as CSS variables like
   var(--cream)); everything else lives here.
   ========================================================================== */

:root {
  --font-ui: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --font-hand: 'Caveat', 'Segoe Print', 'Bradley Hand', cursive;
  --font-note: 'Gaegu', 'Patrick Hand', 'Segoe Print', cursive;

  --radius: 22px;
  --radius-sm: 14px;
  --shadow-sm: 0 1px 2px rgb(59 52 66 / 0.06), 0 2px 8px rgb(59 52 66 / 0.06);
  --shadow: 0 1px 2px rgb(59 52 66 / 0.05), 0 10px 30px rgb(59 52 66 / 0.1);
  --focus: var(--sky-deep);
  --link: var(--sky-deep);
  --gutter: clamp(16px, 4vw, 40px);
  --maxw: 1160px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-ui);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  display: block;
  max-width: 100%;
}

a {
  color: var(--link);
  text-underline-offset: 3px;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 0.4em;
}

p {
  margin: 0 0 0.8em;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  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: 12px;
  top: -60px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--ink);
  color: var(--cream);
  border-radius: 999px;
  font-weight: 700;
  text-decoration: none;
}

.skip-link:focus {
  top: 10px;
}

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

/* ── Header + nav ─────────────────────────────────────────────────────────── */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: color-mix(in srgb, var(--cream) 82%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 70%, transparent);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 62px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 18px;
  white-space: nowrap;
}

.brand img {
  width: 34px;
  height: 34px;
}

.nav {
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--paper) 70%, transparent);
  box-shadow: inset 0 0 0 1px var(--line);
}

.nav a {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  color: var(--ink);
  font-weight: 700;
  font-size: 15px;
  text-decoration: none;
  transition: background-color 0.2s, color 0.2s;
}

.nav a svg {
  width: 18px;
  height: 18px;
}

.nav a:hover {
  background: var(--sky);
}

.nav a[aria-current='page'] {
  background: var(--ink);
  color: var(--cream);
}

@media (max-width: 560px) {
  .brand span {
    display: none;
  }
  .nav a {
    padding: 0 14px;
  }
}

/* Header floating over the night sky on the messages page */
.site-header--dusk {
  position: absolute;
  inset: 0 0 auto;
  background: transparent;
  border-bottom: 0;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  color: #fff;
}

.site-header--dusk .nav {
  background: rgb(255 255 255 / 0.1);
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.18);
}

.site-header--dusk .nav a {
  color: #fff;
}

.site-header--dusk .nav a:hover {
  background: rgb(255 255 255 / 0.16);
}

.site-header--dusk .nav a[aria-current='page'] {
  background: var(--cream);
  color: var(--ink);
}

/* ── Hero ─────────────────────────────────────────────────────────────────── */

.hero {
  position: relative;
  overflow: hidden;
  text-align: center;
  background:
    radial-gradient(1200px 300px at 50% 0%, rgb(255 255 255 / 0.7), transparent 70%),
    linear-gradient(180deg, var(--sky) 0%, color-mix(in srgb, var(--sky) 45%, var(--cream)) 55%, var(--cream) 100%);
}

.hero__text {
  position: relative;
  z-index: 1;
  padding: clamp(28px, 6vw, 56px) var(--gutter) 0;
}

.hero__kicker {
  margin: 0 0 4px;
  font-family: var(--font-hand);
  font-size: clamp(22px, 3.4vw, 28px);
  font-weight: 700;
  color: var(--rose-deep);
}

.hero__title {
  margin: 0;
  font-size: clamp(38px, 7.4vw, 72px);
  line-height: 1.02;
}

.hero__celebrating {
  margin: 10px 0 0;
  font-size: clamp(17px, 2.2vw, 20px);
  color: var(--ink-soft);
  font-weight: 600;
}

.hero__chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--paper) 85%, transparent);
  box-shadow: var(--shadow-sm);
  font-weight: 700;
  font-size: 15px;
}

.chip svg {
  width: 18px;
  height: 18px;
  flex: none;
}

.hero__art {
  position: relative;
  margin-top: -10px;
  pointer-events: none;
}

.hero__art img {
  width: 100%;
  height: clamp(120px, 20vw, 210px);
  object-fit: cover;
  object-position: 50% 100%;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */

.btn {
  --btn-bg: var(--paper);
  --btn-fg: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: var(--btn-bg);
  color: var(--btn-fg);
  font: 800 16px/1.1 var(--font-ui);
  text-decoration: none;
  cursor: pointer;
  box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--ink) 18%, transparent);
  transition: transform 0.15s ease, box-shadow 0.2s, background-color 0.2s, opacity 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(1px);
}

.btn svg {
  width: 18px;
  height: 18px;
  flex: none;
}

.btn--primary {
  --btn-bg: var(--falu-red);
  --btn-fg: #fff;
  box-shadow: 0 6px 16px color-mix(in srgb, var(--falu-red) 30%, transparent);
}

.btn--primary:hover {
  box-shadow: 0 10px 22px color-mix(in srgb, var(--falu-red) 34%, transparent);
}

.btn--dark {
  --btn-bg: var(--ink);
  --btn-fg: var(--cream);
  box-shadow: none;
}

.btn--soft {
  --btn-bg: var(--sage);
  box-shadow: none;
}

.btn--ghost {
  --btn-bg: transparent;
}

.btn--small {
  min-height: 38px;
  padding: 0 14px;
  font-size: 14px;
}

.btn[disabled],
.btn[aria-disabled='true'] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.linklike {
  padding: 0;
  border: 0;
  background: none;
  color: var(--link);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

/* ── Cards & sections ─────────────────────────────────────────────────────── */

.card {
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: clamp(20px, 3vw, 28px);
}

.section {
  padding-block: clamp(28px, 5vw, 56px);
}

.section__head {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  justify-content: space-between;
  gap: 12px 24px;
  margin-bottom: 20px;
}

.section__title {
  font-size: clamp(28px, 4vw, 40px);
  margin: 0;
}

.section__lead {
  margin: 6px 0 0;
  color: var(--ink-soft);
  max-width: 60ch;
}

.handwritten {
  font-family: var(--font-hand);
  font-weight: 700;
}

/* ── Filter pills ─────────────────────────────────────────────────────────── */

.filters__cats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: var(--paper);
  box-shadow: inset 0 0 0 1.5px var(--line);
  color: var(--ink);
  font: 700 15px/1 var(--font-ui);
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

.pill:hover {
  background: var(--sky);
}

.pill[aria-pressed='true'] {
  background: var(--ink);
  color: var(--cream);
  box-shadow: none;
}

/* ── Forms ────────────────────────────────────────────────────────────────── */

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
}

.field > span,
.field-label {
  font-weight: 800;
  font-size: 15px;
}

.field small,
.hint {
  color: var(--ink-soft);
  font-size: 14px;
}

input[type='text'],
input[type='password'],
input[type='search'],
textarea,
select {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border: 1.5px solid color-mix(in srgb, var(--ink) 20%, transparent);
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  font: 500 17px/1.4 var(--font-ui);
  transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--sky-deep);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--sky-deep) 22%, transparent);
}

textarea {
  resize: vertical;
}

.checkbox {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
}

.checkbox input {
  width: 22px;
  height: 22px;
  margin: 1px 0 0;
  flex: none;
  accent-color: var(--sage-deep);
}

.form-error {
  min-height: 0;
  margin: 0;
  color: #A3322A;
  font-weight: 700;
  font-size: 15px;
}

.form-error:not(:empty) {
  margin: 4px 0 12px;
}

/* Honeypot: hidden from people, irresistible to bots */
.hp {
  position: absolute !important;
  left: -10000px !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* ── Dialogs ──────────────────────────────────────────────────────────────── */

dialog {
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 30px 80px rgb(30 25 45 / 0.35);
  overflow: auto;
}

dialog::backdrop {
  background: rgb(31 27 45 / 0.45);
  backdrop-filter: blur(3px);
}

dialog[open] {
  animation: dialog-in 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.97);
  }
}

.dialog__body {
  padding: clamp(22px, 4vw, 32px);
}

.dialog__close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-soft);
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
}

.dialog__close:hover {
  background: var(--cream);
}

.dialog__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

/* ── Toast ────────────────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 200;
  max-width: calc(100vw - 32px);
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--cream);
  font-weight: 700;
  box-shadow: var(--shadow);
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ── Footer ───────────────────────────────────────────────────────────────── */

.site-footer {
  padding: 36px 0 48px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 15px;
}

.site-footer .handwritten {
  display: block;
  font-size: 26px;
  color: var(--rose-deep);
}

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