/* ========================================
   Our Memories - Scrapbook Timeline CSS
   ======================================== */

/* --- CSS Variables --- */
:root {
  --bg-cream: #faf5ee;
  --bg-paper: #f5efe6;
  --text-dark: #3d3229;
  --text-medium: #6b5d4f;
  --text-light: #9b8e80;
  --accent-pink: #e8a0b4;
  --accent-pink-light: #f5d0dc;
  --accent-warm: #e8c4a0;
  --accent-mint: #a8d8c8;
  --accent-lavender: #c4b0e0;
  --accent-peach: #f5c4a8;
  --road-color: rgba(190, 175, 160, 0.45);
  --road-dash: 15px;
  --road-gap: 12px;
  --shadow-soft: 0 2px 8px rgba(61, 50, 41, 0.1);
  --shadow-medium: 0 4px 16px rgba(61, 50, 41, 0.12);
  --shadow-strong: 0 8px 32px rgba(61, 50, 41, 0.16);
  --shadow-card: 2px 3px 8px rgba(61, 50, 41, 0.12), 0 1px 2px rgba(61, 50, 41, 0.08);
  --font-hand: 'Caveat', cursive;
  --font-script: 'Dancing Script', cursive;
  --font-ui: 'Outfit', sans-serif;
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  --z-fab: 100;
  --z-modal: 1000;
  --z-context: 1100;
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
  --transition-slow: 0.5s ease;
  --timeline-center: 60px;
  --photo-size: 210px;
}

