/* Jacoby Mason — Books & Stories */

@font-face {
  font-family: "IM Fell English SC";
  src: url("/fonts/im-fell-english-sc-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "IM Fell English";
  src: url("/fonts/im-fell-english-italic-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}
@font-face {
  font-family: "EB Garamond";
  src: url("/fonts/eb-garamond-latin.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "EB Garamond";
  src: url("/fonts/eb-garamond-italic-latin.woff2") format("woff2");
  font-weight: 400 600;
  font-style: italic;
  font-display: swap;
}

:root {
  --night: #05070c;
  --deep: #0a1222;
  --ivory: #ece3cf;
  --ivory-soft: #d2c8b4;
  --muted: #a09a8b;
  --gold: #c9a45c;
  --gold-bright: #e7c27a;
  --gold-line: rgba(201, 164, 92, 0.38);
  --paper: #e4d8bf;
  --ink: #1e1a13;
  --gold-ink: #6c501b;

  --display: "IM Fell English SC", "Iowan Old Style", Georgia, serif;
  --fell: "IM Fell English", "Iowan Old Style", Georgia, serif;
  --serif: "EB Garamond", "Iowan Old Style", Georgia, serif;

  --header-h: 64px;
  --gutter: clamp(20px, 5vw, 56px);

  /* Original fine grain, generated by an SVG noise filter. */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .32 0 0 0 0 .24 0 0 0 0 .12 0 0 0 .10 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --grain-light: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .9 0 0 0 0 .85 0 0 0 0 .75 0 0 0 .035 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--night);
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }
}

body {
  margin: 0;
  background: var(--night);
  color: var(--ivory);
  font-family: var(--serif);
  font-size: 1.1875rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  display: block;
  max-width: 100%;
}
img {
  height: auto;
}

h1,
h2,
h3,
h4,
p,
ul,
figure {
  margin: 0;
}

h1,
h2,
h3,
h4 {
  font-weight: 400;
}

ul {
  padding: 0;
  list-style: none;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 4px;
}

.container {
  position: relative;
  width: 100%;
  max-width: 1160px;
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 10px 16px;
  background: var(--ivory);
  color: var(--night);
  transform: translateY(-160%);
}
.skip-link:focus {
  transform: none;
}

[id] {
  scroll-margin-top: var(--header-h);
}

/* ── Header ─────────────────────────────────────────────────────────────── */

.site-header {
  position: fixed;
  inset: 0 0 auto;
  z-index: 20;
  background: linear-gradient(rgba(5, 7, 12, 0.92), rgba(5, 7, 12, 0.7));
  border-bottom: 1px solid rgba(201, 164, 92, 0.14);
}
@supports (backdrop-filter: blur(10px)) {
  .site-header {
    background: rgba(5, 7, 12, 0.6);
    backdrop-filter: blur(10px);
  }
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: var(--header-h);
}

.site-header__name {
  font-family: var(--display);
  font-size: 1.3rem;
  letter-spacing: 0.04em;
  text-decoration: none;
  white-space: nowrap;
}

.site-nav {
  display: flex;
  gap: clamp(20px, 4vw, 40px);
}

.site-header__name,
.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
}

.site-nav a {
  font-size: 0.8125rem;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--ivory-soft);
  transition: color 0.3s;
}
.site-nav a:hover {
  color: var(--gold-bright);
}

/* ── Hero ───────────────────────────────────────────────────────────────── */

.hero {
  position: relative;
  height: 100vh;
  height: 100svh;
  min-height: 580px;
  max-height: 1100px;
  overflow: hidden;
  isolation: isolate;
  background: var(--night);
}

.scene {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: -2;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 22%;
  background: linear-gradient(transparent, var(--night));
  z-index: -1;
  pointer-events: none;
}

.hero__content {
  position: absolute;
  inset: 21% var(--gutter) auto;
  text-align: center;
}

.hero__name {
  font-family: var(--display);
  font-size: clamp(2.8rem, 9.5vw, 7.5rem);
  line-height: 0.95;
  letter-spacing: 0.06em;
  text-shadow: 0 0 48px rgba(5, 7, 12, 0.9), 0 0 2px rgba(5, 7, 12, 0.6);
}

.hero__role {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  margin-top: clamp(14px, 2.2vw, 24px);
  font-family: var(--fell);
  font-style: italic;
  font-size: clamp(1.2rem, 2.2vw, 1.6rem);
  color: var(--gold-bright);
}
.hero__role::before,
.hero__role::after {
  content: "";
  width: clamp(28px, 6vw, 64px);
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold));
}
.hero__role::after {
  transform: scaleX(-1);
}

