:root {
  --bg: #f6f3ee;
  --surface: #fbfbfb;
  --ink: #171717;

  /* Darkened slightly for WCAG contrast */
  --muted: #5f5d58;

  --line: #d8d3ca;
  --input-border: #817b72;
  --focus: #1f5fa8;

  --radius-lg: 34px;
  --radius-md: 22px;

  --shadow:
    0 20px 70px rgba(0, 0, 0, 0.08);

  --shell:
    min(1180px, calc(100% - 40px));
}


/* ============================================================
   GLOBAL
   ============================================================ */

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;

  /*
    Prevent sticky header from obscuring anchors/focused content.
  */
  scroll-padding-top: 90px;
}

body {
  margin: 0;

  background: var(--bg);
  color: var(--ink);

  font-family:
    Georgia,
    "Times New Roman",
    serif;

  line-height: 1.5;

  text-rendering: optimizeLegibility;
}

main {
  display: block;
}

a {
  color: inherit;
}

button,
input,
textarea {
  font: inherit;
}

button,
input,
textarea,
a {
  -webkit-tap-highlight-color: transparent;
}

img {
  display: block;
  max-width: 100%;
}

textarea {
  resize: vertical;
}

.shell {
  width: var(--shell);
  margin-inline: auto;
}


/* ============================================================
   ACCESSIBILITY UTILITIES
   ============================================================ */

.visually-hidden {
  position: absolute !important;

  width: 1px !important;
  height: 1px !important;

  padding: 0 !important;
  margin: -1px !important;

  overflow: hidden !important;

  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;

  border: 0 !important;
}

.skip-link {
  position: fixed;
  z-index: 1000;

  top: 10px;
  left: 10px;

  transform: translateY(-180%);

  padding: 10px 14px;

  background: var(--ink);
  color: #fff;

  border-radius: 10px;

  text-decoration: none;
}

.skip-link:focus {
  transform: translateY(0);
}


/* ============================================================
   FOCUS
   ============================================================ */

a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
.book-gallery:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 4px;
}


/* ============================================================
   HEADER
   ============================================================ */

.site-header {
  position: sticky;
  z-index: 100;

  top: 0;

  border-bottom:
    1px solid rgba(23, 23, 23, 0.12);

  background:
    rgba(246, 243, 238, 0.94);

  backdrop-filter: blur(18px);
}

.header-inner {
  min-height: 66px;

  display: flex;

  align-items: center;
  justify-content: space-between;

  gap: 24px;
}

.brand {
  min-height: 44px;

  display: inline-flex;
  align-items: center;

  font-weight: 700;

  text-decoration: none;

  letter-spacing: -0.02em;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;

  gap:
    4px
    clamp(14px, 2vw, 28px);

  font-size: 0.93rem;
}

.site-nav a,
.footer-links a {
  min-height: 44px;

  display: inline-flex;
  align-items: center;

  text-decoration-thickness: 1px;
  text-underline-offset: 4px;
}


/* ============================================================
   MAIN / HERO
   ============================================================ */

.intro-section {
  position: relative;

  overflow: hidden;

  background: var(--bg);
}

.main-image {
  position: absolute;

  inset: 0;

  width: 100%;
  height: 100%;

  object-fit: cover;

  z-index: 0;
}

.main-image-overlay {
  display: none;

  position: absolute;

  inset: 0;

  z-index: 1;

  background:
    linear-gradient(
      90deg,
      rgba(246, 243, 238, 0.95) 0%,
      rgba(246, 243, 238, 0.84) 47%,
      rgba(246, 243, 238, 0.38) 100%
    );
}

.intro-section.has-main-image
.main-image-overlay {
  display: block;
}

.intro {
  position: relative;
  z-index: 2;

  padding-block:
    clamp(90px, 13vw, 170px)
    clamp(70px, 10vw, 130px);
}

.intro > * {
  max-width: 900px;
}

