* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

:root {
  --bg: #f4efe6;
  --bg-alt: #ece2cf;
  --ink: #1c1a17;
  --ink-soft: #5c5648;
  --ink-faint: #8a7f68;
  --accent: #a4432f;
  --rule: #d8cdb8;
  --card: #fdfaf3;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100vh;
}

em {
  font-style: italic;
}

/* ===================== Lock page ===================== */
.lock-page {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  background:
    linear-gradient(rgba(244, 239, 230, 0.78), rgba(244, 239, 230, 0.88)),
    url("./images/47-beautiful-moments.jpg") center / cover no-repeat;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.lock-page.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.lock-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  max-width: 360px;
  width: 100%;
}

.lock-card .eyebrow {
  margin-bottom: -6px;
}

.lock-photo-wrap {
  width: 148px;
  height: 110px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lock-photo {
  height: 148px;
  width: auto;
  max-width: none;
  object-fit: contain;
  transform: rotate(270deg);
  border: 1px solid var(--rule);
  border-radius: 3px;
  box-shadow: 0 10px 24px rgba(28, 26, 23, 0.12);
}

/* Eyebrow (shared) */
.eyebrow {
  text-transform: uppercase;
  letter-spacing: 3px;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
}

/* Timer */
.timer {
  display: flex;
  border-top: 1px solid var(--rule);
  padding-top: 20px;
}

.timer-unit {
  padding: 0 18px;
  border-right: 1px solid var(--rule);
  text-align: center;
}

.timer-unit:first-child {
  padding-left: 0;
}

.timer-unit:last-child {
  border-right: none;
  padding-right: 0;
}

.timer-num {
  display: block;
  font-family: 'Playfair Display', serif;
  font-weight: 600;
  font-size: 1.7rem;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.timer-label {
  display: block;
  font-size: 0.6rem;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-top: 5px;
}

.timer-caption {
  margin-top: -14px;
  font-size: 0.82rem;
  font-style: italic;
  color: var(--ink-soft);
  text-align: center;
  max-width: 280px;
  line-height: 1.5;
}

/* PIN area */
.pin-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.pin-title {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--ink);
}

.pin-dots {
  display: flex;
  gap: 12px;
}

.pin-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1.5px solid var(--ink-faint);
  background: transparent;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.pin-dot.filled {
  background: var(--accent);
  border-color: var(--accent);
  transform: scale(1.1);
}

.pin-dots.shake {
  animation: shake 0.4s ease;
}

.pin-dots.error .pin-dot.filled {
  background: #b3392a;
  border-color: #b3392a;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

.pin-error {
  font-size: 0.78rem;
  color: var(--accent);
  opacity: 0;
  transition: opacity 0.2s ease;
  margin-top: -12px;
}

.pin-error.show {
  opacity: 1;
}

/* Keypad */
.keypad {
  display: grid;
  grid-template-columns: repeat(3, 68px);
  gap: 14px;
}

.key {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  border: 1px solid var(--rule);
  background: var(--card);
  color: var(--ink);
  font-family: 'Playfair Display', serif;
  font-size: 1.35rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.1s ease, border-color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.key:hover {
  background: #f7f1e5;
  border-color: var(--ink-faint);
}

.key:active {
  background: #efe6d3;
  transform: scale(0.95);
}

.key-spacer {
  background: transparent;
  border: none;
  cursor: default;
}

.key-del {
  font-family: 'Inter', sans-serif;
  font-size: 1.1rem;
  color: var(--ink-soft);
}

/* ===================== Main site ===================== */
.site {
  position: relative;
  z-index: 1;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.7s ease;
}

.site.visible {
  opacity: 1;
  visibility: visible;
}

.hero {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  align-items: stretch;
}

.hero-left {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
  padding: 60px;
}

.hero-left .eyebrow {
  margin-bottom: -4px;
}

.hero-title {
  font-family: 'Playfair Display', serif;
  font-weight: 600;
  font-size: 3.4rem;
  line-height: 1.08;
  color: var(--ink);
}

.hero-title em {
  font-weight: 500;
  color: var(--accent);
}

.hero-sub {
  font-size: 0.98rem;
  color: var(--ink-soft);
  max-width: 420px;
  margin-top: -10px;
}

.hero .timer {
  margin-top: 4px;
}

.scroll-cue {
  display: inline-block;
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85rem;
  border-bottom: 1px solid rgba(164, 67, 47, 0.4);
  padding-bottom: 3px;
  width: fit-content;
  transition: border-color 0.3s ease, opacity 0.3s ease;
}

.scroll-cue:hover {
  opacity: 0.75;
}

.hero-right {
  position: relative;
  overflow: hidden;
  background: var(--bg-alt);
}

.hero-right img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.story {
  min-height: 46vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
  padding: 70px 20px;
  background: var(--bg-alt);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.story h2 {
  font-family: 'Playfair Display', serif;
  font-weight: 600;
  font-size: 2rem;
  color: var(--ink);
}

.story p {
  color: var(--ink-soft);
  max-width: 460px;
  font-size: 0.95rem;
}

.story-sub {
  font-style: italic;
}

/* ===================== Timeline ===================== */
.timeline-section {
  max-width: 900px;
  margin: 0 auto;
  padding: 90px 24px 120px;
}

.timeline-items {
  display: flex;
  flex-direction: column;
}

.timeline-item {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 46px;
  align-items: center;
  border-top: 1px solid var(--rule);
  padding: 52px 0;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.timeline-item.visible {
  opacity: 1;
  transform: translateY(0);
}

.timeline-item:nth-child(even) .timeline-media {
  order: 2;
}

.timeline-item:nth-child(even) .timeline-content {
  order: 1;
}

.timeline-date {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 0.85rem;
  letter-spacing: 1px;
  color: var(--accent);
  font-weight: 500;
  margin-bottom: 12px;
}

.timeline-title {
  font-family: 'Playfair Display', serif;
  font-weight: 600;
  font-size: 1.85rem;
  color: var(--ink);
  margin-bottom: 14px;
  line-height: 1.2;
}

.timeline-text {
  font-size: 0.96rem;
  line-height: 1.65;
  color: var(--ink-soft);
  max-width: 420px;
}

.timeline-media-empty {
  display: none;
}

.secret-link {
  display: block;
  margin: 48px auto 0;
  text-align: center;
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 1.05rem;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(164, 67, 47, 0.35);
  width: fit-content;
  padding-bottom: 3px;
}

.secret-link:hover {
  opacity: 0.75;
}

.pin-hint {
  font-size: 0.82rem;
  font-style: italic;
  color: var(--ink-soft);
  margin-top: -6px;
}

.chats-page {
  max-width: 780px;
  margin: 0 auto;
  padding: 70px 24px 100px;
}

.chats-page .eyebrow {
  margin-bottom: 10px;
}

.chats-page h1 {
  font-family: 'Playfair Display', serif;
  font-weight: 600;
  font-size: 2.4rem;
  margin-bottom: 12px;
}

.chats-page .chats-date {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 0.85rem;
  color: var(--accent);
  margin-bottom: 10px;
}

.chats-page .chats-sub {
  color: var(--ink-soft);
  font-style: italic;
  margin-bottom: 40px;
  max-width: 520px;
  line-height: 1.6;
}

.ever-carousel {
  position: relative;
  max-width: 340px;
  margin: 0 auto;
}

.ever-viewport {
  width: 100%;
  aspect-ratio: 9 / 16;
  overflow: hidden;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--card);
}

.ever-track {
  display: flex;
  width: 100%;
  height: 100%;
  transition: transform 0.4s cubic-bezier(0.65, 0, 0.35, 1);
}

.ever-track img {
  width: 100%;
  min-width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  flex: 0 0 100%;
  cursor: pointer;
}

.ever-nav {
  position: absolute;
  top: 42%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid rgba(28, 26, 23, 0.15);
  background: rgba(253, 250, 243, 0.9);
  color: var(--ink);
  font-size: 0.8rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ever-nav:hover {
  background: #fff;
}

.ever-prev { left: -18px; }
.ever-next { right: -18px; }

.ever-caption {
  font-family: 'Playfair Display', serif;
  font-style: italic;
  font-size: 1.05rem;
  color: var(--ink);
  text-align: center;
  margin-top: 18px;
  min-height: 1.4em;
}

.ever-count {
  font-size: 0.72rem;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--ink-faint);
  text-align: center;
  margin-top: 6px;
}

.ever-dots {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 14px;
}

.ever-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  border: none;
  padding: 0;
  background: rgba(28, 26, 23, 0.22);
  cursor: pointer;
}

.ever-dot.active {
  background: var(--accent);
}

.love-note {
  max-width: 480px;
  margin: 72px auto 0;
  padding-top: 40px;
  border-top: 1px solid var(--rule);
}

.love-note p {
  font-family: 'Playfair Display', serif;
  font-size: 1.15rem;
  line-height: 1.7;
  color: var(--ink);
  margin-bottom: 18px;
}

.love-note p:first-child {
  font-style: italic;
  color: var(--accent);
}

.love-sign {
  margin-top: 28px;
  font-style: italic;
  letter-spacing: 1px;
}

.back-link {
  display: inline-block;
  margin-bottom: 28px;
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.85rem;
}

.back-link:hover {
  color: var(--accent);
}

@media (max-width: 420px) {
  .ever-prev { left: 8px; }
  .ever-next { right: 8px; }
}

/* ===================== Per-card mini media carousel ===================== */
.timeline-media {
  position: relative;
  width: 240px;
  border-radius: 4px;
  overflow: hidden;
  border: 1px solid var(--rule);
  background: var(--card);
}

.media-viewport {
  width: 240px;
  height: 300px;
  overflow: hidden;
}

.media-track {
  display: flex;
  height: 100%;
  transition: transform 0.4s cubic-bezier(0.65, 0, 0.35, 1);
}

.media-track img,
.media-track video {
  width: 240px;
  height: 300px;
  object-fit: cover;
  flex: 0 0 240px;
  cursor: pointer;
}

.media-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid rgba(28, 26, 23, 0.15);
  background: rgba(253, 250, 243, 0.85);
  color: var(--ink);
  font-size: 0.7rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.9;
  transition: opacity 0.2s ease, background 0.2s ease;
}

.media-nav:hover {
  opacity: 1;
  background: #fff;
}

.media-prev { left: 8px; }
.media-next { right: 8px; }

.media-dots {
  position: absolute;
  bottom: 10px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  gap: 6px;
}

.media-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: rgba(28, 26, 23, 0.28);
  border: none;
  padding: 0;
  cursor: pointer;
}

.media-dot.active {
  background: var(--accent);
}

/* Lightbox for timeline images */
.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(17, 15, 12, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  padding: 30px;
}

.lightbox.open {
  opacity: 1;
  visibility: visible;
}

.lightbox img {
  max-width: 90vw;
  max-height: 85vh;
  border-radius: 4px;
}

.lightbox-close {
  position: absolute;
  top: 24px;
  right: 24px;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid rgba(244, 239, 230, 0.3);
  background: rgba(244, 239, 230, 0.08);
  color: #f4efe6;
  font-size: 1.1rem;
  cursor: pointer;
}

@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
  }
  .hero-left {
    padding: 90px 32px 50px;
    order: 2;
  }
  .hero-right {
    order: 1;
    height: 50vh;
  }
  .hero-title {
    font-size: 2.6rem;
  }
}

@media (max-width: 700px) {
  .timeline-item {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .timeline-item:nth-child(even) .timeline-media,
  .timeline-item:nth-child(even) .timeline-content {
    order: initial;
  }
  .timeline-media,
  .media-viewport,
  .media-track img,
  .media-track video {
    width: 100%;
  }
  .media-viewport {
    height: 60vw;
    max-height: 340px;
  }
  .media-track img,
  .media-track video {
    flex-basis: 100%;
  }
  .timeline-text {
    max-width: none;
  }
}

@media (max-width: 480px) {
  .hero-left { padding: 70px 22px 40px; }
  .hero-title { font-size: 2.1rem; }
  .timer-unit { padding: 0 12px; }
  .timer-num { font-size: 1.35rem; }
  .keypad { grid-template-columns: repeat(3, 60px); gap: 10px; }
  .key { width: 60px; height: 60px; font-size: 1.2rem; }
  .lock-card { gap: 12px; }
  .lock-photo-wrap { width: 128px; height: 96px; }
  .lock-photo { height: 128px; }
}

@media (max-height: 700px) {
  .lock-photo-wrap { width: 120px; height: 90px; }
  .lock-photo { height: 120px; }
  .lock-card { gap: 12px; }
}