.hero__enter {
  position: absolute;
  left: 50%;
  bottom: clamp(20px, 4vh, 40px);
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  min-width: 44px;
  padding: 6px 10px;
  color: var(--gold);
  text-decoration: none;
  font-size: 0.75rem;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  transition: color 0.4s;
}
.hero__enter span {
  margin-right: -0.32em; /* optically centre tracked text */
}
.hero__door {
  width: 16px;
  height: 27px;
  transition: filter 0.4s;
}
.hero__enter:hover {
  color: var(--gold-bright);
}
.hero__enter:hover .hero__door {
  filter: drop-shadow(0 0 6px rgba(231, 194, 122, 0.8));
}

/* Fog: soft, layered, drifting very slowly. */
.fog {
  position: absolute;
  left: -50%;
  width: 200%;
  pointer-events: none;
  z-index: -1;
}
.fog--far {
  top: 50%;
  height: 26%;
  background:
    radial-gradient(ellipse 22% 45% at 18% 55%, rgba(150, 168, 196, 0.13), transparent 70%),
    radial-gradient(ellipse 18% 40% at 46% 40%, rgba(150, 168, 196, 0.08), transparent 70%),
    radial-gradient(ellipse 24% 50% at 74% 60%, rgba(150, 168, 196, 0.12), transparent 70%);
}
.fog--near {
  bottom: 0;
  height: 34%;
  background:
    radial-gradient(ellipse 26% 55% at 30% 70%, rgba(130, 148, 178, 0.12), transparent 70%),
    radial-gradient(ellipse 22% 45% at 62% 80%, rgba(130, 148, 178, 0.10), transparent 70%),
    radial-gradient(ellipse 20% 50% at 90% 65%, rgba(130, 148, 178, 0.11), transparent 70%);
}

.scene__glow,
.scene__reflection,
.scene__ripples {
  transform-box: fill-box;
  transform-origin: center;
}

/* ── Horizon motif ──────────────────────────────────────────────────────── */

.horizon {
  position: relative;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-line) 30%, rgba(231, 194, 122, 0.7) 50%, var(--gold-line) 70%, transparent);
}
.horizon__light {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 5px;
  height: 9px;
  transform: translate(-50%, -100%);
  background: var(--gold-bright);
  box-shadow: 0 0 10px 2px rgba(231, 194, 122, 0.55), 0 0 30px 8px rgba(224, 162, 74, 0.18);
}

/* ── Books ──────────────────────────────────────────────────────────────── */

.books__intro {
  padding-top: clamp(48px, 8vw, 96px);
  text-align: center;
}

.section-label {
  margin-top: 28px;
  font-family: var(--display);
  font-size: 1.1rem;
  letter-spacing: 0.34em;
  color: var(--gold);
}

.horizon--between {
  margin-block: 0;
}

.book {
  position: relative;
  padding-block: clamp(64px, 10vw, 128px);
  overflow: hidden;
  isolation: isolate;
}

.book__grid {
  display: grid;
  grid-template-columns: minmax(0, 360px) minmax(0, 1fr);
  gap: clamp(48px, 8vw, 112px);
  align-items: center;
}
.book--flip .book__grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 360px);
}
.book--flip .cover {
  order: 2;
}

.book__body {
  max-width: 35rem;
}
.book--flip .book__body {
  justify-self: end;
}

/* Grounded: the compass, warm lamplight, quiet. */
.book--grounded {
  background:
    radial-gradient(circle at 24% 50%, rgba(201, 164, 92, 0.08), transparent 42%),
    var(--grain-light),
    var(--night);
}

.book__compass {
  position: absolute;
  z-index: -1;
  top: 50%;
  left: max(var(--gutter), calc(50% - 580px + var(--gutter)));
  width: 640px;
  height: 640px;
  margin-left: -140px;
  transform: translateY(-50%);
  color: var(--gold);
  opacity: 0.09;
}