/* --- Reset --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* --- Body & Background --- */
html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-ui);
  color: var(--text-dark);
  background-color: var(--bg-cream);
  background-image:
    radial-gradient(ellipse at 15% 20%, rgba(232, 160, 180, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 85% 60%, rgba(168, 216, 200, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 90%, rgba(196, 176, 224, 0.06) 0%, transparent 50%),
    repeating-linear-gradient(0deg, transparent, transparent 40px, rgba(180, 160, 140, 0.025) 40px, rgba(180, 160, 140, 0.025) 41px),
    repeating-linear-gradient(90deg, transparent, transparent 40px, rgba(180, 160, 140, 0.025) 40px, rgba(180, 160, 140, 0.025) 41px);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* --- Background Doodles --- */
.bg-doodles {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.bg-doodle {
  position: absolute;
  font-size: 1.4rem;
  opacity: 0;
  animation: doodleFadeIn 1s ease forwards;
  user-select: none;
  pointer-events: none;
}

@keyframes doodleFadeIn {
  to { opacity: 0.12; }
}

@keyframes doodleFloat {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-8px) rotate(5deg); }
}

.bg-doodle.animate {
  animation: doodleFadeIn 1s ease forwards, doodleFloat 6s ease-in-out infinite;
}

/* --- Site Header --- */
.site-header {
  position: relative;
  text-align: center;
  padding: 48px 24px 24px;
  z-index: 1;
}

.header-content {
  position: relative;
  display: inline-block;
}

.header-content::before,
.header-content::after {
  content: '';
  position: absolute;
  height: 2px;
  width: 60px;
  top: 50%;
  background: linear-gradient(90deg, transparent, var(--accent-pink), transparent);
}

.header-content::before { right: calc(100% + 16px); }
.header-content::after  { left: calc(100% + 16px); }

.site-title {
  font-family: var(--font-script);
  font-size: clamp(2.2rem, 6vw, 3.5rem);
  font-weight: 600;
  color: var(--text-dark);
  line-height: 1.2;
  outline: none;
  border: none;
  cursor: text;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.site-title:hover { background: rgba(232, 160, 180, 0.08); }
.site-title:focus { background: rgba(232, 160, 180, 0.12); }

.site-subtitle {
  font-family: var(--font-hand);
  font-size: clamp(1.1rem, 3vw, 1.5rem);
  color: var(--text-light);
  margin-top: 4px;
  outline: none;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.site-subtitle:hover { background: rgba(232, 160, 180, 0.08); }
.site-subtitle:focus { background: rgba(232, 160, 180, 0.12); }

.header-deco {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.8rem;
  opacity: 0.2;
  animation: doodleFloat 5s ease-in-out infinite;
}

.header-deco-left  { left: max(12px, 5%); animation-delay: 0s; }
.header-deco-right { right: max(12px, 5%); animation-delay: 2.5s; }

/* --- Scrapbook Canvas --- */
.scrapbook-canvas {
  position: relative;
  padding: 10px 20px 120px;
  z-index: 1;
}

/* ═══════════════════════════════════════════
   TIMELINE / ROAD LAYOUT
   ═══════════════════════════════════════════ */

.timeline {
  position: relative;
  max-width: 960px;
  margin: 0 auto;
}

/* The dashed road — vertical center line */
.timeline::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 3px;
  transform: translateX(-50%);
  background: repeating-linear-gradient(
    to bottom,
    var(--road-color) 0,
    var(--road-color) var(--road-dash),
    transparent var(--road-dash),
    calc(var(--road-dash) + var(--road-gap))
  );
  border-radius: 2px;
}

/* --- Timeline Start Marker --- */
.timeline-start {
  text-align: center;
  padding: 10px 0 36px;
  position: relative;
  z-index: 2;
}

.timeline-start-icon {
  font-size: 1.8rem;
  display: block;
  margin-bottom: 4px;
  animation: doodleFloat 4s ease-in-out infinite;
}

.timeline-start-text {
  font-family: var(--font-hand);
  font-size: 1.15rem;
  color: var(--text-light);
  background: var(--bg-cream);
  padding: 2px 12px;
  display: inline-block;
}

/* --- Timeline End Marker --- */
.timeline-end {
  text-align: center;
  padding: 36px 0 20px;
  position: relative;
  z-index: 2;
}

.timeline-end-text {
  font-family: var(--font-hand);
  font-size: 1.15rem;
  color: var(--text-light);
  font-style: italic;
  background: var(--bg-cream);
  padding: 2px 12px;
  display: inline-block;
}

.timeline-end-icon {
  font-size: 1.5rem;
  display: block;
  margin-top: 6px;
  animation: doodleFloat 4.5s ease-in-out infinite;
}

/* --- Year Separator --- */
.timeline-year {
  position: relative;
  z-index: 2;
  text-align: center;
  margin: 36px 0 28px;
}

.timeline-year-label {
  display: inline-block;
  font-family: var(--font-hand);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-medium);
  background: var(--bg-cream);
  padding: 5px 22px;
  border: 2.5px dashed rgba(190, 175, 160, 0.35);
  border-radius: 30px;
  letter-spacing: 1px;
}

/* --- Timeline Item (each memory row) --- */
.timeline-item {
  display: grid;
  grid-template-columns: 1fr var(--timeline-center) 1fr;
  margin-bottom: 72px;
  position: relative;

  /* scroll-reveal animation */
  opacity: 0;
  transition: opacity 0.65s ease, transform 0.65s ease;
}

.timeline-item.left  { transform: translateX(-25px); }
.timeline-item.right { transform: translateX(25px); }

.timeline-item.in-view {
  opacity: 1;
  transform: translateX(0);
}

/* --- Timeline Content (card wrapper) --- */
.timeline-content {
  display: flex;
  padding: 0 6px;
}

.timeline-item.left .timeline-content  { justify-content: flex-end; }
.timeline-item.right .timeline-content { justify-content: flex-start; }

/* --- Timeline Center Column (dot + connectors) --- */
.timeline-center {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 28px;
  position: relative;
}

/* Connector dashes — horizontal line from dot to card */
.timeline-center::before {
  content: '';
  position: absolute;
  top: 35px;
  height: 2px;
  background: repeating-linear-gradient(
    to right,
    rgba(190, 175, 160, 0.35) 0,
    rgba(190, 175, 160, 0.35) 5px,
    transparent 5px,
    transparent 10px
  );
}

.timeline-item.left .timeline-center::before {
  right: calc(50% + 11px);
  left: 0;
}

.timeline-item.right .timeline-center::before {
  left: calc(50% + 11px);
  right: 0;
}

/* --- Timeline Dot --- */
.timeline-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  flex-shrink: 0;
  z-index: 5;
  box-shadow: 0 2px 8px rgba(232, 160, 180, 0.3);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
}

