:root {
  --ivory: #f4ece3;
  --paper: #fffaf4;
  --ink: #2a221e;
  --muted: #6e5f56;
  --wine: #8c3d4a;
  --wine-dark: #6c2e39;
  --gold: #b08d57;
  --gold-soft: #e8d7bc;
  --line: #eadccd;
  --ok: #3d6b4f;
  --warn: #8a5a28;
  --shadow: 0 18px 50px rgba(42, 34, 30, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: "Outfit", system-ui, sans-serif;
  background:
    radial-gradient(1200px 500px at 10% -10%, #fbe7dc 0%, transparent 50%),
    radial-gradient(900px 400px at 110% 10%, #ead7c3 0%, transparent 45%),
    var(--ivory);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.55;
}

a { color: var(--wine); }

.wrap {
  width: min(920px, calc(100% - 32px));
  margin: 0 auto;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 0 8px;
}

.brand {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.55rem;
  letter-spacing: 0.04em;
  text-decoration: none;
  color: var(--ink);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.nav a, .btn, button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.92rem;
  padding: 8px 14px;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
}

.nav a:hover, .nav a.active {
  color: var(--wine);
  background: rgba(140, 61, 74, 0.08);
}

.btn-primary, button.btn-primary {
  background: var(--wine);
  color: #fff;
  padding: 10px 18px;
}

.btn-primary:hover { background: var(--wine-dark); }

.btn-ghost {
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
}

.hero {
  margin: 12px 0 28px;
  border-radius: 28px;
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow);
  min-height: 420px;
}

.hero img {
  width: 100%;
  height: 520px;
  object-fit: cover;
  display: block;
  filter: grayscale(1) contrast(1.05);
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(42, 34, 30, 0.15) 20%, rgba(42, 34, 30, 0.72) 100%);
  color: #fff;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 36px;
}

.hero-overlay p.kicker {
  margin: 0 0 6px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--gold-soft);
}

.hero-overlay h1 {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 500;
  font-size: clamp(2.6rem, 7vw, 4.6rem);
  margin: 0;
  line-height: 0.95;
}

.letter, .card, .countdown, .editor-block {
  background: var(--paper);
  border: 1px solid rgba(176, 141, 87, 0.18);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 28px;
  margin-bottom: 22px;
}

.letter p {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.28rem;
  margin: 0 0 0.7em;
  color: #3b312c;
}

.letter p:first-child { font-style: italic; }
.letter p:last-child { margin-bottom: 0; }

.countdown {
  text-align: center;
  padding: 34px 20px;
}

.countdown .days {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(2.2rem, 6vw, 3.4rem);
  line-height: 1.15;
  color: var(--wine);
}

.countdown .label {
  margin-top: 8px;
  color: var(--muted);
}

.section-title {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 2rem;
  font-weight: 500;
  margin: 34px 0 18px;
  text-align: center;
}

.timeline {
  position: relative;
  padding: 8px 0 40px;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 118px;
  top: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(var(--gold), var(--line));
}

.event {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 36px;
  position: relative;
  margin-bottom: 16px;
}

.event::after {
  content: "";
  position: absolute;
  left: 113px;
  top: 22px;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--gold);
}

.event-date {
  text-align: right;
  padding-top: 14px;
}

.event-date .day {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.35rem;
  display: block;
}

.event-date .meta {
  color: var(--muted);
  font-size: 0.78rem;
}

.event-card {
  background: var(--paper);
  border-radius: 18px;
  padding: 16px 18px;
  border: 1px solid var(--line);
}

.event-card.heart { border-color: #e3b7be; }
.event-card.emphasis { font-weight: 500; }

.heart { color: var(--wine); }

.add-event {
  display: grid;
  grid-template-columns: 160px 1fr auto;
  gap: 10px;
  background: var(--paper);
  border: 1px solid rgba(176, 141, 87, 0.18);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 22px;
}

.add-event input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  font: inherit;
  background: #fff;
  color: var(--ink);
}

.closing {
  text-align: center;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.5rem;
  margin: 10px 0 48px;
}

.site-footer {
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
  padding: 10px 0 40px;
}

/* login */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(420px, 100%);
  background: var(--paper);
  border-radius: 24px;
  padding: 36px 32px;
  box-shadow: var(--shadow);
  text-align: center;
}

.login-card h1 {
  font-family: "Cormorant Garamond", Georgia, serif;
  font-weight: 500;
  font-size: 2.4rem;
  margin: 0 0 8px;
}

.login-card p { color: var(--muted); margin: 0 0 22px; }

.login-card input, .field input, .field textarea, .field select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  font: inherit;
  background: #fff;
  color: var(--ink);
}

.login-card .btn-primary { width: 100%; margin-top: 12px; padding: 12px; }

.error {
  color: var(--wine);
  min-height: 1.2em;
  font-size: 0.9rem;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 8px 0 16px;
}

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.row-2, .row-3 {
  display: grid;
  gap: 12px;
}

.row-2 { grid-template-columns: 1fr 1fr; }
.row-3 { grid-template-columns: 1fr 1fr 1fr; }

.event-editor {
  display: grid;
  gap: 10px;
}

.event-editor-item {
  display: grid;
  grid-template-columns: 150px 1fr auto;
  gap: 10px;
  align-items: start;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px;
}

.muted { color: var(--muted); }
.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  background: var(--ink);
  color: #fff;
  padding: 10px 14px;
  border-radius: 12px;
  display: none;
}

.photo-preview {
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  border-radius: 14px;
  filter: grayscale(1);
}

.hidden { display: none !important; }

.gallery-stage {
  position: relative;
  background: #1c1613;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: var(--shadow);
  min-height: 420px;
  display: grid;
  place-items: center;
}

.gallery-stage img {
  width: 100%;
  height: min(72vh, 640px);
  object-fit: contain;
  display: block;
}

.gallery-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 250, 244, 0.92);
  color: var(--ink);
  font-size: 1.8rem;
  line-height: 1;
  cursor: pointer;
}

.gallery-arrow.prev { left: 14px; }
.gallery-arrow.next { right: 14px; }

.gallery-meta {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.55));
  font-size: 0.92rem;
}

.thumbs {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 14px 2px 8px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.thumb {
  flex: 0 0 auto;
  width: 88px;
  height: 88px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 12px;
  overflow: hidden;
  cursor: pointer;
  background: var(--paper);
  scroll-snap-align: start;
}

.thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.thumb.active { border-color: var(--wine); }

@media (max-width: 720px) {
  .timeline::before, .event::after { display: none; }
  .event, .event-editor-item, .row-2, .row-3, .add-event {
    grid-template-columns: 1fr;
  }
  .event-date { text-align: left; padding-top: 0; }
  .hero img { height: 360px; }
  .hero-overlay { padding: 22px; }
}