.eyebrow {
  margin: 0 0 14px;

  color: var(--muted);

  font-size: 0.8rem;
  font-weight: 700;

  letter-spacing: 0.11em;

  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  letter-spacing: -0.045em;

  /*
    Slightly more line height than before,
    especially useful during text zoom.
  */
  line-height: 1.02;
}

h1 {
  max-width: 780px;

  margin-bottom: 28px;

  font-size:
    clamp(3.5rem, 10vw, 8rem);
}

h2 {
  margin-bottom: 0;

  font-size:
    clamp(2.7rem, 7vw, 6.4rem);
}

h3 {
  margin-bottom: 14px;

  font-size:
    clamp(1.9rem, 3vw, 3.2rem);
}

.intro-copy {
  max-width: 680px;

  margin-bottom: 0;

  color: var(--muted);

  font-size:
    clamp(1.15rem, 2vw, 1.55rem);
}


/* ============================================================
   BOOKS
   ============================================================ */

.books-section {
  padding-block:
    40px 120px;

  scroll-margin-top: 80px;
}

.section-heading-row {
  display: flex;

  align-items: end;
  justify-content: space-between;

  gap: 32px;

  margin-bottom: 34px;
}

.autoplay-button {
  flex: 0 0 auto;

  width: 48px;
  height: 48px;

  display: grid;

  place-items: center;

  border: 0;

  border-radius: 999px;

  background:
    rgba(23, 23, 23, 0.9);

  color: #fff;

  cursor: pointer;

  transition:
    transform 180ms ease,
    background-color 180ms ease;
}

.autoplay-button:hover {
  transform: scale(1.05);

  background: #000;
}

.autoplay-button .icon {
  width: 18px;
  height: 18px;
}

.autoplay-button .icon-pause {
  display: none;
}

.autoplay-button.is-playing
.icon-play {
  display: none;
}

.autoplay-button.is-playing
.icon-pause {
  display: block;
}

.gallery-wrap {
  overflow: hidden;
}

.book-gallery {
  display: grid;

  grid-auto-flow: column;

  grid-auto-columns:
    min(78vw, 790px);

  gap:
    clamp(18px, 2.4vw, 30px);

  overflow-x: auto;

  overscroll-behavior-inline: contain;

  scroll-snap-type:
    inline mandatory;

  scroll-padding-left:
    max(
      20px,
      calc((100vw - 1180px) / 2)
    );

  padding:
    8px
    max(
      20px,
      calc((100vw - 1180px) / 2)
    )
    34px;

  scrollbar-width: none;
}

.book-gallery::-webkit-scrollbar {
  display: none;
}

.book-card {
  display: grid;

  grid-template-columns:
    minmax(0, 1.18fr)
    minmax(250px, 0.82fr);

  scroll-snap-align: start;

  overflow: hidden;

  border-radius:
    var(--radius-lg);

  background:
    var(--surface);

  box-shadow:
    var(--shadow);
}


/* Square book cover */

.book-media {
  width: 100%;

  aspect-ratio: 1 / 1;

  background: #e9e3d8;
}

.book-media img {
  width: 100%;
  height: 100%;

  object-fit: cover;
}


/* Default book artwork if no cover exists */

.cover-placeholder {
  width: 100%;
  height: 100%;

  display: grid;

  place-items: center;
  align-content: center;

  gap: 20px;

  background:
    radial-gradient(
      circle at 28% 26%,
      rgba(255, 255, 255, 0.9),
      transparent 22%
    ),
    linear-gradient(
      145deg,
      #efc9bd,
      #ecdba9 48%,
      #bfd9cf
    );

  color: #3a3936;
}

.cover-placeholder span {
  font-size: 0.86rem;
  font-weight: 700;

  letter-spacing: 0.08em;

  text-transform: uppercase;
}

.cover-placeholder strong {
  font-size:
    clamp(7rem, 14vw, 12rem);

  font-weight: 700;

  line-height: 0.8;

  letter-spacing: -0.08em;
}

