:root {
  color-scheme: light;
  --paper: #f8f4eb;
  --paper-deep: #efe7d8;
  --ivory: #fffdf8;
  --mist: #e8edf0;
  --ink: #2d2a25;
  --muted: #7c7468;
  --faint: #a79d8e;
  --champagne: #b99552;
  --champagne-soft: rgba(185, 149, 82, 0.18);
  --rose: #f4ded8;
  --blue: #dfeaf0;
  --sage: #e5ecdf;
  --butter: #f7e7a9;
  --line: rgba(91, 77, 54, 0.16);
  --line-strong: rgba(91, 77, 54, 0.26);
  --glass: rgba(255, 255, 255, 0.72);
  --shadow: 0 28px 80px rgba(91, 77, 54, 0.16);
  --shadow-soft: 0 14px 38px rgba(91, 77, 54, 0.12);
  --radius: 12px;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --serif: Georgia, "Times New Roman", serif;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  background:
    radial-gradient(circle at 85% 5%, rgba(185, 149, 82, 0.16), transparent 24rem),
    radial-gradient(circle at 12% 22%, rgba(210, 225, 231, 0.8), transparent 30rem),
    linear-gradient(135deg, #fbf7ee 0%, #f7efe2 46%, #eef3f2 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    linear-gradient(90deg, rgba(91,77,54,.055) 1px, transparent 1px),
    linear-gradient(rgba(91,77,54,.045) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(to bottom, black, transparent 78%);
}

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

button,
a {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
  text-decoration: none;
}

.grain {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 10;
  opacity: 0.18;
  background-image: radial-gradient(rgba(91, 77, 54, 0.16) 0.7px, transparent 0.7px);
  background-size: 7px 7px;
  mix-blend-mode: multiply;
}

.topbar {
  position: fixed;
  z-index: 20;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px clamp(20px, 4vw, 64px);
  color: rgba(45, 42, 37, 0.84);
  background: rgba(248, 244, 235, 0.74);
  border-bottom: 1px solid rgba(91, 77, 54, 0.08);
  backdrop-filter: blur(22px);
}

.brand {
  font-family: var(--serif);
  letter-spacing: 0.03em;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 18px;
  font-size: 13px;
}

.ghost-button,
.secondary-button,
.primary-button,
.icon-button {
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--ink);
  cursor: pointer;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}

.ghost-button,
.secondary-button,
.icon-button {
  background: rgba(255, 255, 255, 0.56);
}

.ghost-button {
  padding: 9px 15px;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0 22px;
}

.primary-button {
  border-color: rgba(185, 149, 82, 0.58);
  background: linear-gradient(135deg, #d6b56e, #f1dfad 45%, #a67b35);
  color: #2c2417;
  box-shadow: 0 14px 34px rgba(166, 123, 53, 0.18);
}

.secondary-button {
  background: rgba(255, 255, 255, 0.64);
}

.primary-button:hover,
.secondary-button:hover,
.ghost-button:hover,
.icon-button:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-soft);
}

.full {
  width: 100%;
}

.hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(440px, 0.88fr) minmax(360px, 1fr);
  gap: clamp(32px, 6vw, 90px);
  min-height: 100vh;
  padding: 118px clamp(20px, 6vw, 92px) 68px;
  align-items: center;
  overflow: hidden;
}

.date-line,
.section-heading p,
.dialog-head p,
.processing-card p,
.empty-state p {
  margin: 0 0 18px;
  color: var(--champagne);
  font-size: 12px;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 780px;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(62px, 8.2vw, 118px);
  font-weight: 400;
  line-height: 0.9;
  color: #2f2a22;
}

.hero h1 span {
  white-space: nowrap;
}

.hero-poem {
  max-width: 460px;
  margin: 28px 0 0;
  color: var(--muted);
  font-family: var(--serif);
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1.22;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 34px;
}

.hero-stage {
  position: relative;
  min-height: 560px;
  perspective: 1100px;
}

.film-reel {
  position: absolute;
  inset: 5% 4% 2% 8%;
  transform-style: preserve-3d;
  transform: rotateX(58deg) rotateZ(-11deg);
}

.film-reel::before {
  content: "";
  position: absolute;
  inset: -30px 12%;
  border-left: 1px solid rgba(185, 149, 82, 0.22);
  border-right: 1px solid rgba(185, 149, 82, 0.18);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.6), transparent);
  transform: translateZ(-80px);
}

.preview-frame {
  position: absolute;
  width: min(430px, 92%);
  min-height: 260px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 24px;
  border: 1px solid rgba(185, 149, 82, 0.24);
  border-radius: 14px;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.92), rgba(255,255,255,0.5)),
    radial-gradient(circle at 28% 22%, rgba(185,149,82,.16), transparent 12rem);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  transition: transform .35s ease, box-shadow .35s ease;
}

.preview-frame:hover {
  transform: translateY(-12px) translateZ(32px) rotateZ(1deg);
  box-shadow: 0 40px 110px rgba(91, 77, 54, 0.22);
}

