/* ============================================================
   LorePages — Design System
   Aesthetic: Storybook Studio.
   The warmth of a beloved children's book publisher — still crafted,
   still trustworthy, but now full of light and colour.
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:ital,opsz,wght,SOFT,WONK@0,9..144,300..900,0..100,0..1;1,9..144,300..900,0..100,0..1&family=EB+Garamond:ital,wght@0,400..800;1,400..800&display=swap');

:root {
  /* paper / ink — softer, warmer, less monastic */
  --paper:         #f7f0dc;
  --paper-deep:    #ecdfc0;
  --paper-edge:    #d4c19a;
  --ink:           #2a1e0e;
  --ink-soft:      #4a3620;
  --ink-quiet:     #6d5a3f;
  --muted:         #8f7c60;
  --rule:          #d0b98a;
  --rule-soft:     #e3d4ac;

  /* Primary accents — terracotta family (was oxblood) */
  --terra:         #c4593a;
  --terra-deep:    #9c3d24;
  --terra-warm:    #e07050;
  /* Legacy aliases so existing components keep working while I retint */
  --oxblood:       var(--terra);
  --oxblood-deep:  var(--terra-deep);
  --oxblood-warm:  var(--terra-warm);

  /* Sunny gold, brighter than before */
  --gold:          #d4a441;
  --gold-light:    #eac878;
  --gold-soft:     #f0dfa4;

  /* New secondary accents — each era has a mood */
  --sage:          #7a9a6a;
  --sage-soft:     #b6cca5;
  --azure:         #4a6fa5;
  --azure-soft:    #8fa7c9;
  --berry:         #b4467c;
  --berry-soft:    #d98ab0;
  --sky:           #8ec5d7;

  /* Backward-compatible names */
  --moss:          var(--sage);
  --indigo:        var(--azure);

  /* type */
  --display: 'Fraunces', 'Iowan Old Style', Georgia, 'Times New Roman', serif;
  --body:    'EB Garamond', 'Iowan Old Style', Georgia, 'Times New Roman', serif;

  /* rhythm */
  --max:    1240px;
  --narrow: 720px;
  --gutter: clamp(1.25rem, 4vw, 3rem);

  /* motion */
  --ease:    cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 0.84, 0.44, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: clamp(17px, 1.05vw + 0.55rem, 19px);
  line-height: 1.55;
  font-feature-settings: 'liga' 1, 'kern' 1, 'onum' 1, 'calt' 1;
  text-rendering: geometricPrecision;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Paper texture — a fine pebbled grain layered over the whole page. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(rgba(120,80,40,0.025) 1px, transparent 1.2px) 0 0 / 5px 5px,
    radial-gradient(rgba(120,80,40,0.020) 1px, transparent 1.2px) 2.5px 2.5px / 7px 7px,
    radial-gradient(circle at 30% 20%, rgba(168,122,58,0.04), transparent 60%),
    radial-gradient(circle at 80% 80%, rgba(110,42,42,0.03), transparent 55%);
  z-index: 0;
}
/* a faint warm vignette so the page feels like a single bound page */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, transparent 50%, rgba(74,42,26,0.08));
  z-index: 1;
}

main, header, footer { position: relative; z-index: 2; }

/* ============== Header ============== */
.site-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 1.4rem var(--gutter) 1.2rem;
  border-bottom: 1px solid var(--paper-edge);
  background: linear-gradient(to bottom, var(--paper-deep), transparent);
}
.site-header .brand {
  font-family: var(--display);
  font-variation-settings: 'opsz' 144, 'wght' 500, 'SOFT' 50;
  font-size: 1.5rem;
  color: var(--ink);
  text-decoration: none;
  letter-spacing: 0.005em;
}
.site-header .brand::before {
  content: '·';
  margin-right: 0.5em;
  color: var(--gold);
}
.site-header .brand::after {
  content: '·';
  margin-left: 0.5em;
  color: var(--gold);
}
.site-header nav {
  display: flex;
  gap: clamp(1rem, 2.5vw, 2rem);
  font-variant-caps: all-small-caps;
  letter-spacing: 0.14em;
  font-size: 0.83rem;
}
.site-header nav a {
  color: var(--ink-quiet);
  text-decoration: none;
  position: relative;
  padding-bottom: 2px;
  transition: color 200ms var(--ease);
}
.site-header nav a:hover { color: var(--oxblood); }
.site-header nav a::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: var(--oxblood);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 280ms var(--ease-out);
}
.site-header nav a:hover::after { transform: scaleX(1); }

/* ============== Footer / Colophon ============== */
.site-footer {
  border-top: 1px solid var(--paper-edge);
  margin-top: 6rem;
  padding: 2.5rem var(--gutter) 3.5rem;
  text-align: center;
  font-size: 0.95rem;
  color: var(--ink-quiet);
}
.site-footer .colophon-rule {
  display: inline-block;
  margin-bottom: 1.5rem;
  color: var(--gold);
}
.site-footer nav {
  display: flex;
  gap: 1.5rem;
  justify-content: center;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.18em;
  font-size: 0.8rem;
  margin-bottom: 0.8rem;
}
.site-footer nav a {
  color: var(--ink-quiet);
  text-decoration: none;
  transition: color 200ms var(--ease);
}
.site-footer nav a:hover { color: var(--oxblood); }
.site-footer p {
  font-style: italic;
  font-size: 0.92rem;
  margin: 0;
  color: var(--muted);
}

