/* ------------------------------------------------------------------
   Ethereal Romance design tokens
   ------------------------------------------------------------------ */
:root {
  --surface: #fdf9f5;
  --surface-container-lowest: #ffffff;
  --surface-container-low: #f7f3ef;
  --surface-container: #f1ede9;
  --surface-container-high: #ebe7e4;
  --on-surface: #1c1c19;
  --on-surface-variant: #594047;
  --outline: #8d6f77;
  --outline-variant: #e1bec6;
  --primary: #b7005e;
  --primary-container: #db2777;
  --primary-fixed: #ffd9e2;
  --primary-fixed-dim: #ffb1c7;
  --on-primary: #ffffff;
  --on-primary-fixed-variant: #8e0048;
  --secondary: #805521;
  --secondary-container: #fec485;
  --tertiary-container: #7f63cf;
  --inverse-surface: #31302e;

  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 36px;
  --margin: 20px;

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-pill: 9999px;

  --font-display: "Playfair Display", Georgia, serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;

  --header-h: 64px;
  --page-max: 430px;
}

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

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--surface);
  color: var(--on-surface);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 22px;
  min-height: 100dvh;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, p { margin: 0; }

button {
  font: inherit;
  color: inherit;
  border: 0;
  background: none;
  cursor: pointer;
}

img { display: block; }

.material-symbols-outlined {
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
  line-height: 1;
  user-select: none;
}
.icon-fill { font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24; }

/* Type scale */
.eyebrow {
  display: block;
  font-size: 11px;
  line-height: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--outline);
}
.section-title {
  font-family: var(--font-display);
  font-size: 20px;
  line-height: 28px;
  font-weight: 600;
  color: var(--on-surface);
}

/* ------------------------------------------------------------------
   Header
   ------------------------------------------------------------------ */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  padding-top: env(safe-area-inset-top, 0px);
  background: rgba(253, 249, 245, 0.75);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  box-shadow: 0 1px 12px rgba(219, 39, 119, 0.06);
}
.app-header__inner {
  height: var(--header-h);
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 var(--margin);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.app-header__brand {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-width: 0;
}
.app-header__heart {
  color: var(--primary-container);
  font-size: 26px;
}
.app-header__title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 20px;
  line-height: 28px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--primary);
}
.app-header__dot {
  color: var(--outline-variant);
  font-size: 13px;
  margin: 0 var(--space-xs);
}
.app-header__subtitle {
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  color: var(--on-surface-variant);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 140px;
}

/* ------------------------------------------------------------------
   Page layout
   ------------------------------------------------------------------ */
.page {
  position: relative;
  width: 100%;
  min-height: 100dvh;
  padding-top: calc(var(--header-h) + env(safe-area-inset-top, 0px));
  padding-bottom: calc(var(--space-xl) + env(safe-area-inset-bottom, 0px));
  overflow-x: hidden;
}
.ambient-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  opacity: 0.4;
  pointer-events: none;
}
.content {
  position: relative;
  z-index: 1;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: var(--space-md) var(--margin) var(--space-xl);
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

/* ------------------------------------------------------------------
   Cards
   ------------------------------------------------------------------ */
.card {
  position: relative;
  width: 100%;
  border-radius: var(--radius-md);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

/* ------------------------------------------------------------------
   Hero
   ------------------------------------------------------------------ */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px var(--space-md);
  border-radius: var(--radius-pill);
  background: rgba(255, 217, 226, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--on-primary-fixed-variant);
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  letter-spacing: 0.06em;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  margin-bottom: var(--space-md);
}
.badge .material-symbols-outlined { font-size: 15px; }

.card--hero {
  background: rgba(255, 255, 255, 0.8);
  padding: var(--space-lg);
  box-shadow: 0 20px 25px -5px rgba(219, 39, 119, 0.1), 0 8px 10px -6px rgba(219, 39, 119, 0.1);
  overflow: hidden;
}
.card--hero__glow {
  position: absolute;
  top: -40px;
  left: 50%;
  transform: translateX(-50%);
  width: 176px;
  height: 176px;
  border-radius: 50%;
  background: rgba(255, 177, 199, 0.3);
  filter: blur(48px);
  pointer-events: none;
}
.card--hero__body {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.hero__media {
  width: 100%;
  aspect-ratio: 4 / 5;
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-bottom: var(--space-md);
  box-shadow: 0 8px 24px rgba(219, 39, 119, 0.12);
}
.hero__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 55%;
}
.hero__salutation {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 36px;
  line-height: 44px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--primary);
  margin-bottom: var(--space-xs);
}
.hero__intro {
  max-width: 320px;
  margin-top: var(--space-xs);
  color: var(--on-surface-variant);
  line-height: 1.625;
}
.hero__hint {
  margin-top: var(--space-md);
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  color: var(--secondary);
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  letter-spacing: 0.06em;
}
.hero__hint .material-symbols-outlined { font-size: 18px; }

