/* =========================================================
   TOCCHELLA · Concept C v2 — Das echte Album
   ========================================================= */

:root {
  --paper:        #f0e4cb;
  --paper-warm:   #e6d4ae;
  --paper-deep:   #d8c294;
  --paper-edge:   #c5ad7a;
  --ink:          #2a1f15;
  --ink-soft:     rgba(42, 31, 21, 0.75);
  --ink-faint:    rgba(42, 31, 21, 0.35);
  --ink-ghost:    rgba(42, 31, 21, 0.15);
  --red:          #c14a3c;
  --red-dark:     #8a2f24;
  --green:        #5a7a3c;
  --green-dark:   #3d5727;
  --tape-yellow:  #e8d96b;
  --tape-green:   #b6c97c;
  --tape-pink:    #e5a5b3;
  --tape-blue:    #9bb8d6;
  --accent:       #c97b4a;
  --display:      'Fraunces', 'Times New Roman', serif;
  --hand:         'Caveat', cursive;
  --typewriter:   'Special Elite', monospace;
  --ease:         cubic-bezier(0.65, 0.05, 0.36, 1);
  --ease-out:     cubic-bezier(0.16, 1, 0.3, 1);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html {
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--display);
  line-height: 1.5;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
* { -webkit-tap-highlight-color: transparent; }

/* =========================================================
   Paper background
   ========================================================= */
.paper {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(ellipse 100% 80% at 50% 0%, rgba(201, 123, 74, 0.08), transparent 60%),
    radial-gradient(ellipse 100% 80% at 50% 100%, rgba(138, 47, 36, 0.05), transparent 60%),
    var(--paper);
}
.paper__stains {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 12% 18%, rgba(138, 95, 47, 0.06) 0%, transparent 18%),
    radial-gradient(circle at 88% 82%, rgba(138, 95, 47, 0.05) 0%, transparent 15%),
    radial-gradient(circle at 50% 50%, transparent 60%, rgba(138, 95, 47, 0.08) 100%);
  pointer-events: none;
}
.paper__texture {
  position: absolute;
  inset: 0;
  opacity: 0.5;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.65' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.3 0 0 0 0 0.2 0 0 0 0 0.1 0 0 0 0.5 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none;
}

/* =========================================================
   Album nav (page indicator)
   ========================================================= */
.album-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem clamp(1.25rem, 4vw, 3rem);
  font-family: var(--typewriter);
  font-size: 12px;
  letter-spacing: 0.05em;
  color: var(--ink-soft);
  pointer-events: none;
}
.album-nav__brand {
  font-family: var(--display);
  font-style: italic;
  font-size: 1.125rem;
  letter-spacing: 0.02em;
  color: var(--ink);
}
.album-nav__page {
  font-family: var(--typewriter);
  letter-spacing: 0.1em;
}
#page-num { font-weight: 700; color: var(--red); }

/* =========================================================
   Page base
   ========================================================= */
.album {
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
}
.page {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6rem clamp(1.25rem, 4vw, 3rem) 3rem;
  overflow: hidden;
}
.page.is-active { z-index: 2; }

/* =========================================================
   COVER PAGE
   ========================================================= */
