
/* ── Theme tokens (oklch, light only) ── */
:root {
  --bg: #faf3e8;
  --wall: #faf3e8;
  --ink: oklch(22% 0.04 55);
  --ink-soft: oklch(28% 0.05 55);
  --ink-mute: oklch(32% 0.06 55);
  --accent: oklch(45% 0.16 28);
  --accent-soft: oklch(76% 0.13 45);
  --plank: oklch(54% 0.08 52);
  --plank-lit: oklch(71% 0.07 62);
  --plank-mid: oklch(49% 0.08 50);
  --plank-dark: oklch(33% 0.06 42);
  --plank-edge: oklch(28% 0.05 40);
  --paper: #faf3e8;
  --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/></filter><rect width='100%25' height='100%25' filter='url(%23n)' opacity='0.55'/></svg>");
  --paper-grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='220' height='220'><filter id='p'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.42  0 0 0 0 0.30  0 0 0 0 0.16  0 0 0 0.28 0'/></filter><rect width='100%25' height='100%25' filter='url(%23p)'/></svg>");
  --wood-grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='240' height='64'><filter id='w'><feTurbulence type='fractalNoise' baseFrequency='0.018 0.55' numOctaves='3' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.42  0 0 0 0 0.26  0 0 0 0 0.14  0 0 0 0.55 0'/></filter><rect width='100%25' height='100%25' filter='url(%23w)'/></svg>");
  --card: oklch(97% 0.02 85);
  --card-border: oklch(72% 0.09 55);
  --divider: oklch(82% 0.05 55);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background-color: #8cbfe8;
  font-family: "Lato", sans-serif;
  color: var(--ink);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Cloud shader background (Aceternity) ── */
.cloud-shader {
  position: fixed;
  inset: 0;
  z-index: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.cloud-shader canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* ── Page wrapper ── */
.page-wrapper {
  position: relative;
  z-index: 1;
  max-width: 1264px;
  margin: 0 auto;
  padding: 0 32px 48px;
}

/* ── Header ── */
header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 80px 0 56px;
}
.subtitle {
  display: inline-block;
  font-family: "Lato", sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-mute);
  background: var(--card);
  padding: 7px 16px;
  border-radius: 999px;
  margin-bottom: 20px;
}
header h1 {
  font-family: "Fraunces", serif;
  font-size: clamp(34px, 5.6vw, 72px);
  font-weight: 700;
  line-height: 1.08;
  color: var(--ink);
  letter-spacing: -0.035em;
}
header h1 em {
  font-style: italic;
  font-weight: 700;
  color: var(--accent);
}
.header-sub {
  font-family: "Lato", sans-serif;
  margin-top: 22px;
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.45;
}

/* ── Bookcase ── */
.bookcase {
  position: relative;
}

/* ── Shelf row ── */
.shelf-row {
  padding: 0;
  position: relative;
}

.books {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  min-height: 230px;
  padding: 0 10px;
  flex-wrap: nowrap;
  overflow: visible;
}

/* ── Physical wood plank ── */
.shelf-plank {
  position: relative;
  z-index: 1;
  height: 24px;
  margin: 0 1px;
  border-radius: 3px 3px 4px 4px;
  background-color: var(--plank);
  background-image:
    linear-gradient(
      180deg,
      oklch(78% 0.06 68 / 0.92) 0,
      oklch(72% 0.07 62 / 0.35) 3px,
      transparent 28%
    ),
    linear-gradient(
      180deg,
      transparent 62%,
      oklch(36% 0.06 44 / 0.45) 82%,
      oklch(26% 0.05 40 / 0.88) 100%
    ),
    repeating-linear-gradient(
      91.5deg,
      transparent 0 9px,
      oklch(38% 0.06 44 / 0.14) 10px,
      transparent 12px 21px,
      oklch(62% 0.07 60 / 0.1) 22px,
      transparent 24px 38px,
      oklch(32% 0.05 40 / 0.16) 39px
    ),
    linear-gradient(
      180deg,
      var(--plank-lit) 0%,
      var(--plank) 38%,
      var(--plank-mid) 78%,
      var(--plank-dark) 100%
    );
  box-shadow:
    0 1px 0 rgba(28, 14, 6, 0.5),
    0 3px 4px rgba(42, 22, 8, 0.28),
    0 10px 14px -3px rgba(40, 20, 8, 0.26),
    0 22px 28px -8px rgba(36, 18, 8, 0.16),
    inset 0 1px 0 oklch(84% 0.05 70 / 0.7),
    inset 0 -5px 0 oklch(28% 0.05 40 / 0.55),
    inset 2px 0 3px oklch(78% 0.05 65 / 0.12),
    inset -2px 0 4px oklch(22% 0.04 40 / 0.18);
}