.preview-frame strong {
  display: block;
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 400;
}

.preview-frame p {
  max-width: 310px;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.frame-index {
  color: var(--champagne);
  font-size: 12px;
  letter-spacing: 0.18em;
}

.frame-one {
  top: 32px;
  left: 4%;
}

.frame-two {
  right: 2%;
  bottom: 50px;
}

.specimen {
  position: absolute;
  display: grid;
  place-items: center;
  width: 104px;
  height: 104px;
  border: 1px solid rgba(185, 149, 82, 0.32);
  border-radius: 50%;
  color: rgba(45, 42, 37, 0.72);
  font-family: var(--serif);
  font-size: 15px;
  background: rgba(255, 255, 255, 0.6);
  box-shadow: var(--shadow-soft);
  animation: drift 7s ease-in-out infinite;
}

.specimen span {
  position: absolute;
  inset: 25px;
  border-radius: 38% 48% 42% 50%;
  border: 1px solid rgba(185, 149, 82, 0.36);
  transform: rotate(18deg);
}

.cup {
  right: 3%;
  top: 100px;
}

.badge {
  left: 0;
  top: 48%;
  animation-delay: -2s;
}

.note {
  right: 19%;
  bottom: 42px;
  animation-delay: -4s;
}

.film-section,
.wish-section {
  padding: 92px clamp(20px, 6vw, 92px) 112px;
}

.section-heading {
  max-width: 800px;
  margin-bottom: 52px;
}

.section-heading h2 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(42px, 6vw, 86px);
  font-weight: 400;
  line-height: 1;
  color: #302b24;
}

.film-track {
  display: grid;
  gap: 42px;
}

.empty-state {
  display: grid;
  justify-items: start;
  gap: 18px;
  min-height: 300px;
  padding: clamp(28px, 6vw, 70px);
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    radial-gradient(circle at 20% 20%, rgba(185, 149, 82, 0.12), transparent 18rem),
    rgba(255, 255, 255, 0.62);
  box-shadow: var(--shadow-soft);
}

.empty-state h3 {
  max-width: 660px;
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(34px, 5vw, 66px);
  font-weight: 400;
  line-height: 1;
}

.memory-frame {
  position: relative;
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(300px, 1fr);
  gap: clamp(24px, 5vw, 72px);
  min-height: 440px;
  padding: clamp(18px, 3vw, 34px);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.64);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  transform: translateZ(0);
  transition: transform .28s ease, box-shadow .28s ease;
}

.memory-frame:hover {
  transform: translateY(-8px) rotate(-0.35deg);
  box-shadow: var(--shadow);
}

.memory-frame::before,
.memory-frame::after {
  content: "";
  position: absolute;
  top: 18px;
  bottom: 18px;
  width: 1px;
  background: repeating-linear-gradient(to bottom, rgba(185,149,82,.24), rgba(185,149,82,.24) 8px, transparent 8px, transparent 16px);
  opacity: .55;
}

.memory-frame::before {
  left: 14px;
}

.memory-frame::after {
  right: 14px;
}

.media-panel {
  position: relative;
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: var(--media-bg);
}

.media-panel img,
.media-panel video {
  width: 100%;
  height: 100%;
  min-height: 360px;
  object-fit: cover;
  display: block;
  filter: saturate(.92) contrast(1.02);
  transition: transform .5s ease;
}

.memory-frame:hover .media-panel img,
.memory-frame:hover .media-panel video {
  transform: scale(1.035);
}

.media-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: flex-end;
  padding: 26px;
  background:
    linear-gradient(180deg, transparent, rgba(255,255,255,.72)),
    var(--media-bg);
}

.media-placeholder span {
  max-width: 260px;
  color: rgba(45, 42, 37, 0.68);
  font-family: var(--serif);
  font-size: 27px;
  line-height: 1.15;
}

.memory-copy {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 22px 0;
  z-index: 1;
}

.memory-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 24px;
  color: var(--champagne);
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.memory-copy h3 {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(34px, 5vw, 68px);
  font-weight: 400;
  line-height: 0.98;
}

.memory-copy blockquote {
  margin: 28px 0 0;
  color: rgba(45, 42, 37, .78);
  font-family: var(--serif);
  font-size: clamp(20px, 2.4vw, 32px);
  line-height: 1.35;
}

.author-line {
  margin-top: 28px;
  color: var(--muted);
}

.cutout-specimen {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  width: fit-content;
  margin: 28px 0 0;
  padding: 10px 14px 10px 10px;
  border: 1px solid rgba(185, 149, 82, 0.24);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
}

.cutout-specimen img {
  width: 92px;
  height: 92px;
  object-fit: contain;
  filter: drop-shadow(0 18px 24px rgba(91,77,54,.2));
}

.cutout-specimen figcaption {
  color: rgba(45, 42, 37, .7);
  font-size: 13px;
}

.specimen-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 34px;
}

