.notebook-shell {
  width: 100%;
  max-width: none;
  overflow-x: clip;
}

.notebook-main {
  min-height: calc(100vh - 112px);
  display: grid;
  place-items: start center;
  padding: clamp(8px, 2.4vh, 28px) clamp(0px, 2vw, 34px) clamp(26px, 5vh, 64px);
}

.notebook {
  width: min(100%, 920px);
  position: relative;
  padding-top: clamp(30px, 4.2vw, 44px);
  isolation: isolate;
  perspective: 2200px;
}

.notebook-page-markers {
  height: clamp(44px, 5.5vw, 57px);
  position: absolute;
  z-index: 5;
  top: clamp(-44px, -4.2vw, -30px);
  right: clamp(34px, 8%, 92px);
  display: flex;
  align-items: flex-end;
  gap: clamp(6px, 0.9vw, 11px);
}

.notebook-page-markers[hidden] {
  display: none;
}

.notebook-page-marker {
  width: clamp(48px, 5.7vw, 62px);
  height: clamp(43px, 5vw, 54px);
  display: grid;
  place-items: center;
  padding: 0 0 clamp(7px, 0.8vw, 10px);
  color: var(--beige);
  background-color: var(--clay);
  border: 1px solid rgba(89, 65, 46, 0.2);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  box-shadow: 0 4px 9px rgba(66, 45, 30, 0.13);
  cursor: pointer;
  transform: translateY(7px);
  transition:
    color 180ms ease,
    background 180ms ease,
    box-shadow 180ms ease,
    transform 220ms cubic-bezier(0.22, 1, 0.36, 1);
}

.notebook-page-marker:hover {
  color: var(--beige);
  transform: translateY(5px);
}

.notebook-page-marker[aria-pressed="true"] {
  background-color: var(--terracotta);
  box-shadow: 0 7px 16px rgba(79, 51, 32, 0.19);
  transform: translateY(0);
}

.notebook-page-marker svg {
  width: clamp(21px, 2.5vw, 28px);
  height: clamp(21px, 2.5vw, 28px);
  fill: none;
  stroke: currentColor;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.notebook-cover {
  position: relative;
  z-index: 1;
  padding: clamp(8px, 1.4vw, 16px) clamp(10px, 1.8vw, 21px) clamp(13px, 2vw, 24px);
  background:
    linear-gradient(125deg, rgba(255, 255, 255, 0.22), transparent 22%),
    #b8876e;
  border: 1px solid rgba(83, 54, 39, 0.2);
  border-radius: clamp(20px, 3vw, 38px);
  box-shadow:
    0 38px 74px rgba(69, 48, 35, 0.22),
    0 9px 18px rgba(69, 48, 35, 0.12),
    inset 0 1px rgba(255, 255, 255, 0.4);
}

.notebook-cover::after {
  content: "";
  position: absolute;
  inset: auto 4% -8px;
  height: 18px;
  z-index: -1;
  background: rgba(68, 48, 34, 0.22);
  border-radius: 50%;
  filter: blur(14px);
}

.notebook-spread {
  position:relative;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  transform-style: preserve-3d;
  z-index: 15;
}

.notebook-page {
  min-width: 0;
  aspect-ratio: 0.715;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: clamp(24px, 6.2vw, 64px) clamp(19px, 5.1vw, 52px) clamp(20px, 5vw, 48px);
  background:
    linear-gradient(rgba(255, 252, 246, 0.91), rgba(255, 252, 246, 0.91)),
    url("/textures/paper_BaseColor.jpg") center / cover;
  border: 1px solid rgba(106, 86, 63, 0.17);
  border-radius: 0 clamp(19px, 3.2vw, 34px) clamp(19px, 3.2vw, 34px) 0;
  box-shadow:
    inset 18px 0 30px rgba(107, 82, 54, 0.035),
    inset -2px 0 rgba(255, 255, 255, 0.64),
    0 3px 4px rgba(74, 53, 37, 0.1);
  transform-origin: left center;
  backface-visibility: hidden;
}

.notebook-page::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 5;
  opacity: 0.15;
  pointer-events: none;
  background:
    repeating-linear-gradient(0deg, transparent 0 5px, rgba(85, 65, 43, 0.018) 5px 6px),
    radial-gradient(circle at 18% 8%, rgba(182, 111, 86, 0.08), transparent 30%);
  mix-blend-mode: multiply;
}