/* Atmospheric: deep water, fog, an arched doorway around the cover. */
.book--atmospheric {
  background:
    radial-gradient(ellipse 60% 50% at 80% 45%, rgba(224, 162, 74, 0.07), transparent 70%),
    linear-gradient(180deg, var(--night), #081022 35%, #0b1629 65%, var(--night));
}
.book--flip.book--atmospheric {
  background:
    radial-gradient(ellipse 60% 50% at 78% 45%, rgba(224, 162, 74, 0.08), transparent 70%),
    linear-gradient(180deg, var(--night), #081022 35%, #0b1629 65%, var(--night));
}
.fog--section {
  bottom: 0;
  height: 45%;
  background:
    radial-gradient(ellipse 22% 45% at 20% 70%, rgba(130, 148, 178, 0.09), transparent 70%),
    radial-gradient(ellipse 26% 50% at 55% 80%, rgba(130, 148, 178, 0.07), transparent 70%),
    radial-gradient(ellipse 20% 40% at 85% 60%, rgba(130, 148, 178, 0.09), transparent 70%);
}

/* Covers and their frames */
.cover {
  position: relative;
}
.cover__img {
  width: 100%;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5), 0 30px 60px -20px rgba(0, 0, 0, 0.85);
}

.cover--grounded {
  padding: 14px;
  border: 1px solid var(--gold-line);
  outline: 1px solid rgba(201, 164, 92, 0.14);
  outline-offset: 8px;
}
/* Four tiny gold rivets at the frame's corners. */
.cover--grounded::before {
  content: "";
  position: absolute;
  inset: -4px;
  pointer-events: none;
  background:
    radial-gradient(circle, var(--gold) 1.6px, transparent 2.2px) 0 0 / 8px 8px no-repeat,
    radial-gradient(circle, var(--gold) 1.6px, transparent 2.2px) 100% 0 / 8px 8px no-repeat,
    radial-gradient(circle, var(--gold) 1.6px, transparent 2.2px) 0 100% / 8px 8px no-repeat,
    radial-gradient(circle, var(--gold) 1.6px, transparent 2.2px) 100% 100% / 8px 8px no-repeat;
}

.cover--atmospheric {
  padding: clamp(56px, 7vw, 84px) clamp(16px, 2vw, 22px) clamp(16px, 2vw, 22px);
  border: 1px solid var(--gold-line);
  border-bottom-color: transparent;
  border-radius: 50% 50% 0 0 / 20% 20% 0 0;
  box-shadow: 0 -10px 80px -20px rgba(224, 162, 74, 0.22), inset 0 30px 60px -40px rgba(231, 194, 122, 0.25);
}
/* Water line at the threshold of the doorway. */
.cover--atmospheric::after {
  content: "";
  position: absolute;
  left: -24%;
  right: -24%;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(231, 194, 122, 0.6), transparent);
}

/* Text */
.book__kicker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 18px;
  margin-bottom: 26px;
}

.book__numeral {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-family: var(--display);
  font-size: 1.35rem;
  line-height: 1;
  color: var(--gold);
}
.book__numeral::after {
  content: "";
  width: 32px;
  height: 1px;
  background: var(--gold-line);
}

.status {
  display: inline-block;
  padding: 4px 12px 3px;
  border: 1px solid var(--gold-line);
  font-size: 0.75rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold-bright);
}

.book__date {
  font-size: 0.95rem;
  font-style: italic;
  color: var(--muted);
}

.book__title {
  font-family: var(--display);
  font-size: clamp(2.2rem, 4.6vw, 3.5rem);
  line-height: 1.02;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  text-wrap: balance;
  overflow-wrap: break-word;
}

.book__subtitle {
  margin-top: 14px;
  font-family: var(--fell);
  font-style: italic;
  font-size: clamp(1.2rem, 2.2vw, 1.45rem);
  line-height: 1.35;
  color: var(--ivory-soft);
}

.book__byline {
  margin-top: 20px;
  font-size: 0.8125rem;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--gold);
}

.book__meta {
  display: flex;
  flex-wrap: wrap;
  margin-top: 6px;
  font-style: italic;
  font-size: 1rem;
  color: var(--muted);
}
.book__meta li + li::before {
  content: "\00b7";
  margin-inline: 0.55em;
  font-style: normal;
  color: var(--gold);
}

.book__description {
  margin-top: 30px;
  padding-top: 28px;
  border-top: 1px solid rgba(236, 227, 207, 0.12);
  color: var(--ivory-soft);
}
.book__description p + p,
.book__more > p:first-child {
  margin-top: 0.9em;
}

.book__more[hidden] {
  display: none;
}
.book__more:focus {
  outline: none;
}

.book__lead {
  font-family: var(--fell);
  font-style: italic;
  font-size: clamp(1.45rem, 2.6vw, 1.85rem);
  line-height: 1.3;
  color: var(--ivory);
}
.book__lead + p {
  margin-top: 1.1em !important;
}

.book__closing {
  margin-top: 1.6em !important;
  font-family: var(--fell);
  font-style: italic;
  font-size: clamp(1.5rem, 2.6vw, 1.85rem);
  line-height: 1.3;
  color: var(--gold-bright);
  text-shadow: 0 0 24px rgba(231, 194, 122, 0.25);
}
.book__closing::before {
  content: "";
  display: block;
  width: 44px;
  height: 1px;
  margin-bottom: 0.8em;
  background: var(--gold-line);
}

.read-more {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin-top: 14px;
  padding: 0;
  background: none;
  border: 0;
  font: inherit;
  font-style: italic;
  font-size: 1.05rem;
  color: var(--gold);
  cursor: pointer;
}
.read-more__label {
  border-bottom: 1px solid var(--gold-line);
  transition: border-color 0.3s, color 0.3s;
}
.read-more:hover .read-more__label {
  color: var(--gold-bright);
  border-color: var(--gold-bright);
}

