/* =========================================================================
   Lillian Andrews — The Crestwood Chronicles
   Brand system: "Enchanted Forest (Brighter)"  ·  Cinzel + Crimson Pro
   All colors reference the six-role palette below. Edit :root to retune.
   ========================================================================= */

:root {
  /* --- Six-role brand palette --- */
  --color-primary:   #267A52;  /* headers, nav, buttons, links            */
  --color-secondary: #6FA06A;  /* borders, decorative — never body text   */
  --color-accent:    #F0A12E;  /* CTAs, highlights — always dark text     */
  --color-bg:        #FBF9F0;  /* page background                         */
  --color-text:      #232B26;  /* body copy                               */
  --color-muted:     #DCE0D4;  /* dividers, subtle borders, alt sections  */

  /* --- Derived shades --- */
  --color-primary-dark: #1C5C3D;  /* hover/active on primary               */
  --color-accent-dark:  #D98A16;  /* hover/active on accent                */
  --color-ink-overlay:  rgba(35, 43, 38, 0.62); /* text-over-image scrim   */

  /* --- Typography --- */
  --font-heading: 'Cinzel', 'Trajan Pro', Georgia, serif;
  --font-body:    'Crimson Pro', Georgia, 'Times New Roman', serif;

  /* --- Type scale --- */
  --fs-h1: 3rem;      /* 48px */
  --fs-h2: 2.25rem;   /* 36px */
  --fs-h3: 1.5rem;    /* 24px */
  --fs-h4: 1.25rem;   /* 20px */
  --fs-body: 1.125rem;/* 18px */
  --fs-eyebrow: 0.75rem;
  --fs-caption: 0.9rem;

  /* --- Spacing scale (8px base) --- */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px; --sp-8: 64px; --sp-9: 96px;

  /* --- Radius --- */
  --r-sm: 4px; --r-md: 8px; --r-lg: 12px; --r-cover: 6px;

  /* --- Shadows (elevation) --- */
  --sh-subtle: 0 1px 3px rgba(35,43,38,.12);
  --sh-card:   0 6px 16px rgba(35,43,38,.12);
  --sh-strong: 0 12px 30px rgba(35,43,38,.35);

  /* --- Layout --- */
  --content-max: 1080px;
  --reading-max: 38rem;
}

/* ------------------------------------------------------------ Announcement */
.announcement-bar {
  background: var(--color-accent);
  color: var(--color-text);
  text-align: center;
  padding: var(--sp-3) var(--sp-5);
}
.announcement-bar p { margin: 0; font-size: var(--fs-caption); font-weight: 600; }
.announcement-bar a {
  color: var(--color-text);
  font-weight: 700;
  text-decoration: underline;
}
.announcement-bar a:hover { color: var(--color-primary-dark); }

/* ------------------------------------------------------------------ Reset */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background-color: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: var(--fs-body);
  line-height: 1.6;
  /* Subtle parchment warmth */
  background-image: radial-gradient(rgba(111,160,106,0.035) 1px, transparent 1px);
  background-size: 22px 22px;
}
img { max-width: 100%; height: auto; display: block; }

/* ------------------------------------------------------------- Typography */
h1, h2, h3, h4 {
  font-family: var(--font-heading);
  font-weight: 500;
  color: var(--color-primary);
  line-height: 1.15;
  margin: 0 0 var(--sp-4);
}
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-h4); }
p { margin: 0 0 var(--sp-4); }
.eyebrow {
  font-family: var(--font-heading);
  font-size: var(--fs-eyebrow);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--color-primary);
  margin: 0 0 var(--sp-2);
}
a { color: var(--color-primary); text-underline-offset: 2px; }
a:hover { color: var(--color-primary-dark); }