.shelf-plank::before {
  content: "";
  position: absolute;
  inset: 1px 0 5px;
  border-radius: 2px;
  pointer-events: none;
  opacity: 0.42;
  mix-blend-mode: multiply;
  background-image:
    var(--wood-grain),
    repeating-linear-gradient(
      0.8deg,
      transparent 0 17px,
      oklch(30% 0.05 40 / 0.12) 18px,
      transparent 20px
    );
  background-size: 240px 64px, auto;
}

.shelf-plank::after {
  content: "";
  position: absolute;
  left: var(--knot-x, 24%);
  top: 5px;
  width: 15px;
  height: 9px;
  border-radius: 70% 40% 65% 45%;
  pointer-events: none;
  opacity: 0.38;
  background:
    radial-gradient(
      ellipse at 42% 40%,
      oklch(48% 0.08 50) 0 18%,
      oklch(34% 0.06 42) 42%,
      oklch(28% 0.05 40) 70%,
      transparent 72%
    );
  box-shadow:
    2px 1px 0 oklch(24% 0.04 38 / 0.2),
    92px 3px 0 -3px oklch(32% 0.05 42 / 0.28);
}

.shelf-plank[data-wear="1"]::after {
  left: 68%;
  width: 11px;
  height: 7px;
  opacity: 0.3;
  box-shadow: -54px 2px 0 -2px oklch(30% 0.05 40 / 0.22);
}
.shelf-plank[data-wear="2"]::after {
  left: 12%;
  top: 7px;
  width: 18px;
  height: 6px;
  opacity: 0.26;
  transform: rotate(-8deg);
}
.shelf-plank[data-wear="3"]::after {
  left: 46%;
  width: 9px;
  height: 10px;
  opacity: 0.34;
  box-shadow:
    120px 1px 0 -3px oklch(36% 0.06 48 / 0.2),
    -70px 4px 0 -4px oklch(28% 0.04 40 / 0.18);
}
.shelf-plank[data-wear="4"]::after {
  left: 81%;
  width: 22px;
  height: 4px;
  border-radius: 40%;
  opacity: 0.22;
  background: linear-gradient(
    90deg,
    transparent,
    oklch(30% 0.05 40 / 0.55) 40%,
    transparent
  );
  box-shadow: none;
}

/* ── Upright book: cloth spine with grain, bevel, and contact shadow ── */
.book {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  border-radius: 2px 3px 2px 1px;
  box-shadow:
    0 1px 0 rgba(18, 10, 6, 0.22),
    1px 2px 3px rgba(18, 10, 6, 0.14),
    inset 1px 0 0 rgba(255, 255, 255, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset -2px 0 0 rgba(0, 0, 0, 0.2),
    inset 0 -2px 3px rgba(0, 0, 0, 0.14),
    inset 4px 0 6px -3px rgba(0, 0, 0, 0.22),
    inset -5px 0 7px -3px rgba(0, 0, 0, 0.24);
}

.book::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 1;
  opacity: 0.32;
  mix-blend-mode: overlay;
  background-image: var(--grain);
  background-size: 160px 160px;
}

.book-title-spine {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  font-family: "Nunito", sans-serif;
  font-size: 10px;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: 0.3px;
  text-align: center;
  padding: 8px 2px;
  max-height: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-sizing: border-box;
  position: relative;
  z-index: 3;
}

/* Spine type combinations (mixed stacks + weight for variety) */
.book-title-spine.spine-combo-0 {
  font-family: "Nunito", system-ui, sans-serif;
  font-weight: 800;
  font-style: normal;
  letter-spacing: 0.3px;
}
.book-title-spine.spine-combo-1 {
  font-family: "Lato", "Nunito", sans-serif;
  font-weight: 900;
  font-style: normal;
  letter-spacing: 0.45px;
}
.book-title-spine.spine-combo-2 {
  font-family: "Faculty Glyphic", "Lato", sans-serif;
  font-weight: 400;
  font-style: normal;
  letter-spacing: 0.35px;
  font-size: 9.5px;
}
.book-title-spine.spine-combo-3 {
  font-family: "Playfair Display", "Times New Roman", serif;
  font-weight: 700;
  font-style: normal;
  letter-spacing: 0.2px;
  font-size: 10.5px;
}
.book-title-spine.spine-combo-4 {
  font-family: "Playfair Display", "Lato", sans-serif;
  font-weight: 700;
  font-style: italic;
  letter-spacing: 0.15px;
}
.book-title-spine.spine-combo-5 {
  font-family: "Lato", "Playfair Display", sans-serif;
  font-weight: 800;
  font-style: normal;
  letter-spacing: 0.25px;
  text-transform: none;
  font-size: 9px;
}

/* ── Horizontal stack cluster ── */
.stack-cluster {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
  position: relative;
  gap: 1px;
}