.book-content {
  display: flex;

  flex-direction: column;

  justify-content: end;

  padding:
    clamp(28px, 5vw, 58px);
}

.book-kicker {
  margin-bottom: 12px;

  color: var(--muted);

  font-size: 0.9rem;

  font-weight: 650;
}

.book-description {
  max-width: 34ch;

  margin-bottom: 28px;

  color: var(--muted);

  font-size: 1.04rem;
}

.book-link,
.book-status {
  align-self: flex-start;

  min-height: 44px;

  display: inline-flex;

  align-items: center;

  padding: 0 18px;

  border-radius: 999px;

  font-weight: 650;
}

.book-link {
  background: var(--ink);

  color: #fff;

  text-decoration: none;
}


/*
  Original #ff9900 + white did not meet
  normal-text contrast requirements.

  This darker orange does.
*/

.book-status.pending {
  background: #FF9900;

  color: #333E48;
}


/* ============================================================
   STORY
   ============================================================ */

.story-section,
.newsletter-section,
.accessibility-section {
  padding-block:
    clamp(100px, 14vw, 100px);

  scroll-margin-top: 80px;
}

.story-section {
  background: #1b1b1a;

  color: #fff;
}

.story-grid,
.newsletter-grid,
.accessibility-inner {
  display: grid;

  grid-template-columns:
    minmax(0, 0.9fr)
    minmax(0, 1.1fr);

  gap:
    clamp(50px, 9vw, 130px);

  align-items: start;
}

.story-section .eyebrow,
.story-copy {
  color: #c8c5bf;
}

.story-copy {
  max-width: 620px;

  font-size:
    clamp(1.2rem, 2.1vw, 1.65rem);
}

.story-copy p {
  margin-bottom: 1.25em;
}

.placeholder-note {
  color: #fff;

  font-size: 0.85rem;
  font-weight: 700;

  letter-spacing: 0.08em;

  text-transform: uppercase;
}


/* ============================================================
   NEWSLETTER / CONTACT
   ============================================================ */

.newsletter-section {
  background: #e7ded0;
}

.newsletter-grid
> div
> p:last-child {
  max-width: 570px;

  margin-top: 28px;

  color: var(--muted);

  font-size: 1.12rem;
}

.newsletter-form {
  padding:
    clamp(26px, 5vw, 46px);

  border-radius:
    var(--radius-md);

  background:
    rgba(255, 255, 255, 0.78);
}

.field {
  margin-bottom: 24px;
}

.field label {
  display: block;

  margin-bottom: 8px;

  font-weight: 700;
}

.optional {
  margin-left: 5px;

  color: var(--muted);

  font-size: 0.82rem;

  font-weight: 500;
}

input[type="email"],
input[type="text"],
textarea {
  width: 100%;

  padding:
    11px 14px;

  border:
    1px solid
    var(--input-border);

  border-radius: 12px;

  background: #fff;

  color: var(--ink);
}

input[type="email"],
input[type="text"] {
  min-height: 52px;
}

textarea {
  min-height: 150px;

  line-height: 1.5;
}

.field-hint,
.privacy-note,
.form-status {
  color: var(--muted);

  font-size: 0.9rem;
}

.field-hint {
  margin:
    7px 0 0;
}

.checkbox-field {
  display: grid;

  grid-template-columns:
    24px minmax(0, 1fr);

  gap: 11px;

  align-items: start;

  margin-bottom: 24px;
}

.checkbox-field input {
  width: 22px;
  height: 22px;

  margin: 2px 0 0;

  accent-color:
    var(--ink);
}

.checkbox-field label {
  line-height: 1.45;
}

.primary-button {
  min-height: 50px;

  padding:
    0 20px;

  border: 0;

  border-radius: 999px;

  background: var(--ink);

  color: #fff;

  cursor: pointer;

  font-weight: 700;
}

.primary-button:hover {
  background: #000;
}

