:root {
  /* Typography compliance note: Source Serif 4** for life stories */
  --album-paper: #E8D8BE;
  --raised-ivory: #F4EAD8;
  --tea-shadow: #B89A72;
  --sepia-ink: #4F3828;
  --faded-umber: #8A6044;
  --dust-rose: #C99A8B;
  --oxidized-sage: #7C8A72;
  --photo-brown: #2E211A;
  --warm-depth: #D6BE99;
  --highlight: #FFF7E8;
  --display: "Alegreya Sans", "Trebuchet MS", sans-serif;
  --serif: "Source Serif 4", Georgia, serif;
  --label: "Noto Sans", Arial, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  color: var(--sepia-ink);
  background: radial-gradient(circle at 50% 0%, var(--raised-ivory) 0%, var(--album-paper) 46%, var(--warm-depth) 100%);
  font-family: var(--serif);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .24;
  background-image: radial-gradient(var(--faded-umber) .45px, transparent .45px), linear-gradient(90deg, rgba(255,247,232,.24) 1px, transparent 1px);
  background-size: 15px 15px, 72px 72px;
  mix-blend-mode: multiply;
}

.paper-field {
  position: relative;
  min-height: 100vh;
  padding: 28px 20px 64px;
  isolation: isolate;
}

.sunbeam {
  position: fixed;
  width: 42vw;
  height: 42vw;
  left: var(--beam-x, 50%);
  top: var(--beam-y, 24%);
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,247,232,.52), rgba(244,234,216,.20) 42%, transparent 70%);
  pointer-events: none;
  transition: left .45s ease, top .45s ease;
  z-index: -1;
}

.dust { position: fixed; width: 7px; height: 7px; border-radius: 50%; background: rgba(79,56,40,.18); filter: blur(.8px); animation: drift 18s infinite ease-in-out; pointer-events: none; }
.dust-one { left: 18%; top: 24%; }
.dust-two { right: 22%; top: 42%; animation-delay: -6s; }
.dust-three { left: 62%; top: 13%; animation-delay: -11s; }

@keyframes drift { 0%,100% { transform: translate3d(0,0,0) scale(.8); opacity: .25; } 50% { transform: translate3d(18px,-34px,0) scale(1.12); opacity: .58; } }

.album-tabs {
  position: fixed;
  left: 28px;
  top: 50%;
  transform: translateY(-50%);
  display: grid;
  gap: 10px;
  z-index: 5;
}

.tab {
  font-family: var(--label);
  font-size: 11px;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--faded-umber);
  text-decoration: none;
  padding: 11px 13px;
  border-radius: 999px;
  background: var(--album-paper);
  box-shadow: 7px 7px 16px rgba(184,154,114,.44), -7px -7px 16px rgba(255,247,232,.68);
  transition: transform .35s ease, box-shadow .35s ease, color .35s ease;
}

.tab.active, .tab:hover {
  color: var(--sepia-ink);
  transform: scale(1.035);
  box-shadow: inset 5px 5px 12px rgba(184,154,114,.42), inset -5px -5px 12px rgba(255,247,232,.72);
}

.memorial-alcove {
  width: min(760px, 100%);
  margin: 0 auto;
  position: relative;
}

.chapter {
  min-height: calc(100vh - 56px);
  margin: 0 auto 54px;
  padding: clamp(34px, 7vw, 72px);
  border-radius: 42px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  background: linear-gradient(145deg, rgba(244,234,216,.92), rgba(232,216,190,.88));
  box-shadow: 28px 28px 60px rgba(138,96,68,.24), -24px -24px 62px rgba(255,247,232,.65), inset 1px 1px 0 rgba(255,247,232,.82);
  transform-origin: 50% 18%;
  transition: transform .9s ease, filter .9s ease;
}

.chapter::before {
  content: "";
  position: absolute;
  inset: 18px;
  border-radius: 34px;
  border: 1px solid rgba(255,247,232,.48);
  box-shadow: inset 8px 8px 22px rgba(184,154,114,.18), inset -8px -8px 22px rgba(255,247,232,.54);
  pointer-events: none;
}

.chapter.turning { transform: rotateX(7deg) translateY(-8px) scale(.985); filter: sepia(.12); }
.entrance { text-align: center; overflow: hidden; }

.archive-label, figcaption, .stamp, cite {
  font-family: var(--label);
  letter-spacing: .16em;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--faded-umber);
}

.wordmark {
  font-family: var(--display);
  letter-spacing: .08em;
  font-weight: 700;
  color: var(--oxidized-sage);
  font-size: clamp(24px, 4vw, 38px);
}

