/* Muisto: the app's album materials on the web. Day is cream laid paper with dark ink; night is
   the black paper of an old photo album with chalk-white ink, oxblood ribbons and gilt. */

@font-face { font-family: "Figtree"; src: url("../assets/fonts/figtree-wght.woff2") format("woff2"); font-style: normal; font-weight: 300 900; font-display: swap; }

:root {
  --paper: #F3EBDD;
  --ink: #2A2420;
  --quiet: #6B5E54;
  --faint: rgba(107, 94, 84, 0.5);
  --rule: rgba(42, 36, 32, 0.16);
  --oxblood: #85302B;
  --card: #FCF9F4;
  --cloth: #3B6654;
  --gilt-light: #F7E099;
  --gilt-dark: #B38738;
  --gilt: linear-gradient(135deg, #F7E099, #B38738 38%, #F2D68C 64%, #A37A30);
  --night-paper: #22201E;
  --chalk: #EDE6D6;
  --night-quiet: #BDB09C;
  --night-oxblood: #DB7566;
  --shadow: rgba(64, 38, 20, 0.3);
  --serif: "EB Garamond", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --caps: "Alegreya SC", "EB Garamond", Georgia, serif;
  --hand: "Kalam", "Bradley Hand", cursive;
  --numerals: "Cinzel", "EB Garamond", serif;
  --page-max: 1180px;
  --gutter: clamp(16px, 4vw, 48px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: auto; }
body {
  margin: 0;
  background: var(--night-paper) url("img/paper-night.webp") repeat;
  background-size: 320px;
  color: var(--ink);
  font-family: var(--serif);
  font-size: clamp(18px, 1.15vw + 10px, 21px);
  line-height: 1.6;
  font-kerning: normal;
  font-variant-numeric: oldstyle-nums proportional-nums;
  text-rendering: optimizeLegibility;
}
img, canvas, svg { display: block; max-width: 100%; }
a { color: inherit; }
button { font: inherit; color: inherit; }
p { margin: 0; }

.skip {
  position: absolute; left: -9999px; top: 8px; z-index: 50;
  background: var(--card); color: var(--ink); padding: 10px 16px; border-radius: 8px;
}
.skip:focus { left: 12px; }
:focus-visible { outline: 2px solid var(--gilt-dark); outline-offset: 3px; border-radius: 6px; }

/* ------------------------------------------------------------------ top bar */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 30;
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px var(--gutter);
  color: var(--chalk);
  transition: color 0.4s, background-color 0.4s, box-shadow 0.4s;
  pointer-events: none;
}
.topbar > * { pointer-events: auto; }
.topbar.scrolled {
  background: rgba(34, 32, 30, 0.82);
  backdrop-filter: blur(10px) saturate(1.2);
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
}
.topbar.on-day {
  color: var(--ink);
  background: rgba(243, 235, 221, 0.86);
  backdrop-filter: blur(10px) saturate(1.2);
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
  box-shadow: 0 1px 0 var(--rule);
}
.studio-link {
  display: inline-flex; align-items: center; gap: 10px;
  text-decoration: none; font-family: var(--caps); font-size: 17px; letter-spacing: 0.06em;
}
.studio-link img { border-radius: 7px; }

/* ------------------------------------------------------------------ hero: the book on a night desk, the shelf beneath */
.hero { position: relative; color: var(--chalk); padding-bottom: clamp(56px, 7vw, 96px); overflow: clip; }
.hero-stage {
  position: relative; z-index: 3; max-width: 1480px; margin: 0 auto;
  display: grid; grid-template-columns: minmax(300px, 0.34fr) 1fr; align-items: center; column-gap: clamp(20px, 3vw, 48px);
  height: clamp(620px, 100svh, 960px); padding: 76px var(--gutter) 8px;
}
/* a short window: the words close up so the book keeps its room */
@media (min-width: 861px) and (max-height: 820px) {
  .app-icon { width: 64px; height: 64px; border-radius: 15px; margin-bottom: 14px; }
  .hero h1 { font-size: min(8.4vw, 13vh); }
  .tagline { margin-top: 10px; font-size: clamp(21px, 2vw, 26px); }
  .lede { font-size: 17px; }
  .status { margin-top: 14px; }
}
@media (min-width: 861px) and (max-height: 600px) {
  .hero-copy > .app-icon { display: none; }
}
.lamp {
  position: absolute; inset: 0; pointer-events: none; z-index: 0;
  background:
    radial-gradient(48% 46% at 64% 34%, rgba(255, 214, 160, 0.17), rgba(255, 214, 160, 0) 70%),
    radial-gradient(60% 30% at 50% 88%, rgba(255, 214, 160, 0.08), rgba(255, 214, 160, 0) 70%),
    radial-gradient(120% 60% at 50% 110%, rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0) 60%);
}
.motes { position: absolute; left: 0; top: 0; width: 100%; height: 100%; z-index: 2; pointer-events: none; }
.hero-copy { position: relative; z-index: 3; max-width: 30rem; }
.app-icon { width: 84px; height: 84px; border-radius: 19px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); margin-bottom: 22px; }
.hero h1 {
  margin: 0; font-weight: 500; letter-spacing: -0.015em; line-height: 0.92;
  font-size: clamp(64px, 8.4vw, 136px);
}
.tagline { margin-top: 18px; font-style: italic; font-size: clamp(23px, 2.2vw, 32px); line-height: 1.25; color: var(--chalk); }
.lede { margin-top: 14px; color: var(--night-quiet); max-width: 26rem; }
.status {
  display: inline-block; margin-top: 22px; padding: 5px 16px 7px; border-radius: 999px;
  font-style: italic; font-size: 17px; color: var(--chalk); border: 1px solid rgba(237, 230, 214, 0.42);
}

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; border: 0;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}

.book-area { position: relative; z-index: 1; height: clamp(460px, 74svh, 780px); max-width: 1180px; margin: clamp(10px, 2vw, 26px) auto 0; display: grid; grid-template-rows: minmax(0, 1fr) auto; }
.book-wrap { position: relative; min-height: 0; }
.book-canvas { width: 100%; height: 100%; cursor: pointer; }
.book-fallback { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 0; }
.book-fallback[hidden] { display: none; }
.book-fallback canvas { width: auto; height: 82%; box-shadow: 0 20px 40px rgba(0, 0, 0, 0.5); }
/* a book changes: the old one is lifted away, the new one set down on the desk */
.book-wrap.leave { animation: lift-away 0.32s cubic-bezier(.5, 0, .75, .2) forwards; }
.book-wrap.arrive { animation: set-down 0.95s cubic-bezier(.16, .84, .24, 1) both; }
@keyframes lift-away { to { opacity: 0; transform: translateY(-26px) scale(1.03); } }