.page--cover {
  background: var(--paper-warm);
}
.cover {
  position: relative;
  width: min(720px, 100%);
  aspect-ratio: 3 / 4;
  background: var(--paper-warm);
  box-shadow:
    0 2px 4px rgba(42, 31, 21, 0.15),
    0 20px 60px rgba(42, 31, 21, 0.25),
    inset 0 0 100px rgba(138, 95, 47, 0.1);
  display: grid;
  place-items: center;
  padding: 3rem;
  border: 1px solid var(--paper-edge);
}
.cover__border {
  position: absolute;
  inset: 1.5rem;
  border: 1px solid var(--ink);
  pointer-events: none;
}
.cover__inner {
  text-align: center;
  max-width: 540px;
}
.cover__top {
  font-family: var(--typewriter);
  font-size: 12px;
  letter-spacing: 0.2em;
  color: var(--ink-soft);
  margin-bottom: 1.5rem;
}
.cover__title {
  font-family: var(--hand);
  font-weight: 700;
  font-size: clamp(3rem, 10vw, 6.5rem);
  line-height: 0.9;
  color: var(--ink);
  letter-spacing: -0.03em;
  margin: 1rem 0 0;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.cover__t1, .cover__t2 {
  display: inline-block;
  opacity: 0;
  animation: handwrite 0.6s var(--ease-out) forwards;
}
.cover__t1 { animation-delay: 0.4s; color: var(--red); }
.cover__t2 { animation-delay: 0.7s; }
@keyframes handwrite {
  0% { opacity: 0; transform: translateY(20px) scale(0.95); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}
.cover__sub {
  margin-top: 1.5rem;
  font-family: var(--display);
  font-size: 1.5rem;
  font-style: italic;
  color: var(--ink-soft);
  letter-spacing: 0.05em;
}
.cover__sub-line {
  display: block;
  font-family: var(--display);
  font-size: clamp(2.75rem, 10vw, 6rem);
  font-style: normal;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.03em;
  line-height: 1;
  margin: 0.25rem 0 0.75rem;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.cover__sub-year {
  display: block;
  font-family: var(--typewriter);
  font-size: 0.875rem;
  letter-spacing: 0.3em;
  margin-top: 0.5rem;
  opacity: 0.7;
}
.cover__handwritten {
  margin-top: 1.5rem;
  font-family: var(--hand);
  font-size: 1.25rem;
  color: var(--ink-soft);
  line-height: 1.3;
}
.cover__stamps {
  margin-top: 2rem;
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}
.cover__corner {
  position: absolute;
  width: 30px;
  height: 30px;
  border: 2px solid var(--ink);
}
.cover__corner--tl {
  top: 12px;
  left: 12px;
  border-right: 0;
  border-bottom: 0;
}
.cover__corner--br {
  bottom: 12px;
  right: 12px;
  border-left: 0;
  border-top: 0;
}

/* =========================================================
   SPREAD (double page)
   ========================================================= */
.spread {
  display: grid;
  grid-template-columns: 1fr;
  gap: 3rem;
  max-width: 1100px;
  width: 100%;
  align-items: center;
}
.spread__left, .spread__right {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  position: relative;
}

/* =========================================================
   POLAROID
   ========================================================= */
.polaroid {
  position: relative;
  background: var(--paper-warm);
  padding: 0.75rem 0.75rem 3rem;
  box-shadow:
    0 1px 3px rgba(42, 31, 21, 0.2),
    0 8px 24px rgba(42, 31, 21, 0.25);
  width: 100%;
  max-width: 360px;
  transform: rotate(var(--rot, 0deg));
  transition: transform 0.5s var(--ease), box-shadow 0.5s var(--ease);
  opacity: 0;
  animation: polaroid-in 0.8s var(--ease-out) forwards;
}
.polaroid[data-float="1"] { --rot: -2deg; animation-delay: 0.1s; }
.polaroid[data-float="2"] { --rot: 4deg; animation-delay: 0.3s; }
.polaroid[data-float="3"] { --rot: -3deg; animation-delay: 0.45s; }
.polaroid[data-float="4"] { --rot: 3deg; animation-delay: 0.1s; }
.polaroid[data-float="5"] { --rot: -2deg; animation-delay: 0.3s; }
.polaroid[data-float="6"] { --rot: 2deg; animation-delay: 0.45s; }
.polaroid[data-float="7"] { --rot: -3deg; animation-delay: 0.1s; }
.polaroid[data-float="8"] { --rot: 4deg; animation-delay: 0.3s; }
.polaroid[data-float="9"] { --rot: -2deg; animation-delay: 0.45s; }

@keyframes polaroid-in {
  0% { opacity: 0; transform: rotate(0deg) translateY(40px) scale(0.95); }
  100% { opacity: 1; transform: rotate(var(--rot)) translateY(0) scale(1); }
}

.polaroid:hover, .polaroid:focus-visible {
  transform: rotate(0deg) scale(1.04);
  box-shadow:
    0 2px 6px rgba(42, 31, 21, 0.25),
    0 20px 40px rgba(42, 31, 21, 0.35);
  z-index: 10;
}

.polaroid__img {
  width: 100%;
  aspect-ratio: 3/4;
  object-fit: cover;
  object-position: center 22%;
  background: var(--paper-deep);
  filter: contrast(1.05) saturate(1.05) sepia(0.08);
}
.polaroid__caption {
  position: absolute;
  bottom: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--display);
  font-size: 0.875rem;
  color: var(--ink-soft);
  white-space: nowrap;
  text-align: center;
  font-style: italic;
}
.polaroid__caption--hand {
  font-family: var(--hand);
  font-size: 1.125rem;
  color: var(--ink);
  font-weight: 500;
  white-space: normal;
  width: 90%;
  bottom: 0.5rem;
}

.polaroid--big {
  max-width: 380px;
  padding: 1rem 1rem 3.5rem;
}
.polaroid--small {
  max-width: 220px;
  padding: 0.5rem 0.5rem 2.25rem;
}
.polaroid--small .polaroid__caption { font-size: 0.75rem; bottom: 0.5rem; }
.polaroid--small .polaroid__caption--hand { font-size: 0.875rem; }

/* =========================================================
   TAPE
   ========================================================= */
.tape {
  position: absolute;
  width: 80px;
  height: 24px;
  background: var(--tape-yellow);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.15),
    inset 0 0 0 1px rgba(0, 0, 0, 0.05);
  z-index: 5;
  opacity: 0.92;
  transform: rotate(var(--tape-rot, -30deg));
  /* torn edges effect */
  background-image:
    radial-gradient(circle at 0 50%, transparent 2px, currentColor 2.5px, currentColor 4px, transparent 5px),
    radial-gradient(circle at 100% 50%, transparent 2px, currentColor 2.5px, currentColor 4px, transparent 5px),
    linear-gradient(currentColor, currentColor);
  background-size: 5px 100%, 5px 100%, 100% 100%;
  background-position: left, right, center;
  background-repeat: no-repeat, no-repeat, no-repeat;
}
.tape--yellow { color: var(--tape-yellow); background-color: var(--tape-yellow); }
.tape--green  { color: var(--tape-green); background-color: var(--tape-green); }
.tape--pink   { color: var(--tape-pink); background-color: var(--tape-pink); }
.tape--blue   { color: var(--tape-blue); background-color: var(--tape-blue); }

.tape--tl {
  top: -10px;
  left: -20px;
  --tape-rot: -25deg;
}
.tape--tr {
  top: -10px;
  right: -20px;
  --tape-rot: 25deg;
}
.tape--bl {
  bottom: 60px;
  left: -20px;
  --tape-rot: -15deg;
}
.tape--br {
  bottom: 60px;
  right: -20px;
  --tape-rot: 15deg;
}

/* =========================================================
   STAMPS
   ========================================================= */
.stamp {
  display: inline-block;
  padding: 0.4rem 0.8rem;
  border: 2px solid currentColor;
  font-family: var(--typewriter);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--red);
  transform: rotate(-8deg);
  opacity: 0.85;
  background: rgba(193, 74, 60, 0.04);
  position: relative;
}
.stamp::before {
  content: '';
  position: absolute;
  inset: -2px;
  border: 1px dashed currentColor;
  opacity: 0.4;
}
.stamp--red { color: var(--red); border-color: var(--red-dark); }
.stamp--green { color: var(--green); border-color: var(--green-dark); transform: rotate(6deg); }
.stamp--rot { transform: rotate(-15deg); }
.stamp--small { font-size: 9px; padding: 0.25rem 0.6rem; }

