/* ===========================================================
   Alfred Inkwell — storybook design system
   =========================================================== */

:root {
  /* -- Color tokens -- */
  --paper: #FBF3E3;
  --paper-shade: #F3E7D0;
  --ink: #26324A;
  --ink-soft: #445071;
  --coral: #E2725B;
  --coral-deep: #C85A44;
  --sage: #7C9473;
  --mustard: #E8B84B;
  --plum: #4A3B52;
  --white: #FFFDF8;

  /* -- Type tokens -- */
  --font-display: 'Fraunces', Georgia, serif;
  --font-body: 'Nunito', 'Segoe UI', sans-serif;
  --font-hand: 'Caveat', cursive;

  /* -- Spacing / layout -- */
  --max-width: 1080px;
  --radius-lg: 28px;
  --radius-md: 16px;
  --shadow-soft: 0 12px 30px rgba(38, 50, 74, 0.12);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--paper);
  color: var(--ink);
  line-height: 1.6;
  font-size: 17px;
  overflow-x: hidden;
}

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

a { color: inherit; }

h1, h2, h3 {
  font-family: var(--font-display);
  color: var(--ink);
  margin: 0 0 0.5em;
  line-height: 1.15;
}

p { margin: 0 0 1em; }

.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(251, 243, 227, 0.92);
  backdrop-filter: blur(6px);
  border-bottom: 2px solid var(--paper-shade);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 14px;
  padding-bottom: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.35rem;
  color: var(--ink);
}

.brand-mark {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
}

.main-nav {
  display: flex;
  gap: 28px;
  font-weight: 700;
}

.main-nav a {
  text-decoration: none;
  color: var(--ink-soft);
  position: relative;
  padding: 4px 2px;
}

.main-nav a:hover,
.main-nav a:focus-visible {
  color: var(--coral-deep);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  font-size: 1.6rem;
  cursor: pointer;
  color: var(--ink);
}

@media (max-width: 640px) {
  .main-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--paper);
    flex-direction: column;
    gap: 0;
    border-bottom: 2px solid var(--paper-shade);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.25s ease;
  }
  .main-nav.open { max-height: 260px; }
  .main-nav a {
    padding: 14px 24px;
    border-top: 1px solid var(--paper-shade);
  }
  .nav-toggle { display: block; }
}

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: 72px 0 60px;
  text-align: center;
  overflow: visible;
}

.hero-page {
  position: relative;
  max-width: 720px;
  margin: 0 auto;
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 56px 40px 48px;
  box-shadow: var(--shadow-soft);
  /* deckled / torn paper edge via mask */
}

.hero-eyebrow {
  font-family: var(--font-hand);
  font-size: 1.4rem;
  color: var(--coral-deep);
  margin-bottom: 4px;
  display: inline-block;
  transform: rotate(-2deg);
}

.hero h1 {
  font-size: clamp(2.3rem, 5vw, 3.4rem);
  margin-bottom: 18px;
}

.hero h1 .quill-underline {
  position: relative;
  display: inline-block;
}

.hero h1 .quill-underline::after {
  content: "";
  position: absolute;
  left: -2%;
  right: -2%;
  bottom: -0.22em;
  height: 0.34em;
  /* background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 20' preserveAspectRatio='none'%3E%3Cpath d='M2 12 C 40 4, 80 18, 120 8 C 150 2, 175 14, 198 9' stroke='%23E2725B' stroke-width='5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E"); */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 30' preserveAspectRatio='none'%3E%3Cpath d='M2 35 C 30 2, 60 2, 80 25 C 110 35, 130 0, 145 22 C 150 35, 170 0, 185 22' stroke='%23E2725B' stroke-width='5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: 100% 100%;
}

.hero p.lede {
  font-size: 1.15rem;
  color: var(--ink-soft);
  max-width: 480px;
  margin: 0 auto 30px;
}

.quill-svg {
  width: 120px;
  height: auto;
  margin: 0 auto 18px;
  display: block;
}

.quill-path {
  stroke-dasharray: 340;
  stroke-dashoffset: 340;
  animation: write-in 1.6s ease forwards 0.3s;
}

@keyframes write-in {
  to { stroke-dashoffset: 0; }
}

.ink-drop {
  opacity: 0;
  animation: drop-in 0.4s ease forwards 1.7s;
}

@keyframes drop-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Ink trail connecting sections */
.ink-trail {
  display: block;
  width: 100%;
  height: 60px;
  margin: -10px auto -10px;
}

.ink-trail path {
  stroke: var(--ink-soft);
  stroke-width: 2.5;
  stroke-dasharray: 6 10;
  stroke-linecap: round;
  fill: none;
  opacity: 0.35;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 1rem;
  text-decoration: none;
  padding: 14px 28px;
  border-radius: 999px;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  border: none;
  cursor: pointer;
}