.timeline-dot.dot-heart {
  background: var(--accent-pink);
  border: 3px solid white;
}

.timeline-dot.dot-star {
  background: var(--accent-warm);
  border: 3px solid white;
}

.timeline-dot.dot-mint {
  background: var(--accent-mint);
  border: 3px solid white;
}

.timeline-dot.dot-lavender {
  background: var(--accent-lavender);
  border: 3px solid white;
}

.timeline-item:hover .timeline-dot {
  transform: scale(1.25);
  box-shadow: 0 3px 12px rgba(232, 160, 180, 0.45);
}

/* --- Timeline Spacer (empty side) --- */
.timeline-spacer {
  min-height: 1px;
}

/* ═══════════════════════════════════════════
   EMPTY STATE
   ═══════════════════════════════════════════ */

.empty-state {
  text-align: center;
  padding: 80px 32px;
  animation: fadeInUp 0.8s ease forwards;
}

.empty-state.hidden { display: none; }

.empty-illustration {
  font-size: 4rem;
  margin-bottom: 16px;
  animation: doodleFloat 4s ease-in-out infinite;
}

.empty-title {
  font-family: var(--font-script);
  font-size: 1.8rem;
  color: var(--text-dark);
  margin-bottom: 8px;
}

.empty-text {
  font-family: var(--font-hand);
  font-size: 1.2rem;
  color: var(--text-light);
  margin-bottom: 24px;
}

.empty-cta {
  font-family: var(--font-hand);
  font-size: 1.2rem;
  padding: 12px 28px;
  background: linear-gradient(135deg, var(--accent-pink), var(--accent-peach));
  color: white;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(232, 160, 180, 0.3);
  transition: all var(--transition-normal);
}

.empty-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(232, 160, 180, 0.4);
}

/* ═══════════════════════════════════════════
   MEMORY CARD
   ═══════════════════════════════════════════ */

.memory-card {
  display: inline-block;
  position: relative;
  transition: filter var(--transition-fast);
}

.memory-card:hover {
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.08));
}

.memory-card-inner {
  position: relative;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 16px;
}

/* Card text group — date + note beside the photo */
.card-text-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 180px;
  min-width: 60px;
  flex-shrink: 1;
}

/* LEFT items: text on left, photo on right (closer to road) */
.timeline-item.left .card-text-group { order: 1; text-align: right; }
.timeline-item.left .photo-stack     { order: 2; }
.timeline-item.left .card-actions     { order: 3; }

/* RIGHT items: photo on left (closer to road), text on right */
.timeline-item.right .photo-stack     { order: 1; }
.timeline-item.right .card-text-group { order: 2; text-align: left; }
.timeline-item.right .card-actions    { order: 3; }

/* Alignment based on timeline side */
.timeline-item.left .memory-card-inner  { justify-content: flex-end; }
.timeline-item.right .memory-card-inner { justify-content: flex-start; }

/* Card actions — shown on hover */
.card-actions {
  position: absolute;
  top: -8px;
  right: -8px;
  display: flex;
  gap: 4px;
  opacity: 0;
  transform: scale(0.8);
  transition: all var(--transition-fast);
  z-index: 50;
}

.memory-card:hover .card-actions {
  opacity: 1;
  transform: scale(1);
}

.action-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: none;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  box-shadow: var(--shadow-soft);
}

.action-btn.edit-btn {
  background: white;
  color: var(--text-medium);
}

.action-btn.edit-btn:hover {
  background: var(--accent-mint);
  color: white;
  transform: scale(1.1);
}

.action-btn.delete-btn {
  background: white;
  color: var(--text-medium);
}