/* Availability */
.availability {
  margin-top: 36px;
  padding-top: 28px;
  border-top: 1px solid rgba(236, 227, 207, 0.12);
}

.availability__heading {
  font-family: var(--display);
  font-size: 1.5rem;
  line-height: 1.2;
  letter-spacing: 0.03em;
}

.availability__label {
  margin-top: 2px;
  font-style: italic;
  font-size: 1rem;
  color: var(--muted);
}

.retailers {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

/* Planned (unconfirmed): dashed, quiet, not clickable. */
.retailer {
  display: inline-block;
  padding: 5px 14px 4px;
  border: 1px dashed rgba(236, 227, 207, 0.26);
  font-size: 1rem;
  line-height: 1.4;
  color: var(--ivory-soft);
  text-decoration: none;
  cursor: default;
}

/* Live: solid gold, clickable. */
.retailer--live {
  border: 1px solid var(--gold);
  color: var(--ivory);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-color: var(--gold-line);
  text-underline-offset: 3px;
  transition: background-color 0.3s, color 0.3s;
}
.retailer--live:hover {
  background: var(--gold);
  color: var(--night);
}

.availability__note {
  margin-top: 14px;
  font-style: italic;
  font-size: 0.95rem;
  color: var(--muted);
}

/* ── About ──────────────────────────────────────────────────────────────── */

.about {
  position: relative;
  padding-block: clamp(72px, 11vw, 128px);
  background:
    radial-gradient(ellipse at center, transparent 45%, rgba(70, 50, 20, 0.22) 100%),
    var(--grain),
    var(--paper);
  color: var(--ink);
  box-shadow: inset 0 24px 40px -24px rgba(0, 0, 0, 0.45), inset 0 -24px 40px -24px rgba(0, 0, 0, 0.45);
}

.about__inner {
  max-width: 44rem;
  text-align: center;
}

.about__door {
  width: 18px;
  height: 30px;
  margin: 0 auto 22px;
  color: var(--gold-ink);
}

.about__heading {
  font-family: var(--display);
  font-size: clamp(1.7rem, 3.2vw, 2.2rem);
  line-height: 1.15;
  letter-spacing: 0.03em;
  margin-bottom: 24px;
}

.about p {
  font-size: clamp(1.2rem, 2.3vw, 1.4rem);
  line-height: 1.6;
}

/* ── Footer ─────────────────────────────────────────────────────────────── */

.site-footer {
  padding-block: 56px 44px;
  text-align: center;
}

.horizon--footer {
  max-width: 420px;
  margin: 0 auto 28px;
}

.site-footer__line {
  font-family: var(--fell);
  font-style: italic;
  font-size: 1.2rem;
  color: var(--ivory-soft);
}

.site-footer__legal {
  margin-top: 6px;
  font-size: 0.9rem;
  color: var(--muted);
}

.site-footer__credit {
  margin-top: 8px;
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--muted);
}
.site-footer__credit a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: inherit;
  text-decoration-color: var(--gold-line);
  text-underline-offset: 3px;
}
.site-footer__credit a:hover {
  color: var(--gold-bright);
}

/* ── Motion (only when the visitor hasn't asked for less) ───────────────── */

@media (prefers-reduced-motion: no-preference) {
  .fog--far {
    animation: drift 150s ease-in-out infinite alternate;
  }
  .fog--near,
  .fog--section {
    animation: drift 110s ease-in-out infinite alternate-reverse;
  }
  .scene__glow {
    animation: breathe 7s ease-in-out infinite alternate;
  }
  .scene__reflection {
    animation: shimmer 5s ease-in-out infinite alternate;
  }
  .scene__ripples {
    animation: swell 16s ease-in-out infinite alternate;
  }

  [data-reveal].is-pending {
    opacity: 0;
    transform: translateY(18px);
  }
  [data-reveal].is-revealed {
    opacity: 1;
    transform: none;
    transition: opacity 1.2s ease, transform 1.2s ease;
  }
}

@keyframes drift {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(22%);
  }
}
@keyframes breathe {
  from {
    opacity: 0.7;
    transform: scale(0.96);
  }
  to {
    opacity: 1;
    transform: scale(1.04);
  }
}
@keyframes shimmer {
  from {
    opacity: 0.75;
    transform: translateX(-2px) scaleX(0.97);
  }
  to {
    opacity: 1;
    transform: translateX(2px) scaleX(1.03);
  }
}
@keyframes swell {
  from {
    transform: translateX(-14px);
  }
  to {
    transform: translateX(14px);
  }
}

/* ── Responsive ─────────────────────────────────────────────────────────── */