/* ------------------------------------------------------------------
   Chapters carousel
   ------------------------------------------------------------------ */
.chapters {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
}
.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
}
.section-cue {
  flex-shrink: 0;
  padding-top: 18px;
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  letter-spacing: 0.06em;
  color: var(--primary);
}

.carousel {
  display: flex;
  gap: var(--space-md);
  margin: 0 calc(-1 * var(--margin));
  padding: 0 var(--margin) var(--space-sm);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-behavior: smooth;
  scroll-padding: 0 var(--margin);
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.carousel::-webkit-scrollbar { display: none; }

.chapter {
  flex-shrink: 0;
  width: min(84vw, calc(var(--page-max) - 2 * var(--margin) - 24px));
  scroll-snap-align: center;
  border-radius: var(--radius-md);
  background: rgba(247, 243, 239, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.chapter__media {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
}
.chapter__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 45%;
}
.chapter__fade {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, var(--surface-container-low) 0%, rgba(247, 243, 239, 0.2) 50%, transparent 100%);
}
.chip {
  position: absolute;
  top: var(--space-sm);
  left: var(--space-sm);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: var(--primary);
  font-size: 11px;
  line-height: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}
.chapter__body {
  padding: var(--space-md);
  display: flex;
  flex-direction: column;
  flex: 1;
}
.chapter__title {
  font-family: var(--font-display);
  font-size: 20px;
  line-height: 28px;
  font-weight: 600;
  margin-bottom: var(--space-xs);
}
.chapter__text {
  font-size: 13px;
  line-height: 1.625;
  color: var(--on-surface-variant);
}

/* ------------------------------------------------------------------
   Personal notes
   ------------------------------------------------------------------ */
.card--notes {
  background: rgba(241, 237, 233, 0.7);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: var(--space-lg);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.card--notes .eyebrow { margin-bottom: var(--space-xs); }
.card--notes .section-title { margin-bottom: var(--space-xs); }
.notes__lead {
  max-width: 320px;
  margin-bottom: var(--space-md);
  font-size: 13px;
  line-height: 18px;
  color: var(--on-surface-variant);
}
.notes__grid {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
  text-align: left;
}
.note {
  padding: 0;
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
  display: flex;
  flex-direction: column;
  text-align: left;
  overflow: hidden;
  transition: transform 150ms ease;
}
.note__media {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
}
.note__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 40%;
}
.note__body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: var(--space-sm);
  min-height: 54px;
}
.note:active { transform: scale(0.95); }
.note__label {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--primary);
  font-size: 11px;
  line-height: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
}
.note__label .material-symbols-outlined { font-size: 16px; }
.note__name {
  font-size: 13px;
  line-height: 18px;
  color: var(--on-surface-variant);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.note__reveal {
  font-size: 13px;
  line-height: 1.3;
  font-weight: 500;
  color: var(--primary);
}

/* ------------------------------------------------------------------
   Proposal
   ------------------------------------------------------------------ */
.proposal {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-top: var(--space-sm);
}
.proposal__aura {
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: 50%;
  background: rgba(255, 177, 199, 0.25);
  filter: blur(48px);
  pointer-events: none;
}
.card--proposal {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(40px);
  -webkit-backdrop-filter: blur(40px);
  padding: var(--space-lg);
  box-shadow: 0 25px 50px -12px rgba(219, 39, 119, 0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
}
.proposal__heart {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--primary-fixed);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-md);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -2px rgba(0, 0, 0, 0.1);
  animation: heart-bounce 1s infinite;
}
.proposal__heart .material-symbols-outlined { font-size: 36px; }
.proposal__eyebrow {
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--secondary);
  margin-bottom: var(--space-xs);
}
.proposal__question {
  font-family: var(--font-display);
  font-size: 36px;
  line-height: 1.25;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--on-surface);
  margin-bottom: var(--space-md);
}
.proposal__text {
  max-width: 320px;
  color: var(--on-surface-variant);
  line-height: 1.625;
  margin-bottom: var(--space-xl);
}
.proposal__actions {
  position: relative;
  width: 100%;
  min-height: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
}
.btn-yes {
  width: 100%;
  padding: 16px var(--space-lg);
  border-radius: var(--radius-pill);
  background: linear-gradient(to right, var(--primary), var(--primary-container));
  color: var(--on-primary);
  font-size: 14px;
  line-height: 20px;
  font-weight: 700;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 10px 15px -3px rgba(219, 39, 119, 0.3), 0 4px 6px -4px rgba(219, 39, 119, 0.3);
  transition: transform 300ms ease, box-shadow 300ms ease;
  animation: heart-pulse 2.4s ease-in-out infinite;
}
.btn-yes .material-symbols-outlined { font-size: 20px; }
.btn-yes:active { transform: scale(0.95) !important; }
.btn-yes:disabled { cursor: default; animation: none; }
.btn-maybe {
  padding: 10px var(--space-lg);
  border-radius: var(--radius-pill);
  background: rgba(235, 231, 228, 0.8);
  color: var(--on-surface-variant);
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  letter-spacing: 0.06em;
  transition: transform 200ms ease, background 200ms ease;
}