.action-btn.delete-btn:hover {
  background: #e85d5d;
  color: white;
  transform: scale(1.1);
}

.action-btn.add-photo-btn {
  background: white;
  color: var(--text-medium);
}

.action-btn.add-photo-btn:hover {
  background: var(--accent-lavender);
  color: white;
  transform: scale(1.1);
}

/* ═══════════════════════════════════════════
   PHOTO STACK & POLAROID
   ═══════════════════════════════════════════ */

.photo-stack {
  position: relative;
  display: inline-flex;
  align-items: flex-start;
}

.polaroid {
  position: relative;
  background: white;
  padding: 8px;
  padding-bottom: 10px;
  box-shadow: var(--shadow-card);
  transition: transform var(--transition-normal), box-shadow var(--transition-normal);
  display: inline-block;
  flex-shrink: 0;
}

.polaroid + .polaroid {
  margin-left: -40px;
}

.memory-card:hover .polaroid {
  box-shadow: var(--shadow-medium);
}

.polaroid img {
  display: block;
  width: var(--photo-size);
  height: var(--photo-size);
  object-fit: cover;
  image-rendering: auto;
}

/* Clickable photo — opens lightbox */
.polaroid {
  cursor: pointer;
}

.polaroid:hover {
  filter: brightness(0.97);
}

/* ═══════════════════════════════════════════
   DECORATIONS (tape, washi, clip, pin)
   ═══════════════════════════════════════════ */