h1, h2, h3 { font-family: var(--display); margin: 0; font-weight: 500; line-height: 1.05; }
h1 { margin-top: 12px; font-size: clamp(42px, 8vw, 76px); color: var(--sepia-ink); }
h2 { font-size: clamp(36px, 6vw, 58px); max-width: 620px; margin-bottom: 28px; }
h3 { font-size: 28px; color: var(--sepia-ink); }
p { font-size: 18px; line-height: 1.75; }

.raised-paper {
  background: var(--raised-ivory);
  box-shadow: 16px 16px 34px rgba(184,154,114,.38), -14px -14px 30px rgba(255,247,232,.78), inset 1px 1px 0 rgba(255,247,232,.92);
}

.inset-paper {
  background: rgba(232,216,190,.78);
  box-shadow: inset 10px 10px 22px rgba(184,154,114,.42), inset -10px -10px 22px rgba(255,247,232,.66);
}

.name-plaque {
  border-radius: 32px;
  padding: 32px clamp(22px, 5vw, 56px);
  animation: paperRise 1.4s ease both;
}

@keyframes paperRise { from { box-shadow: 5px 5px 13px rgba(184,154,114,.2), -4px -4px 12px rgba(255,247,232,.5); transform: translateY(8px); } to { box-shadow: 16px 16px 34px rgba(184,154,114,.38), -14px -14px 30px rgba(255,247,232,.78); transform: translateY(0); } }

