/* ==========================================================================
   Design system - "The Gift Ledger"
   --------------------------------------------------------------------------
   One warm paper ground, a green-cast charcoal for type, deep evergreen as
   the single action colour, cranberry reserved for urgency/destructive, and
   a small brass note for "already bought". Availability is the loudest
   signal in the whole interface, so its colours are defined here as
   first-class tokens rather than ad-hoc badge styles.
   ========================================================================== */

/* --- Self-hosted type ---------------------------------------------------- */
@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces-latin.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Fraunces";
  src: url("../fonts/fraunces-latin-ext.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Inter";
  src: url("../fonts/inter-latin-ext.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  /* --- Surfaces -------------------------------------------------------- */
  --paper: #faf7f2;
  --paper-raised: #fffdfa;
  --paper-sunken: #f2ede4;
  --paper-tint: #eef1ec; /* neutral tile behind product photography */

  /* --- Ink ------------------------------------------------------------- */
  --ink: #1f2421;
  --ink-soft: #5b635d;
  --ink-faint: #8b9289;
  --ink-inverse: #f6f3ec;

  /* --- Accents --------------------------------------------------------- */
  --evergreen: #1f4d3a;
  --evergreen-bright: #2d6a4f;
  --evergreen-wash: #e8efe9;
  --evergreen-deep: #16352a;

  --cranberry: #8c2f39;
  --cranberry-bright: #a6414b;
  --cranberry-wash: #f6e9e8;

  --brass: #9a7637;
  --brass-wash: #f5eeda;

  /* --- Lines ----------------------------------------------------------- */
  --line: #e4ddd1;
  --line-strong: #d3cabb;
  --line-dark: rgba(246, 243, 236, 0.14);

  /* --- Availability (the core semantic set) ---------------------------- */
  --status-open: var(--evergreen-bright);
  --status-open-wash: var(--evergreen-wash);
  --status-partial: #9a7637;
  --status-partial-wash: var(--brass-wash);
  --status-claimed: var(--cranberry);
  --status-claimed-wash: var(--cranberry-wash);
  --status-bought: #4a5a50;
  --status-bought-wash: #e9ece9;

  /* --- Feedback -------------------------------------------------------- */
  --success: #2d6a4f;
  --warning: #9a7637;
  --danger: #8c2f39;
  --info: #37556b;

  /* --- Type ------------------------------------------------------------ */
  --font-display: "Fraunces", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --font-ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;

  --fs-xs: 0.8rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-md: 1.0625rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.5rem;
  --fs-2xl: 1.875rem;
  --fs-3xl: 2.375rem;
  --fs-4xl: 3rem;
  --fs-5xl: 3.75rem;

  --lh-tight: 1.1;
  --lh-snug: 1.3;
  --lh-normal: 1.55;
  --lh-relaxed: 1.7;

  /* --- Space (4px base) ------------------------------------------------ */
  --sp-1: 0.25rem;
  --sp-2: 0.5rem;
  --sp-3: 0.75rem;
  --sp-4: 1rem;
  --sp-5: 1.25rem;
  --sp-6: 1.5rem;
  --sp-8: 2rem;
  --sp-10: 2.5rem;
  --sp-12: 3rem;
  --sp-16: 4rem;
  --sp-20: 5rem;
  --sp-24: 6rem;

  /* --- Radii: deliberately different per hierarchy level --------------- */
  --r-xs: 4px;
  --r-sm: 7px;
  --r-md: 11px;
  --r-lg: 18px;
  --r-xl: 26px;
  --r-pill: 999px;

  /* --- Shadows: warm-tinted, never neutral grey ------------------------ */
  --sh-hair: 0 1px 2px rgba(47, 38, 26, 0.05);
  --sh-1: 0 1px 2px rgba(47, 38, 26, 0.04), 0 2px 8px rgba(47, 38, 26, 0.05);
  --sh-2: 0 2px 4px rgba(47, 38, 26, 0.05), 0 12px 28px rgba(47, 38, 26, 0.09);
  --sh-3: 0 8px 20px rgba(31, 36, 33, 0.14), 0 32px 64px rgba(31, 36, 33, 0.18);
  --sh-inset: inset 0 1px 0 rgba(255, 255, 255, 0.6);

  /* --- Motion ---------------------------------------------------------- */
  --ease-out: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ease-spring: cubic-bezier(0.34, 1.26, 0.64, 1);
  --dur-fast: 120ms;
  --dur-base: 200ms;
  --dur-slow: 420ms;

  /* --- Layout ---------------------------------------------------------- */
  --container: 76rem;
  --container-narrow: 46rem;
  --measure: 66ch;
  --sidebar-w: 15rem;
  --header-h: 3.75rem;

  --z-sticky: 40;
  --z-header: 50;
  --z-modal: 100;
  --z-toast: 120;
}

/* Accent themes selected per wishlist in the admin settings. */
[data-theme="evergreen"] {
  --cranberry: #2d6a4f;
  --cranberry-bright: #3b8364;
  --cranberry-wash: var(--evergreen-wash);
  --status-claimed: #3b6b55;
  --status-claimed-wash: var(--evergreen-wash);
}
[data-theme="cranberry"] {
  --evergreen: #7a2730;
  --evergreen-bright: #8c2f39;
  --evergreen-wash: #f6e9e8;
  --evergreen-deep: #5e1d25;
  --status-open: #8c2f39;
  --status-open-wash: #f6e9e8;
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: var(--fs-base);
  line-height: var(--lh-normal);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100vh;
}

h1,
h2,
h3,
h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: var(--lh-tight);
  letter-spacing: -0.015em;
  margin: 0;
  color: var(--ink);
}