/* Masking Tape */
.deco-tape .polaroid::before {
  content: '';
  position: absolute;
  width: 80px;
  height: 24px;
  top: -11px;
  left: 50%;
  transform: translateX(-50%) rotate(-2deg);
  background: linear-gradient(135deg, rgba(232, 196, 160, 0.55), rgba(245, 210, 175, 0.65), rgba(232, 196, 160, 0.5));
  z-index: 3;
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

/* Washi Tape */
.deco-washi .polaroid::before {
  content: '';
  position: absolute;
  width: 100px;
  height: 22px;
  top: -10px;
  left: 50%;
  transform: translateX(-50%) rotate(1deg);
  background: repeating-linear-gradient(-45deg, rgba(232, 160, 180, 0.35), rgba(232, 160, 180, 0.35) 4px, rgba(245, 208, 220, 0.35) 4px, rgba(245, 208, 220, 0.35) 8px);
  z-index: 3;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
}

.deco-washi.washi-mint .polaroid::before {
  background: repeating-linear-gradient(-45deg, rgba(168, 216, 200, 0.4), rgba(168, 216, 200, 0.4) 4px, rgba(200, 236, 224, 0.35) 4px, rgba(200, 236, 224, 0.35) 8px);
}

.deco-washi.washi-lavender .polaroid::before {
  background: repeating-linear-gradient(-45deg, rgba(196, 176, 224, 0.4), rgba(196, 176, 224, 0.4) 4px, rgba(220, 208, 240, 0.35) 4px, rgba(220, 208, 240, 0.35) 8px);
}

.deco-washi.washi-peach .polaroid::before {
  background: repeating-linear-gradient(-45deg, rgba(245, 196, 168, 0.4), rgba(245, 196, 168, 0.4) 4px, rgba(250, 216, 196, 0.35) 4px, rgba(250, 216, 196, 0.35) 8px);
}

/* Binder Clip */
.deco-clip .polaroid::before {
  content: '';
  position: absolute;
  width: 28px;
  height: 14px;
  background: linear-gradient(180deg, #666, #888);
  border-radius: 3px 3px 0 0;
  top: -6px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.deco-clip .polaroid::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 20px;
  border: 3px solid #999;
  border-radius: 0 0 4px 4px;
  border-top: none;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
}

/* Push Pin */
.deco-pin .polaroid::before {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  background: radial-gradient(circle at 35% 35%, #ff8a8a, #d64545);
  border-radius: 50%;
  top: -9px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  box-shadow: 1px 2px 4px rgba(0,0,0,0.25), inset 0 -1px 2px rgba(0,0,0,0.15);
}

.deco-pin .polaroid::after {
  content: '';
  position: absolute;
  width: 3px;
  height: 8px;
  background: linear-gradient(180deg, #aaa, #888);
  top: 5px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2;
  border-radius: 0 0 1px 1px;
}

/* ═══════════════════════════════════════════
   MEMORY DATE & NOTE
   ═══════════════════════════════════════════ */

.memory-date {
  font-family: var(--font-hand);
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text-dark);
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  outline: none;
  cursor: text;
  white-space: nowrap;
  background: transparent;
  border: 1.5px dashed transparent;
  transition: all var(--transition-fast);
  min-width: 60px;
  margin-top: 2px;
}

/* text-align handled by .card-text-group */

.memory-date:hover {
  background: rgba(232, 196, 160, 0.15);
  border-color: rgba(232, 196, 160, 0.3);
}

.memory-date:focus {
  background: rgba(232, 196, 160, 0.2);
  border-color: rgba(232, 196, 160, 0.5);
}

.memory-date:empty::before {
  content: 'add date';
  color: var(--text-light);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.memory-card:hover .memory-date:empty::before { opacity: 0.6; }

/* Note — the invisible text box */
.memory-note {
  font-family: var(--font-hand);
  font-size: 1.05rem;
  color: var(--text-medium);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  outline: none;
  cursor: text;
  min-width: 80px;
  max-width: 240px;
  min-height: 1.3em;
  line-height: 1.4;
  background: transparent;
  border: 1.5px dashed transparent;
  transition: all var(--transition-fast);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

/* text-align handled by .card-text-group */

.memory-note:hover {
  background: rgba(255, 255, 220, 0.25);
  border-color: rgba(200, 190, 140, 0.25);
}

.memory-note:focus {
  background: rgba(255, 255, 220, 0.4);
  border-color: rgba(200, 190, 140, 0.4);
}

.memory-note:empty::before {
  content: 'write a note...';
  color: var(--text-light);
  opacity: 0;
  transition: opacity var(--transition-fast);
  font-style: italic;
}

.memory-card:hover .memory-note:empty::before { opacity: 0.5; }

/* Sticker near cards */
.card-sticker {
  position: absolute;
  font-size: 1.4rem;
  opacity: 0.5;
  pointer-events: none;
  user-select: none;
  animation: doodleFloat 5s ease-in-out infinite;
}

/* ═══════════════════════════════════════════
   FAB BUTTON
   ═══════════════════════════════════════════ */

.fab-add {
  position: fixed;
  bottom: 32px;
  right: 32px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-pink), var(--accent-peach));
  border: none;
  box-shadow: 0 4px 18px rgba(232, 160, 180, 0.35);
  cursor: pointer;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-fab);
  transition: all var(--transition-normal);
}

.fab-add:hover {
  transform: scale(1.1) rotate(90deg);
  box-shadow: 0 6px 24px rgba(232, 160, 180, 0.5);
}

.fab-add:active { transform: scale(1.05) rotate(90deg); }
.fab-add svg { width: 26px; height: 26px; }

/* ═══════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(61, 50, 41, 0.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: var(--z-modal);
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
  padding: 20px;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-cream);
  border-radius: var(--radius-lg);
  padding: 36px;
  max-width: 460px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-strong);
  transform: translateY(24px) scale(0.96);
  transition: transform var(--transition-normal);
  position: relative;
}

.modal::-webkit-scrollbar { width: 6px; }
.modal::-webkit-scrollbar-track { background: transparent; }
.modal::-webkit-scrollbar-thumb { background: rgba(155, 142, 128, 0.3); border-radius: 3px; }

.modal-overlay.active .modal {
  transform: translateY(0) scale(1);
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(155, 142, 128, 0.1);
  cursor: pointer;
  font-size: 20px;
  color: var(--text-light);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: rgba(155, 142, 128, 0.2);
  color: var(--text-dark);
}

.modal-title {
  font-family: var(--font-script);
  font-size: 1.8rem;
  color: var(--text-dark);
  margin-bottom: 24px;
  text-align: center;
}

/* --- Upload Area --- */
.upload-area {
  position: relative;
  border: 2px dashed rgba(155, 142, 128, 0.25);
  border-radius: var(--radius-md);
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all var(--transition-normal);
  margin-bottom: 20px;
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.3);
}

.upload-area:hover,
.upload-area.dragover {
  border-color: var(--accent-pink);
  background: rgba(232, 160, 180, 0.05);
}

.upload-area.dragover { transform: scale(1.01); }

.upload-area.has-photos {
  padding: 12px;
  min-height: auto;
}

.upload-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.upload-placeholder.hidden { display: none; }

.upload-icon-wrap { position: relative; }
.upload-icon { font-size: 2.5rem; }

.upload-sparkle {
  position: absolute;
  top: -8px;
  right: -12px;
  font-size: 1rem;
  animation: doodleFloat 3s ease-in-out infinite;
}

.upload-text {
  font-family: var(--font-hand);
  font-size: 1.15rem;
  color: var(--text-medium);
}

.upload-hint {
  font-size: 0.8rem;
  color: var(--text-light);
}

/* Upload Preview */
.upload-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.upload-preview.hidden { display: none; }

.upload-thumb {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
}

.upload-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.upload-thumb-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,0.5);
  color: white;
  border: none;
  cursor: pointer;
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.upload-thumb:hover .upload-thumb-remove { opacity: 1; }