.notebook-page > * {
  position: relative;
  z-index: 6;
}

.notebook-spine {
  width: 12px;
  position: absolute;
  inset: 1.5% auto 2.2% 10px;
  z-index: 19;
  pointer-events: none;
  background:
      linear-gradient(90deg, transparent, rgba(82, 59, 40, 0.14) 45%, rgba(255, 255, 255, 0.36) 51%, transparent),
      radial-gradient(ellipse at center, #8d674f 0 16%, transparent 18%) center / 16px 45px repeat-y;
  opacity: 0.46;
}

.notebook-turn {
  width: clamp(42px, 5vw, 58px);
  aspect-ratio: 1;
  position: absolute;
  z-index: 20;
  top: 50%;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--ink);
  background: rgba(251, 248, 242, 0.92);
  border: 1px solid rgba(100, 81, 60, 0.17);
  border-radius: 50%;
  box-shadow: 0 12px 28px rgba(71, 52, 38, 0.14);
  cursor: pointer;
  transform: translateY(-50%);
  transition: transform 180ms ease, color 180ms ease, box-shadow 180ms ease;
}

.notebook-turn:hover {
  color: var(--terracotta);
  box-shadow: 0 15px 31px rgba(71, 52, 38, 0.2);
}

.notebook-turn:focus-visible,
.notebook-page-marker:focus-visible,
.calendar-arrow:focus-visible,
.calendar-day.has-memories:focus-visible,
.scrapbook-card:focus-visible,
.map-stage:focus-visible,
.map-controls button:focus-visible,
.map-country:focus-visible,
.map-country-dot:focus-visible,
.map-postcard-marker:focus-visible {
  outline: 3px solid rgba(182, 111, 86, 0.48);
  outline-offset: 4px;
}

.notebook-turn[hidden] {
  display: none;
}

.notebook-turn span {
  font-family: "DM Sans", sans-serif;
  font-size: clamp(22px, 3vw, 33px);
  font-weight: 300;
  line-height: 1;
}

.notebook-turn-previous {
  left: clamp(-11px, -2vw, -28px);
}

.notebook-turn-next {
  right: clamp(-11px, -2vw, -28px);
}

