/* ==========================================================
   BASE — design tokens, typography, buttons, shared effects
   ========================================================== */

:root {
  /* Palette (romantic vintage) */
  --cream: #fff8ed;
  --paper: #f8ead0;
  --paper-deep: #efd9b4;
  --blush: #f6d6d8;
  --rose: #c9828b;
  --rose-deep: #a9566a;
  --burgundy: #6e2638;
  --burgundy-deep: #4a1626;
  --night: #24101f;
  --brown: #6b4a3a;
  --gold: #d4af6a;
  --gold-soft: #ebd196;
  --ink: #2d2222;
  --ink-soft: #5b4545;

  /* Type */
  --font-script: "Great Vibes", "Snell Roundhand", "Apple Chancery", "Brush Script MT", cursive;
  --font-serif: "Cormorant Garamond", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --font-hand: "Caveat", "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive;

  /* Motion */
  --ease: cubic-bezier(0.22, 0.8, 0.24, 1);
  --ease-soft: cubic-bezier(0.4, 0, 0.2, 1);

  /* Layout */
  --page-pad: clamp(1.1rem, 5vw, 3rem);
  --max: 1180px;

  /* Paper grain (inline SVG noise — no image file needed) */
  --grain: url("data:image/svg+xml;utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .42 0 0 0 0 .29 0 0 0 0 .23 0 0 0 .5 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: clip;
}

html.modal-open {
  overflow: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: clip;
  background: var(--cream);
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: clamp(1.15rem, 1.05rem + 0.35vw, 1.3rem);
  line-height: 1.6;
  font-weight: 500;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Fixed paper grain + soft vignette over the whole experience */
body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 900;
}
body::before {
  background-image: var(--grain);
  opacity: 0.22;
}
body::after {
  background: radial-gradient(ellipse at 50% 45%, transparent 58%, rgba(74, 22, 38, 0.13) 100%);
}

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

h1, h2, h3, h4, p, figure, ol, ul {
  margin: 0;
  padding: 0;
}
ol, ul { list-style: none; }

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

a { color: inherit; }

.sr-only {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* Visible keyboard focus everywhere */
:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ---------- Headings ---------- */
.section-head {
  text-align: center;
  max-width: 44rem;
  margin: 0 auto;
}
.section-title {
  font-family: var(--font-script);
  font-weight: 400;
  font-size: clamp(3.1rem, 9vw, 5.6rem);
  line-height: 1.05;
  color: var(--burgundy);
  letter-spacing: 0.005em;
}
.section-sub {
  margin-top: 0.6rem;
  font-style: italic;
  font-size: clamp(1.25rem, 1.1rem + 0.7vw, 1.65rem);
  color: var(--ink-soft);
}

/* Little ornament divider: line — flower — line */
.ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
  color: var(--gold);
  margin: 1.4rem auto;
  width: min(280px, 70%);
}
.ornament::before,
.ornament::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, currentColor);
}
.ornament::after {
  background: linear-gradient(270deg, transparent, currentColor);
}
.ornament .ic {
  width: 22px;
  height: 22px;
  flex: none;
}

/* ---------- Inline SVG icons (see js/icons.js) ---------- */
.ic {
  display: inline-block;
  width: 1em;
  height: 1em;
  fill: currentColor;
  overflow: visible;
}
.ic .ic-core { fill: var(--core, var(--gold)); }
[data-icon] > .ic,
.page__flower > .ic,
.book__icon > .ic,
.bloom .head > .ic { width: 100%; height: 100%; }

/* ---------- Buttons ---------- */
.btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55em;
  min-height: 52px;
  padding: 0.75rem 2.1rem;
  border: 1px solid var(--gold);
  border-radius: 999px;
  background: linear-gradient(180deg, #843349 0%, var(--burgundy) 60%, var(--burgundy-deep) 100%);
  color: var(--cream);
  font-family: var(--font-serif);
  font-weight: 600;
  font-size: 1.18rem;
  letter-spacing: 0.03em;
  line-height: 1.1;
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 12px 26px -12px rgba(74, 22, 38, 0.75),
    0 2px 4px rgba(74, 22, 38, 0.25);
  transition: transform 0.35s var(--ease), box-shadow 0.35s var(--ease), filter 0.35s;
}
.btn:hover {
  transform: translateY(-2px);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    0 18px 34px -12px rgba(74, 22, 38, 0.8),
    0 0 0 4px rgba(212, 175, 106, 0.22);
}
.btn:active { transform: translateY(0) scale(0.98); }
.btn[disabled] { opacity: 0.6; cursor: default; transform: none; }