/* --------------------------------------------------------- Skip + a11y */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--color-primary);
  color: #fff;
  padding: var(--sp-3) var(--sp-5);
  z-index: 999;
  border-radius: 0 0 var(--r-md) 0;
  text-decoration: none;
}
.skip-link:focus {
  left: 0;
  color: #fff;
}
:focus-visible {
  outline: 3px solid var(--color-accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); border: 0;
}

/* ------------------------------------------------------------ Containers */
.container {
  width: 100%;
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--sp-5);
}
.section { padding-block: var(--sp-8); }
.section--muted { background: var(--color-muted); }
.reading { max-width: var(--reading-max); }

/* --------------------------------------------------------------- Header */
.site-header {
  background: var(--color-primary);
  color: #fff;
  text-align: center;
  padding-block: var(--sp-6);
}
.site-header .header-inner {
  max-width: var(--content-max);
  margin-inline: auto;
  padding-inline: var(--sp-5);
}
.site-title a {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 2rem;
  letter-spacing: 0.08em;
  color: #fff;
  text-decoration: none;
}
.site-header .tagline {
  font-family: var(--font-heading);
  font-size: var(--fs-eyebrow);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin: var(--sp-3) 0 0;
}

/* ------------------------------------------------------------------ Nav */
.site-nav {
  background: var(--color-primary-dark);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--sh-subtle);
}
.site-nav ul {
  list-style: none;
  margin: 0 auto;
  padding: 0;
  max-width: var(--content-max);
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--sp-2);
}
.site-nav a {
  display: block;
  padding: var(--sp-4) var(--sp-5);
  min-height: 44px;
  color: #fff;
  text-decoration: none;
  font-family: var(--font-heading);
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  border-bottom: 3px solid transparent;
}
.site-nav a:hover { color: var(--color-accent); }
.site-nav a.active {
  color: var(--color-accent);
  border-bottom-color: var(--color-accent);
}

/* ----------------------------------------------------------- Buttons/CTA */
.button {
  display: inline-block;
  font-family: var(--font-heading);
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  padding: var(--sp-3) var(--sp-6);
  min-height: 44px;
  line-height: 1.4;
  border-radius: var(--r-md);
  border: 2px solid transparent;
  cursor: pointer;
  transition: background-color .15s ease, transform .05s ease;
}
.button--primary { background: var(--color-primary); color: #fff; }
.button--primary:hover { background: var(--color-primary-dark); color: #fff; }
.button--accent { background: var(--color-accent); color: var(--color-text); }
.button--accent:hover { background: var(--color-accent-dark); color: var(--color-text); }
.button--ghost {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}
.button--ghost:hover { background: var(--color-primary); color: #fff; }
.button:active { transform: translateY(1px); }
.button[aria-disabled="true"],
.button.is-disabled {
  background: var(--color-muted);
  color: #5f6b60;
  cursor: default;
  pointer-events: none;
}

/* ---------------------------------------------------------------- Hero */
.hero {
  position: relative;
  color: #fff;
  text-align: center;
  padding-block: var(--sp-9);
  min-height: 32rem;
  display: flex;
  align-items: center;
  /* Mobile / base: a plain green gradient — no cover image is downloaded here.
     The desktop cover image is added in the min-width media query below, so
     phones never request the large artwork. */
  background-color: var(--color-primary-dark);
  background-image: linear-gradient(rgba(35,43,38,0.55), rgba(28,92,61,0.78));
  background-size: cover;
  background-position: center 38%;
  background-repeat: no-repeat;
}
/* Desktop / tablet: layer the Book 1 cover behind a more opaque scrim for easier
   reading. Because this rule sits inside a min-width query, mobile browsers do not
   fetch the image. Path is relative to this stylesheet (docs/css/ -> ../images/). */
@media (min-width: 768px) {
  .hero--home {
    background-image:
      linear-gradient(rgba(35,43,38,0.68), rgba(35,43,38,0.48) 45%, rgba(28,92,61,0.80)),
      url('../images/book-4-banner.jpg');
    background-position: center 35%;
  }
}
.hero .container { max-width: 46rem; }
.hero h1 {
  color: #fff;
  font-size: clamp(2.4rem, 6vw, var(--fs-h1));
  text-shadow: 0 2px 12px rgba(20, 28, 22, 0.75);
}
.hero .eyebrow { color: var(--color-accent); text-shadow: 0 1px 6px rgba(20, 28, 22, 0.8); }
.hero p {
  font-size: 1.3rem;
  margin-inline: auto;
  max-width: 34rem;
  text-shadow: 0 1px 8px rgba(20, 28, 22, 0.85);
}
.hero .hero-actions {
  display: flex; gap: var(--sp-4);
  justify-content: center; flex-wrap: wrap;
  margin-top: var(--sp-6);
}

/* ------------------------------------------------------------ Book grid */
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--sp-7);
  margin-top: var(--sp-6);
}
.book-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  text-decoration: none;
  color: var(--color-text);
  padding: var(--sp-4);
  border-radius: var(--r-lg);
  transition: transform .15s ease, box-shadow .15s ease;
}
.book-card:hover { transform: translateY(-4px); }
.book-card img {
  border-radius: var(--r-cover);
  box-shadow: var(--sh-card);
  transition: box-shadow .15s ease;
}
.book-card:hover img { box-shadow: var(--sh-strong); }
.book-card .book-series {
  font-family: var(--font-heading);
  font-size: var(--fs-eyebrow);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-primary);
  margin: var(--sp-4) 0 var(--sp-1);
}
.book-card .book-title {
  font-family: var(--font-heading);
  font-size: var(--fs-h4);
  font-weight: 600;
  color: var(--color-text);
  margin: 0;
}