/* =========================================================
   Handwritten elements
   ========================================================= */
.handwritten {
  font-family: var(--hand);
  color: var(--ink);
  font-weight: 500;
  line-height: 1.2;
}
.handwritten--big {
  font-size: clamp(2.5rem, 5vw, 3.5rem);
  font-weight: 700;
  line-height: 0.95;
  margin: 0;
}
.handwritten--medium { font-size: 1.5rem; }
.handwritten--small { font-size: 1rem; }
.handwritten__small {
  display: block;
  font-size: 1.125rem;
  font-weight: 400;
  color: var(--ink-soft);
  margin-top: 0.5rem;
  font-style: italic;
}

.bio {
  font-family: var(--display);
  font-style: italic;
  font-size: 1.0625rem;
  line-height: 1.5;
  color: var(--ink-soft);
  max-width: 38ch;
}
.bio strong {
  font-style: normal;
  font-weight: 600;
  color: var(--ink);
}
.bio--small { font-size: 0.9375rem; max-width: 30ch; }

.annotation {
  position: absolute;
  font-family: var(--hand);
  font-size: 1rem;
  color: var(--red-dark);
  white-space: nowrap;
  pointer-events: none;
  line-height: 1.2;
  z-index: 3;
}
.annotation--arrow {
  bottom: -2.5rem;
  left: 1rem;
}
.annotation--arrow::after {
  content: '';
  position: absolute;
  top: -1.5rem;
  left: 0.5rem;
  width: 1px;
  height: 1.5rem;
  background: var(--red-dark);
  transform: rotate(45deg);
}