/* ------------------------------------------------------------------
   Celebration modal
   ------------------------------------------------------------------ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--margin);
  background: rgba(49, 48, 46, 0.6);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  opacity: 0;
  transition: opacity 500ms ease;
}
.modal[hidden] { display: none; }
.modal.is-open { opacity: 1; }
.modal__card {
  position: relative;
  width: 100%;
  max-width: 384px;
  border-radius: var(--radius-md);
  background: var(--surface-container-lowest);
  padding: var(--space-xl);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  transform: scale(0.9);
  transition: transform 500ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.modal.is-open .modal__card { transform: scale(1); }
.modal__badge {
  width: 80px;
  height: 80px;
  margin-top: -84px;
  margin-bottom: var(--space-md);
  border-radius: 50%;
  background: var(--primary-fixed);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 0 0 4px var(--surface-container-lowest);
}
.modal__badge .material-symbols-outlined { font-size: 42px; }
.modal__eyebrow {
  font-size: 11px;
  line-height: 14px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--secondary);
  margin-bottom: var(--space-xs);
}
.modal__title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 32px;
  line-height: 40px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--primary);
  margin-bottom: var(--space-sm);
}
.modal__text {
  line-height: 1.625;
  margin-bottom: var(--space-md);
}
.modal__quote {
  width: 100%;
  padding: var(--space-md);
  border-radius: var(--radius-sm);
  background: var(--surface-container-low);
  color: var(--on-surface-variant);
  font-size: 13px;
  line-height: 18px;
  font-style: italic;
  margin-bottom: var(--space-lg);
}
.btn-close {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-pill);
  background: var(--primary);
  color: var(--on-primary);
  font-size: 12px;
  line-height: 16px;
  font-weight: 600;
  letter-spacing: 0.06em;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  transition: transform 150ms ease;
}
.btn-close:active { transform: scale(0.95); }

.confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 70;
  pointer-events: none;
}
.confetti-canvas[hidden] { display: none; }

/* ------------------------------------------------------------------
   Animations
   ------------------------------------------------------------------ */
@keyframes heart-bounce {
  0%, 100% { transform: translateY(-25%); animation-timing-function: cubic-bezier(0.8, 0, 1, 1); }
  50% { transform: translateY(0); animation-timing-function: cubic-bezier(0, 0, 0.2, 1); }
}
@keyframes heart-pulse {
  0%, 100% { box-shadow: 0 10px 15px -3px rgba(219, 39, 119, 0.3), 0 0 0 0 rgba(219, 39, 119, 0.25); }
  50% { box-shadow: 0 10px 15px -3px rgba(219, 39, 119, 0.3), 0 0 28px 4px rgba(219, 39, 119, 0.18); }
}

@media (prefers-reduced-motion: reduce) {
  .proposal__heart, .btn-yes { animation: none; }
  .carousel { scroll-behavior: auto; }
  .modal, .modal__card, .btn-maybe, .btn-yes { transition: none; }
}