.book-bar { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 4px 0 6px; text-align: center; }
.book-caption { min-height: 1.6em; color: var(--night-quiet); font-size: 18px; }
.book-caption .chosen-name { font-family: var(--caps); font-size: 21px; letter-spacing: 0.04em; color: var(--chalk); }
.book-caption .chosen-blurb { font-style: italic; }
.flip {
  appearance: none; border: 0; cursor: pointer; display: inline-flex; align-items: center; gap: 10px;
  padding: 11px 24px 12px 20px; border-radius: 999px;
  font-weight: 500; font-size: 19px; color: #241D12; background: var(--gilt);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.45);
  transition: transform 0.2s, opacity 0.3s, background 0.3s, color 0.3s;
}
.flip-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px 18px; }
.flip-hint { margin: 0; font-style: italic; font-size: 19px; color: var(--night-quiet); }
.flip-or { font-size: 15px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--night-quiet); }
@media (max-width: 640px) { .flip-row { flex-direction: column; gap: 8px; } }
.flip svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
.flip:hover:not(:disabled) { transform: translateY(-2px); }
.flip:active:not(:disabled) { transform: translateY(1px) scale(0.98); }
.flip:disabled { cursor: default; opacity: 0.6; }
.flip[data-state="ready"] { animation: beckon 2.6s ease-in-out 0.4s infinite; }
.flip[data-state="flipping"] { background: transparent; color: var(--chalk); box-shadow: inset 0 0 0 1.5px rgba(237, 230, 214, 0.55); }
.flip[data-state="flipping"] svg { animation: leaf 1.4s ease-in-out infinite; }
@keyframes beckon {
  0%, 100% { box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 0 0 0 rgba(247, 224, 153, 0.5); }
  50% { box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.45), 0 0 0 10px rgba(247, 224, 153, 0); }
}
@keyframes leaf { 50% { transform: scaleX(-1); } }

/* the page opens: the lamp comes up, the book is set down on the desk, the words follow */
.hero .lamp { animation: lamp-on 2.2s ease-out both; }
.hero-copy > * { animation: rise 1s cubic-bezier(.2, .8, .2, 1) both; }
.hero-copy > .app-icon { animation-delay: 0.35s; }
.hero-copy > h1 { animation-delay: 0.45s; }
.hero-copy > .tagline { animation-delay: 0.6s; }
.hero-copy > .lede { animation-delay: 0.7s; }
.hero-copy > .status { animation-delay: 0.8s; }
@keyframes lamp-on { 0% { opacity: 0; } 35% { opacity: 0.55; } 45% { opacity: 0.4; } 100% { opacity: 1; } }
@keyframes set-down { from { opacity: 0; transform: translateY(-38px) scale(1.035); } 40% { opacity: 1; } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translateY(18px); } to { opacity: 1; transform: none; } }

/* the shelf on the desk, under the book */
.styles-desk { position: relative; z-index: 3; max-width: var(--page-max); margin: clamp(30px, 5vw, 70px) auto 0; padding: 0 var(--gutter); }
.styles-desk .section-head { max-width: 46rem; }
.styles-desk .section-head p { color: var(--night-quiet); }
.styles-desk .section-head .lead-in { display: block; margin-bottom: 4px; font-weight: 600; font-size: 1.32em; line-height: 1.25; color: var(--chalk); }
.book-wrap.turnable canvas { cursor: grab; }
.book-wrap.turnable canvas:active { cursor: grabbing; }
.styles-desk .double-rule { border-color: rgba(237, 230, 214, 0.7); border-bottom-color: rgba(237, 230, 214, 0.45); }
.styles-desk .glyph { color: var(--night-oxblood); }


