:root {
  --accent: #e88ca6;
  --accent-dark: #d46a89;
  --ink: #2b2b2b;
  --muted: #8a8a8a;
  --line: #d9d9d9;
  --node-size: 190px;
  --node-gap: 160px;
  --font-display: 'Playfair Display', Georgia, serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  background: #ffffff;
  color: var(--ink);
  font-family: var(--font-body);
  overflow-x: hidden;
}

.page-frame {
  position: fixed;
  inset: 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  pointer-events: none;
  z-index: 50;
}

/* ---------- Header ---------- */

.page-header {
  text-align: center;
  padding: 48px 24px 20px;
}

.page-header h1 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2rem, 5vw, 3rem);
  margin: 0 0 16px;
  color: var(--ink);
}

.heart {
  display: inline-block;
  color: var(--accent);
  transform-origin: center;
  animation: heartbeat 1.8s ease-in-out infinite;
}

@keyframes heartbeat {
  0%, 100% { transform: scale(1); }
  25% { transform: scale(1.18); }
  40% { transform: scale(0.96); }
  55% { transform: scale(1.12); }
}

.days-counter {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: fit-content;
  padding: 10px 32px;
  margin: 0 auto 16px;
  background: linear-gradient(135deg, #fff6f8, #ffe9ee);
  border: 1px solid #f6d3dc;
  border-radius: 18px;
  box-shadow: 0 6px 16px rgba(232, 140, 166, 0.15);
}

.days-count {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.7rem;
  line-height: 1.1;
  color: var(--accent-dark);
}

.days-label {
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 2px;
}

.page-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

/* ---------- Timeline ---------- */

.timeline {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 80px 0 100px;
  cursor: grab;
  scrollbar-width: thin;
  scrollbar-color: var(--accent) #f2f2f2;
}

.timeline:active {
  cursor: grabbing;
}

.timeline::-webkit-scrollbar {
  height: 8px;
}

.timeline::-webkit-scrollbar-track {
  background: #f5f5f5;
}

.timeline::-webkit-scrollbar-thumb {
  background: var(--accent);
  border-radius: 4px;
}

.timeline-track {
  position: relative;
  display: flex;
  align-items: flex-start;
  width: max-content;
  padding: 0 8vw;
}

.vine-svg {
  position: absolute;
  z-index: 0;
  pointer-events: none;
  overflow: visible;
}

/* ---------- Node ---------- */

.node {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: var(--node-size);
  margin-right: var(--node-gap);
  flex: 0 0 auto;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  cursor: pointer;
  text-align: center;
}

.node:last-child {
  margin-right: 0;
}

.node-date {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 0.85rem;
  color: var(--accent-dark);
  margin-bottom: 10px;
  white-space: nowrap;
}

.node-square {
  display: block;
  width: var(--node-size);
  height: var(--node-size);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
  border: 4px solid #ffffff;
  outline: 1px solid #eee;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  background: #f2f2f2;
}

.node-square img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.node:hover .node-square,
.node:focus-visible .node-square {
  transform: translateY(-6px) scale(1.03);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.16);
}

/* First node: the day we met — circular, ringed, no line leading into it */

.node-visual {
  position: relative;
  display: block;
}

.node--first .node-square {
  border-radius: 50%;
  border-color: var(--accent);
  box-shadow: 0 8px 22px rgba(232, 140, 166, 0.35);
}

.node-ring {
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 2px dashed var(--accent);
  opacity: 0.55;
  pointer-events: none;
  animation: pulseRing 2.4s ease-in-out infinite;
}

@keyframes pulseRing {
  0%, 100% { transform: scale(1); opacity: 0.55; }
  50% { transform: scale(1.08); opacity: 0.15; }
}

.node--first .node-date {
  font-size: 0.9rem;
  font-weight: 600;
}

.node--first .node-caption {
  font-weight: 700;
  color: var(--accent-dark);
}

.node:focus-visible {
  outline: none;
}

.node:focus-visible .node-square {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.node-caption {
  margin-top: 14px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.35;
  max-width: calc(var(--node-size) + 20px);
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 60px 24px;
  font-size: 0.95rem;
}

.empty-state code {
  background: #f5f5f5;
  padding: 2px 6px;
  border-radius: 4px;
}

/* ---------- Modal ---------- */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 15, 17, 0.55);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
  animation: fadeIn 0.2s ease;
}

.modal-overlay[hidden] {
  display: none;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: #ffffff;
  width: min(640px, 100%);
  max-height: min(85vh, 900px);
  border-radius: 24px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.25s ease;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(24px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-scroll {
  overflow-y: auto;
  max-height: min(85vh, 900px);
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  color: var(--ink);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: background 0.2s ease;
}

.modal-close:hover {
  background: #ffffff;
}

.modal-header-photo {
  width: 100%;
  height: 280px;
  object-fit: contain;
  display: block;
  background: var(--line);
}

.modal-body {
  padding: 28px 32px 36px;
}

.modal-date {
  font-family: var(--font-display);
  font-style: italic;
  color: var(--accent-dark);
  margin: 0 0 6px;
  font-size: 0.95rem;
}

.modal-body h2 {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.7rem;
  margin: 0 0 18px;
}

.modal-text p {
  line-height: 1.7;
  color: #444;
  margin: 0 0 14px;
  font-size: 0.98rem;
}

.modal-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.modal-photos figure {
  margin: 0;
}

.modal-photos img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 14px;
  display: block;
}

.modal-photos figcaption {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 6px;
  text-align: center;
}

/* ---------- Responsive ---------- */

@media (max-width: 600px) {
  :root {
    --node-size: 140px;
    --node-gap: 90px;
  }

  .modal-body {
    padding: 22px 20px 28px;
  }

  .modal-header-photo {
    height: 200px;
  }
}