.primary-button:disabled {
  cursor: wait;

  opacity: 0.65;
}

.form-status {
  min-height: 1.5em;

  margin:
    16px 0 0;

  color: var(--ink);

  font-weight: 650;
}

.privacy-note {
  margin:
    10px 0 0;
}


/* Bot honeypot.
   Not display:none because many primitive bots skip display:none fields. */

.bot-field {
  position: absolute;

  left: -10000px;

  width: 1px;
  height: 1px;

  overflow: hidden;
}

.turnstile-container {
  margin-bottom: 20px;
}


/* ============================================================
   ACCESSIBILITY SECTION
   ============================================================ */

.accessibility-section {
  background:
    var(--bg);
}

.accessibility-copy {
  max-width: 650px;

  font-size: 1.08rem;
}

.accessibility-copy p {
  margin-bottom: 1.3em;
}

.accessibility-copy a {
  min-height: 44px;

  display: inline-flex;
  align-items: center;

  font-weight: 700;

  text-underline-offset: 4px;
}


/* ============================================================
   FOOTER
   ============================================================ */

.site-footer {
  border-top:
    1px solid var(--line);
}

.footer-inner {
  min-height: 110px;

  display: flex;

  align-items: center;
  justify-content: space-between;

  gap: 24px;

  color: var(--muted);

  font-size: 0.9rem;
}

.footer-inner p {
  margin-bottom: 0;
}

.footer-links {
  display: flex;

  flex-wrap: wrap;

  gap: 18px;
}


/* ============================================================
   EMPTY BOOK LIST
   ============================================================ */

.empty-state {
  padding: 50px;

  background: #fff;

  border-radius: 24px;
}


/* ============================================================
   TABLET
   ============================================================ */

@media (max-width: 800px) {

  :root {
    --shell:
      min(100% - 28px, 1180px);
  }

  .header-inner {
    gap: 14px;
  }

  .site-nav {
    gap: 4px 14px;

    font-size: 0.84rem;
  }

  .intro {
    padding-top: 80px;
  }

  .main-image-overlay {
    background:
      rgba(246, 243, 238, 0.82);
  }

  .section-heading-row {
    align-items: center;
  }

  .book-gallery {
    grid-auto-columns:
      min(88vw, 620px);

    scroll-padding-left:
      14px;

    padding-inline:
      14px;
  }

  /*
    Important:
    Do NOT force a fixed-height image row here.
    The cover remains exactly square.
  */

  .book-card {
    grid-template-columns: 1fr;

    grid-template-rows:
      auto auto;
  }

  .story-grid,
  .newsletter-grid,
  .accessibility-inner {
    grid-template-columns:
      1fr;

    gap: 38px;
  }

  .footer-inner {
    align-items: flex-start;

    flex-direction: column;

    justify-content: center;

    padding-block: 28px;
  }
}


/* ============================================================
   PHONE
   ============================================================ */

@media (max-width: 520px) {

  .header-inner {
    min-height: 62px;
  }

  /*
    Keep all navigation choices.
    The old CSS removed "Our Story" on small screens.
  */

  .site-nav {
    justify-content: flex-end;
  }

  h1 {
    font-size:
      clamp(3.2rem, 16vw, 5.2rem);
  }

  .books-section {
    padding-bottom: 90px;
  }

  .section-heading-row {
    margin-bottom: 22px;
  }

  .autoplay-button {
    width: 44px;
    height: 44px;
  }

  .book-gallery {
    grid-auto-columns:
      91vw;
  }

  .book-card {
    border-radius: 26px;
  }

  .book-content {
    padding: 28px;
  }

  .footer-links {
    gap: 6px 18px;
  }
}


/* ============================================================
   REDUCED MOTION
   ============================================================ */

@media (prefers-reduced-motion: reduce) {

  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;

    transition-duration:
      0.001ms !important;

    animation-duration:
      0.001ms !important;

    animation-iteration-count:
      1 !important;
  }
}