/* ------------------------------------------------------------------ the film on iPhone Duo */
.reel { position: relative; z-index: 1; height: 100%; min-height: 0; opacity: 0; transition: opacity 0.9s ease 0.2s; }
.reel.ready { opacity: 1; }
.reel-canvas { position: absolute; left: 0; top: 0; transform-origin: 0 0; perspective: 2400px; perspective-origin: 50% 40%; }
/* the hinge, a strip of brushed metal down the shut phone's spine */
.r-hinge {
  position: absolute; left: calc(var(--pw) - 6px); top: 4px; bottom: 4px; width: 8px; border-radius: 4px 0 0 4px; z-index: 0;
  background: linear-gradient(90deg, #8A93A5, #DCE1EA 35%, #A7AFBE 60%, #5E6778); transform: translateZ(-1px);
}
.r-floor {
  position: absolute; left: 0; height: 46px; margin-top: -10px; border-radius: 50%; pointer-events: none;
  background: radial-gradient(closest-side, rgba(0, 0, 0, 0.62), rgba(0, 0, 0, 0.3) 55%, rgba(0, 0, 0, 0));
  filter: blur(6px);
}
.r-duo { position: absolute; width: calc(var(--pw) * 2); height: var(--ph); transform-style: preserve-3d; will-change: transform; }
.r-panel {
  position: absolute; top: 0; width: var(--pw); height: var(--ph);
  background: linear-gradient(150deg, #4C5870 0%, #26304A 22%, #1A2134 55%, #2C3751 82%, #131A28 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.28), inset 0 0 0 2.4px #0A0D14;
}
.r-scr { position: absolute; overflow: hidden; background: #000; }
.r-right { left: var(--pw); border-radius: 7px 36px 36px 7px; }
.r-right .r-scr { left: 0; right: var(--bz); top: var(--bz); bottom: var(--bz); border-radius: 0 26px 26px 0; }
.r-flap { position: absolute; left: 0; top: 0; width: var(--pw); height: var(--ph); transform-origin: 100% 50%; transform-style: preserve-3d; }
.r-face { left: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.r-in { border-radius: 36px 7px 7px 36px; }
.r-in .r-scr { left: var(--bz); right: 0; top: var(--bz); bottom: var(--bz); border-radius: 26px 0 0 26px; }
.r-out { transform: rotateY(180deg); border-radius: 7px 36px 36px 7px; }
.r-out .r-scr { inset: var(--bz); border-radius: 3px 28px 28px 3px; }
.r-img, .r-lf { position: absolute; inset: 0; background-size: 200% 100%; background-repeat: no-repeat; background-color: #EFE6D6; }
.r-cover { position: absolute; inset: 0; background: #2A2420 center / cover no-repeat; will-change: filter; }
.r-gloss { position: absolute; top: -10%; bottom: -10%; left: 0; width: 60%; pointer-events: none; mix-blend-mode: screen; background: linear-gradient(90deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0.16) 45%, rgba(255, 255, 255, 0.05) 60%, rgba(255, 255, 255, 0)); }
.r-cam { position: absolute; right: 7%; top: 3.6%; width: 7.4%; aspect-ratio: 1; border-radius: 50%; background: radial-gradient(circle at 40% 38%, #2C3448 0 18%, #07080C 30%); box-shadow: 0 0 0 1.5px #0B0D12; }
.r-dim { position: absolute; inset: 0; border-radius: inherit; background: #05070C; opacity: 0; pointer-events: none; }
.r-shade { position: absolute; inset: 0; opacity: 0; pointer-events: none; background: linear-gradient(90deg, rgba(20, 12, 4, 0.55), rgba(20, 12, 4, 0.15) 45%, rgba(20, 12, 4, 0) 80%); }
.r-shade-l { background: linear-gradient(270deg, rgba(20, 12, 4, 0.55), rgba(20, 12, 4, 0.15) 45%, rgba(20, 12, 4, 0) 80%); }
/* the inner screen, flat, for the pages to turn across */
.r-display { position: absolute; left: var(--bz); right: var(--bz); top: var(--bz); bottom: var(--bz); border-radius: 26px; overflow: hidden; pointer-events: none; transform: translateZ(0.6px); }
.r-crease { position: absolute; left: 50%; top: 0; bottom: 0; width: 34px; margin-left: -17px; background: linear-gradient(90deg, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.1) 46%, rgba(255, 255, 255, 0.06) 54%, rgba(0, 0, 0, 0)); }
.r-pages { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; }
.r-leaf { position: absolute; left: 50%; top: 0; width: 50%; height: 100%; opacity: 0; }
.r-lf { transform-origin: 0 50%; }
.r-lf-back { left: -100%; right: 100%; transform-origin: 100% 50%; }
.r-lf i { position: absolute; inset: 0; opacity: 0; }
.r-lf-front i { background: linear-gradient(90deg, rgba(30, 18, 6, 0.6), rgba(30, 18, 6, 0.1) 60%, rgba(255, 255, 255, 0.08)); }
.r-lf-back i { background: linear-gradient(270deg, rgba(30, 18, 6, 0.55), rgba(30, 18, 6, 0.08) 60%, rgba(255, 255, 255, 0.06)); }

.r-world { position: absolute; inset: 0; transform-style: preserve-3d; transform-origin: 50% 45%; }
.r-hint, .r-stylename { position: absolute; margin: 0; white-space: nowrap; text-align: center; color: #F4EBDA; opacity: 0; }
.r-hint { font-family: var(--serif); font-weight: 500; font-size: 44px; line-height: 1.05; letter-spacing: -0.01em; }
.r-stylename .r-name { display: block; line-height: 1.05; }
.reel-canvas.m .r-hint { font-size: 46px; }
.reel-canvas.m .r-hint span { display: block; }

/* the headline over each scene */
.r-fan, .r-priv { position: absolute; inset: 0; visibility: hidden; }
.r-head {
  position: absolute; left: 50%; margin: 0; z-index: 5; text-align: center; white-space: nowrap; transform: translateX(-50%);
  font-family: var(--serif); font-weight: 500; font-size: 70px; line-height: 0.98; letter-spacing: -0.015em; color: #F6EEDF;
  text-shadow: 0 6px 30px rgba(0, 0, 0, 0.55);
}
.r-head span { display: block; }
.r-head span + span { font-style: italic; color: #E8C877; }
.r-head1 { font-size: 58px; }
.r-head0b { font-size: 46px; }
.r-head2 { font-size: 62px; }
.r-head1 span { display: inline-block; }
.reel-canvas.m .r-head { font-size: 64px; }
.reel-canvas.m .r-head2 { font-size: 47px; }
.reel-canvas.m .r-head1 { font-size: 58px; }
.reel-canvas.m .r-head1 span { display: block; }
.reel-canvas.m .r-head0b { font-size: 35px; }
.r-more { position: absolute; margin: 0; white-space: nowrap; opacity: 0; transform-origin: 50% 50%; }
.r-more span {
  display: inline-block; padding: 8px 24px 11px; border-radius: 999px; font-family: var(--serif); font-style: italic; font-weight: 500; font-size: 34px; line-height: 1;
  color: #3B2810; background: linear-gradient(135deg, #F7E099, #C99A45 40%, #F2D68C 68%, #B38738); box-shadow: 0 8px 22px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}
.reel-canvas.m .r-more span { font-size: 38px; }
.r-edit { position: absolute; inset: 0; visibility: hidden; }
.r-wid { position: absolute; inset: 0; visibility: hidden; }
.r-widphone {
  position: absolute; padding: var(--bz); border-radius: 7px 36px 36px 7px; z-index: 2; will-change: transform;
  background: linear-gradient(150deg, #4C5870 0%, #26304A 22%, #1A2134 55%, #2C3751 82%, #131A28 100%);
  box-shadow: 0 30px 50px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.r-widscr { width: 100%; height: 100%; border-radius: 3px 28px 28px 3px; background: #2A2620 url("img/shots/widgets-duo.webp") 0 0 / 100% 100% no-repeat; }
.r-wg { position: absolute; display: block; background-image: url("img/shots/widgets-duo.webp"); background-repeat: no-repeat; will-change: transform; }

.r-edphone {
  position: absolute; padding: var(--bz); border-radius: 7px 36px 36px 7px; z-index: 2; will-change: transform;
  background: linear-gradient(150deg, #4C5870 0%, #26304A 22%, #1A2134 55%, #2C3751 82%, #131A28 100%);
  box-shadow: 0 30px 50px rgba(0, 0, 0, 0.55), inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}
.r-edscr { width: 100%; height: 100%; border-radius: 3px 28px 28px 3px; background: #C69D6E url("img/shots/scrapbook/spread-2.webp") 0 0 / 200% 100% no-repeat; }
.r-stk, .r-loose { position: absolute; left: 0; top: 0; opacity: 0; will-change: transform; }
.r-stk .sticker-art, .r-loose .sticker-art { display: block; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(1px 5px 6px rgba(30, 15, 0, 0.45)); }
.r-loose .sticker-art { height: auto; }
.r-slip { position: absolute; left: 0; top: 0; padding: 6px 14px 8px; background: #FCF7E6; box-shadow: 0 3px 8px rgba(40, 20, 0, 0.35); transform-origin: 0 50%; opacity: 0; }
.r-slip span { display: block; font-family: var(--hand); font-size: 25px; line-height: 1.2; color: #33296A; white-space: nowrap; }
.r-lib { position: absolute; inset: -160px 0; overflow: hidden; visibility: hidden; z-index: 4;
  -webkit-mask-image: linear-gradient(transparent 60px, #000 330px); mask-image: linear-gradient(transparent 60px, #000 330px); }
.r-libgrid { position: absolute; left: 0; top: 0; width: 100%; height: 300%; will-change: transform; }
.r-tile { position: absolute; border-radius: 6px; background: #3A332C center / cover no-repeat; filter: grayscale(0.85) brightness(1.02); opacity: 0.5; }
.r-lift { position: absolute; left: 0; top: 0; border-radius: 6px; background: center / cover no-repeat; opacity: 0; z-index: 3; will-change: transform;
  box-shadow: 0 0 0 4px #FBF8F2, 0 18px 30px rgba(0, 0, 0, 0.5); }
.r-strip { position: absolute; left: 0; width: 0; height: 0; will-change: transform; }
.r-shot { position: absolute; left: 0; top: 0; height: auto; max-width: none; will-change: transform; filter: drop-shadow(0 26px 30px rgba(0, 0, 0, 0.55)) drop-shadow(0 4px 8px rgba(0, 0, 0, 0.35)); }
.r-priv .r-lockbadge {
  position: absolute; left: 0; top: 0; width: 112px; height: 112px; border-radius: 50%; opacity: 0; z-index: 2;
  display: grid; place-items: center; background: radial-gradient(circle at 35% 30%, #A8433B, #85302B 55%, #5E1F1B);
  box-shadow: 0 0 0 4px #F2D68C, 0 0 0 6px #B38738, 0 14px 26px rgba(30, 10, 5, 0.5), inset 0 2px 3px rgba(255, 255, 255, 0.35);
}
.r-priv .r-lockbadge::after {
  content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 3px solid rgba(242, 214, 140, 0.9);
  opacity: calc(1 - var(--ring, 0)); transform: scale(calc(1 + var(--ring, 0) * 0.8)); pointer-events: none;
}
.r-priv .r-lockbadge svg { width: 62px; height: 62px; fill: none; stroke: #FBF3E1; stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; }
.r-privtext { position: absolute; left: 50%; bottom: 40px; margin: 0; white-space: nowrap; font-family: var(--serif); font-weight: 500; font-size: 64px; line-height: 1; letter-spacing: -0.015em; color: #F6EEDF; opacity: 0; text-shadow: 0 6px 30px rgba(0, 0, 0, 0.55); }
.reel-canvas.m .r-privtext { font-size: 64px; bottom: 52px; }

/* the icon and the name, to end on */
.r-mark { position: absolute; width: 0; height: 0; opacity: 0; color: var(--chalk); }
.r-icon { position: absolute; left: 0; top: 0; width: 168px; max-width: none; height: 168px; border-radius: 38px; box-shadow: 0 22px 40px rgba(0, 0, 0, 0.55), 0 4px 10px rgba(0, 0, 0, 0.4); }
.r-word { position: absolute; left: 0; top: 112px; white-space: nowrap; font-weight: 500; font-size: 70px; line-height: 1; letter-spacing: -0.01em; }
.r-sub { position: absolute; left: 0; top: 198px; white-space: nowrap; font-style: italic; font-size: 22px; color: var(--night-quiet); }

/* ------------------------------------------------------------------ day sections on laid paper */
.day {
  position: relative; color: var(--ink);
  background: var(--paper) url("img/paper-day.webp") repeat; background-size: 320px;
  padding: clamp(72px, 9vw, 130px) var(--gutter);
}
.deckle { position: absolute; left: 0; right: 0; top: -1px; width: 100%; height: 22px; transform: translateY(-100%); }
.deckle path { fill: var(--paper); }
.section-head { max-width: 44rem; margin: 0 auto; text-align: left; }
.section-head.narrow { max-width: 38rem; }
.section-head h2 {
  display: flex; align-items: baseline; gap: 12px; margin: 0; text-wrap: balance;
  font-family: var(--caps); font-weight: 500; font-size: clamp(30px, 3.2vw, 42px); line-height: 1.15; letter-spacing: 0.01em;
}
.section-head .glyph { font-family: "EB Garamond", serif; font-weight: 500; font-size: 0.86em; line-height: 1; color: var(--oxblood); transform: translateY(0.02em); }
.double-rule { margin: 12px 0 22px; height: 6px; border-top: 1.5px solid rgba(42, 36, 32, 0.85); border-bottom: 0.6px solid rgba(42, 36, 32, 0.55); width: 100%; }
.section-head p { max-width: 38rem; }
.note { font-style: italic; color: var(--quiet); font-size: 17px; margin-top: 12px; }

/* ------------------------------------------------------------------ the shelf of styles */
.shelf-wrap { position: relative; max-width: 1080px; margin: clamp(10px, 2vw, 24px) auto 0; padding: 0 8px; }
.shelf-row { position: relative; }
/* room above the books for the one taken down to rise into */
.shelf {
  position: relative; z-index: 1;
  display: flex; align-items: flex-end; justify-content: center; gap: 3px; padding: 56px 10px 0;
}
.spine {
  --h: 200px; --w: 52px;
  position: relative; flex: 0 0 auto; width: var(--w); height: var(--h);
  border: 0; padding: 0; cursor: pointer; border-radius: 3px 3px 1px 1px;
  background: var(--cloth-colour);
  box-shadow: inset 3px 0 6px rgba(255, 255, 255, 0.10), inset -5px 0 8px rgba(0, 0, 0, 0.30), 1px 0 2px rgba(0, 0, 0, 0.35);
  transform-origin: bottom center; transition: transform 0.3s cubic-bezier(.2, .8, .2, 1.2);
  color: var(--foil);
}
/* the cloth's weave, drawn plainly: no blending, so nothing has to be repainted as books move */
.spine::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.07) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.1) 0 1px, transparent 1px 3px);
}
.spine::after {
  content: ""; position: absolute; left: 4px; right: 4px; top: 10px; bottom: 10px;
  border-top: 1px solid var(--foil); border-bottom: 1px solid var(--foil); opacity: 0.55; pointer-events: none;
}
.spine .spine-title {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(90deg);
  white-space: nowrap; font-size: 17px; line-height: 1; pointer-events: none;
}
.spine .spine-no { position: absolute; left: 0; right: 0; bottom: 18px; text-align: center; font-family: var(--numerals); font-weight: 700; font-size: 11px; pointer-events: none; }
.spine { transition: transform 0.35s cubic-bezier(.2, .8, .2, 1.2), filter 0.4s, box-shadow 0.4s; }
.spine:hover, .spine:focus-visible { transform: translateY(-12px) rotate(-1.5deg); }
/* the book on the desk is taken off the shelf: lifted clear, lit, the gilt edge catching the lamp,
   a brass pointer under it, and the rest of the row in shadow */
.spine[aria-selected="true"] {
  --rest: translateY(-44px); transform: var(--rest); z-index: 2;
  box-shadow: 0 0 0 2px #F2D68C, 0 0 26px 6px rgba(247, 224, 153, 0.5), 0 22px 26px rgba(0, 0, 0, 0.5), inset -5px 0 8px rgba(0, 0, 0, 0.30);
}
.shelf-wrap:has(.spine[aria-selected="true"]) .spine:not([aria-selected="true"]) { filter: brightness(0.6) saturate(0.75); }
.shelf-wrap:has(.spine[aria-selected="true"]) .spine:not([aria-selected="true"]):hover { filter: brightness(0.92); }
.spine-tag {
  position: absolute; left: 50%; bottom: -34px; width: 0; height: 0; transform: translateX(-50%) translateY(6px);
  border: 9px solid transparent; border-bottom: 13px solid #E8C877; border-top: 0;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.45)); opacity: 0; transition: opacity 0.3s, transform 0.35s; pointer-events: none;
}
.spine[aria-selected="true"] .spine-tag { opacity: 1; transform: translateX(-50%); }
/* The books drop onto the shelf one after another as it comes into view: transform and opacity
   only, each on its own layer just for the half second it moves (muisto.js adds .arriving, then
   takes both classes away). */
.shelf-wrap.ready .spine { opacity: 0; }
.shelf-wrap.arriving .spine {
  opacity: 1; will-change: transform, opacity;
  animation: spine-in 0.5s cubic-bezier(.2, .9, .3, 1.12) backwards; animation-delay: calc(var(--i) * 0.035s);
}
@keyframes spine-in {
  from { opacity: 0; transform: translateY(-46px) rotate(var(--lean, -6deg)); }
  40% { opacity: 1; }
  to { opacity: 1; transform: var(--rest, none); }
}
.plank {
  position: relative; height: 18px; margin: 0 -8px; border-radius: 2px;
  background:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.10) 0 0.6px, transparent 0.6px 2.2px),
    linear-gradient(#8C5C33, #6B4221 55%, #4D2E17);
  box-shadow: 0 6px 10px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
.plank.small { height: 14px; margin: 0; }
.brass {
  position: absolute; right: 14px; top: 12px; padding: 1px 8px; border-radius: 2px;
  font-family: var(--caps); font-size: 12px; letter-spacing: 0.06em; color: #40290F;
  background: linear-gradient(var(--gilt-light), var(--gilt-dark)); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

/* ------------------------------------------------------------------ the books it finds */
.found-grid {
  display: grid; grid-template-columns: 1.3fr 0.9fr; grid-template-areas: "trips otd" "trips years"; align-items: start;
  gap: clamp(36px, 5vw, 64px) clamp(28px, 5vw, 72px); max-width: var(--page-max); margin: clamp(40px, 5vw, 70px) auto 0;
}
.trips { grid-area: trips; } .onthisday { grid-area: otd; } .years { grid-area: years; }
.chapter { display: flex; align-items: center; gap: 9px; margin: 0 0 16px; font-family: var(--caps); font-weight: 500; font-size: 24px; letter-spacing: 0.01em; }
.chapter svg { width: 20px; height: 20px; }
.postcards { position: relative; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 20px; padding: 10px 2px 6px; }
.postcard {
  background: var(--card); padding: 8px 8px 12px; border-radius: 3px;
  box-shadow: 0 6px 12px var(--shadow); transform: rotate(var(--tilt));
}
.postcard .ph { position: relative; display: block; aspect-ratio: 1 / 0.64; overflow: hidden; }
.postcard .ph canvas { width: 100%; height: 100%; }
.postcard .stamp {
  position: absolute; top: 8px; right: 8px; width: 40px; height: 48px; padding: 3px; background: #fff;
  -webkit-mask: radial-gradient(circle 1.6px at 2.3px 2.3px, #0000 98%, #000) -2.3px -2.3px / 4.6px 4.6px;
  mask: radial-gradient(circle 1.6px at 2.3px 2.3px, #0000 98%, #000) -2.3px -2.3px / 4.6px 4.6px;
  filter: drop-shadow(0 1px 1.2px rgba(0, 0, 0, 0.35));
}
.postcard .stamp canvas { width: 100%; height: 100%; filter: saturate(0.6); outline: 2px solid #fff; outline-offset: -2px; }
.postcard .row { display: flex; justify-content: space-between; align-items: flex-start; gap: 6px; padding: 7px 3px 0; }
.postcard .town { font-weight: 600; font-size: 23px; line-height: 1.1; color: var(--ink); }
.postcard .line { font-style: italic; font-size: 15px; color: var(--quiet); line-height: 1.3; margin-top: 2px; }
.postmark {
  flex: 0 0 auto; width: 42px; height: 42px; border-radius: 50%; transform: rotate(-12deg);
  border: 1.4px solid rgba(41, 51, 107, 0.62); box-shadow: inset 0 0 0 3.2px var(--card), inset 0 0 0 3.9px rgba(41, 51, 107, 0.45);
  display: grid; place-content: center; text-align: center; font-family: var(--caps); font-size: 10px; line-height: 0.95; color: rgba(41, 51, 107, 0.7);
}
.postcards.ready .postcard { opacity: 0; }
.postcards.arriving .postcard { opacity: 1; will-change: transform, opacity; animation: deal 0.6s cubic-bezier(.2, .8, .25, 1) backwards; animation-delay: calc(var(--i) * 0.1s); }
@keyframes deal {
  0% { opacity: 0; transform: translate(-140px, -60px) rotate(calc(var(--tilt) - 18deg)) scale(1.06); }
  70% { opacity: 1; }
  100% { opacity: 1; transform: rotate(var(--tilt)); }
}

.calendar-wrap { position: relative; width: min(360px, 100%); aspect-ratio: 1 / 1.08; margin: 6px 0 0; cursor: pointer; }
.calendar-wrap::before {
  /* the two rings that hold the leaves */
  content: ""; position: absolute; left: 30%; right: 30%; top: 5.5%; height: 18px; z-index: 2; pointer-events: none;
  background:
    radial-gradient(closest-side, #ddd, #8c8c8c 70%, transparent 72%) left / 8px 18px no-repeat,
    radial-gradient(closest-side, #ddd, #8c8c8c 70%, transparent 72%) right / 8px 18px no-repeat;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.35));
}
.calendar-canvas { width: 100%; height: 100%; }

.year-shelf { display: flex; align-items: flex-end; gap: 2.5px; height: 168px; padding: 0 8px; overflow: hidden; }
.year {
  --w: 38px; --h: 140px;
  position: relative; width: var(--w); height: var(--h); flex: 0 0 auto; border-radius: 3px;
  background: var(--leather);
  box-shadow: inset 2px 0 4px rgba(255, 255, 255, 0.12), inset -4px 0 6px rgba(0, 0, 0, 0.35), 1px 0 2px rgba(0, 0, 0, 0.4);
  display: flex; flex-direction: column; align-items: center; padding: 8px 0;
}
.year .band { width: 100%; height: 4px; margin: 10px 0; background: linear-gradient(rgba(0, 0, 0, 0.35), rgba(255, 255, 255, 0.12), rgba(0, 0, 0, 0.35)); }
.year .label {
  writing-mode: vertical-rl; transform: rotate(180deg); padding: 6px 2px; border-radius: 2px;
  background: var(--label); font-family: var(--numerals); font-weight: 700; font-size: 11px; letter-spacing: 0.08em;
  color: transparent; background-clip: padding-box;
}
.year .label span { background: var(--gilt); -webkit-background-clip: text; background-clip: text; color: transparent; }
.year.pamphlet { --w: 18px; background: color-mix(in srgb, var(--leather) 65%, #EDE0C7); }
.year.pamphlet .label { background: none; }
.year.pamphlet .label span { background: none; color: #FCF4E0; }
.years.ready .year { opacity: 0; }
.years.arriving .year { opacity: 1; will-change: transform, opacity; animation: shelve 0.5s cubic-bezier(.25, .9, .3, 1.08) backwards; animation-delay: calc(var(--i) * 0.04s); }
@keyframes shelve { from { opacity: 0; transform: translateX(56px) rotate(3deg); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------------ Edit, on a phone */
.edits { overflow: clip; padding-top: clamp(110px, 12vw, 170px); padding-bottom: clamp(110px, 12vw, 170px); }
.edits-grid {
  position: relative; z-index: 1; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center;
  gap: clamp(32px, 6vw, 96px); max-width: 1060px; margin: 0 auto;
}
.edits .section-head { margin: 0; }
.edit-steps { list-style: none; margin: 26px 0 0; padding: 0; display: grid; gap: 10px; max-width: 34rem; }
.edit-steps li {
  padding: 9px 14px 10px 18px; border-left: 3px solid rgba(42, 36, 32, 0.14); border-radius: 0 10px 10px 0;
  color: var(--quiet); line-height: 1.45; transition: border-color 0.45s, background-color 0.45s, color 0.45s, transform 0.45s cubic-bezier(.2, .8, .2, 1);
}
.edit-steps strong { font-weight: 600; color: var(--ink); }
.edit-steps li { cursor: pointer; }
.edit-steps li:hover:not(.now) { border-left-color: rgba(133, 48, 43, 0.45); color: var(--ink); }
.edit-steps li:focus-visible { outline: 2px solid var(--gilt-dark); outline-offset: 2px; }
.edit-steps li.now { border-left-color: var(--oxblood); background: rgba(252, 249, 244, 0.78); color: var(--ink); transform: translateX(8px); box-shadow: 0 3px 10px rgba(64, 38, 20, 0.08); }

.phone { margin: 0; width: clamp(286px, 29vw, 360px); }
.device {
  container-type: inline-size; position: relative; aspect-ratio: 464 / 980; padding: 2.6%;
  border-radius: 13.4% / 6.35%;
  background: linear-gradient(145deg, #4A5568, #1F2633 38%, #2E3747 70%, #161B25);
  box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.2), inset 0 0 0 4px rgba(0, 0, 0, 0.5), 0 40px 60px -24px rgba(40, 24, 10, 0.6), 0 12px 24px rgba(40, 24, 10, 0.22);
}
.screen {
  position: relative; width: 100%; height: 100%; overflow: hidden; border-radius: 50em;
  font-size: calc(100cqw / 464); line-height: 1; color: #1D1D1F;
  font-family: system-ui, -apple-system, "Helvetica Neue", sans-serif; font-variant-numeric: normal;
  background: radial-gradient(closest-side, rgba(115, 82, 51, 0) 60%, rgba(115, 82, 51, 0.13)), #F3EBDD url("img/paper-day.webp"); background-size: 100% 100%, 210em;
}
.screen .ico { width: 24em; height: 24em; fill: none; stroke: #1D1D1F; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; display: block; }
.ed-status { position: absolute; left: 0; right: 0; top: 0; height: 54em; display: flex; align-items: center; justify-content: space-between; padding: 6em 36em 0 54em; }
.ed-time { font-size: 17em; font-weight: 600; }
.ed-island { position: absolute; left: 50%; top: 11em; width: 124em; height: 36em; border-radius: 18em; background: #050505; transform: translateX(-50%); }
.ed-signal { display: flex; align-items: flex-end; gap: 2em; height: 12em; margin-left: auto; margin-right: 8em; }
.ed-signal i { width: 3.2em; border-radius: 1em; background: #1D1D1F; }
.ed-signal i:nth-child(1) { height: 4em; } .ed-signal i:nth-child(2) { height: 6.5em; } .ed-signal i:nth-child(3) { height: 9em; } .ed-signal i:nth-child(4) { height: 12em; }
.ed-battery { width: 26em; height: 12.5em; border-radius: 4em; border: 1.2em solid rgba(29, 29, 31, 0.45); padding: 1.5em; }
.ed-battery i { display: block; width: 80%; height: 100%; border-radius: 2em; background: #1D1D1F; }

.glass {
  position: absolute; display: flex; align-items: center; height: 44em; border-radius: 24em;
  background: rgba(255, 255, 255, 0.6); -webkit-backdrop-filter: blur(12px) saturate(1.6); backdrop-filter: blur(12px) saturate(1.6);
  box-shadow: inset 0 0.8em 1em rgba(255, 255, 255, 0.85), inset 0 0 0 0.8em rgba(255, 255, 255, 0.55), 0 1em 6em rgba(60, 40, 20, 0.16);
}
.glass > span { display: grid; place-items: center; width: 46em; height: 44em; border-radius: 22em; transition: background-color 0.15s, transform 0.15s; }
.glass > span.pressed, .glass.pressed { transform: scale(0.9); }
.ed-nav { position: absolute; left: 0; right: 0; top: 58em; height: 48em; }
.ed-undo { left: 16em; top: 2em; padding: 0 4em; }
.ed-undo .dim .ico { stroke: rgba(29, 29, 31, 0.3); }
.ed-title { position: absolute; left: 50%; top: 6em; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 3em; }
.ed-title b { font-size: 17em; font-weight: 600; }
.ed-title span { font-size: 12em; color: rgba(60, 60, 67, 0.62); }
.glass.prominent { right: 16em; top: 2em; width: 44em; justify-content: center; background: #85302B; box-shadow: inset 0 0.8em 1em rgba(255, 255, 255, 0.28), 0 2em 6em rgba(133, 48, 43, 0.4); transition: transform 0.15s; }
.glass.prominent .ico { stroke: #fff; stroke-width: 2.4; }

.ed-page {
  position: absolute; left: 9em; top: 126em; width: 422em; height: 594em; border-radius: 3em;
  background: #C69D6E url("img/shots/scrapbook/spread-2.webp") 0 0 / 200% 100% no-repeat;
  box-shadow: 0 4em 10em rgba(64, 38, 20, 0.32);
}
.ed-layer { position: absolute; inset: 0; pointer-events: none; }
.finished .ed-page, .finished .ed-layer { animation: bob 3.2s ease-in-out infinite; }
.finished .ed-done { animation: done-bounce 0.55s cubic-bezier(.3, 1.6, .5, 1); }
@keyframes bob { 50% { translate: 0 -2.5em; } }
@keyframes done-bounce { 40% { scale: 1.22; } }
.ed-sticker { position: absolute; transform-origin: 50% 50%; }
.ed-sticker-in { width: 100%; height: 100%; }
.sticker-art { display: block; width: 100%; height: 100%; overflow: visible; }
.ed-sticker .sticker-art, .ed-cell .sticker-art { filter: drop-shadow(0.5em 1.8em 2em rgba(61, 36, 10, 0.42)); }
.ed-outline { position: absolute; inset: -6em; border-radius: 6em; border: 1.6em dashed rgba(42, 36, 32, 0.85); box-shadow: 0 0 0 1.4em rgba(255, 255, 255, 0.85), inset 0 0 0 1.4em rgba(255, 255, 255, 0.85); opacity: 0; transition: opacity 0.2s; }
.ed-sticker.selected .ed-outline { opacity: 1; }
.ed-sticker.carried .sticker-art { filter: drop-shadow(1em 8em 8em rgba(61, 36, 10, 0.45)); }
.ed-slip { position: absolute; padding: 7em 16em 9em; background: #FCF7E6; box-shadow: 0 2em 4em rgba(40, 20, 0, 0.3); transform: rotate(-3deg); }
.ed-slip span { font-family: var(--hand); font-size: 27em; color: #33296A; white-space: nowrap; }

.ed-sheet {
  position: absolute; left: 8em; top: 736em; width: 424em; height: 128em; padding: 8em; display: flex; align-items: center; gap: 8em;
  border-radius: 14em; background: #FCF9F4; box-shadow: inset 0 0 0 1em rgba(42, 36, 32, 0.1), 0 2em 4em rgba(64, 38, 20, 0.28);
}
.ed-tray { flex: 1; height: 112em; overflow: hidden; }
.ed-cells { display: grid; grid-auto-flow: column; grid-template-rows: 54em 54em; grid-auto-columns: 54em; gap: 4em; padding: 0 6em; }
.ed-cell { display: grid; place-items: center; transition: transform 0.15s; }
.ed-cell.pressed { transform: scale(0.86); }
.ed-cell > span { display: block; }
.ed-bin { flex: 0 0 58em; height: 58em; border-radius: 50%; display: grid; place-items: center; background: rgba(133, 48, 43, 0.08); box-shadow: inset 0 0 0 1.2em rgba(133, 48, 43, 0.55); transition: background-color 0.18s, transform 0.18s; }
.ed-bin .ico { stroke: #85302B; width: 22em; height: 22em; stroke-width: 1.8; }
.ed-bin.waiting { background: rgba(133, 48, 43, 0.16); box-shadow: none; outline: 1.2em dashed rgba(133, 48, 43, 0.6); outline-offset: -1.2em; }
.ed-bin.over { background: #85302B; transform: scale(1.15); }
.ed-bin.over .ico { stroke: #fff; }

.ed-bar { position: absolute; left: 16em; right: 16em; top: 878em; height: 48em; display: flex; justify-content: space-between; }
.ed-bar .glass { position: relative; height: 48em; }
.ed-pager { padding: 0 10em; gap: 14em; }
.ed-pager .ico { stroke: rgba(29, 29, 31, 0.85); }
.ed-tools > span { position: relative; width: 48em; height: 48em; }
.ed-tools > span em {
  position: absolute; left: 50%; bottom: 4.4em; font-size: 13em; font-style: normal; font-weight: 600; white-space: nowrap;
  padding: 0.55em 0.85em 0.6em; border-radius: 0.8em; color: #fff; background: rgba(29, 29, 31, 0.86);
  transform: translateX(-50%) translateY(0.4em) scale(0.85); opacity: 0; transition: opacity 0.2s, transform 0.25s cubic-bezier(.3, 1.4, .5, 1); pointer-events: none;
}
.ed-tools > span:last-child em { left: auto; right: -0.8em; transform: translateY(0.4em) scale(0.85); transform-origin: right bottom; }
.ed-tools > span.named { background: rgba(29, 29, 31, 0.08); }
.ed-tools > span.named em { opacity: 1; transform: translateX(-50%); }
.ed-tools > span:last-child.named em { transform: none; }
.ed-tools > span[data-tool="remove"] .ico { stroke: #C0392B; }
.ed-home { position: absolute; left: 50%; bottom: 8em; width: 140em; height: 5em; border-radius: 3em; background: #111; transform: translateX(-50%); }

.ed-panel { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0, 0, 0, 0.18); opacity: 0; transition: opacity 0.25s; pointer-events: none; }
.ed-panel.on { opacity: 1; }
.ed-card {
  width: 396em; padding: 22em 22em 18em; border-radius: 24em; background: #FCF9F4 url("img/paper-day.webp"); background-size: 210em;
  box-shadow: 0 12em 34em rgba(0, 0, 0, 0.28); transform: translateY(40em) scale(0.96); transition: transform 0.4s cubic-bezier(.3, 1.3, .5, 1);
}
.ed-panel.on .ed-card { transform: none; }
.ed-card-kicker { font-family: var(--caps); font-size: 13em; letter-spacing: 0.08em; color: #6B5E54; }
.ed-card-title { font-family: var(--serif); font-size: 26em; font-weight: 500; margin-top: 0.2em; color: #2A2420; }
.ed-field { display: flex; align-items: center; gap: 1em; min-height: 50em; margin-top: 14em; padding: 0 14em; border-radius: 12em; background: #fff; box-shadow: inset 0 0 0 1.2em rgba(42, 36, 32, 0.2); }
.ed-field span { font-family: var(--serif); font-size: 20em; color: #2A2420; white-space: nowrap; }
.ed-caret { width: 2em; height: 24em; background: #3B6654; animation: caret 1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
.ed-card-buttons { display: flex; justify-content: flex-end; gap: 10em; margin-top: 16em; }
.ed-cancel, .ed-save { font-size: 16em; font-weight: 600; padding: 0.75em 1.25em; border-radius: 99em; transition: transform 0.15s; }
.ed-cancel { background: rgba(42, 36, 32, 0.08); color: #2A2420; }
.ed-save { background: #3B6654; color: #F5F0E4; }
.ed-save.pressed { transform: scale(0.92); }

.touch {
  position: absolute; left: 0; top: 0; z-index: 6; width: 44em; height: 44em; border-radius: 50%; pointer-events: none;
  background: rgba(70, 58, 50, 0.24); box-shadow: 0 0 0 2em rgba(255, 255, 255, 0.85), 0 4em 12em rgba(0, 0, 0, 0.28);
  opacity: 0; transition: opacity 0.25s, scale 0.15s, background-color 0.15s;
}
.touch.on { opacity: 1; }
.touch.down { scale: 0.8; background: rgba(70, 58, 50, 0.38); }

/* Scrapbook's stickers, large, stuck about the paper round the phone */
.sticker-cloud { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.loose {
  position: absolute; width: var(--w); padding: 0; border: 0; background: none; cursor: pointer; pointer-events: auto;
  transform: translate(-50%, -50%) rotate(var(--turn)) scale(0); transition: scale 0.25s cubic-bezier(.3, 1.6, .5, 1);
}
.sticker-cloud.on .loose { animation: stick-on 0.75s cubic-bezier(.3, 1.55, .5, 1) calc(var(--i) * 0.09s) forwards; }
.loose .sticker-art { height: auto; filter: drop-shadow(1px 4px 5px rgba(61, 36, 10, 0.35)); animation: drift var(--drift) ease-in-out calc(var(--i) * -0.7s) infinite alternate; }
.loose:hover { scale: 1.1; }
.loose.poked .sticker-art { animation: poke 0.8s cubic-bezier(.3, 1.4, .5, 1); }
@keyframes stick-on {
  0% { opacity: 0; transform: translate(-50%, -50%) translateY(-60px) rotate(calc(var(--turn) - 40deg)) scale(1.5); }
  60% { opacity: 1; }
  100% { opacity: 1; transform: translate(-50%, -50%) rotate(var(--turn)) scale(1); }
}
@keyframes drift { from { transform: translate(0, 0) rotate(-3deg); } to { transform: translate(4px, -9px) rotate(4deg); } }
@keyframes poke { 0% { transform: none; } 35% { transform: translateY(-26px) rotate(-200deg) scale(1.15); } 100% { transform: rotate(-360deg); } }
@media (max-width: 1239.98px) { .loose.side { display: none; } }

/* ------------------------------------------------------------------ Widgets, on a Home Screen */
.widgets { padding-top: clamp(40px, 6vw, 90px); }
.widgets-grid { grid-template-columns: auto minmax(0, 1fr); }
.wd-home {
  background:
    radial-gradient(120% 70% at 85% 10%, rgba(255, 246, 228, 0.55), transparent 60%),
    radial-gradient(90% 60% at 10% 90%, rgba(40, 34, 52, 0.55), transparent 70%),
    linear-gradient(160deg, #B9A58A 0%, #8C7A66 35%, #5E5562 65%, #3B3646 100%);
}
.wd-status .ed-time { color: #fff; }
.wd-status .ed-signal i, .wd-status .ed-battery i { background: #fff; }
.wd-status .ed-battery { border-color: rgba(255, 255, 255, 0.55); }
.wd { position: absolute; cursor: pointer; transform-origin: 50% 60%; opacity: 0; transition: translate 0.5s cubic-bezier(.3, 1.4, .5, 1), filter 0.5s; }
.landed .wd { animation: wd-drop 0.75s cubic-bezier(.3, 1.45, .5, 1) forwards; }
.landed .wd:nth-of-type(2) { animation-delay: 0.12s; } .landed .wd:nth-of-type(3) { animation-delay: 0.24s; } .landed .wd:nth-of-type(4) { animation-delay: 0.36s; }
.landed [data-slot="season"] { animation-delay: 0s; } .landed [data-slot="today"] { animation-delay: 0.16s; }
.landed [data-slot="daily"] { animation-delay: 0.32s; } .landed [data-slot="daily2"] { animation-delay: 0.44s; }
@keyframes wd-drop {
  0% { opacity: 0; transform: translateY(-46em) rotate(-6deg) scale(1.12); }
  55% { opacity: 1; }
  100% { opacity: 1; transform: none; }
}
.wd-card { position: relative; width: 100%; height: 100%; overflow: hidden; border-radius: 24em; box-shadow: 0 4em 14em rgba(20, 12, 6, 0.28); }
.wd[data-slot="daily"] .wd-card, .wd[data-slot="daily2"] .wd-card { border-radius: 22em; }
.wd-face { position: absolute; inset: 0; }
.wd-face img { display: block; width: 100%; height: 100%; object-fit: cover; }
.wd.lit { translate: 0 -10em; filter: drop-shadow(0 14em 16em rgba(20, 12, 6, 0.35)); }
.wd:hover { translate: 0 -5em; }
.wd-name { position: absolute; text-align: center; line-height: 1; }
.wd-name b { font-size: 12.5em; font-weight: 500; color: rgba(255, 255, 255, 0.92); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35); }
.wd-tag {
  position: absolute; right: -0.45em; top: -0.8em; padding: 0.35em 0.7em 0.4em; border-radius: 0.35em; white-space: nowrap; line-height: 1;
  font-family: var(--serif, serif); font-style: italic; font-size: 23em; color: #7A2A24; background: #FBF6EC;
  box-shadow: 0 3px 8px rgba(40, 20, 8, 0.3); transform: rotate(5deg) scale(0); transform-origin: 80% 80%;
  transition: transform 0.45s cubic-bezier(.3, 1.6, .5, 1);
}
.wd.tagged .wd-tag { transform: rotate(5deg) scale(1); }
.wd[data-slot="daily"] .wd-tag { right: auto; left: -0.35em; transform: rotate(-5deg) scale(0); }
.wd[data-slot="daily"].tagged .wd-tag { transform: rotate(-5deg) scale(1); }
.wd[data-slot="daily2"] .wd-tag { display: none; }
.wd-dots { position: absolute; left: 50%; bottom: 14em; display: flex; gap: 7em; transform: translateX(-50%); }
.wd-dots i { width: 7em; height: 7em; border-radius: 50%; background: rgba(255, 255, 255, 0.45); }
.wd-dots i.on { background: #fff; }
.wd-loose .sticker-art { width: 100%; border-radius: 14%; filter: drop-shadow(1px 6px 8px rgba(61, 36, 10, 0.35)); }

/* ------------------------------------------------------------------ the App Store button: gilt, like the flip, and it breathes */
.store {
  display: inline-flex; align-items: center; gap: 14px; text-decoration: none;
  padding: 13px 32px 14px 22px; border-radius: 999px; color: #241D12; background: var(--gilt);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.45);
  animation: beckon 2.8s ease-in-out 2.2s infinite;
  transition: transform 0.2s, filter 0.2s;
}
.store:hover { transform: translateY(-2px); filter: brightness(1.06); }
.store:focus-visible { outline: 2px solid var(--chalk); outline-offset: 4px; }
.store-glyph { width: 30px; height: 30px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.store-words { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.05; }
.store-small { font-style: italic; font-size: 16px; }
.store-big { font-weight: 600; font-size: 30px; letter-spacing: -0.01em; }
.hero-copy > .store { margin-top: 28px; animation: rise 1s cubic-bezier(.2, .8, .2, 1) 0.8s both, beckon 2.8s ease-in-out 2.2s infinite; }
.closing-store { margin-top: 34px; }
.closing-icon { display: block; border-radius: 34px; transition: transform 0.25s; }
.closing-icon:hover { transform: translateY(-3px) rotate(-2deg); }
.closing-icon:focus-visible, .closing-link:focus-visible { outline: 2px solid var(--chalk); outline-offset: 6px; }
.closing-link { color: inherit; text-decoration: none; transition: color 0.2s; }
.closing-link:hover { color: var(--gilt-light); }
@media (min-width: 861px) and (max-height: 820px) { .hero-copy > .store { margin-top: 18px; } .store-big { font-size: 26px; } }
@media (max-width: 860px) {
  .hero-copy > .store { grid-row: 5; grid-column: 1 / -1; justify-self: center; margin-top: 22px; position: relative; z-index: 5; }
  .store-big { font-size: 26px; }
}
@media (prefers-reduced-motion: reduce) { .store, .hero-copy > .store { animation: none; } }

/* ------------------------------------------------------------------ privacy and closing */
.private { padding-top: clamp(40px, 6vw, 80px); }
.closing {
  position: relative; color: var(--chalk); text-align: center; padding: clamp(80px, 11vw, 150px) var(--gutter);
  background:
    radial-gradient(50% 60% at 50% 40%, rgba(255, 214, 160, 0.12), rgba(255, 214, 160, 0) 70%),
    var(--night-paper) url("img/paper-night.webp"); background-size: auto, 320px;
}
.closing-inner { max-width: 36rem; margin: 0 auto; display: flex; flex-direction: column; align-items: center; }
.app-icon.big { width: 150px; height: 150px; border-radius: 34px; margin-bottom: 30px; }
.closing h2 { margin: 0; font-weight: 500; font-size: clamp(34px, 4.4vw, 56px); line-height: 1.08; }
.closing .ornament { margin-top: 30px; width: 170px; }

.footer {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 18px 30px;
  padding: 30px var(--gutter) 34px; background: #1F4A3A; color: #E9E5DE; font-family: "Figtree", system-ui, sans-serif; font-size: 15px; line-height: 1.5;
  font-variant-numeric: normal;
}
.footer img { height: 52px; width: auto; }
.footer-text { text-align: right; }
.footer-text p { color: rgba(233, 229, 222, 0.7); }
.footer-links { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 22px; margin-bottom: 6px; }
.footer-links a { color: #E9E5DE; font-weight: 500; }
.footer a { text-decoration: none; }
.footer-text a { font-weight: 500; }
.footer a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ------------------------------------------------------------------ narrow screens */
@media (max-width: 860px) {
  /* on a phone the words stack round the book: its name above, the button below */
  .hero-stage {
    height: auto; grid-template-columns: auto minmax(0, 1fr); grid-template-rows: auto auto auto;
    align-items: center; column-gap: 14px; padding: 66px var(--gutter) 0;
  }
  .hero-copy { display: contents; }
  .hero-copy > .app-icon { grid-row: 1; grid-column: 1; width: 54px; height: 54px; border-radius: 12px; margin: 0; }
  .hero h1 { grid-row: 1; grid-column: 2; font-size: 54px; line-height: 1; }
  .tagline { grid-row: 2; grid-column: 1 / -1; font-size: 21px; margin-top: 10px; }
  .lede { grid-row: 3; grid-column: 1 / -1; font-size: 17px; margin-top: 8px; max-width: none; }
  .status { display: none; }
  .reel { grid-row: 4; grid-column: 1 / -1; height: auto; aspect-ratio: 600 / 780; margin: 6px -10px 0; }
  .book-area { height: auto; margin: 6px -8px 0; }
  .book-wrap { height: min(74svh, 640px); }
  .book-caption { font-size: 16px; }
  .book-caption .chosen-name { font-size: 18px; }
  .flip { font-size: 17px; padding: 10px 20px 11px 16px; }
  .section-head h2 { font-size: 26px; gap: 10px; }
  .shelf { padding: 54px 0 0; gap: 2px; }
  .shelf-row + .shelf-row { margin-top: 4px; }
  .spine .spine-title { font-size: 14px; }
  .spine .spine-no { bottom: 12px; font-size: 10px; }
  .spine[aria-selected="true"] { --rest: translateY(-36px); }
  .found-grid { grid-template-columns: 1fr; grid-template-areas: "trips" "otd" "years"; }
  .postcards { gap: 16px 12px; }
  .postcard .town { font-size: 19px; }
  .postcard .line { font-size: 13px; }
  .postcard .stamp { width: 30px; height: 36px; }
  .postmark { width: 36px; height: 36px; font-size: 9px; }
  .footer-text { text-align: left; }
  .footer-links { justify-content: flex-start; }
  .edits-grid { grid-template-columns: 1fr; justify-items: center; }
  .widgets-grid .phone { order: 2; }
  .wd-loose.top { display: none; }
  .edits-copy { justify-self: stretch; }
  .phone { width: min(330px, 80vw); }
  .loose { width: calc(var(--w) * 0.6); }
  .loose.top { top: 52px !important; }
  .loose.bottom { top: calc(100% - 56px) !important; }
  .loose.side { display: none; }
}
/* a phone shows one page at a time, standing taller */
@media (max-width: 699.98px) {
  .book-wrap { height: auto; aspect-ratio: 0.74; max-height: 76svh; margin: 0 auto; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001s !important; animation-delay: 0s !important; transition-duration: 0.001s !important; transition-delay: 0s !important; }
  .motes { display: none; }
  .loose .sticker-art { animation: none; }
}