.upload-add-more {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-sm);
  border: 2px dashed rgba(155, 142, 128, 0.25);
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  color: var(--text-light);
  transition: all var(--transition-fast);
}

.upload-add-more:hover {
  border-color: var(--accent-pink);
  color: var(--accent-pink);
}

/* --- Form Elements --- */
.form-group { margin-bottom: 18px; }

.form-label {
  display: block;
  font-family: var(--font-hand);
  font-size: 1.1rem;
  color: var(--text-medium);
  margin-bottom: 6px;
}

.label-icon { margin-right: 4px; }

.form-input {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid rgba(155, 142, 128, 0.2);
  border-radius: var(--radius-md);
  font-family: var(--font-hand);
  font-size: 1.05rem;
  color: var(--text-dark);
  background: rgba(255, 255, 255, 0.5);
  transition: all var(--transition-fast);
  outline: none;
}

.form-input:focus {
  border-color: var(--accent-pink);
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 0 0 3px rgba(232, 160, 180, 0.1);
}

.form-textarea {
  resize: vertical;
  min-height: 70px;
}

/* --- Decoration Options --- */
.decoration-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.deco-option {
  flex: 1;
  min-width: 70px;
  padding: 10px 6px;
  border: 1.5px solid rgba(155, 142, 128, 0.15);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.3);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-family: var(--font-hand);
  font-size: 0.9rem;
  color: var(--text-medium);
  transition: all var(--transition-fast);
}

.deco-option:hover {
  border-color: var(--accent-pink);
  background: rgba(232, 160, 180, 0.05);
}

.deco-option.active {
  border-color: var(--accent-pink);
  background: rgba(232, 160, 180, 0.1);
  color: var(--text-dark);
  box-shadow: 0 0 0 2px rgba(232, 160, 180, 0.15);
}

.deco-preview {
  display: block;
  width: 40px;
  height: 16px;
  border-radius: 2px;
}

.deco-preview-tape  { background: linear-gradient(135deg, rgba(232, 196, 160, 0.6), rgba(245, 210, 175, 0.7)); }

.deco-preview-washi {
  background: repeating-linear-gradient(-45deg, rgba(232, 160, 180, 0.4), rgba(232, 160, 180, 0.4) 3px, rgba(245, 208, 220, 0.4) 3px, rgba(245, 208, 220, 0.4) 6px);
}

.deco-preview-clip {
  width: 18px;
  height: 16px;
  background: #888;
  border-radius: 3px 3px 0 0;
  position: relative;
}