h1 {
  font-size: clamp(var(--fs-3xl), 5vw, var(--fs-4xl));
  font-variation-settings: "opsz" 96, "SOFT" 20;
}
h2 {
  font-size: var(--fs-2xl);
  font-variation-settings: "opsz" 48;
}
h3 {
  font-size: var(--fs-lg);
  font-variation-settings: "opsz" 24;
  letter-spacing: -0.008em;
}
h4 {
  font-size: var(--fs-md);
  font-variation-settings: "opsz" 18;
  letter-spacing: 0;
}

p {
  margin: 0;
  max-width: var(--measure);
}

a {
  color: var(--evergreen);
  text-decoration-color: color-mix(in srgb, var(--evergreen) 35%, transparent);
  text-underline-offset: 0.18em;
  transition: color var(--dur-fast) var(--ease-out);
}
a:hover {
  color: var(--evergreen-bright);
  text-decoration-color: currentColor;
}

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

ul,
ol {
  margin: 0;
  padding: 0;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: var(--sp-8) 0;
}

fieldset {
  border: 0;
  margin: 0;
  padding: 0;
}

/* Visible, generous focus ring everywhere. */
:focus-visible {
  outline: 2px solid var(--evergreen-bright);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

::selection {
  background: var(--evergreen-wash);
  color: var(--evergreen-deep);
}

/* ==========================================================================
   Layout utilities
   ========================================================================== */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--sp-5);
}
.container--narrow {
  max-width: var(--container-narrow);
}

.stack > * + * {
  margin-top: var(--flow, var(--sp-4));
}
.stack-2 > * + * {
  margin-top: var(--sp-2);
}
.stack-6 > * + * {
  margin-top: var(--sp-6);
}

.row {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.row--between {
  justify-content: space-between;
}
.row--wrap {
  flex-wrap: wrap;
}
.row--top {
  align-items: flex-start;
}

.grow {
  flex: 1 1 auto;
  min-width: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--sp-4);
  top: -3rem;
  z-index: var(--z-toast);
  background: var(--evergreen);
  color: var(--ink-inverse);
  padding: var(--sp-2) var(--sp-4);
  border-radius: var(--r-sm);
  text-decoration: none;
  transition: top var(--dur-base) var(--ease-out);
}
.skip-link:focus {
  top: var(--sp-4);
  color: var(--ink-inverse);
}

/* ==========================================================================
   Typographic helpers
   ========================================================================== */
.display {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: var(--lh-tight);
}
.lede {
  font-size: var(--fs-md);
  color: var(--ink-soft);
  line-height: var(--lh-relaxed);
  max-width: 54ch;
}
.meta {
  font-size: var(--fs-sm);
  color: var(--ink-soft);
}
.meta-tight {
  font-size: var(--fs-xs);
  color: var(--ink-faint);
}
.numeral {
  font-family: var(--font-display);
  font-variant-numeric: tabular-nums;
  font-variation-settings: "opsz" 36;
  letter-spacing: -0.01em;
}
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.clamp-2 {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.clamp-3 {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.text-soft {
  color: var(--ink-soft);
}
.text-danger {
  color: var(--danger);
}
.text-success {
  color: var(--success);
}

/* ==========================================================================
   Icons
   ========================================================================== */
.icon {
  width: 1.125em;
  height: 1.125em;
  flex: none;
  stroke: currentColor;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  vertical-align: -0.18em;
}
.icon--sm {
  width: 0.9375em;
  height: 0.9375em;
}
.icon--lg {
  width: 1.5em;
  height: 1.5em;
}

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

/* The visitor-facing "reduce motion" switch sets this on <html>. */
[data-motion="off"] *,
[data-motion="off"] *::before,
[data-motion="off"] *::after {
  animation-duration: 0.001ms !important;
  animation-iteration-count: 1 !important;
  transition-duration: 0.001ms !important;
}

@media print {
  .no-print {
    display: none !important;
  }
  body {
    background: #fff;
  }
}