/* =========================================================
   Sticker stack
   ========================================================= */
.sticker-stack {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-top: 1rem;
}
.sticker-stack .polaroid--small { max-width: none; }

/* Chibi polaroid — placeholder state */
.polaroid--chibi .polaroid__img--placeholder {
  background: var(--paper-deep);
  position: relative;
}
.polaroid--chibi .polaroid__img--placeholder::before {
  content: '?';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--display);
  font-style: italic;
  font-size: 3rem;
  color: var(--ink-faint);
}
.polaroid--chibi .polaroid__img--placeholder::after {
  content: 'kommt bald';
  position: absolute;
  bottom: 0.75rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--hand);
  font-size: 0.875rem;
  color: var(--ink-faint);
  white-space: nowrap;
}

/* =========================================================
   Address card (Email)
   ========================================================= */
.address-card {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto auto;
  gap: 0.25rem 0.75rem;
  padding: 1rem 1.25rem;
  background: var(--paper-warm);
  border: 1px dashed var(--ink-faint);
  font-family: var(--typewriter);
  font-size: 0.875rem;
  color: var(--ink);
  margin-top: 1rem;
  position: relative;
  transition: border-color 0.3s var(--ease), transform 0.3s var(--ease);
  min-height: 44px;
}
.address-card::before {
  content: '';
  position: absolute;
  top: 8px;
  right: 8px;
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, transparent 50%, var(--red) 50%);
  opacity: 0.5;
}
.address-card:active {
  border-color: var(--red);
  transform: scale(0.98);
}
.address-card__to {
  font-family: var(--hand);
  font-size: 1.125rem;
  color: var(--ink-soft);
  align-self: start;
}
.address-card__name {
  font-family: var(--hand);
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--ink);
  align-self: center;
}
.address-card__mail {
  grid-column: 1 / -1;
  font-size: 0.9375rem;
  color: var(--ink);
  letter-spacing: 0.02em;
}
.address-card__hint {
  grid-column: 1 / -1;
  font-family: var(--hand);
  font-size: 0.875rem;
  color: var(--ink-faint);
  font-style: italic;
}

/* =========================================================
   DIVIDER PAGE
   ========================================================= */
.page--divider {
  background: var(--paper-warm);
}
.divider {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
}
.divider__num {
  font-family: var(--display);
  font-weight: 300;
  font-style: italic;
  font-size: clamp(5rem, 15vw, 9rem);
  line-height: 1;
  color: var(--ink-ghost);
  letter-spacing: -0.05em;
}
.divider__handwritten {
  font-family: var(--hand);
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  color: var(--ink);
  margin: 0;
}
.divider__arrow {
  font-size: 2.5rem;
  color: var(--accent);
  animation: bounce 2s ease-in-out infinite;
}
@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(8px); }
}

/* =========================================================
   TIMELINE PAGE
   ========================================================= */