/* ------------------------------------------------ Book detail / listing */
.book-detail {
  display: grid;
  grid-template-columns: minmax(220px, 320px) 1fr;
  gap: var(--sp-7);
  align-items: start;
  margin-bottom: var(--sp-8);
  padding-bottom: var(--sp-8);
  border-bottom: 1px solid var(--color-muted);
}
.book-detail:last-child { border-bottom: 0; margin-bottom: 0; }
.book-detail__cover img {
  border-radius: var(--r-cover);
  box-shadow: var(--sh-strong);
  width: 100%;
}
.book-detail__meta .age-range {
  display: inline-block;
  font-family: var(--font-heading);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-primary-dark);
  background: var(--color-muted);
  padding: var(--sp-1) var(--sp-3);
  border-radius: var(--r-sm);
  margin-bottom: var(--sp-4);
  margin-right: var(--sp-2);
}
.book-detail__meta .age-range.badge-new {
  color: var(--color-text);
  background: var(--color-accent);
}

/* Full-width atmospheric banner (used on individual book pages) */
.book-banner img {
  width: 100%;
  max-height: 26rem;
  object-fit: cover;
  display: block;
}
.buy-links {
  display: flex; flex-wrap: wrap; gap: var(--sp-3);
  margin-top: var(--sp-5);
}
.buy-note {
  font-size: var(--fs-caption);
  color: var(--color-primary-dark);
  font-style: italic;
}

/* ---------------------------------------------------------------- About */
.about-layout {
  display: grid;
  grid-template-columns: minmax(200px, 280px) 1fr;
  gap: var(--sp-7);
  align-items: start;
}
.about-photo img {
  border-radius: var(--r-lg);
  box-shadow: var(--sh-card);
  background: var(--color-muted);
}
.photo-placeholder {
  aspect-ratio: 4 / 5;
  display: grid;
  place-items: center;
  text-align: center;
  padding: var(--sp-5);
  border: 2px dashed var(--color-secondary);
  border-radius: var(--r-lg);
  color: var(--color-primary-dark);
  font-size: var(--fs-caption);
}