@media (max-width: 899px) {
  .book__grid,
  .book--flip .book__grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 48px;
  }
  .book--flip .cover {
    order: 0;
  }
  .cover {
    width: min(72vw, 330px);
    margin-inline: auto;
  }
  .book__body,
  .book--flip .book__body {
    max-width: 38rem;
    margin-inline: auto;
    justify-self: auto;
  }
  .book__compass {
    top: clamp(10px, 4vw, 40px);
    left: 50%;
    width: min(130vw, 600px);
    height: auto;
    margin-left: 0;
    transform: translateX(-50%);
  }
  .book--atmospheric,
  .book--flip.book--atmospheric {
    background:
      radial-gradient(ellipse 80% 30% at 50% 22%, rgba(224, 162, 74, 0.09), transparent 70%),
      linear-gradient(180deg, var(--night), #081022 30%, #0b1629 70%, var(--night));
  }
}

/* Phones: keep the atmosphere, drop the moving parts that cost battery. */
@media (max-width: 700px) {
  .fog--far,
  .fog--near,
  .fog--section,
  .scene__ripples {
    animation: none !important;
  }
  .hero {
    min-height: 540px;
    max-height: 860px;
  }
  .hero__content {
    top: 18%;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 1.125rem;
  }
  .hero__name {
    font-size: clamp(3.2rem, 17vw, 4.6rem);
    line-height: 0.92;
  }
  .hero__name span {
    display: block;
  }
  .site-header__name {
    font-size: 1.15rem;
  }
  .site-nav a {
    letter-spacing: 0.18em;
  }
  .book__title {
    font-size: clamp(2rem, 9.6vw, 2.5rem);
  }
}

/* ── 404 ────────────────────────────────────────────────────────────────── */

.not-found {
  display: grid;
  place-items: center;
  min-height: 100vh;
  min-height: 100svh;
  padding-block: 48px;
  text-align: center;
  background: radial-gradient(ellipse 50% 30% at 50% 62%, rgba(224, 162, 74, 0.1), transparent 70%), linear-gradient(var(--night), var(--deep) 60%, var(--night));
}
.not-found__horizon {
  max-width: 420px;
  margin: 48px auto 24px;
}

/* The entrance stays a single, uninterrupted scene. */
.entrance-page .hero { min-height: 420px; max-height: none; }
.books-page main { padding-top: var(--header-h); }
.books-page .books__intro { padding-top: 40px; }