.deco-preview-clip::after {
  content: '';
  position: absolute;
  bottom: -6px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 8px;
  border: 2px solid #aaa;
  border-top: none;
  border-radius: 0 0 3px 3px;
}

.deco-preview-pin {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #ff8a8a, #d64545);
  box-shadow: 1px 1px 3px rgba(0,0,0,0.2);
}

/* --- Submit Button --- */
.submit-btn {
  width: 100%;
  padding: 14px 24px;
  border: none;
  border-radius: 50px;
  background: linear-gradient(135deg, var(--accent-pink), var(--accent-peach));
  color: white;
  font-family: var(--font-hand);
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 15px rgba(232, 160, 180, 0.3);
  transition: all var(--transition-normal);
  margin-top: 8px;
}

.memory-date {
  margin-top: 0;
}

.submit-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(232, 160, 180, 0.4);
}

.submit-btn:active { transform: translateY(0); }

/* --- Context Menu --- */
.context-menu {
  position: fixed;
  background: var(--bg-cream);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-strong);
  padding: 6px;
  z-index: var(--z-context);
  opacity: 0;
  visibility: hidden;
  transform: scale(0.9);
  transition: all var(--transition-fast);
  min-width: 180px;
}

.context-menu.active {
  opacity: 1;
  visibility: visible;
  transform: scale(1);
}

.ctx-btn {
  display: block;
  width: 100%;
  padding: 10px 14px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: var(--font-hand);
  font-size: 1.05rem;
  color: var(--text-dark);
  text-align: left;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.ctx-btn:hover { background: rgba(232, 160, 180, 0.1); }

/* ═══════════════════════════════════════════
   LIGHTBOX
   ═══════════════════════════════════════════ */

.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
  cursor: zoom-out;
}

.lightbox-overlay.active {
  opacity: 1;
  visibility: visible;
}

.lightbox-img {
  max-width: 90vw;
  max-height: 88vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 8px 40px rgba(0,0,0,0.4);
  transform: scale(0.92);
  transition: transform 0.3s ease;
  cursor: default;
}

.lightbox-overlay.active .lightbox-img {
  transform: scale(1);
}

.lightbox-close {
  position: absolute;
  top: 20px;
  right: 24px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.12);
  color: white;
  font-size: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  z-index: 10;
}

.lightbox-close:hover { background: rgba(255,255,255,0.25); }

.lightbox-prev,
.lightbox-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: rgba(255,255,255,0.1);
  color: white;
  font-size: 28px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.lightbox-prev { left: 16px; }
.lightbox-next { right: 16px; }
.lightbox-prev:hover, .lightbox-next:hover { background: rgba(255,255,255,0.22); }

.lightbox-prev.hidden, .lightbox-next.hidden { display: none; }

/* ═══════════════════════════════════════════
   ANIMATIONS
   ═══════════════════════════════════════════ */

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

@keyframes cardRemove {
  to { opacity: 0; transform: scale(0.6) rotate(10deg); }
}

.memory-card.removing {
  animation: cardRemove 0.35s ease forwards;
  pointer-events: none;
}

/* ═══════════════════════════════════════════
   SCROLLBAR
   ═══════════════════════════════════════════ */

body::-webkit-scrollbar { width: 8px; }
body::-webkit-scrollbar-track { background: transparent; }
body::-webkit-scrollbar-thumb { background: rgba(155, 142, 128, 0.25); border-radius: 4px; }
body::-webkit-scrollbar-thumb:hover { background: rgba(155, 142, 128, 0.4); }

::selection {
  background: rgba(232, 160, 180, 0.25);
  color: var(--text-dark);
}

/* ═══════════════════════════════════════════
   RESPONSIVE — TABLET  (≤ 900px)
   ═══════════════════════════════════════════ */

