/* The Coloring Shelf — mobile-first styles */

:root {
  --ivory: #FFF8EC;
  --paper: #FFFDF7;
  --nook: #F6EAD3;
  --forest: #19352D;
  --forest-2: #24493E;
  --marigold: #F3BD55;
  --marigold-soft: #F9DFA6;
  --terracotta: #BF644A;
  --text: #19352D;
  --text-soft: #4E6159;
  --line: rgba(25, 53, 45, 0.16);
  --shadow-sheet: 0 1px 1px rgba(25, 53, 45, 0.08), 0 10px 24px -8px rgba(25, 53, 45, 0.28);

  --font-display: "Young Serif", Georgia, "Times New Roman", serif;
  --font-body: "Figtree", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

  --wrap: 72rem;
  --gutter: clamp(1.25rem, 5vw, 2.5rem);
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: 1rem;
}

body {
  margin: 0;
  background: var(--ivory);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

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

[hidden] { display: none !important; }

a { color: inherit; text-underline-offset: 0.18em; text-decoration-thickness: 1.5px; }

h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.08;
  margin: 0;
  letter-spacing: -0.01em;
}

p { margin: 0; }

:focus-visible {
  outline: 3px solid var(--forest);
  outline-offset: 3px;
  border-radius: 6px;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

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

.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  background: var(--forest);
  color: var(--ivory);
  padding: 0.75rem 1rem;
  border-radius: 10px;
  font-weight: 600;
}
.skip-link:focus { top: 1rem; }

main:focus { outline: none; }

/* ---------- Header ---------- */

.site-header { padding-block: 1rem; }

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  font-family: var(--font-display);
  font-size: 1.2rem;
  min-height: 44px;
  white-space: nowrap;
}
.wordmark-mark { width: 32px; height: 32px; flex: none; }

.site-nav { display: flex; gap: 0.25rem; }
.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-inline: 0.6rem;
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  border-radius: 8px;
  white-space: nowrap;
}
.site-nav a:hover { text-decoration: underline; }

@media (max-width: 380px) {
  .wordmark { font-size: 1.05rem; }
  .wordmark-mark { width: 26px; height: 26px; }
  .site-nav a { padding-inline: 0.4rem; font-size: 0.9rem; }
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 0.7rem 1.4rem;
  border-radius: 14px;
  border: 2px solid var(--forest);
  font: 600 1.05rem/1.2 var(--font-body);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.btn-primary { background: var(--forest); color: var(--ivory); }
.btn-primary:hover { background: var(--forest-2); border-color: var(--forest-2); }

.btn-secondary { background: transparent; color: var(--forest); }
.btn-secondary:hover { background: var(--forest); color: var(--ivory); }

.btn-large {
  min-height: 68px;
  width: 100%;
  font-size: 1.15rem;
  border-radius: 16px;
  box-shadow: 0 5px 0 var(--marigold);
}
.btn-large:active { transform: translateY(2px); box-shadow: 0 3px 0 var(--marigold); }
.btn-sub { font-weight: 500; font-size: 0.85rem; opacity: 0.85; margin-top: 0.15rem; }

/* ---------- Hero ---------- */

.hero { padding-block: 0.5rem 3.5rem; }

.hero-inner {
  display: grid;
  gap: 2rem;
  align-items: center;
}

.hero-visual {
  position: relative;
  display: grid;
  place-items: center;
  padding: 1.25rem 0 1.75rem;
}

.hero-sun {
  position: absolute;
  width: min(66vw, 400px);
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--marigold);
  top: 0;
  right: max(-4vw, -2rem);
}

.sheet-stack {
  position: relative;
  width: clamp(170px, 46vw, 360px);
  aspect-ratio: 850 / 1100;
}

.sheet {
  position: absolute;
  inset: 0;
  background: var(--paper);
  border-radius: 4px;
  box-shadow: var(--shadow-sheet);
  overflow: hidden;
  transform-origin: 50% 90%;
}
.sheet img { width: 100%; height: 100%; object-fit: cover; }

.sheet-back-2 { transform: translate(-17%, 3%) rotate(-9deg); }
.sheet-back-1 { transform: translate(15%, 1%) rotate(7deg); }
.sheet-cover { transform: rotate(-1.5deg); }

