/* =========================================================
   MEMORY PAGES — Shared components for all layouts
   ========================================================= */

.memory-page {
  position: relative;
  width: 100%;
  height: 100%;
  padding: 1.4rem 1.6rem 2.2rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

/* Page titles */
.memory-title {
  font-family: var(--font-script);
  font-size: clamp(1.4rem, 3vw, 2rem);
  color: var(--ink);
  line-height: 1.3;
}

.memory-date {
  font-family: var(--font-hand);
  font-size: 0.95rem;
  color: var(--ink-faded);
  margin-top: 0.2rem;
}

.memory-quote {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1rem;
  color: var(--ink-light);
  line-height: 1.6;
}

.memory-note {
  font-family: var(--font-hand);
  font-size: 1.1rem;
  color: var(--ink);
  line-height: 1.5;
}

/* =========================================================
   Photo styles — physically attached feel
   ========================================================= */

/* Polaroid */
.polaroid {
  position: relative;
  background: #fefefe;
  padding: 10px 10px 36px;
  box-shadow: 2px 3px 10px var(--shadow-soft);
  transition: transform 0.4s var(--ease-gentle);
}

.polaroid:hover {
  transform: rotate(0deg) scale(1.02) !important;
}

.polaroid img,
.polaroid .photo-placeholder {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  background: var(--paper-dark);
}

.zoomable-image {
  cursor: zoom-in;
}

.polaroid-caption {
  font-family: var(--font-hand);
  font-size: 0.9rem;
  color: var(--ink-light);
  text-align: center;
  margin-top: 6px;
  position: absolute;
  bottom: 8px;
  left: 10px;
  right: 10px;
}

/* Torn paper photo frame */
.torn-photo {
  position: relative;
  padding: 6px;
  background: var(--paper-aged);
  box-shadow: 2px 4px 8px var(--shadow-soft);
}

.torn-photo::before,
.torn-photo::after {
  content: '';
  position: absolute;
  width: 20px;
  height: 20px;
  background: var(--paper);
  z-index: 2;
}

.torn-photo::before {
  top: -2px;
  left: -2px;
  clip-path: polygon(0 0, 100% 0, 0 100%);
}

.torn-photo::after {
  bottom: -2px;
  right: -2px;
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
}

.torn-photo img,
.torn-photo .photo-placeholder {
  width: 100%;
  display: block;
  filter: sepia(0.15);
}

/* Photo with paper corners */
.photo-corners {
  position: relative;
  display: inline-block;
}

.photo-corners::before,
.photo-corners::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border: 2px solid var(--paper-dark);
  z-index: 3;
}

.photo-corners::before {
  top: -4px;
  left: -4px;
  border-right: none;
  border-bottom: none;
}

.photo-corners::after {
  bottom: -4px;
  right: -4px;
  border-left: none;
  border-top: none;
}

/* Film strip */
.film-strip {
  display: flex;
  gap: 4px;
  background: #1a1a1a;
  padding: 8px 4px;
  position: relative;
}

.film-strip::before,
.film-strip::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 6px;
  background: repeating-linear-gradient(90deg,
      #1a1a1a 0px,
      #1a1a1a 8px,
      #333 8px,
      #333 12px);
}

.film-strip::before {
  top: 0;
}

.film-strip::after {
  bottom: 0;
}

.film-frame {
  flex: 1;
  aspect-ratio: 3/2;
  background: var(--paper-dark);
  border: 1px solid #333;
  overflow: hidden;
}

.film-frame img,
.film-frame video,
.film-frame .photo-placeholder {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Layered photo stack */
.photo-stack {
  position: relative;
}

.photo-stack .stack-item {
  position: absolute;
  box-shadow: 1px 2px 6px var(--shadow-soft);
  transition: transform 0.4s var(--ease-gentle);
}

.photo-stack .stack-item:nth-child(1) {
  z-index: 3;
}

.photo-stack .stack-item:nth-child(2) {
  z-index: 2;
}

.photo-stack .stack-item:nth-child(3) {
  z-index: 1;
}

/* Photo placeholder — EDITABLE: replace with your images */
.photo-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(135deg, var(--paper-aged) 0%, var(--paper-dark) 100%);
  color: var(--ink-faded);
  font-family: var(--font-hand);
  font-size: 0.85rem;
  text-align: center;
  min-height: 80px;
}

/* =========================================================
   Video frame — paper style
   ========================================================= */