/* ============== CTA — the bookmark stamp ============== */
.cta,
button.cta,
a.cta {
  --cta-bg: var(--terra);
  --cta-bg-hover: var(--terra-warm);
  display: inline-flex;
  align-items: center;
  gap: 0.7em;
  font-family: var(--display);
  font-variation-settings: 'opsz' 14, 'wght' 520, 'SOFT' 100;
  font-size: 1.02rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-variant: small-caps;
  color: #fff7e6;
  background: var(--cta-bg);
  padding: 1em 1.9em;
  border: 0;
  border-radius: 12px;
  text-decoration: none;
  cursor: pointer;
  position: relative;
  isolation: isolate;
  box-shadow:
    inset 0 0 0 1px rgba(255, 240, 200, 0.28),
    inset 0 1px 0 rgba(255, 240, 200, 0.38),
    0 2px 0 rgba(28, 19, 11, 0.08),
    0 12px 24px -10px rgba(156, 61, 36, 0.55);
  transition: background 240ms var(--ease), transform 260ms cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 240ms var(--ease);
}
.cta::before {
  content: '';
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(255, 240, 200, 0.22);
  border-radius: 8px;
  pointer-events: none;
}
/* Sparkle bloom on hover */
.cta::after {
  content: '';
  position: absolute;
  top: -4px; right: -4px;
  width: 10px; height: 10px;
  background:
    radial-gradient(circle at center, var(--gold-light) 0%, transparent 60%);
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 280ms var(--ease), transform 380ms var(--ease-out);
  pointer-events: none;
}
.cta:hover {
  background: var(--cta-bg-hover);
  transform: translateY(-2px) scale(1.02);
  box-shadow:
    inset 0 0 0 1px rgba(255, 240, 200, 0.30),
    inset 0 1px 0 rgba(255, 240, 200, 0.36),
    0 2px 0 rgba(28, 19, 11, 0.08),
    0 18px 30px -12px rgba(156, 61, 36, 0.60);
}
.cta:hover::after { opacity: 1; transform: scale(1.4); }
.cta:active { transform: translateY(0) scale(1); }

/* The "quill" — a small flourish character used in CTAs */
.cta .quill { font-size: 1.1em; line-height: 1; font-style: italic; text-transform: none; letter-spacing: 0; }

/* ============== Form controls — manuscript ruled ============== */
input[type='text'],
input[type='email'],
select,
textarea {
  font-family: var(--body);
  font-size: 1.1rem;
  color: var(--ink);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--rule);
  border-radius: 0;
  padding: 0.55em 0.1em;
  width: 100%;
  transition: border-color 200ms var(--ease);
  font-feature-settings: 'onum' 1, 'kern' 1;
}
input[type='text']:focus,
input[type='email']:focus,
select:focus,
textarea:focus {
  outline: none;
  border-bottom-color: var(--oxblood);
}
select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ink-quiet) 50%),
    linear-gradient(135deg, var(--ink-quiet) 50%, transparent 50%);
  background-position:
    calc(100% - 16px) calc(50% - 2px),
    calc(100% - 11px) calc(50% - 2px);
  background-size: 5px 5px;
  background-repeat: no-repeat;
}

label > span {
  display: block;
  margin-bottom: 0.55em;
  font-family: var(--display);
  font-variation-settings: 'opsz' 14, 'wght' 480, 'SOFT' 100;
  font-size: 0.78rem;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.2em;
  color: var(--ink-quiet);
}

/* ============== Decorative fleuron rule ============== */
.fleuron {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  margin: 4rem auto;
  color: var(--gold);
  max-width: 480px;
}
.fleuron::before,
.fleuron::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--rule), transparent);
}
.fleuron svg {
  width: 36px;
  height: 18px;
  flex-shrink: 0;
}

/* Section labels  — "VOLUME I", "PLATE N°", etc. */
.eyebrow {
  font-family: var(--display);
  font-variation-settings: 'opsz' 14, 'wght' 500, 'SOFT' 100;
  font-size: 0.8rem;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.32em;
  color: var(--gold);
  text-indent: 0.32em;
}

/* shared typography */
h1, h2, h3 {
  font-family: var(--display);
  font-weight: 400;
  margin: 0;
}

/* utility */
.center-stack { display: grid; place-items: center; text-align: center; }

/* ============== Motion: page-in reveal ============== */
@keyframes ink-rise {
  from { opacity: 0; transform: translateY(0.6em); filter: blur(2px); }
  to   { opacity: 1; transform: translateY(0);     filter: blur(0); }
}
@keyframes plate-rise {
  from { opacity: 0; transform: translateY(1.2em) scale(0.985); }
  to   { opacity: 1; transform: translateY(0)     scale(1); }
}
@keyframes seal-pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.04); }
}

/* honour reduced-motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}