.pdf-tag {
  position: absolute;
  right: -8%;
  bottom: 9%;
  background: var(--terracotta);
  color: var(--paper);
  font-weight: 700;
  font-size: clamp(0.75rem, 2.6vw, 0.9rem);
  padding: 0.3em 0.75em;
  border-radius: 6px;
  transform: rotate(4deg);
  box-shadow: 0 6px 14px -6px rgba(25, 53, 45, 0.5);
}

/* The one moment of motion: the printed pages fan out on load. */
@media (prefers-reduced-motion: no-preference) {
  .sheet-back-2 { animation: fan-left 0.7s cubic-bezier(.2,.8,.2,1) 0.15s both; }
  .sheet-back-1 { animation: fan-right 0.7s cubic-bezier(.2,.8,.2,1) 0.15s both; }
  @keyframes fan-left { from { transform: rotate(-1.5deg); } }
  @keyframes fan-right { from { transform: rotate(-1.5deg); } }
}

.hero-copy { display: grid; gap: 1.1rem; }

.hero-kicker {
  font-weight: 700;
  font-size: 0.98rem;
  color: #A5523A; /* terracotta, darkened for small-text contrast */
}

.hero-title {
  font-size: clamp(2.45rem, 10.5vw, 4.4rem);
  line-height: 1.02;
  max-width: 14ch;
  text-wrap: balance;
}

.hero-desc {
  font-size: 1.1rem;
  color: var(--text-soft);
  max-width: 34rem;
}

.hero-actions { margin-top: 0.4rem; }

.format-note {
  font-size: 0.98rem;
  color: var(--text-soft);
  max-width: 34rem;
  padding-left: 0.9rem;
  border-left: 3px solid var(--marigold);
}
.format-note strong { color: var(--text); }

.availability {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.25rem 1rem;
  padding: 0.95rem 1.1rem;
  border: 2px dashed rgba(25, 53, 45, 0.35);
  border-radius: 14px;
  max-width: 34rem;
}
.availability-label { font-family: var(--font-display); font-size: 1.2rem; }
.availability-price { color: var(--text-soft); font-weight: 600; }

.peek { display: grid; gap: 0.6rem; margin-top: 0.3rem; }
.peek-label { font-weight: 600; font-size: 0.95rem; color: var(--text-soft); }
.peek-row { list-style: none; margin: 0; padding: 0; display: flex; gap: 0.9rem; }
.peek-page {
  display: block;
  width: 84px;
  background: var(--paper);
  border-radius: 3px;
  box-shadow: var(--shadow-sheet);
  overflow: hidden;
  transition: transform 0.15s ease;
}
.peek-row li:nth-child(odd) .peek-page { transform: rotate(-2deg); }
.peek-row li:nth-child(even) .peek-page { transform: rotate(2deg); }
.peek-row .peek-page:hover { transform: rotate(0) translateY(-3px); }

.hero-message { padding-block: 2rem; }
.hero-message .btn { justify-self: start; }

/* Loading skeleton */
.hero-skeleton { display: grid; gap: 2rem; }
.sk { background: rgba(25, 53, 45, 0.07); border-radius: 10px; }
.sk-visual { width: clamp(170px, 46vw, 360px); aspect-ratio: 850 / 1100; justify-self: center; }
.sk-lines { display: grid; gap: 0.8rem; }
.sk-line { height: 1.1rem; }
.sk-short { width: 45%; }
.sk-title { height: 3rem; width: 80%; }
.sk-btn { height: 68px; border-radius: 16px; }

@media (min-width: 900px) {
  .hero { padding-block: 2rem 5rem; }
  .hero-inner,
  .hero-skeleton {
    grid-template-columns: 1.05fr 0.95fr;
    gap: 4rem;
  }
  .hero-visual { order: 2; padding-block: 3rem; }
  .hero-copy { order: 1; }
  .hero-sun { width: 400px; right: -1.5rem; top: 0; }
  .sheet-stack { width: 340px; }
  .btn-large { width: auto; min-width: 20rem; }
  .sk-visual { order: 2; width: 340px; }
}