.video-frame {
  position: relative;
  padding: 8px;
  background: var(--paper-aged);
  box-shadow: 2px 4px 10px var(--shadow-soft);
  display: inline-block;
}

.video-frame video {
  display: block;
  width: 100%;
  filter: sepia(0.1) contrast(1.02);
}

.video-frame .washi-tape {
  top: -8px;
  left: 20%;
  width: 60px;
}

/* =========================================================
   Audio players — vintage styles
   ========================================================= */

/* Vinyl record player */
.vinyl-player {
  position: relative;
  width: 138px;
  text-align: center;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
  transition: transform 0.3s ease, filter 0.3s ease;
  filter: drop-shadow(0 12px 20px rgba(20, 12, 8, 0.18));
}

.vinyl-player::after {
  content: '';
  position: absolute;
  inset: auto 8px -10px;
  height: 18px;
  background: radial-gradient(circle, rgba(20, 12, 8, 0.28) 0%, rgba(20, 12, 8, 0) 72%);
  filter: blur(12px);
  z-index: -1;
}

.vinyl-player:hover {
  transform: translateY(-4px) rotate(-1deg);
  filter: drop-shadow(0 16px 26px rgba(20, 12, 8, 0.24));
}

.vinyl-disc {
  width: 96px;
  height: 96px;
  margin: 0 auto;
  border-radius: 50%;
  background:
    radial-gradient(circle at 25% 25%, #f1e7cf 0%, #c9a970 12%, #6a3f1d 24%, #241510 38%, #111 48%, #2e2926 62%, #111 76%, #1b1712 100%);
  box-shadow:
    inset 0 0 0 4px rgba(255, 248, 221, 0.1),
    inset 0 0 24px rgba(0, 0, 0, 0.5),
    0 8px 22px rgba(20, 12, 8, 0.26);
  position: relative;
  cursor: pointer;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  overflow: hidden;
}

.vinyl-disc::before {
  content: '';
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  border: 1px dashed rgba(255, 248, 221, 0.24);
  box-shadow: inset 0 0 0 2px rgba(0, 0, 0, 0.12);
}

.vinyl-disc::after {
  content: '';
  position: absolute;
  inset: 22px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.3) 0 8%, transparent 9% 100%),
    repeating-radial-gradient(circle at center, rgba(255, 255, 255, 0.08) 0 1px, transparent 1px 8px);
  opacity: 0.3;
  pointer-events: none;
}

.vinyl-disc.playing {
  animation: vinyl-spin 3s linear infinite;
}

.vinyl-disc.paused {
  animation: none;
}

@keyframes vinyl-spin {
  to {
    transform: rotate(360deg);
  }
}