/* An editorial margin beside Jacoby's own words. */
.about { padding-block: clamp(52px, 7vw, 88px); }
.about__grid { display: grid; grid-template-columns: minmax(0, .85fr) minmax(0, 1.4fr); gap: clamp(36px, 7vw, 88px); }
.about__eyebrow, .letters__eyebrow { font-size: .8rem !important; letter-spacing: .2em; text-transform: uppercase; }
.about__eyebrow { color: var(--gold-ink); }
.about__heading { margin-top: 14px; font-size: clamp(2.4rem, 4.5vw, 3.6rem); max-width: 8em; }
.about__prose p { font-size: clamp(1.15rem, 1.8vw, 1.3rem); line-height: 1.55; }
.about__prose p + p { margin-top: 1em; }
.about__vignette { position: relative; margin-top: 40px; height: 250px; overflow: hidden; border-bottom: 1px solid #a18c65; background: radial-gradient(ellipse at 50% 60%, #bba16c45, transparent 65%); }
.about__threshold { position: absolute; inset: 25px 0 auto; display: grid; place-items: center; }
.about__door { width: 65px; height: 110px; margin: 0; color: var(--gold-ink); }
.about__water { position: absolute; inset: 134px 10% 48px; background: repeating-linear-gradient(0deg, transparent 0 12px, #9a805632 13px, transparent 14px); transform: perspective(180px) rotateX(45deg); }
.about__folio { position: absolute; inset: auto 0 12px; text-align: center; color: var(--gold-ink); font-style: italic; font-size: 1rem; }

/* Warm lamplight, ink-dark water, and a small unopened letter. */
.letters { padding-block: clamp(56px, 8vw, 100px); border-bottom: 1px solid var(--gold-line); background: radial-gradient(ellipse at 25% 65%, #b8823020, transparent 48%), var(--grain-light), linear-gradient(120deg, #121713, #09121b 70%); }
.letters__grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: clamp(36px, 7vw, 88px); align-items: center; }
.letters__eyebrow { color: var(--gold-bright); margin-bottom: 20px; }
.letters h2 { font-family: var(--display); font-size: clamp(2.1rem, 4vw, 3.2rem); line-height: 1.12; text-wrap: balance; }
.letters__description { color: var(--ivory-soft); margin-top: 24px; line-height: 1.55; }
.letter-art { position: relative; width: 210px; height: 135px; margin: 38px auto 0; transform: rotate(-7deg); filter: drop-shadow(4px 12px 12px #05070c80); }
.letter-art__paper { position: absolute; inset: 0 14px 15px; padding: 12px 20px; background: var(--grain), #ded0ae; color: var(--gold-ink); border: 1px solid #b79a65; }
.letter-art__paper span { display: block; font-style: italic; font-size: .9rem; line-height: 1.3; }
.letter-art__paper span + span { font-family: var(--fell); font-size: 1.3rem; }
.letter-art__envelope { position: absolute; inset: 42px 0 0; border: 1px solid #b79a65; background: linear-gradient(27deg, transparent 49.5%, #af9362 50%, transparent 50.8%), linear-gradient(-27deg, #c5b18b 49.5%, #af9362 50%, #ddcba7 50.8%); }
.letter-art__envelope span { position: absolute; left: calc(50% - 16px); top: 25px; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: #675036; color: #efdcaa; font-family: var(--display); font-size: .75rem; box-shadow: 0 2px 3px #33271960; }
.letters__signup { border-top: 1px solid var(--gold-line); padding-top: 30px; }
.letters__field + .letters__field { margin-top: 22px; }
.letters label { display: block; margin-bottom: 8px; color: var(--ivory); }
.letters label span { color: var(--muted); font-size: 1rem; }
.letters input:not([type="hidden"]) { width: 100%; min-height: 50px; padding: 10px 14px; border: 1px solid #a68b5c80; border-radius: 0; background: #080e14; color: var(--ivory); font: inherit; line-height: 1.3; }
.letters__disclosure { margin-top: 24px; font-size: 1rem; line-height: 1.45; color: var(--ivory-soft); }
.letters__submit { width: 100%; min-height: 52px; margin-top: 24px; padding: 12px 24px; font: inherit; font-family: var(--display); font-size: 1.2rem; color: #211b10; background: #d0af72; border: 1px solid #e7c27a; cursor: pointer; transition: background-color .2s; }
.letters__submit:hover { background: #e7c88f; }
.letters__submit:disabled { opacity: .7; cursor: wait; }
.letters__status { margin-top: 16px; min-height: 3em; font-size: 1.1rem; line-height: 1.45; color: var(--gold-bright); }
.letters__status[data-state="error"] { color: #f0bcb0; }
.received { max-width: 38rem; }
.received h1 { font-family: var(--display); font-size: clamp(2rem, 6vw, 3.5rem); line-height: 1.2; margin-bottom: 24px; }
.received a { display: inline-block; margin-top: 24px; color: var(--gold-bright); }
@media (max-width: 760px) {
  .about__grid, .letters__grid { grid-template-columns: minmax(0, 1fr); }
  .about__margin { display: grid; grid-template-columns: 1fr 100px; column-gap: 16px; align-items: center; }
  .about__eyebrow, .about__heading { grid-column: 1; }
  .about__heading { margin-bottom: 0; }
  .about__vignette { grid-column: 2; grid-row: 1 / 3; height: 145px; margin-top: 0; }
  .about__threshold { inset-block-start: 10px; }
  .about__door { width: 40px; height: 70px; }
  .about__water { inset: 80px 0 15px; }
  .about__folio { display: none; }
  .letter-art { width: 170px; height: 115px; margin-top: 28px; }
  .site-nav { gap: 14px; }
  .site-nav a { font-size: .7rem; letter-spacing: .1em; }
}
@media (max-width: 360px) {
  .site-header__name { font-size: 1rem; }
  .site-nav { gap: 10px; }
  .about__margin { grid-template-columns: 1fr 65px; }
}

/* Viewport-driven layouts retain the same content and interaction state. */
.container {
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}
.site-header { position: sticky; padding-top: env(safe-area-inset-top); }
.site-header__inner { height: auto; min-height: var(--header-h); flex-wrap: wrap; gap: 0 20px; }
.site-header__name { white-space: normal; }
.site-nav { flex-wrap: wrap; gap: 4px 16px; }
.site-nav a { justify-content: center; min-width: 48px; padding-inline: 4px; font-size: .875rem; letter-spacing: .12em; }
.books-page main { padding-top: 0; }
[id] { scroll-margin-top: calc(var(--header-offset, var(--header-h)) + 20px); }
.book__grid > *, .about__grid > *, .letters__grid > * { min-width: 0; }
.book__body, .about__prose, .letters__description { max-width: 58ch; }
.book__title, .about__heading, .letters h2 { overflow-wrap: anywhere; }
.book__more:focus-visible { outline: 2px solid var(--gold-bright); outline-offset: 6px; }
.read-more { padding: 8px 4px; }
.about :focus-visible { outline-color: var(--gold-ink); }
.letters input { scroll-margin-block: 120px 24px; }
.letters__status { overflow-wrap: anywhere; scroll-margin-block: 120px 24px; }
.site-footer { padding-bottom: max(32px, env(safe-area-inset-bottom)); }
.site-footer__credit a { display: inline; padding-block: 14px; }

.entrance-page .hero {
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  max-height: none;
}
.hero__content { top: max(18%, env(safe-area-inset-top)); }
.hero__enter {
  bottom: max(20px, env(safe-area-inset-bottom));
  min-width: 100px;
  min-height: 64px;
  font-size: .875rem;
}
@media (max-aspect-ratio: 4/3) {
  /* Keep the original crescent inside the portrait crop of the ocean SVG. */
  .scene__moon { transform: translate(-470px, -55px); }
}
@media (min-width: 720px) and (max-width: 1099px) {
  .book__grid, .book--flip .book__grid {
    grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr);
    gap: clamp(28px, 4vw, 44px);
    align-items: start;
  }
  .book--flip .book__grid { grid-template-columns: minmax(0, 1.2fr) minmax(0, .8fr); }
  .book--flip .cover { order: 2; }
  .cover { width: 100%; margin: 0; }
  .book__title { font-size: clamp(2rem, 4.4vw, 3rem); }
  .book__compass { top: 32px; left: 15%; width: 480px; }
}
@media (max-width: 719px) {
  .book { padding-block: clamp(44px, 9vw, 64px); }
  .book__grid, .book--flip .book__grid { gap: 36px; }
  .cover { width: min(76vw, 330px); }
  .book__body { width: 100%; }
  .about__prose { max-width: 58ch; }
  .letters__grid { max-width: 42rem; }
}
@media (max-width: 479px) {
  :root { --header-h: 108px; }
  .site-header__inner { justify-content: center; padding-block: 4px; gap: 0; }
  .site-header__name { justify-content: center; width: 100%; font-size: 1.25rem; }
  .site-header nav { width: 100%; }
  .site-nav { justify-content: center; gap: 4px 20px; }
  .site-nav a { font-size: .875rem; letter-spacing: .12em; }
  .about__margin { grid-template-columns: minmax(0, 1fr) 55px; }
  .about__heading { font-size: clamp(2rem, 9vw, 2.7rem); }
  .about__eyebrow { letter-spacing: .12em; }
  .hero__name { font-size: clamp(2.5rem, 14vw, 4rem); }
}
@media (max-height: 480px) {
  .entrance-page .hero__content { top: max(8%, env(safe-area-inset-top)); }
  .hero__name { font-size: clamp(2rem, 9vh, 3rem); }
  .hero__name span { display: inline; }
  .hero__role { margin-top: 8px; font-size: 1.1rem; }
  .hero__enter { bottom: max(8px, env(safe-area-inset-bottom)); gap: 2px; min-height: 48px; }
  .hero__door { height: 18px; }
  .scene { top: 5%; }
  .scene__moon { transform: translate(-160px, 0); }
  .site-header { position: relative; }
  [id] { scroll-margin-top: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* The same golden threshold, seen from inside. Architecture stays still. */
.library { position: relative; isolation: isolate; overflow: hidden; padding-bottom: 44px; background: radial-gradient(ellipse at 50% 0%, #b38a4220, transparent 40%), linear-gradient(#0c1421, #080d16 65%, var(--night)); }
.library__architecture { position: absolute; inset: 20px max(12px, calc((100% - 1280px)/2)) 160px; display: grid; grid-template-columns: 1fr 1.5fr 1fr; gap: 20px; z-index: -1; opacity: .5; pointer-events: none; }
.library__architecture span { border: 1px solid #c9a45c22; border-radius: 50% 50% 0 0 / 180px 180px 0 0; box-shadow: inset 0 0 0 8px #080e1833, inset 0 0 0 9px #c9a45c10; }
.library__architecture span:nth-child(2) { margin-top: 28px; }
.library__intro { padding: clamp(28px, 4vw, 52px) 0 30px; text-align: center; }
.library__key { width: 15px; height: 25px; color: var(--gold); margin: 0 auto 16px; }
.library__intro h1 { font-family: var(--display); font-size: clamp(1.8rem, 4.5vw, 3.4rem); line-height: 1.15; letter-spacing: .12em; text-transform: uppercase; text-wrap: balance; }
.library__intro p { margin-top: 12px; font-style: italic; font-size: clamp(1.15rem, 2vw, 1.4rem); color: var(--ivory-soft); }
.story-gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(24px, 5vw, 68px); }
.story { min-width: 0; }
.story__link { display: block; text-decoration: none; }
.story__alcove { position: relative; isolation: isolate; display: grid; place-items: end center; padding: 45px 30px 28px; border: 1px solid #c9a45c45; border-bottom: 0; border-radius: 50% 50% 0 0 / 100px 100px 0 0; background: radial-gradient(ellipse at 50% 48%, #bc8a352b, transparent 68%), #0b1015; }
.story--atmospheric .story__alcove { background: radial-gradient(ellipse at 50% 58%, #547a9540, transparent 70%), linear-gradient(#0e1b2b, #080d17); }
.story__alcove::before { content: ''; position: absolute; inset: 9px 9px 0; border: 1px solid #c9a45c22; border-radius: inherit; z-index: -1; }
.story__compass { position: absolute; width: 88%; left: 6%; top: 8%; color: var(--gold); opacity: .16; z-index: -1; }
.story__door { position: absolute; top: 14px; width: 10px; height: 17px; color: var(--gold); opacity: .6; }
.story__cover { width: min(100%, 220px); transform: rotate(-2deg); transition: transform .25s ease; }
.story--atmospheric .story__cover { transform: rotate(2deg); }
.story__cover img { width: 100%; height: auto; box-shadow: 8px 6px 0 -4px #c8b99560, 12px 18px 30px #03050ad9; }
.story__shelf { position: absolute; inset: auto -8px 0; height: 9px; border-top: 1px solid #d5b77488; background: linear-gradient(#534530, #1a1a1b); box-shadow: 0 12px 20px #03050a; }
.story__caption { padding: 25px 4px 18px; }
.story__category { font-size: .75rem; letter-spacing: .15em; text-transform: uppercase; color: var(--gold-bright); }
.story__caption h2 { font-family: var(--display); font-size: clamp(1.6rem, 2.8vw, 2.15rem); line-height: 1.15; margin-top: 10px; }
.story__subtitle { margin-top: 10px; max-width: 32ch; color: var(--ivory-soft); font-style: italic; font-size: 1.05rem; line-height: 1.35; }
.story__author { font-size: 1rem; color: var(--muted); margin-top: 10px; }
.story__bottom { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: center; justify-content: space-between; margin-top: 18px; border-top: 1px solid var(--gold-line); padding-top: 16px; }
.story__open { font-size: 1rem; color: var(--gold-bright); text-decoration: underline; text-underline-offset: 5px; }
.story__open span { display: inline-block; margin-left: 6px; }
.story__link:hover .story__cover, .story__link:focus-visible .story__cover { transform: translateY(-6px) rotate(0); }
.story__link:hover .story__alcove, .story__link:focus-visible .story__alcove { border-color: var(--gold); }
.library__entrance { display: flex; gap: 10px; align-items: center; justify-content: center; width: fit-content; min-height: 44px; margin: 24px auto 0; color: var(--ivory-soft); font-size: 1rem; text-underline-offset: 4px; }
.library__exit { width: 10px; height: 18px; color: var(--gold); }
.detail-return { padding-block: 22px; font-size: 1.05rem; color: var(--gold-bright); }
.detail-return a { display: inline-flex; align-items: center; min-height: 44px; text-underline-offset: 5px; }
@media (max-width: 599px) {
  .story-gallery { grid-template-columns: minmax(0, 1fr); gap: 34px; max-width: 390px; margin-inline: auto; }
  .story__cover { width: min(100%, 190px); }
  .story__alcove { padding: 36px 36px 24px; }
  .library__intro { padding-bottom: 26px; }
  .library__architecture { grid-template-columns: 1fr; inset-inline: 10px; }
  .library__architecture span:not(:first-child) { display: none; }
}
@media (min-width: 600px) and (max-width: 800px) {
  .story__alcove { padding-inline: 24px; }
  .story__cover { width: min(100%, 190px); }
  .story__caption h2 { font-size: 1.65rem; }
}
/* A single, brief passage: no ongoing animation in the library. */
.entrance-page .scene__glow, .entrance-page .scene__reflection,
.entrance-page .scene__ripples, .entrance-page .fog { animation: none; }
.hero .scene { transition: transform 1s cubic-bezier(.3,.1,.25,1); transform-origin: 50% 61%; }
.hero .scene__glow { transition: transform .9s ease, opacity .5s ease; }
.hero .scene__door > rect:first-child { transition: fill .35s ease; }
.hero__content, .hero__enter { transition: opacity .3s ease; }
.hero::before { content: ''; position: absolute; inset: -20%; z-index: 3; pointer-events: none; background: radial-gradient(ellipse at 50% 60%, #f3d49bcc, #b8843c66 35%, transparent 65%); opacity: 0; transform: scale(.2); transition: transform 1s ease, opacity 1s ease; }
.is-entering .scene { transform: scale(2.8); }
.is-entering .scene__glow { transform: scale(4); opacity: 1; }
.is-entering .scene__door > rect:first-child { fill: #fff0ba; }
.is-entering .hero::before { opacity: 1; transform: scale(1.6); }
.is-entering .hero__content, .is-entering .hero__enter { opacity: 0; }
@media (prefers-reduced-motion: reduce) {
  .hero *, .hero::before, .story__cover { transition: none !important; }
}

.books-page .fog { animation: none; }