.page--timeline {
  flex-direction: column;
  background: var(--paper-warm);
  gap: 2rem;
}
.timeline {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  max-width: 500px;
  width: 100%;
  margin: 0 auto;
}
.timeline__entry {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 1.5rem;
  align-items: center;
  width: 100%;
  opacity: 0;
  animation: polaroid-in 0.8s var(--ease-out) forwards;
}
.timeline__entry:nth-of-type(1) { animation-delay: 0.1s; }
.timeline__entry:nth-of-type(2) { animation-delay: 0.3s; }
.timeline__entry:nth-of-type(3) { animation-delay: 0.5s; }
.timeline__entry--alt { grid-template-columns: 1fr auto; }
.timeline__year-num {
  font-family: var(--typewriter);
  font-size: 2.5rem;
  color: var(--ink);
  letter-spacing: 0.05em;
  display: block;
  line-height: 1;
}
.timeline__year-label {
  font-family: var(--display);
  font-style: italic;
  font-size: 0.875rem;
  color: var(--ink-faint);
}
.timeline__card {
  position: relative;
  background: var(--paper);
  padding: 1rem 1.25rem;
  border: 1px dashed var(--ink-faint);
  min-height: 80px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.25rem;
  box-shadow: 0 4px 12px rgba(42, 31, 21, 0.12);
  transform: rotate(-1deg);
}
.timeline__card .handwritten--big { font-size: 1.75rem; }
.timeline__entry--alt .timeline__card { transform: rotate(1deg); }
.timeline__entry:last-of-type .timeline__card { transform: rotate(-0.5deg); }
.timeline__sticker {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 50px;
  height: 16px;
  transform: rotate(35deg);
  z-index: 5;
}
.timeline__sticker--green { background: var(--tape-green); }
.timeline__sticker--pink { background: var(--tape-pink); }
.timeline__sticker--yellow { background: var(--tape-yellow); }
.timeline__line {
  width: 2px;
  height: 20px;
  background: var(--ink);
  opacity: 0.4;
}
.timeline__handwritten {
  margin-top: 1.5rem;
  font-family: var(--hand);
  font-size: 1.25rem;
  color: var(--ink-soft);
  font-style: italic;
  text-align: center;
}

/* =========================================================
   TREE PAGE
   ========================================================= */
.page--tree {
  flex-direction: column;
  background: var(--paper-warm);
  gap: 2rem;
}
.page__handwritten {
  font-family: var(--hand);
  font-size: 1.5rem;
  color: var(--ink-soft);
  text-align: center;
}
.page__handwritten--top { margin-bottom: 1rem; }

.tree {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  position: relative;
}
.tree__branch {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  position: relative;
}
.tree__branch--top {
  margin-bottom: 1rem;
}
.tree__branch--middle {
  margin: 0.5rem 0;
}
.tree__year {
  font-family: var(--typewriter);
  font-size: 11px;
  letter-spacing: 0.2em;
  color: var(--ink-faint);
}
.tree__line {
  width: 1px;
  height: 30px;
  background: var(--ink);
  opacity: 0.5;
}
.tree__line--down {
  height: 40px;
}
.tree__row {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  justify-content: center;
}
.tree__connector {
  width: 80px;
  height: 1px;
  background: var(--ink);
  opacity: 0.5;
  position: relative;
}
.tree__connector::before,
.tree__connector::after {
  content: '';
  position: absolute;
  top: 0;
  width: 1px;
  height: 60px;
  background: var(--ink);
  opacity: 0.5;
}
.tree__connector::before { left: 0; }
.tree__connector::after { right: 0; }

.tree__node {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 0.5rem;
  width: 140px;
}
.tree__node img {
  width: 140px;
  height: 175px;
  object-fit: cover;
  object-position: center 22%;
  background: var(--paper-deep);
  filter: contrast(1.05) saturate(1.05) sepia(0.08);
  box-shadow: 0 4px 12px rgba(42, 31, 21, 0.2);
  transform: rotate(var(--rot, 0deg));
  opacity: 0;
  animation: polaroid-in 0.8s var(--ease-out) forwards;
}
.tree__node--mirko { --rot: -3deg; animation-delay: 0.1s; }
.tree__node--anja { --rot: 3deg; animation-delay: 0.3s; }
.tree__node--neo { --rot: -2deg; animation-delay: 0.5s; }
.tree__node--big { width: 180px; }
.tree__node--big img {
  width: 180px;
  height: 225px;
}
.tree__name {
  font-family: var(--hand);
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--ink);
}
.tree__role {
  font-family: var(--typewriter);
  font-size: 10px;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  text-transform: uppercase;
}
.tree__heart {
  font-family: var(--hand);
  font-size: 2.5rem;
  color: var(--red);
  font-weight: 700;
}
.tree__row--parents {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 1rem;
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
}
.tree__handwritten {
  font-family: var(--hand);
  font-size: 1.25rem;
  color: var(--ink-soft);
  font-style: italic;
  margin-top: 1rem;
}

/* =========================================================
   ENVELOPE
   ========================================================= */
.page--envelope {
  flex-direction: column;
  background: var(--paper-warm);
  gap: 2rem;
}

