/* ==========================================================================
   guestbook.css — Wishing Wall guestbook: form + wall (card grid) + wax-seal
   swatches. Mobile-first; reuses tokens from styles/tokens.css and the shared
   .wf-field/.wf-input/.wf-fieldset form look from components/forms.css.
   Accessible focus + non-colour-only states; per BRIEF §3 palette.
   ========================================================================== */

/* Layout: single column on phones; form + wall side-by-side on wide screens. */
.wf-guestbook__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-xl);
  margin-block-start: var(--space-lg);
}
@media (min-width: 56rem) {
  .wf-guestbook__grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr);
    align-items: start;
  }
}

/* ── Wax-seal colour swatches ──────────────────────────────────────────────
   Each seal value maps to a palette colour. The swatch is a round "wax blob";
   the radio keeps the real semantics (label text is never colour-only). */
.wf-wish__seal--bronze { --seal: var(--c-mustard); }
.wf-wish__seal--olive  { --seal: var(--c-olive); }
.wf-wish__seal--red    { --seal: var(--c-terracotta); }

/* The real <legend> is visually hidden (kept for a11y/the accessible name);
   native "legend straddles the fieldset border" positioning proved unreliable
   here, so a plain aria-hidden paragraph — styled exactly like every other
   field label (.wf-field__label) — stands in as the visible heading, sitting
   as a normal block above the box instead of depending on that rendering. */
.wf-guestbook__seals-heading {
  font-family: var(--font-serif);
  font-size: var(--step--1);
  font-weight: 600;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.08em;
  color: var(--c-terracotta-dk);
  margin-block-end: var(--space-xs);
}
.wf-guestbook__seals-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-md);
}

/* One seal choice: radio + colour swatch + text label. */
.wf-seal {
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  min-height: 44px;
  cursor: pointer;
}
.wf-seal input {
  width: 1.15rem;
  height: 1.15rem;
  accent-color: var(--c-terracotta);
}

/* The colour swatch — a soft round wax seal. */
.wf-seal__swatch {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: radial-gradient(
    circle at 35% 30%,
    color-mix(in srgb, var(--seal, var(--c-clay)) 70%, #fff) 0%,
    var(--seal, var(--c-clay)) 60%,
    color-mix(in srgb, var(--seal, var(--c-clay)) 70%, #000) 100%
  );
  box-shadow: var(--shadow-soft);
  flex: none;
}
.wf-seal__label {
  font-family: var(--font-body);
  color: var(--c-sepia);
}

/* Visible focus when the (real) radio is keyboard-focused — not colour-only. */
.wf-seal input:focus-visible + .wf-seal__swatch {
  outline: 2px solid var(--c-focus);
  outline-offset: 2px;
}
/* Selected seal gets a ring so the choice is clear beyond the radio dot. */
.wf-seal input:checked + .wf-seal__swatch {
  box-shadow: 0 0 0 2px var(--c-parchment), 0 0 0 4px var(--seal, var(--c-clay));
}

/* ── Thank-you confirmation (aria-live region) ─────────────────────────────── */
.wf-guestbook__thanks {
  color: var(--c-success);
  font-weight: 600;
}
.wf-guestbook__thanks:empty { display: none; }

/* ── The wall ──────────────────────────────────────────────────────────────── */
.wf-guestbook__wall-title {
  font-family: var(--font-serif);
  font-size: var(--step-1);
  letter-spacing: 0.04em;
  color: var(--c-burgundy);
  margin-block-end: var(--space-md);
}

/* Center the guestbook section header (title + intro) so it matches every other
   section's centered header. The form + wall below keep their own alignment. */
#guestbook > .u-container > h2,
#guestbook > .u-container > .wf-help {
  text-align: center;
}

.wf-wishwall {
  list-style: none;
  margin: 0;
  /* Inner padding so cards (and their focus rings / wax seals) aren't clipped
     by the scroll edge; extra inline-end room for the scrollbar gutter. */
  padding: var(--space-2xs) var(--space-sm) var(--space-2xs) var(--space-2xs);
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-md);
  /* Cap the wall so a growing pile of wishes scrolls in place instead of
     elongating the whole page (~a few cards tall). Keyboard-scrollable. */
  max-height: clamp(22rem, 48vh, 32rem);
  overflow-y: auto;
  /* Soft, on-brand scrollbar. */
  scrollbar-width: thin;
  scrollbar-color: var(--c-clay) transparent;
  /* Faint top/bottom fade so it reads as a scroll region. */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 var(--space-md), #000 calc(100% - var(--space-md)), transparent 100%);
          mask-image: linear-gradient(to bottom, transparent 0, #000 var(--space-md), #000 calc(100% - var(--space-md)), transparent 100%);
}
.wf-wishwall::-webkit-scrollbar { width: 0.5rem; }
.wf-wishwall::-webkit-scrollbar-thumb {
  background: var(--c-clay);
  border-radius: var(--radius-md);
}
.wf-wishwall::-webkit-scrollbar-track { background: transparent; }
/* Visible focus ring when the scroll region is keyboard-focused. */
.wf-wishwall:focus-visible {
  outline: 2px solid var(--c-focus);
  outline-offset: 2px;
}
@media (min-width: 36rem) {
  .wf-wishwall { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 56rem) {
  /* Inside the wider right column, keep wish cards single-column for readability. */
  .wf-guestbook__wall .wf-wishwall { grid-template-columns: 1fr; }
}

/* A single wish card — soft parchment note with a wax seal in the corner. */
.wf-wish {
  position: relative;
  background: var(--c-parchment-deep);
  border: 1px solid var(--c-parchment-line);
  border-radius: var(--radius-lg);
  padding: var(--space-lg) var(--space-md) var(--space-md);
  box-shadow: var(--shadow-soft);
}

/* The wax-seal badge on a card. */
.wf-wish__seal {
  position: absolute;
  top: calc(-1 * var(--space-xs));
  inset-inline-end: var(--space-md);
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: radial-gradient(
    circle at 35% 30%,
    color-mix(in srgb, var(--seal, var(--c-clay)) 70%, #fff) 0%,
    var(--seal, var(--c-clay)) 60%,
    color-mix(in srgb, var(--seal, var(--c-clay)) 70%, #000) 100%
  );
  box-shadow: var(--shadow-soft);
}

.wf-wish__msg {
  font-family: var(--font-body);
  font-size: var(--step-0);
  color: var(--c-sepia);
  margin: 0 0 var(--space-sm);
}
.wf-wish__name {
  font-family: var(--font-serif);
  font-size: var(--step--1);
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--c-sepia-soft);
  margin: 0;
}

/* The guest's OWN just-posted wish — a subtle highlight so they can find it. */
.wf-wish--mine {
  border-color: var(--c-terracotta);
  background: color-mix(in srgb, var(--c-terracotta) 6%, var(--c-parchment-deep));
}

@media (prefers-reduced-motion: no-preference) {
  .wf-wish--mine { animation: wf-wish-in 0.4s ease both; }
}
@keyframes wf-wish-in {
  from { opacity: 0; transform: translateY(-0.5rem); }
  to   { opacity: 1; transform: none; }
}