.memory-chip {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(185, 149, 82, 0.24);
  border-radius: 999px;
  color: rgba(45, 42, 37, .72);
  background: rgba(255,255,255,.56);
  font-size: 13px;
}

.memory-chip::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--champagne);
  box-shadow: 0 0 18px var(--champagne-soft);
}

.wish-section {
  position: relative;
  background: linear-gradient(180deg, transparent, rgba(255,255,255,.32));
}

.wish-wall {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 22px;
  align-items: start;
}

.wish-note {
  min-height: 210px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 22px;
  border: 1px solid rgba(91, 77, 54, 0.12);
  border-radius: 6px;
  box-shadow: 0 18px 34px rgba(91, 77, 54, 0.13);
  transform: rotate(var(--tilt));
  transition: transform .25s ease, box-shadow .25s ease;
}

.wish-note:hover {
  transform: rotate(0deg) translateY(-8px) scale(1.02);
  box-shadow: 0 28px 52px rgba(91, 77, 54, 0.18);
}

.wish-note p {
  margin: 0;
  font-family: var(--serif);
  font-size: 23px;
  line-height: 1.32;
}

.wish-note footer {
  display: grid;
  gap: 5px;
  margin-top: 28px;
  color: var(--muted);
  font-size: 13px;
}

.wish-note small {
  color: var(--champagne);
  letter-spacing: .08em;
  text-transform: uppercase;
}

.wish-note.cream { background: #fffaf0; }
.wish-note.butter { background: #f8e9a8; }
.wish-note.rose { background: #f4ddd8; }
.wish-note.blue { background: #dfeaf0; }
.wish-note.sage { background: #e5ecdf; }

.upload-dialog {
  width: min(640px, calc(100vw - 32px));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0;
  color: var(--ink);
  background: rgba(255, 253, 248, .96);
  box-shadow: var(--shadow);
}

.upload-dialog::backdrop {
  background: rgba(81, 72, 58, .28);
  backdrop-filter: blur(8px);
}

.upload-dialog form {
  display: grid;
  gap: 18px;
  padding: 28px;
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.dialog-head h2,
.processing-card h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: 34px;
}

.icon-button {
  width: 38px;
  height: 38px;
  font-size: 22px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

label span {
  color: var(--faint);
  font-size: 12px;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 13px 14px;
  color: var(--ink);
  background: rgba(255,255,255,.72);
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: rgba(185, 149, 82, .72);
  box-shadow: 0 0 0 4px rgba(185,149,82,.12);
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.processing {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(248, 244, 235, .72);
  backdrop-filter: blur(12px);
}

.processing[hidden] {
  display: none;
}

.processing-card {
  width: min(520px, 100%);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 32px;
  background: rgba(255, 253, 248, .92);
  box-shadow: var(--shadow);
}

.progress-rail {
  height: 3px;
  margin: 28px 0;
  overflow: hidden;
  background: rgba(91,77,54,.12);
}

.progress-rail span {
  display: block;
  width: 0%;
  height: 100%;
  background: var(--champagne);
  transition: width .45s ease;
}

.processing-card ol {
  display: grid;
  gap: 12px;
  margin: 0;
  padding-left: 18px;
  color: var(--faint);
}

.processing-card li.active {
  color: var(--ink);
}

.save-toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 45;
  max-width: min(380px, calc(100vw - 32px));
  border: 1px solid rgba(185, 149, 82, 0.28);
  border-radius: 999px;
  padding: 12px 16px;
  color: rgba(45, 42, 37, .86);
  background: rgba(255, 253, 248, .88);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(12px);
  font-size: 13px;
}

.save-toast[hidden] {
  display: none;
}

@keyframes drift {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50% { transform: translateY(-18px) rotate(4deg); }
}

@media (max-width: 920px) {
  .hero,
  .memory-frame {
    grid-template-columns: 1fr;
  }

  .hero-stage {
    min-height: 520px;
  }

  .film-reel {
    inset: 0 0 0 4%;
  }
}

@media (max-width: 720px) {
  .topbar {
    padding: 16px 18px;
  }

  .nav-actions {
    gap: 10px;
  }

  .nav-actions a {
    display: none;
  }

  .hero {
    padding: 104px 18px 58px;
  }

  .hero h1 {
    font-size: clamp(56px, 17vw, 86px);
  }

  .hero-stage {
    min-height: 430px;
  }

  .preview-frame {
    min-height: 220px;
  }

  .frame-one {
    left: 0;
  }

  .frame-two {
    bottom: 36px;
  }

  .specimen {
    width: 82px;
    height: 82px;
    font-size: 13px;
  }

  .film-section,
  .wish-section {
    padding: 68px 18px 86px;
  }

  .save-toast {
    right: 16px;
    bottom: 16px;
  }

  .memory-frame {
    min-height: 0;
    padding: 18px;
  }

  .media-panel,
  .media-panel img,
  .media-panel video {
    min-height: 280px;
  }

  .form-grid,
  .wish-wall {
    grid-template-columns: 1fr;
  }
}

@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;
  }
}