.envelope {
  position: relative;
  width: min(420px, 100%);
  aspect-ratio: 4/3;
  background: linear-gradient(135deg, #f4e8d0 0%, #e8d8b8 100%);
  border-radius: 4px;
  box-shadow:
    0 4px 12px rgba(42, 31, 21, 0.2),
    0 20px 40px rgba(42, 31, 21, 0.25);
  cursor: pointer;
  overflow: hidden;
  transition: transform 0.6s var(--ease);
}
.envelope:active { transform: scale(0.98); }

.envelope__back {
  position: absolute;
  inset: 0;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  opacity: 0.6;
}
.envelope__stamps {
  display: flex;
  gap: 0.5rem;
  align-self: flex-end;
}
.envelope__from {
  align-self: flex-start;
}
.envelope__from p {
  font-family: var(--hand);
  font-size: 1rem;
  color: var(--ink-soft);
  margin-top: 0.25rem;
}

.envelope__flap {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50%;
  background: linear-gradient(180deg, #f0e0bc 0%, #e0cc9c 100%);
  clip-path: polygon(0 0, 100% 0, 50% 80%);
  transform-origin: top center;
  transition: transform 0.8s var(--ease-out);
  z-index: 3;
  filter: drop-shadow(0 2px 4px rgba(42, 31, 21, 0.2));
}
.envelope.is-open .envelope__flap {
  transform: rotateX(180deg);
}

.envelope__front {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 1rem;
  z-index: 2;
}
.envelope__to {
  text-align: left;
  margin-left: -3rem;
  margin-top: 2rem;
}
.envelope__name {
  font-family: var(--display);
  font-style: italic;
  font-size: 2rem;
  font-weight: 400;
  color: var(--ink);
  margin-top: 0.25rem;
  line-height: 1;
}
.envelope__address {
  font-family: var(--mono), monospace;
  font-size: 0.875rem;
  color: var(--ink-soft);
  margin-top: 0.5rem;
  letter-spacing: 0.05em;
}

.envelope__hint {
  position: absolute;
  bottom: -2rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--hand);
  font-size: 1.125rem;
  color: var(--ink-soft);
  white-space: nowrap;
  transition: opacity 0.4s var(--ease);
}
.envelope.is-open .envelope__hint { opacity: 0; }

.envelope-link {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

/* =========================================================
   BACK COVER
   ========================================================= */
.page--back {
  background: var(--paper-warm);
}
.back-cover {
  text-align: center;
  max-width: 500px;
}
.back-cover__sign {
  font-family: var(--hand);
  font-size: 2.5rem;
  color: var(--ink);
  margin-bottom: 2rem;
}
.back-cover__line {
  font-family: var(--hand);
  font-size: 1.5rem;
  color: var(--ink-soft);
  margin-bottom: 0.5rem;
  line-height: 1.4;
}
.back-cover__sigs {
  margin-top: 3rem;
  display: flex;
  justify-content: center;
  gap: 2rem;
  flex-wrap: wrap;
}
.back-cover__sig {
  font-family: var(--hand);
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--ink);
  transform: rotate(-3deg);
}
.back-cover__sig:nth-child(2) { transform: rotate(2deg); }
.back-cover__sig:nth-child(3) { transform: rotate(-1deg); }
.back-cover__sealed {
  margin-top: 3rem;
  display: flex;
  justify-content: center;
  gap: 1rem;
  flex-wrap: wrap;
}

/* =========================================================
   Toast
   ========================================================= */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translate(-50%, 100px);
  padding: 0.75rem 1.25rem;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--typewriter);
  font-size: 12px;
  letter-spacing: 0.08em;
  border-radius: 100px;
  z-index: 9998;
  opacity: 0;
  transition: opacity 0.35s var(--ease), transform 0.35s var(--ease);
  pointer-events: none;
  white-space: nowrap;
  max-width: calc(100vw - 2rem);
}
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

::selection { background: var(--red); color: var(--paper); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  html { scroll-behavior: auto; }
}

/* =========================================================
   TABLET (≥ 800px) — spread side by side
   ========================================================= */
@media (min-width: 800px) {
  .spread {
    grid-template-columns: 1fr 1fr;
    gap: 4rem;
    max-width: 1100px;
  }
  .page--anja .spread {
    grid-template-columns: 1fr 1fr;
  }
  .sticker-stack {
    grid-template-columns: 1fr 1fr;
  }
}