.notebook-announcement {
  width: 1px;
  height: 1px;
  position: absolute;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

.notebook-kicker {
  margin: 0;
  color: var(--clay);
  font-size: clamp(8px, 1vw, 12px);
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

/* Calendar pages */
.calendar-heading {
  flex: 0 0 auto;
  margin-bottom: clamp(18px, 3.8vw, 43px);
}

.calendar-title-row {
  display: grid;
  grid-template-columns: clamp(34px, 5vw, 52px) minmax(0, 1fr) clamp(34px, 5vw, 52px);
  align-items: center;
  gap: clamp(7px, 2vw, 20px);
  margin-top: clamp(11px, 2.2vw, 23px);
}

.calendar-title-row h1 {
  min-width: 0;
  overflow: hidden;
  font-size: clamp(28px, 6vw, 64px);
  text-align: center;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-arrow {
  width: 100%;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  padding: 0 0 3px;
  color: var(--ink);
  background: transparent;
  border: 1px solid rgba(102, 83, 62, 0.16);
  border-radius: 50%;
  cursor: pointer;
  transition: 180ms ease;
}

.calendar-arrow:hover:not(:disabled) {
  color: var(--terracotta);
  background: rgba(182, 111, 86, 0.07);
  border-color: rgba(182, 111, 86, 0.28);
}

.calendar-arrow:disabled {
  opacity: 0.2;
  cursor: default;
}

.calendar-arrow span {
  font-family: "Fraunces", serif;
  font-size: clamp(24px, 4vw, 41px);
  line-height: 0.7;
}

.calendar-grid {
  min-height: 0;
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: auto repeat(6, minmax(0, 1fr));
  border: 1px solid rgba(102, 83, 62, 0.17);
  border-radius: 10px;
}

.calendar-weekday {
  display: grid;
  place-items: center;
  padding: clamp(7px, 1.4vw, 14px) 2px;
  color: var(--muted);
  border-bottom: 1px solid rgba(102, 83, 62, 0.17);
  font-size: clamp(6px, 1vw, 10px);
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.calendar-day {
  min-width: 0;
  min-height: 0;
  position: relative;
  display: block;
  padding: clamp(4px, 1.1vw, 10px);
  color: var(--ink);
  background: transparent;
  border: 0;
  border-right: 1px solid rgba(102, 83, 62, 0.13);
  border-bottom: 1px solid rgba(102, 83, 62, 0.13);
  text-align: left;
}

.calendar-day:nth-child(7n) {
  border-right: 0;
}

.calendar-day:nth-last-child(-n + 7) {
  border-bottom: 0;
}

.calendar-day.has-memories {
  border-radius: 0;
  cursor: pointer;
  transition: background 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.calendar-day.has-memories:hover {
  z-index: 3;
  background: #fae9dc;
  box-shadow: 0 0 0 1px rgba(182, 111, 86, 0.18), 0 8px 18px rgba(93, 63, 44, 0.09);
  transform: scale(1.035);
}

.calendar-day-number {
  position: relative;
  z-index: 3;
  font-family: "Fraunces", serif;
  font-size: clamp(9px, 1.9vw, 18px);
  line-height: 1;
}

.calendar-day.has-memories .calendar-day-number {
  color: var(--terracotta);
  font-weight: 600;
}

.calendar-thumbnails {
  height: calc(100% - clamp(12px, 2.1vw, 22px));
  position: absolute;
  inset: auto clamp(2px, 0.6vw, 6px) clamp(2px, 0.6vw, 6px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.calendar-thumbnails img {
  width: min(67%, 54px);
  max-height: 92%;
  aspect-ratio: 1;
  display: block;
  object-fit: cover;
  padding: clamp(1px, 0.3vw, 3px);
  background: #fffdf8;
  border: 1px solid rgba(80, 63, 45, 0.16);
  box-shadow: 0 3px 6px rgba(70, 50, 34, 0.2);
  transform: translateX(calc((var(--thumbnail-index) - 1) * -18%)) rotate(calc((var(--thumbnail-index) - 1) * 5deg));
}

.calendar-thumbnails img + img {
  margin-left: -42%;
}

.calendar-more-count {
  min-width: 17px;
  height: 17px;
  position: absolute;
  z-index: 4;
  right: 2px;
  bottom: 2px;
  display: grid;
  place-items: center;
  padding: 0 3px;
  color: #fff;
  background: var(--terracotta);
  border: 1px solid #fff9f1;
  border-radius: 999px;
  font-size: 7px;
  line-height: 1;
}

.calendar-footer {
  flex: 0 0 auto;
  padding-top: clamp(16px, 3.5vw, 34px);
  text-align: center;
}

.calendar-memory-count {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  color: var(--clay);
  font-family: "Caveat", cursive;
  font-size: clamp(16px, 3vw, 27px);
  font-weight: 500;
}

.calendar-memory-count::before,
.calendar-memory-count::after {
  content: "";
  height: 1px;
  flex: 1;
  background: repeating-linear-gradient(90deg, rgba(132, 104, 75, 0.3) 0 5px, transparent 5px 9px);
}

.notebook-page-number {
  margin: clamp(7px, 1.6vw, 15px) 0 0;
  color: var(--muted);
  font-family: "Fraunces", serif;
  font-size: clamp(8px, 1.3vw, 12px);
}

/* Scrapbook pages */
.scrapbook-page {
  padding-bottom: clamp(18px, 4vw, 39px);
}

.scrapbook-heading {
  flex: 0 0 auto;
  text-align: center;
}

.scrapbook-heading h1 {
  margin-top: clamp(8px, 1.7vw, 17px);
  font-size: clamp(31px, 5.5vw, 58px);
  line-height: 1;
}

.scrapbook-heading h1 strong {
  color: var(--terracotta);
  font-weight: 500;
}

.scrapbook-heading > p:last-child {
  margin: clamp(7px, 1.4vw, 14px) 0 0;
  color: var(--taupe);
  font-family: "Caveat", cursive;
  font-size: clamp(13px, 2vw, 20px);
}

.scrapbook-collage {
  min-height: 0;
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: center;
  align-items: center;
  gap: clamp(13px, 3vw, 30px);
  padding: clamp(17px, 4vw, 40px) clamp(1px, 1vw, 10px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(170, 153, 133, 0.4) transparent;
}

.scrapbook-collage.postcard-count-1 {
  grid-template-columns: minmax(0, 0.82fr);
  justify-content: center;
}

.scrapbook-collage.postcard-count-3 .scrapbook-card:first-child {
  grid-column: 1 / -1;
  width: 60%;
  justify-self: center;
}

.scrapbook-card {
  min-width: 0;
  display: block;
  padding: clamp(5px, 1.1vw, 11px) clamp(5px, 1.1vw, 11px) clamp(10px, 2.2vw, 22px);
  color: var(--ink);
  background: #fffdf8;
  border: 1px solid rgba(88, 67, 47, 0.13);
  box-shadow: 0 14px 25px rgba(67, 48, 33, 0.16);
  text-decoration: none;
  transform: rotate(var(--card-rotation));
  transition: transform 200ms ease, box-shadow 200ms ease;
}

.scrapbook-card:hover {
  z-index: 3;
  box-shadow: 0 19px 31px rgba(67, 48, 33, 0.22);
  transform: translateY(-4px) rotate(0deg);
}

.scrapbook-photo {
  aspect-ratio: 1.5;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #e8dfd2;
}

.scrapbook-card.is-portrait .scrapbook-photo {
  aspect-ratio: 2 / 3;
  width: 68%;
  margin-inline: auto;
}

.scrapbook-photo canvas,
.scrapbook-fallback-image {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.scrapbook-photo canvas {
  opacity: 0;
  transition: opacity 250ms ease;
}

.scrapbook-photo canvas.is-ready {
  opacity: 1;
}

.scrapbook-missing-image {
  color: var(--taupe);
  font-size: 9px;
  text-align: center;
}

.scrapbook-caption {
  display: block;
  padding: clamp(7px, 1.5vw, 15px) clamp(2px, 0.5vw, 5px) 0;
  text-align: center;
}

.scrapbook-caption strong {
  display: block;
  color: var(--terracotta);
  font-size: clamp(7px, 1vw, 10px);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.scrapbook-caption span {
  display: -webkit-box;
  margin-top: clamp(3px, 0.7vw, 7px);
  overflow: hidden;
  color: var(--muted);
  font-family: "Caveat", cursive;
  font-size: clamp(12px, 2vw, 20px);
  line-height: 1.15;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
}

.scrapbook-footer {
  flex: 0 0 auto;
  text-align: center;
}

.scrapbook-footer > p:first-child {
  margin: 0;
  color: var(--clay);
  font-family: "Caveat", cursive;
  font-size: clamp(14px, 2.4vw, 22px);
}

/* World map and country pages */
.map-page {
  gap: clamp(10px, 2vw, 22px);
  padding: clamp(20px, 4.6vw, 46px) clamp(18px, 4.6vw, 47px) clamp(18px, 3.8vw, 38px);
}

.map-heading {
  flex: 0 0 auto;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
}

.map-heading h1 {
  margin-top: clamp(5px, 1vw, 10px);
  font-size: clamp(27px, 5.2vw, 54px);
  line-height: 1;
}

.map-heading > div:first-child > p:last-child {
  margin: clamp(5px, 1vw, 9px) 0 0;
  color: var(--taupe);
  font-family: "Caveat", cursive;
  font-size: clamp(12px, 2vw, 19px);
}

.map-controls {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  padding: 4px;
  background: rgba(234, 224, 211, 0.72);
  border: 1px solid rgba(103, 83, 62, 0.13);
  border-radius: 999px;
  box-shadow: 0 5px 12px rgba(75, 56, 40, 0.08);
}

.map-controls button {
  min-width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--ink);
  background: rgba(255, 253, 248, 0.74);
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  font: 500 18px/1 "DM Sans", sans-serif;
  transition: color 160ms ease, background 160ms ease, transform 160ms ease;
}

.map-controls button:hover {
  color: var(--terracotta);
  background: #fffdf8;
  transform: translateY(-1px);
}

.map-controls [data-map-zoom-value] {
  min-width: 48px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-align: center;
}

.map-controls .map-reset {
  width: auto;
  min-width: 51px;
  margin-left: 4px;
  padding-inline: 10px;
  border-radius: 999px;
  font-size: 9px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.map-stage {
  min-height: 0;
  height: 80%;
  flex: 1 1 auto;
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at 20% 30%, rgba(255, 255, 255, 0.7), transparent 34%),
    repeating-linear-gradient(0deg, transparent 0 31px, rgba(126, 105, 80, 0.045) 31px 32px),
    repeating-linear-gradient(90deg, transparent 0 31px, rgba(126, 105, 80, 0.045) 31px 32px),
    #f2eadf;
  border: 1px solid rgba(106, 86, 63, 0.18);
  border-radius: clamp(13px, 2vw, 22px);
  box-shadow:
    inset 0 1px rgba(255, 255, 255, 0.8),
    inset 0 0 38px rgba(136, 111, 82, 0.055),
    0 8px 22px rgba(74, 53, 37, 0.06);
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.map-stage:active {
  cursor: grabbing;
}

.map-stage svg {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}

.world-map-layer {
  transform-origin: 0 0;
}

.map-country {
  fill: transparent;
  stroke: #a79884;
  stroke-width: 0.72;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
  transition: fill 160ms ease, stroke 160ms ease;
}

.map-country:hover,
.map-country:focus-visible {
  fill: rgba(210, 192, 169, 0.4);
  stroke: #987d67;
}

.map-country.has-postcards {
  fill: transparent;
  stroke: #a76c58;
  stroke-width: 1.15;
}

.map-country.has-postcards:hover,
.map-country.has-postcards:focus-visible {
  fill: rgba(200, 153, 127, 0.52);
  stroke: var(--terracotta);
}

.map-country-label {
  fill: #66594b;
  stroke: rgba(246, 239, 229, 0.92);
  stroke-width: 2.2px;
  paint-order: stroke;
  font-family: "DM Sans", sans-serif;
  font-size: 6.5px;
  font-weight: 500;
  letter-spacing: 0.01em;
  text-anchor: middle;
  pointer-events: auto;
  cursor: pointer;
  transition: opacity 160ms ease;
}

.map-country-label.has-postcards {
  fill: #875844;
  font-weight: 700;
}

.map-page[data-zoom-level="1"] .map-country-label.is-map-small,
.map-page[data-zoom-level="1"] .map-country-label.is-map-tiny,
.map-page[data-zoom-level="2"] .map-country-label.is-map-tiny {
  opacity: 0;
  pointer-events: none;
}

.map-country-dot {
  fill: var(--terracotta);
  stroke: #fffaf2;
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
}

.map-postcard-marker {
  cursor: pointer;
  filter: drop-shadow(0 3px 3px rgba(69, 48, 34, 0.2));
  transition: opacity 160ms ease;
}

.map-postcard-marker:hover,
.map-postcard-marker:focus-visible {
  opacity: 0.86;
}

.map-postcard-backing {
  fill: #fffdf8;
  stroke: rgba(93, 68, 47, 0.32);
  stroke-width: 0.8;
  vector-effect: non-scaling-stroke;
}

.map-postcard-count-badge {
  fill: var(--terracotta);
  stroke: #fff9f1;
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.map-postcard-count {
  fill: #fff;
  font-family: "DM Sans", sans-serif;
  font-size: 6.4px;
  font-weight: 700;
  text-anchor: middle;
}

.map-footer {
  flex: 0 0 auto;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 20px;
  color: var(--clay);
}

.map-footer p {
  margin: 0;
  font-family: "Caveat", cursive;
  font-size: clamp(13px, 2vw, 20px);
}

.map-footer .notebook-page-number {
  color: var(--muted);
  font-family: "Fraunces", serif;
  font-size: clamp(8px, 1.3vw, 12px);
  letter-spacing: 0.12em;
}

.country-heading h1 {
  color: var(--ink);
}

.country-collage {
  align-content: start;
}

.country-collection-empty {
  min-height: 0;
  flex: 1 1 auto;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 15px;
  padding: 30px;
  color: var(--muted);
  text-align: center;
}

.country-collection-empty span {
  width: clamp(45px, 7vw, 65px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  color: var(--clay);
  background: rgba(224, 210, 192, 0.44);
  border: 1px solid rgba(128, 102, 76, 0.14);
  border-radius: 50%;
  font-family: "Fraunces", serif;
  font-size: clamp(20px, 3vw, 29px);
}

.country-collection-empty p {
  max-width: 250px;
  margin: 0;
  font-family: "Caveat", cursive;
  font-size: clamp(16px, 2.6vw, 25px);
  line-height: 1.25;
}

.country-footer {
  padding-top: 8px;
}

/* Empty, loading, and closing pages */
.notebook-state-page,
.notebook-end-page,
.notebook-blank-page {
  justify-content: center;
  text-align: center;
}

.notebook-state,
.notebook-end-content {
  width: min(100%, 480px);
  margin: auto;
}

.notebook-state-seal,
.notebook-end-sprig {
  width: clamp(47px, 8vw, 72px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  margin: 0 auto clamp(18px, 3vw, 28px);
  color: var(--off-white);
  background: var(--clay);
  border-radius: 8px;
  box-shadow: 0 10px 22px rgba(150, 86, 66, 0.2);
  font-size: clamp(17px, 3vw, 26px);
}

.notebook-state .notebook-kicker,
.notebook-end-content .notebook-kicker {
  margin-bottom: clamp(13px, 2.4vw, 23px);
}

.notebook-state h1,
.notebook-end-content h1 {
  font-size: clamp(38px, 7vw, 68px);
  line-height: 1.03;
}

.notebook-state > p:last-of-type,
.notebook-end-content > p:last-of-type {
  max-width: 400px;
  margin: clamp(14px, 2.6vw, 25px) auto 0;
  color: var(--muted);
  font-size: clamp(11px, 1.5vw, 14px);
  line-height: 1.7;
}

.notebook-state .primary-link,
.notebook-end-content .primary-link {
  margin-top: clamp(21px, 3.5vw, 34px);
}

.notebook-end-sprig {
  color: var(--clay);
  background: transparent;
  border: 1px solid rgba(182, 111, 86, 0.22);
  border-radius: 50%;
  box-shadow: none;
}

.notebook-blank-page span {
  color: rgba(170, 153, 133, 0.24);
  font-family: "Fraunces", serif;
  font-size: clamp(20px, 3vw, 34px);
}

/* Page-turn movement */
.notebook.is-turning-forward {
  --notebook-turn-angle: 84deg;
  --notebook-turn-offset: -2.5%;
  --notebook-turn-settle: -0.8deg;
}

.notebook.is-turning-backward {
  --notebook-turn-angle: -84deg;
  --notebook-turn-offset: 2.5%;
  --notebook-turn-settle: 0.8deg;
}

.notebook.is-turning-forward .notebook-page:first-child,
.notebook.is-turning-backward .notebook-page:first-child {
  z-index: 12;
  animation: notebook-page-turn 700ms cubic-bezier(0.22, 0.61, 0.36, 1) both;
  will-change: transform, opacity, filter;
}

@keyframes notebook-page-turn {
  0% {
    opacity: 0.32;
    transform: rotateY(var(--notebook-turn-angle)) translateX(var(--notebook-turn-offset)) scaleX(0.985);
    filter: brightness(0.76) saturate(0.88);
  }
  48% {
    opacity: 0.92;
    filter: brightness(0.91) saturate(0.96);
  }
  88% {
    opacity: 1;
    transform: rotateY(var(--notebook-turn-settle)) translateX(0) scaleX(1);
    filter: brightness(0.99) saturate(1);
  }
  100% {
    opacity: 1;
    transform: rotateY(0deg) translateX(0);
    filter: brightness(1) saturate(1);
  }
}

/* The single/double-page breakpoint intentionally follows viewport shape. */
@media (min-aspect-ratio: 1 / 1) {
  .notebook {
    width: min(100%, 1460px);
  }

  .notebook-spread {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .notebook-page {
    padding: clamp(22px, 3.2vw, 52px) clamp(18px, 2.65vw, 43px) clamp(18px, 2.5vw, 40px);
  }

  .notebook-page:first-child {
    border-radius: clamp(19px, 2.3vw, 32px) 4px 4px clamp(19px, 2.3vw, 32px);
    box-shadow:
      inset -27px 0 37px rgba(81, 60, 39, 0.07),
      inset 2px 0 rgba(255, 255, 255, 0.64),
      0 3px 4px rgba(74, 53, 37, 0.1);
    transform-origin: right center;
  }

  .notebook-page:nth-child(2) {
    border-radius: 4px clamp(19px, 2.3vw, 32px) clamp(19px, 2.3vw, 32px) 4px;
  }

  .map-page {
    grid-column: 1 / -1;
    aspect-ratio: 1.43;
    padding: clamp(23px, 2.8vw, 41px) clamp(26px, 3.5vw, 51px) clamp(20px, 2.5vw, 36px);
    border-radius: clamp(19px, 2.3vw, 32px);
  }

  .map-heading h1 {
    font-size: clamp(28px, 3.2vw, 48px);
  }

  .map-heading > div:first-child > p:last-child,
  .map-footer p {
    font-size: clamp(13px, 1.35vw, 19px);
  }

  .notebook-spine {
    width: 30px;
    inset: 1.4% auto 2% 50%;
    background:
      linear-gradient(90deg, transparent, rgba(82, 59, 40, 0.14) 45%, rgba(255, 255, 255, 0.36) 51%, transparent),
      radial-gradient(ellipse at center, #8d674f 0 16%, transparent 18%) center / 16px 45px repeat-y;
    transform: translateX(-50%);
  }

  .calendar-heading {
    margin-bottom: clamp(16px, 2.1vw, 33px);
  }

  .calendar-title-row {
    grid-template-columns: clamp(32px, 3vw, 46px) minmax(0, 1fr) clamp(32px, 3vw, 46px);
    gap: clamp(7px, 1.2vw, 17px);
    margin-top: clamp(9px, 1.3vw, 19px);
  }

  .calendar-title-row h1 {
    font-size: clamp(27px, 3.4vw, 52px);
  }

  .calendar-day {
    padding: clamp(3px, 0.7vw, 8px);
  }

  .calendar-day-number {
    font-size: clamp(9px, 1.15vw, 17px);
  }

  .calendar-memory-count {
    font-size: clamp(15px, 1.7vw, 24px);
  }

  .scrapbook-heading h1 {
    font-size: clamp(29px, 3.2vw, 49px);
  }

  .scrapbook-collage {
    gap: clamp(11px, 1.8vw, 26px);
    padding-block: clamp(14px, 2.3vw, 34px);
  }

  .scrapbook-caption span {
    font-size: clamp(12px, 1.2vw, 18px);
  }

  .notebook.is-turning-backward .notebook-page:first-child {
    animation: none;
  }

  .notebook.is-turning-backward .notebook-page:nth-child(2) {
    z-index: 12;
    animation: notebook-page-turn 700ms cubic-bezier(0.22, 0.61, 0.36, 1) both;
    will-change: transform, opacity, filter;
  }
}

@media (max-aspect-ratio: 1 / 1) {
  .notebook-cover {
    padding: clamp(8px, 1.4vw, 16px) clamp(10px, 1.8vw, 21px) clamp(13px, 2vw, 24px) 0;
    border-radius: 0 clamp(20px, 3vw, 38px) clamp(20px, 3vw, 38px) 0;
  }
  .notebook-main {
    padding-inline: 0;
  }

  .notebook-turn {
    top: auto;
    bottom: clamp(13px, 3vw, 28px);
    transform: none;
  }

  .notebook-turn-previous { left: clamp(15px, 4vw, 38px); }
  .notebook-turn-next { right: clamp(15px, 4vw, 38px); }

  .map-heading {
    align-items: start;
    flex-direction: column;
    gap: 10px;
  }

  .map-controls {
    align-self: flex-end;
  }

  .map-stage {
    flex: 0 0 auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  .notebook-page,
  .notebook.is-turning-forward .notebook-page:first-child,
  .notebook.is-turning-backward .notebook-page:first-child,
  .notebook.is-turning-backward .notebook-page:nth-child(2) {
    animation: none;
    will-change: auto;
  }
}