/* --------------------------------------------------------------- Cards */
.card {
  background: #fff;
  border: 1px solid var(--color-muted);
  border-radius: var(--r-lg);
  padding: var(--sp-6);
  box-shadow: var(--sh-subtle);
}
.card + .card { margin-top: var(--sp-5); }

/* ----------------------------------------------------------- Newsletter */
.newsletter-section {
  background: var(--color-primary);
  color: #fff;
  text-align: center;
  padding-block: var(--sp-8);
}
.newsletter-section h2 { color: #fff; }
.newsletter-section p { color: var(--color-muted); max-width: 34rem; margin-inline: auto; }
.newsletter-form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--sp-3);
  justify-content: center;
  align-items: flex-end;
  max-width: 40rem;
  margin: var(--sp-6) auto 0;
}
.newsletter-form .field {
  display: flex;
  flex-direction: column;
  text-align: left;
  flex: 1 1 200px;
}
.newsletter-form label {
  font-family: var(--font-heading);
  font-size: var(--fs-eyebrow);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: var(--sp-2);
}
.newsletter-form input {
  font-family: var(--font-body);
  font-size: 1rem;
  padding: var(--sp-3) var(--sp-4);
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: var(--r-md);
  background: #fff;
  color: var(--color-text);
}
.newsletter-form .button { flex: 0 0 auto; }

/* --------------------------------------------------------- Contact form */
.contact-form { max-width: var(--reading-max); }
.contact-form .field { display: flex; flex-direction: column; margin-bottom: var(--sp-5); }
.contact-form label {
  font-family: var(--font-heading);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--color-primary);
  margin-bottom: var(--sp-2);
}
.contact-form input,
.contact-form textarea {
  font-family: var(--font-body);
  font-size: 1rem;
  padding: var(--sp-3) var(--sp-4);
  min-height: 44px;
  border: 1px solid var(--color-secondary);
  border-radius: var(--r-md);
  background: #fff;
  color: var(--color-text);
}
.contact-form textarea { min-height: 140px; resize: vertical; }
.notice {
  background: var(--color-muted);
  border-left: 4px solid var(--color-accent);
  padding: var(--sp-4) var(--sp-5);
  border-radius: var(--r-sm);
  margin-bottom: var(--sp-6);
  font-size: var(--fs-caption);
}

/* -------------------------------------------------------------- Footer */
.site-footer {
  background: var(--color-primary-dark);
  color: var(--color-muted);
  text-align: center;
  padding-block: var(--sp-7);
}
.site-footer a { color: #fff; }
.footer-inner { max-width: var(--content-max); margin-inline: auto; padding-inline: var(--sp-5); }
.footer-nav {
  list-style: none; padding: 0; margin: 0 0 var(--sp-4);
  display: flex; gap: var(--sp-5); justify-content: center; flex-wrap: wrap;
}
.footer-nav a {
  font-family: var(--font-heading);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
}
.footer-contact { margin: 0 0 var(--sp-2); }
.footer-copy { font-size: var(--fs-caption); margin: var(--sp-4) 0 0; }

/* ---------------------------------------------------------- Utilities */
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.lead { font-size: 1.3rem; }
.divider {
  height: 1px; border: 0; background: var(--color-muted);
  margin-block: var(--sp-7);
}

/* -------------------------------------------------------- Responsive */
@media (max-width: 768px) {
  :root { --fs-h1: 2.4rem; --fs-h2: 1.85rem; }
  .book-detail { grid-template-columns: 1fr; gap: var(--sp-5); }
  .book-detail__cover { max-width: 260px; margin-inline: auto; }
  .about-layout { grid-template-columns: 1fr; gap: var(--sp-5); }
  .about-photo { max-width: 240px; margin-inline: auto; }
  .section { padding-block: var(--sp-7); }
}
@media (max-width: 480px) {
  .site-nav a { padding: var(--sp-3) var(--sp-4); }
  .newsletter-form { flex-direction: column; align-items: stretch; }
}

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