/* =========================================================
   Mobile tweaks
   ========================================================= */
@media (max-width: 600px) {
  .cover__title { font-size: 4rem; }
  .address-card { font-size: 0.8125rem; }
  .address-card__name { font-size: 1.25rem; }
  .tree__node img { width: 110px; height: 140px; }
  .tree__node { width: 110px; }
  .tree__node--big img { width: 140px; height: 175px; }
  .tree__node--big { width: 140px; }
  .tree__row { gap: 0.5rem; }
  .tree__connector { width: 30px; }
  .lang-switch { padding: 3px 5px; gap: 3px; }
  .lang-switch__item { width: 22px; height: 14px; }
  .album-nav__brand { display: none; }
  .site-footer { padding: 2rem 1.25rem 1.5rem; }
  .site-footer__grid { grid-template-columns: 1fr; gap: 1.5rem; }
}

/* =========================================================
   Language switcher (fixed top-right)
   ========================================================= */
.lang-switch {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px 6px;
  background: rgba(255, 247, 232, 0.85);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 999px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08);
  pointer-events: auto;
}
.lang-switch__item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 18px;
  border-radius: 2px;
  opacity: 0.45;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.lang-switch__item:hover { opacity: 1; transform: translateY(-1px); }
.lang-switch__item.is-active {
  opacity: 1;
  box-shadow: 0 0 0 2px var(--red);
}
.lang-switch__item svg { display: block; width: 100%; height: 100%; }

/* =========================================================
   Site footer
   ========================================================= */
.site-footer {
  margin-top: 0;
  padding: 3rem 2rem 2rem;
  background: var(--paper-warm);
  border-top: 1px solid var(--paper-edge);
  color: var(--ink-soft);
  font-family: var(--typewriter);
  font-size: 0.85rem;
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
}
.site-footer__grid {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr;
  gap: 2rem;
  max-width: 1100px;
  margin: 0 auto;
}
.site-footer h3 {
  font-family: var(--hand);
  font-size: 1.4rem;
  color: var(--ink);
  margin: 0 0 0.75rem;
}
.site-footer p { margin: 0.25rem 0; line-height: 1.6; }
.site-footer a {
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid var(--paper-edge);
  transition: color 0.2s, border-color 0.2s;
}
.site-footer a:hover {
  color: var(--red);
  border-bottom-color: var(--red);
}
.site-footer__brand strong {
  font-family: var(--display);
  font-size: 1.2rem;
  color: var(--ink);
  letter-spacing: 0.02em;
}
.site-footer__legal {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--paper-edge);
  font-size: 0.78rem;
  font-style: italic;
  text-align: center;
  max-width: 1100px;
  margin-left: auto;
  margin-right: auto;
}
.site-footer__legal .footer-ds-link {
  font-style: normal;
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
  text-decoration-color: rgba(107, 24, 24, 0.4);
  transition: text-decoration-color .15s ease;
}
.site-footer__legal .footer-ds-link:hover {
  text-decoration-color: #6b1818;
}

/* =========================================================
   Mail-protection (anti-scraper ROT13 + reveal on click)
   ========================================================= */
.mail-link {
  display: inline-block;
  filter: blur(2px);
  opacity: 0.85;
  transition: filter 0.3s ease, opacity 0.3s ease;
  cursor: pointer;
  padding: 1px 4px;
  border-radius: 3px;
  background: rgba(0, 0, 0, 0.03);
  border-bottom: 1px dashed rgba(0, 0, 0, 0.2);
  user-select: none;
}
.mail-link:hover {
  filter: blur(0);
  opacity: 1;
  background: rgba(193, 74, 60, 0.08);
  border-bottom-color: var(--red);
}
.mail-link.revealed {
  filter: none !important;
  opacity: 1;
  background: rgba(193, 74, 60, 0.08);
  border-bottom: 1px solid var(--red);
}
.mail-card {
  cursor: pointer;
}
.mail-card:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 4px;
}
.mail-toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  padding: 0.5rem 1rem;
  border-radius: 999px;
  font-family: var(--typewriter);
  font-size: 0.85rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 9999;
}
.mail-toast.visible { opacity: 1; }