/* Image topper on top of horizontal book stacks */
.stack-topper {
  display: block;
  width: auto;
  margin-bottom: 4px;
  pointer-events: none;
  user-select: none;
}
.stack-topper.plant-1 { height: 120px; }
.stack-topper.plant-2 { height: 128px; }
.stack-topper.snow-globe { height: 110px; }
.stack-topper.earth-globe { height: 118px; }

/* A single horizontal book: spine-up stack with the same physical lighting */
.book-flat {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  border-radius: 2px 2px 1px 1px;
  box-shadow:
    0 1px 1px rgba(18, 10, 6, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.26),
    inset 1px 0 0 rgba(255, 255, 255, 0.14),
    inset 0 -2px 0 rgba(0, 0, 0, 0.2),
    inset -2px 0 3px rgba(0, 0, 0, 0.14),
    inset 0 3px 5px -2px rgba(0, 0, 0, 0.12),
    inset 0 -4px 6px -2px rgba(0, 0, 0, 0.16);
}

.book-flat::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 1;
  opacity: 0.3;
  mix-blend-mode: overlay;
  background-image: var(--grain);
  background-size: 140px 140px;
}

.book-flat-title {
  font-family: "Nunito", sans-serif;
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 10px;
  letter-spacing: 0.2px;
  max-width: 100%;
  position: relative;
  z-index: 3;
}

/* ── Decorative shelf objects (images) ── */
.shelf-deco {
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  padding: 0 6px;
}
.shelf-deco img {
  display: block;
  height: 130px;
  width: auto;
  pointer-events: none;
  user-select: none;
}

/* ── Stats section ── */
.stats-section {
  margin-top: 72px;
  padding: 0 8px;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.55s ease, transform 0.55s ease;
  transition-delay: 0.7s;
}
.stats-title {
  font-family: "Fraunces", serif;
  font-weight: 700;
  font-size: clamp(22px, 2.4vw, 30px);
  color: var(--ink);
  margin-bottom: 28px;
  text-align: center;
}
.stats-title em {
  font-style: italic;
  color: var(--accent);
}

.stats-counts {
  display: flex;
  justify-content: center;
  gap: 0;
  background: var(--card);
  border-radius: 16px;
  overflow: hidden;
  max-width: 760px;
  margin: 0 auto;
}
.stat-count {
  flex: 1;
  text-align: center;
  padding: 28px 20px;
  position: relative;
  min-width: 0;
}
.stat-count + .stat-count::before {
  content: "";
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 2px;
  background: var(--card-border);
}
.stat-number {
  font-family: "Fraunces", serif;
  font-size: clamp(34px, 4.5vw, 52px);
  font-weight: 900;
  color: var(--accent);
  line-height: 1;
  display: block;
}
.stat-label {
  font-family: "Lato", sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2.4px;
  text-transform: uppercase;
  color: var(--ink-mute);
  margin-top: 8px;
  display: block;
}

.shelf-row,
.shelf-plank {
  opacity: 0;
}

.shelf-row.is-in,
.shelf-plank.is-in {
  animation: row-in 0.55s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.bookcase.is-ready ~ .stats-section {
  opacity: 1;
  transform: none;
}

@keyframes row-in {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .shelf-row,
  .shelf-plank,
  .stats-section {
    opacity: 1;
    transform: none;
    transition: none;
    animation: none;
  }
}

.site-footer {
  position: relative;
  z-index: 1;
  padding: 10px 20px;
  text-align: center;
  font-family: "Lato", sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--ink);
  background: transparent;
}

/* ── Tablet responsive tweaks (768 – 1024 px) ── */
@media (max-width: 1024px) {
  .page-wrapper {
    padding: 0 22px 40px;
  }
  header {
    padding: 56px 0 40px;
  }
  .stats-section {
    margin-top: 56px;
  }
  .stats-title {
    margin-bottom: 22px;
  }
  .stat-count {
    padding: 22px 12px;
  }
  .stat-label {
    letter-spacing: 2px;
  }
}

/* ── Mobile / small viewport notice ── */
.mobile-notice {
  display: none;
  position: relative;
  z-index: 1;
}

@media (max-width: 767px) {
  .page-wrapper,
  .site-footer {
    display: none;
  }
  .mobile-notice {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    min-height: 100vh;
    padding: 40px 28px;
    gap: 20px;
  }
  .mobile-notice .glyph {
    font-size: 48px;
  }
  .mobile-notice h2 {
    font-family: "Playfair Display", serif;
    font-weight: 900;
    font-size: 30px;
    line-height: 1.15;
    color: var(--ink);
    max-width: 16ch;
  }
  .mobile-notice p {
    font-family: "Playfair Display", serif;
    font-size: 16px;
    line-height: 1.5;
    color: var(--ink);
    font-style: italic;
    max-width: 32ch;
  }
}