.btn:hover, .btn:focus-visible {
  transform: translateY(-2px);
}

.btn-primary {
  background: var(--coral);
  color: var(--white);
  box-shadow: 0 8px 20px rgba(226, 114, 91, 0.35);
}

.btn-primary:hover { background: var(--coral-deep); }

.btn-secondary {
  background: transparent;
  color: var(--ink);
  border: 2px solid var(--ink);
}

.btn-secondary:hover { background: var(--ink); color: var(--white); }

.btn-small {
  padding: 10px 20px;
  font-size: 0.9rem;
}

/* ---------- Section headings ---------- */
.section {
  padding: 56px 0;
}

.section-heading {
  text-align: center;
  max-width: 560px;
  margin: 0 auto 40px;
}

.section-heading .eyebrow {
  font-family: var(--font-hand);
  color: var(--sage);
  font-size: 1.3rem;
  display: block;
  transform: rotate(-1.5deg);
}

.section-heading h2 {
  font-size: clamp(1.8rem, 3.5vw, 2.4rem);
}

/* ---------- Book cards ---------- */
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 32px;
}

.book-card {
  background: var(--white);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  text-decoration: none;
  color: var(--ink);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.book-card:hover, .book-card:focus-visible {
  transform: translateY(-6px) rotate(-0.6deg);
  box-shadow: 0 20px 40px rgba(38, 50, 74, 0.18);
}

.book-cover {
  aspect-ratio: 4 / 4;
  background: var(--paper-shade);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

/* .book-cover svg { width: 100%; height: 100%; } */

.book-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mascot-image img {
  width: 10%;
  height: 10%;
}

.book-info {
  padding: 20px 22px 26px;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.book-info h3 { font-size: 1.3rem; margin-bottom: 6px; }

.book-age {
  font-family: var(--font-body);
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--sage);
  margin-bottom: 10px;
}

.book-info p.desc {
  color: var(--ink-soft);
  font-size: 0.96rem;
  flex-grow: 1;
}

.book-footer {
  padding: 14px 22px 22px;
  border-top: 1px solid rgba(38, 50, 74, 0.1);
}

.book-actions { margin-top: 0; }

/* ---------- About ---------- */
.about {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 40px;
  align-items: center;
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 40px;
  box-shadow: var(--shadow-soft);
}

.about-portrait {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--mustard);
  display: flex;
  align-items: center;
  justify-content: center;
}

.about-portrait svg { width: 70%; height: 70%; }

.about h2 { font-size: 1.7rem; }

.signature {
  font-family: var(--font-hand);
  font-size: 1.6rem;
  color: var(--coral-deep);
  margin-top: 12px;
  transform: rotate(-1deg);
  display: inline-block;
}

@media (max-width: 640px) {
  .about { grid-template-columns: 1fr; text-align: center; padding: 32px 24px; }
  .about-portrait { width: 140px; margin: 0 auto; }
}

/* ---------- CTA strip ---------- */
.cta-strip {
  background: var(--ink);
  color: var(--paper);
  border-radius: var(--radius-lg);
  padding: 48px 32px;
  text-align: center;
}

.cta-strip h2 { color: var(--white); }
.cta-strip p { color: var(--paper-shade); max-width: 460px; margin-left: auto; margin-right: auto; }

/* ---------- Footer ---------- */
.site-footer {
  border-top: 2px solid var(--paper-shade);
  padding: 36px 0 44px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.site-footer .social {
  display: flex;
  justify-content: center;
  gap: 18px;
  margin: 14px 0 6px;
}

.site-footer .social a {
  text-decoration: none;
  color: var(--ink);
  font-weight: 800;
}

.site-footer .social a:hover { color: var(--coral-deep); }

/* ---------- Book detail page ---------- */
.book-detail {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 48px;
  align-items: start;
  padding: 20px 0 60px;
}

.book-detail .book-cover {
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
}

.book-detail-info .book-age { font-size: 0.85rem; }
.book-detail-info h1 { font-size: 2.2rem; }

.book-detail-info .desc { font-size: 1.05rem; color: var(--ink-soft); }

.feature-list {
  list-style: none;
  padding: 0;
  margin: 20px 0 28px;
}

.feature-list li {
  padding-left: 28px;
  position: relative;
  margin-bottom: 10px;
  color: var(--ink-soft);
}

.feature-list li::before {
  content: "✦";
  position: absolute;
  left: 0;
  color: var(--mustard);
}

.breadcrumb {
  font-size: 0.9rem;
  color: var(--ink-soft);
  margin: 24px 0 0;
}

.breadcrumb a { color: var(--coral-deep); text-decoration: none; font-weight: 700; }

@media (max-width: 720px) {
  .book-detail { grid-template-columns: 1fr; }
  .book-detail .book-cover { max-width: 320px; margin: 0 auto; }
}