@media (max-width: 900px) {
  :root {
    --timeline-center: 50px;
    --photo-size: 175px;
  }

  .site-header { padding: 36px 16px 20px; }

  .header-content::before,
  .header-content::after { width: 40px; }

  .timeline { padding: 0 12px; }

  .timeline-item { margin-bottom: 56px; }

  .card-text-group { max-width: 160px; }

  .memory-note { max-width: 160px; }

  .fab-add { bottom: 24px; right: 24px; width: 54px; height: 54px; }

  .modal { padding: 28px; }
  .modal-title { font-size: 1.5rem; }
}

/* ═══════════════════════════════════════════
   RESPONSIVE — PHONE  (≤ 640px)
   ═══════════════════════════════════════════ */

@media (max-width: 640px) {
  :root {
    --timeline-center: 44px;
    --photo-size: 150px;
  }

  .site-header { padding: 28px 12px 16px; }

  .header-content::before,
  .header-content::after { display: none; }

  .header-deco { display: none; }

  .scrapbook-canvas { padding: 10px 8px 100px; }

  /* Road shifts to the left */
  .timeline::before {
    left: 22px;
  }

  .timeline { padding: 0 4px; }

  /* All items become 2-column: road | content */
  .timeline-item {
    grid-template-columns: var(--timeline-center) 1fr;
    margin-bottom: 22px;
  }

  /* Hide spacer */
  .timeline-spacer { display: none; }

  /* For LEFT items, reorder columns so center comes first */
  .timeline-item.left .timeline-content { order: 2; }
  .timeline-item.left .timeline-center  { order: 1; }

  /* All content aligns left */
  .timeline-item.left .timeline-content,
  .timeline-item.right .timeline-content {
    justify-content: flex-start;
    padding-left: 6px;
    padding-right: 0;
  }

  /* Switch to vertical card layout on phone */
  .memory-card-inner { flex-direction: column !important; align-items: flex-start !important; gap: 6px !important; }

  .timeline-item.left .card-text-group,
  .timeline-item.right .card-text-group { order: 2 !important; text-align: left !important; }

  .timeline-item.left .photo-stack,
  .timeline-item.right .photo-stack { order: 1 !important; }

  .card-text-group { max-width: 65vw !important; }

  /* Scroll reveal — slide up instead of sideways */
  .timeline-item.left,
  .timeline-item.right { transform: translateY(20px); }

  .timeline-item.left.in-view,
  .timeline-item.right.in-view { transform: translateY(0); }

  /* Connector always to the right */
  .timeline-item.left .timeline-center::before,
  .timeline-item.right .timeline-center::before {
    left: calc(50% + 9px);
    right: 0;
  }

  .timeline-dot { width: 14px; height: 14px; }

  .timeline-year {
    margin: 24px 0 18px;
    padding-left: var(--timeline-center);
    text-align: left;
  }

  .timeline-year-label { font-size: 1.15rem; padding: 4px 16px; }

  .timeline-start, .timeline-end {
    padding-left: var(--timeline-center);
    text-align: left;
  }

  .memory-note { max-width: 65vw; }

  .polaroid + .polaroid { margin-left: -30px; }

  .modal {
    padding: 20px;
    border-radius: var(--radius-md);
    max-height: 92vh;
  }

  .fab-add { bottom: 20px; right: 20px; width: 50px; height: 50px; }
  .fab-add svg { width: 22px; height: 22px; }

  .deco-option { min-width: 60px; padding: 8px 4px; }
}

/* ═══════════════════════════════════════════
   RESPONSIVE — SMALL PHONE  (≤ 380px)
   ═══════════════════════════════════════════ */

@media (max-width: 380px) {
  :root {
    --photo-size: 120px;
    --timeline-center: 38px;
  }

  .timeline::before { left: 19px; }

  .site-title { font-size: 1.6rem; }
  .site-subtitle { font-size: 1rem; }

  .polaroid { padding: 5px; padding-bottom: 7px; }
}

/* --- Print --- */
@media print {
  .fab-add, .modal-overlay, .context-menu, .card-actions, .bg-doodles { display: none !important; }
  .timeline-item { opacity: 1 !important; transform: none !important; }
}