.hero-arrangement { display: grid; grid-template-columns: 1.04fr .86fr; gap: 22px; align-items: center; margin: 34px 0 14px; }
.portrait-card { margin: 0; border-radius: 30px; padding: 18px; transform: translateY(-8px) rotate(-1.4deg); transition: transform .65s ease, box-shadow .65s ease; }
.photo-mat { position: relative; border-radius: 22px; padding: 16px; background: #D6BE99; box-shadow: inset 8px 8px 17px rgba(46,33,26,.28), inset -8px -8px 17px rgba(255,247,232,.36); }
.sepia-portrait { height: 300px; border-radius: 18px; position: relative; overflow: hidden; background: radial-gradient(circle at 50% 26%, #C99A8B 0 9%, transparent 10%), radial-gradient(ellipse at 50% 56%, #4F3828 0 18%, transparent 19%), linear-gradient(135deg, #2E211A, #8A6044 46%, #D6BE99); filter: sepia(.72) contrast(.88); }
.silhouette { position: absolute; left: 50%; bottom: 40px; width: 112px; height: 132px; transform: translateX(-50%); border-radius: 50% 50% 18px 18px; background: rgba(46,33,26,.58); box-shadow: 0 -82px 0 -34px rgba(46,33,26,.66); }
.portrait-glow { position: absolute; inset: -20%; background: radial-gradient(circle at 42% 20%, rgba(255,247,232,.36), transparent 44%); }
.glassine { position: absolute; inset: 6px 6px auto auto; width: 42%; height: 84%; border-radius: 10px; background: linear-gradient(115deg, rgba(255,247,232,.34), rgba(255,247,232,.08)); backdrop-filter: blur(1px); transform: rotate(2deg); }
.date-well { border-radius: 26px; padding: 28px; text-align: left; transform: translateY(22px) rotate(1.2deg); }
.date-well span { font-family: var(--label); text-transform: uppercase; letter-spacing: .18em; font-size: 11px; color: var(--oxidized-sage); }
.date-well strong { display: block; margin-top: 12px; font-family: var(--display); font-size: 31px; line-height: 1.1; font-weight: 500; }
.entrance-copy { max-width: 620px; margin: 28px auto 0; }

.album-corner { position: absolute; width: 76px; height: 76px; border-top: 2px solid rgba(138,96,68,.28); top: 34px; }
.corner-left { left: 34px; border-left: 2px solid rgba(138,96,68,.28); border-radius: 18px 0 0 0; }
.corner-right { right: 34px; border-right: 2px solid rgba(138,96,68,.28); border-radius: 0 18px 0 0; }

.fragment-stack { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; align-items: stretch; }
.memory-card, .index-slip { border-radius: 28px; padding: 28px; transition: transform .6s ease, box-shadow .6s ease; }
.memory-card:nth-child(2) { transform: translateY(32px); }
.negative-strip { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; padding: 16px; border-radius: 22px; background: var(--photo-brown); box-shadow: 14px 14px 28px rgba(46,33,26,.22), -10px -10px 24px rgba(255,247,232,.46); }
.negative-strip span { min-height: 72px; border-radius: 10px; background: linear-gradient(135deg, #8A6044, #D6BE99); opacity: .72; }

.quote-well { border-radius: 34px; padding: 34px; position: relative; }
.quote-well::before { content: ""; position: absolute; inset: 24px; background: repeating-linear-gradient(to bottom, transparent 0 31px, rgba(138,96,68,.16) 32px); pointer-events: none; }
blockquote { margin: 0; font-size: clamp(27px, 4vw, 42px); line-height: 1.35; position: relative; }
cite { display: block; margin-top: 22px; font-style: normal; position: relative; }
.voice-tabs { display: flex; gap: 14px; margin: 28px 0 14px; flex-wrap: wrap; }
.pressed-control, .turn-leaf, .place-pin { border: 0; color: var(--sepia-ink); cursor: pointer; font-family: var(--label); }
.pressed-control, .turn-leaf { border-radius: 999px; padding: 14px 20px; background: var(--album-paper); box-shadow: 8px 8px 18px rgba(184,154,114,.44), -8px -8px 18px rgba(255,247,232,.7); letter-spacing: .12em; text-transform: uppercase; }
.pressed-control.active, .pressed-control:active, .turn-leaf:active { box-shadow: inset 6px 6px 13px rgba(184,154,114,.44), inset -6px -6px 13px rgba(255,247,232,.68); }
.voice-note { color: var(--faded-umber); }

.thread-map { position: relative; min-height: 440px; border-radius: 36px; overflow: hidden; background-image: radial-gradient(circle at 20% 70%, rgba(124,138,114,.22), transparent 18%), radial-gradient(circle at 82% 25%, rgba(201,154,139,.28), transparent 17%); }
.thread-line { position: absolute; left: 17%; right: 17%; top: 52%; height: 2px; background: var(--tea-shadow); transform: rotate(-12deg); box-shadow: 0 0 0 1px rgba(255,247,232,.38); }
.place-pin { position: absolute; padding: 12px 15px; border-radius: 999px; background: var(--raised-ivory); box-shadow: 8px 8px 17px rgba(184,154,114,.42), -7px -7px 17px rgba(255,247,232,.72); transition: transform .55s ease, box-shadow .55s ease; }
.pin-a { left: 11%; top: 58%; }
.pin-b { left: 43%; top: 35%; }
.pin-c { right: 10%; top: 55%; }
.loupe { position: absolute; right: 16%; bottom: 12%; width: 152px; height: 152px; border-radius: 50%; display: grid; place-content: center; text-align: center; font-family: var(--display); font-size: 22px; color: var(--sepia-ink); background: rgba(255,247,232,.38); box-shadow: inset 8px 8px 18px rgba(184,154,114,.32), inset -8px -8px 18px rgba(255,247,232,.66), 10px 10px 24px rgba(138,96,68,.18); border: 1px solid rgba(255,247,232,.62); }
.loupe small { font-family: var(--label); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--faded-umber); }

.index-grid { display: grid; gap: 18px; }
.index-slip { display: grid; grid-template-columns: 170px 1fr; gap: 18px; align-items: center; }
.index-slip span { font-family: var(--display); font-size: 25px; color: var(--oxidized-sage); }
.index-slip p { margin: 0; }
.turn-leaf { align-self: center; margin-top: 32px; }

.memory-object.preview, .memory-object:hover { transform: scale(1.03) translateY(-4px); box-shadow: 22px 22px 42px rgba(184,154,114,.42), -16px -16px 34px rgba(255,247,232,.78); }
.portrait-card.preview, .portrait-card:hover { transform: scale(1.03) translateY(-12px) rotate(-1.4deg); }
.place-pin.preview, .place-pin:hover { transform: scale(1.06); }

@media (max-width: 900px) {
  .album-tabs { position: sticky; top: 12px; transform: none; left: auto; display: flex; justify-content: center; flex-wrap: wrap; margin-bottom: 18px; }
  .tab { font-size: 10px; padding: 9px 10px; }
}

@media (max-width: 680px) {
  .paper-field { padding: 12px 12px 42px; }
  .chapter { border-radius: 30px; padding: 34px 22px; }
  .hero-arrangement, .fragment-stack, .index-slip { grid-template-columns: 1fr; }
  .date-well, .memory-card:nth-child(2) { transform: none; }
  .sepia-portrait { height: 240px; }
  h1 { font-size: 42px; }
  .thread-map { min-height: 380px; }
  .place-pin { font-size: 11px; }
}