.vinyl-center {
  position: absolute;
  inset: 28px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fdf4d7 0%, #e2c08d 28%, #8a5529 100%);
  box-shadow: inset 0 0 0 2px rgba(255, 248, 221, 0.4), inset 0 0 12px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.vinyl-center-label {
  font-family: var(--font-hand);
  font-size: 0.72rem;
  line-height: 1.1;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: rgba(54, 34, 18, 0.86);
  text-align: center;
  padding: 0.2rem 0.4rem;
  z-index: 1;
}

.vinyl-image {
  display: none;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.vinyl-image.ready {
  display: block;
}

.vinyl-disc.has-image .vinyl-center-label {
  display: none;
}

.vinyl-icon {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 1.1rem;
  color: rgba(54, 34, 18, 0.8);
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.35);
  pointer-events: none;
}

.vinyl-disc.playing .vinyl-icon {
  opacity: 0;
}

.vinyl-disc.paused .vinyl-icon {
  opacity: 1;
}

.vinyl-label {
  font-family: var(--font-hand);
  font-size: 0.78rem;
  color: var(--ink-faded);
  margin: 0;
  letter-spacing: 0.06em;
}

/* Cassette tape player */
.cassette-player {
  position: relative;
  width: 160px;
  background: #2a2a2a;
  border-radius: 4px;
  padding: 12px;
  box-shadow: 2px 4px 8px var(--shadow-deep);
}

.cassette-window {
  background: #1a1a1a;
  border-radius: 2px;
  padding: 8px;
  margin-bottom: 8px;
  display: flex;
  gap: 20px;
  justify-content: center;
}

.cassette-reel {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 2px solid #555;
  position: relative;
}

.cassette-reel.playing {
  animation: vinyl-spin 2s linear infinite;
}

.cassette-reel::after {
  content: '';
  position: absolute;
  inset: 8px;
  background: #333;
  border-radius: 50%;
}

.cassette-label {
  font-family: var(--font-typewriter);
  font-size: 0.6rem;
  color: #aaa;
  text-align: center;
  letter-spacing: 0.05em;
}

.cassette-btn {
  width: 100%;
  padding: 4px;
  font-family: var(--font-hand);
  font-size: 0.85rem;
  color: #ccc;
  background: #333;
  border: none;
  cursor: pointer;
  margin-top: 4px;
}

.cassette-btn:hover {
  background: #444;
}

/* Walkman */
.walkman-player {
  position: relative;
  width: 140px;
  background: linear-gradient(180deg, #d4d0c8 0%, #b8b4ac 100%);
  border-radius: 6px;
  padding: 10px;
  box-shadow: 2px 4px 8px var(--shadow-deep);
}

.walkman-window {
  background: #1a3a2a;
  height: 30px;
  border-radius: 2px;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.walkman-tape {
  width: 50px;
  height: 16px;
  background: #333;
  border-radius: 2px;
}

.walkman-controls {
  display: flex;
  gap: 6px;
  justify-content: center;
}

.walkman-btn {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #888;
  border: 2px solid #666;
  color: #fff;
  font-size: 0.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.walkman-btn:hover {
  background: #999;
}

/* Old radio */
.radio-player {
  position: relative;
  width: 130px;
  background: linear-gradient(180deg, #8b7355 0%, #6b5344 100%);
  border-radius: 8px 8px 4px 4px;
  padding: 10px;
  box-shadow: 2px 4px 8px var(--shadow-deep);
}

.radio-dial {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: radial-gradient(circle, #f0e6d3 30%, #d4c4a8 100%);
  border: 3px solid #5c4a3a;
  margin: 0 auto 8px;
  position: relative;
  cursor: pointer;
}

.radio-dial::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 18px;
  background: var(--ink);
  transform-origin: bottom center;
  transform: translate(-50%, -100%) rotate(-30deg);
}

.radio-grille {
  height: 20px;
  background: repeating-linear-gradient(0deg,
      #4a3a2a 0px,
      #4a3a2a 2px,
      #5c4a3a 2px,
      #5c4a3a 4px);
  border-radius: 2px;
  margin-bottom: 6px;
}

.radio-label {
  font-family: var(--font-typewriter);
  font-size: 0.55rem;
  color: #f0e6d3;
  text-align: center;
}

/* =========================================================
   Letter & envelope
   ========================================================= */
.envelope {
  position: relative;
  width: 200px;
  height: 130px;
  cursor: pointer;
  transition: transform 0.4s var(--ease-gentle);
}

.envelope:hover {
  transform: scale(1.03);
}

.envelope-body {
  position: absolute;
  inset: 0;
  background: var(--paper-aged);
  border: 1px solid var(--paper-dark);
  box-shadow: 2px 4px 8px var(--shadow-soft);
}

.envelope-flap {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 65px;
  background: var(--paper);
  clip-path: polygon(0 0, 50% 100%, 100% 0);
  border-bottom: 1px solid var(--paper-dark);
  transition: transform 0.6s var(--ease-page);
  transform-origin: top center;
  z-index: 2;
}

.envelope.open .envelope-flap {
  transform: rotateX(180deg);
}

.letter-inside {
  position: absolute;
  top: 20px;
  left: 5px;
  right: 10px;
  background:
    radial-gradient(circle at 3% 12%, rgba(78, 38, 14, 0.38) 0 2px, transparent 8px),
    radial-gradient(circle at 96% 22%, rgba(55, 25, 8, 0.32) 0 2px, transparent 10px),
    radial-gradient(circle at 14% 98%, rgba(96, 50, 18, 0.35) 0 2px, transparent 12px),
    linear-gradient(90deg, rgba(88, 43, 15, 0.2), transparent 10%, transparent 90%, rgba(70, 31, 10, 0.23)),
    linear-gradient(180deg, rgba(91, 48, 17, 0.22), transparent 12%, transparent 86%, rgba(48, 22, 9, 0.26)),
    var(--paper);
  padding: 1rem;
  font-family: var(--font-hand);
  font-size: 0.95rem;
  line-height: 1.6;
  box-shadow: 0 -2px 4px var(--shadow-soft);
  transform: translateY(0);
  transition: transform 0.8s var(--ease-page) 0.3s;
  z-index: 1;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  border: 1px solid rgba(100, 56, 24, 0.35);
  clip-path: polygon(0.8% 3%,
      6% 0.8%,
      14% 2.2%,
      24% 0.6%,
      34% 1.8%,
      45% 0.4%,
      58% 1.5%,
      68% 0.5%,
      81% 1.8%,
      92% 0.7%,
      99% 3.8%,
      97.8% 14%,
      99.4% 24%,
      98% 36%,
      99.1% 49%,
      97.7% 63%,
      99.2% 75%,
      97.4% 88%,
      99% 97%,
      88% 99%,
      76% 97.7%,
      65% 99.4%,
      53% 98%,
      42% 99.1%,
      31% 97.5%,
      20% 99%,
      9% 97.8%,
      1.2% 99%,
      2.5% 88%,
      0.7% 77%,
      2% 64%,
      0.8% 51%,
      2.1% 38%,
      0.6% 25%,
      2.3% 14%);
  filter: drop-shadow(0 2px 3px rgba(40, 20, 8, 0.18));
}

.letter-inside::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(45, 19, 5, 0.34), rgba(136, 76, 24, 0.13) 4%, transparent 13%, transparent 87%, rgba(122, 67, 21, 0.15) 96%, rgba(42, 17, 5, 0.34)),
    linear-gradient(180deg, rgba(42, 17, 5, 0.33), rgba(136, 76, 24, 0.12) 5%, transparent 14%, transparent 86%, rgba(120, 63, 19, 0.16) 95%, rgba(38, 15, 4, 0.36));
  mix-blend-mode: multiply;
}

.envelope.open .letter-inside {
  transform: translateY(10px);
  max-height: 500px;
  opacity: 1;
  width: 250px;
}
/* =========================================================
   Image zoom
   ========================================================= */
.image-zoom-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: clamp(1rem, 4vw, 3rem);
  background: rgba(18, 10, 5, 0);
  cursor: zoom-out;
  opacity: 0;
  transition: opacity 0.22s ease, background 0.22s ease;
}

.image-zoom-overlay.visible {
  opacity: 1;
  background: rgba(18, 10, 5, 0.76);
}

.image-zoom-overlay.closing {
  opacity: 0;
  background: rgba(18, 10, 5, 0);
}

.zoomed-frame {
  position: relative !important;
  inset: auto !important;
  left: auto !important;
  right: auto !important;
  top: auto !important;
  bottom: auto !important;
  display: block !important;
  flex: 0 1 auto;
  width: min(var(--zoom-target-width, 560px), calc(100vw - 2rem)) !important;
  max-width: min(86vw, 760px) !important;
  max-height: 82vh !important;
  height: auto !important;
  margin: 0 !important;
  transform: scale(0.88) rotate(0deg) !important;
  transform-origin: center center !important;
  transition: transform 0.24s var(--ease-gentle);
  cursor: default;
  z-index: 1;
  overflow: visible;
}

.image-zoom-overlay.visible .zoomed-frame {
  transform: scale(1) rotate(0deg) !important;
}

.zoomed-frame img,
.zoomed-frame .photo-placeholder {
  width: 100% !important;
  height: auto;
  max-width: 100% !important;
  max-height: 72vh !important;
  object-fit: cover;
}


.zoomed-frame.photo-placeholder {
  width: min(var(--zoom-target-width, 560px), 72vw, 560px) !important;
  min-height: min(var(--zoom-source-height, 320px), 58vh, 420px);
}

/* =========================================================
   Stickers & doodles
   ========================================================= */
.sticker {
  position: absolute;
  font-size: 1.5rem;
  filter: drop-shadow(1px 1px 1px var(--shadow-soft));
  z-index: 5;
  transition: transform 0.3s var(--ease-gentle);
}

.sticker:hover {
  transform: scale(1.1) rotate(5deg);
}

.doodle {
  position: absolute;
  opacity: 0.4;
  pointer-events: none;
}

.doodle-heart {
  font-family: var(--font-hand);
  font-size: 1.2rem;
  color: var(--rose);
}

.doodle-arrow {
  font-family: var(--font-hand);
  font-size: 1.5rem;
  color: var(--ink-faded);
}

/* Botanical illustration */
.botanical {
  position: absolute;
  opacity: 0.35;
  pointer-events: none;
  font-size: 3rem;
  filter: saturate(0.4);
}

/* Leaf decoration */
.leaf-deco {
  position: absolute;
  font-size: 1.8rem;
  opacity: 0.45;
  filter: saturate(0.5) hue-rotate(20deg);
  pointer-events: none;
}