/* ---------- Shelf ---------- */

.shelf { padding-block: 3.5rem 4rem; border-top: 1px solid var(--line); }

.section-head { display: grid; gap: 0.6rem; margin-bottom: 1.75rem; max-width: 36rem; }
.section-head h2 { font-size: clamp(2rem, 7vw, 2.75rem); }
.section-head p { color: var(--text-soft); }

.shelf-status { font-size: 0.95rem; color: var(--text-soft); margin-bottom: 1.25rem; }

.shelf-grid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 2.5rem;
}

@media (min-width: 640px) {
  .shelf-grid { grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 2.5rem 2rem; }
}

.book { display: grid; gap: 1.1rem; align-content: start; }

/* Each book stands in its own cubby on a wooden ledge. */
.book-cover {
  position: relative;
  background: var(--nook);
  border-radius: 18px 18px 4px 4px;
  padding: 1.75rem 2.75rem 0;
  display: grid;
  place-items: end center;
}
.book-cover::after {
  content: "";
  position: absolute;
  left: -6px;
  right: -6px;
  bottom: -12px;
  height: 14px;
  border-radius: 3px;
  background: var(--forest);
  box-shadow: 0 6px 0 -2px rgba(25, 53, 45, 0.18);
}
.book-cover-img {
  width: 100%;
  max-width: 230px;
  aspect-ratio: 850 / 1100;
  object-fit: cover;
  border-radius: 3px 3px 0 0;
  box-shadow: 0 -1px 0 rgba(25,53,45,0.06), -6px 0 18px -10px rgba(25, 53, 45, 0.45);
}

.book-body { display: grid; gap: 0.55rem; padding-top: 0.6rem; justify-items: start; }
.book-title { font-size: 1.45rem; }
.book-age { font-weight: 600; color: #A5523A; font-size: 0.95rem; }
.book-desc {
  color: var(--text-soft);
  font-size: 0.98rem;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.book-status { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.75rem; margin-top: 0.15rem; }
.status-pill {
  display: inline-block;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: var(--marigold-soft);
}
.status-pill.status--available { background: var(--forest); color: var(--ivory); }
.status-pill.status--unavailable { background: rgba(25, 53, 45, 0.1); }
.book-price { font-weight: 600; font-size: 0.95rem; color: var(--text-soft); }
.book-sample { margin-top: 0.5rem; width: 100%; }

@media (min-width: 640px) {
  .book-sample { width: auto; }
}

/* ---------- FAQ ---------- */

.faq { padding-block: 3.5rem 4.5rem; background: var(--paper); border-top: 1px solid var(--line); }

@media (min-width: 900px) {
  .faq-inner { display: grid; grid-template-columns: 0.8fr 1.2fr; gap: 4rem; align-items: start; }
}

.faq-list { border-top: 1px solid var(--line); }

.faq details { border-bottom: 1px solid var(--line); }

.faq summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 60px;
  padding-block: 0.9rem;
  font-weight: 600;
  font-size: 1.08rem;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "";
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background:
    linear-gradient(var(--forest), var(--forest)) center / 12px 2px no-repeat,
    linear-gradient(var(--forest), var(--forest)) center / 2px 12px no-repeat,
    var(--marigold-soft);
  transition: transform 0.2s ease;
}
.faq details[open] summary::after {
  transform: rotate(45deg);
}
.faq-answer { padding-bottom: 1.1rem; color: var(--text-soft); max-width: 38rem; }
.faq-answer strong { color: var(--text); }

/* ---------- Footer ---------- */

.site-footer { background: var(--forest); color: var(--ivory); padding-block: 2.5rem 3rem; }
.footer-inner { display: grid; gap: 0.5rem; font-size: 0.95rem; }
.footer-name { font-family: var(--font-display); font-size: 1.3rem; }
.site-footer a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 600; }
.site-footer :focus-visible { outline-color: var(--marigold); }
.footer-copy { opacity: 0.75; }

.noscript {
  position: fixed;
  inset: auto 1rem 1rem;
  background: var(--forest);
  color: var(--ivory);
  padding: 1rem;
  border-radius: 12px;
  text-align: center;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