.btn--ghost {
  background: rgba(255, 248, 237, 0.5);
  color: var(--burgundy);
  border-color: rgba(110, 38, 56, 0.45);
  box-shadow: 0 8px 20px -14px rgba(74, 22, 38, 0.6);
}
.btn--ghost:hover {
  background: rgba(255, 248, 237, 0.85);
  box-shadow: 0 14px 28px -14px rgba(74, 22, 38, 0.6), 0 0 0 4px rgba(201, 130, 139, 0.2);
}

.btn--gold {
  background: linear-gradient(180deg, #f0d9a1 0%, var(--gold) 55%, #b98f47 100%);
  color: var(--burgundy-deep);
  border-color: rgba(255, 240, 200, 0.7);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.5),
    0 12px 28px -12px rgba(0, 0, 0, 0.6);
}
.btn--gold:hover {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.55),
    0 18px 34px -12px rgba(0, 0, 0, 0.6),
    0 0 0 4px rgba(235, 209, 150, 0.28);
}

.btn--small {
  min-height: 44px;
  padding: 0.55rem 1.5rem;
  font-size: 1.05rem;
}

/* ripple */
.ripple {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transform: scale(0);
  animation: ripple 0.75s ease-out forwards;
  pointer-events: none;
}
@keyframes ripple {
  to { transform: scale(1); opacity: 0; }
}

/* ---------- Scroll reveal (only when JS is on) ---------- */
.js .reveal {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 1.1s var(--ease), transform 1.1s var(--ease);
  transition-delay: var(--d, 0s);
}
.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

/* ---------- Click / trail effects (created by js/effects.js) ---------- */
.fx-heart,
.fx-petal,
.fx-spark {
  position: fixed;
  left: 0;
  top: 0;
  pointer-events: none;
  z-index: 10000;
  will-change: transform, opacity;
}
.fx-heart {
  line-height: 1;
  font-family: "Segoe UI Symbol", "Apple Symbols", "DejaVu Sans", sans-serif;
}
.fx-petal {
  width: 12px;
  height: 16px;
  border-radius: 100% 0 100% 0;
  opacity: 0.9;
}
.fx-spark {
  width: 14px;
  height: 14px;
  background: var(--gold-soft);
  clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
}

.fx-float {
  position: fixed;
  bottom: -40px;
  pointer-events: none;
  z-index: 9000;
  line-height: 1;
  will-change: transform, opacity;
}

.fx-confetti {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  pointer-events: none;
  z-index: 9500;
}

/* bloom flowers (gate) */
.bloom {
  position: fixed;
  bottom: -6px;
  pointer-events: none;
  z-index: 8;
  transform-origin: 50% 100%;
  color: var(--rose);
}
.bloom .stem {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 2px;
  background: linear-gradient(to top, #5f7a58, #8aa17f);
  transform: translateX(-50%) scaleY(0);
  transform-origin: bottom;
  animation: stem-grow 1.5s var(--ease) forwards;
  animation-delay: var(--delay, 0s);
}
.bloom .head {
  position: absolute;
  left: 50%;
  transform: translate(-50%, 50%) scale(0) rotate(-40deg);
  animation: bloom-open 1.4s var(--ease) forwards;
  animation-delay: calc(var(--delay, 0s) + 0.9s);
}
@keyframes stem-grow {
  to { transform: translateX(-50%) scaleY(1); }
}
@keyframes bloom-open {
  60% { transform: translate(-50%, 50%) scale(1.12) rotate(6deg); }
  to  { transform: translate(-50%, 50%) scale(1) rotate(0deg); }
}

/* ---------- Toast (tiny handwritten note) ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: max(1.4rem, env(safe-area-inset-bottom));
  z-index: 11000;
  max-width: min(92vw, 30rem);
  padding: 0.85rem 1.4rem 0.9rem;
  background: var(--cream);
  background-image: var(--grain);
  color: var(--burgundy);
  font-family: var(--font-hand);
  font-size: 1.45rem;
  line-height: 1.25;
  text-align: center;
  border-radius: 4px 12px 5px 10px;
  border: 1px solid rgba(212, 175, 106, 0.7);
  box-shadow: 0 16px 34px -12px rgba(45, 12, 22, 0.6), 0 2px 4px rgba(45, 12, 22, 0.2);
  transform: translate(-50%, 30px) rotate(-1deg);
  opacity: 0;
  transition: opacity 0.5s var(--ease), transform 0.6s var(--ease);
  pointer-events: none;
}
.toast.is-on {
  opacity: 1;
  transform: translate(-50%, 0) rotate(-1deg);
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0s !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0s !important;
    scroll-behavior: auto !important;
  }
  .js .reveal { opacity: 1; transform: none; }
}

/* ---------- Ambient particle canvases ---------- */
.ambient {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.ambient--fixed {
  position: fixed;
  z-index: 1;
}

[hidden] { display: none !important; }
