/* ============================================================
   The Civil Code Illustrated: lacivilcode.com
   Plain CSS. No build step, no dependencies.
   Visual identity: cream paper, black line art, restrained
   Tulane-green accent, classic serif, small-caps labels.
   ============================================================ */

/* ---------- Optional: self-hosted display serif ----------
   The site ships with a classic system-serif stack, no web fonts,
   no network requests, no CDN. To match the book's Garamond-style
   face exactly, self-host EB Garamond (SIL OFL, free to bundle) as
   described in assets/fonts/README.txt, then UNCOMMENT this block.

@font-face {
  font-family: "EB Garamond";
  src: url("/assets/fonts/ebgaramond-regular.woff2") format("woff2");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "EB Garamond";
  src: url("/assets/fonts/ebgaramond-italic.woff2") format("woff2");
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: "EB Garamond";
  src: url("/assets/fonts/ebgaramond-semibold.woff2") format("woff2");
  font-weight: 600; font-style: normal; font-display: swap;
}
:root {
  --font-serif:   "EB Garamond", "Iowan Old Style", Palatino, Georgia, "Times New Roman", serif;
  --font-display: "EB Garamond", "Iowan Old Style", Palatino, Georgia, serif;
}
---------------------------------------------------------------- */

/* ---------- Design tokens ---------- */
:root {
  /* Colour: near-black ink on warm cream; one accent (Tulane green). */
  --paper:       #f6f1e7;
  --paper-tint:  #efe7d6;   /* alternating sections */
  --page:        #fdfbf4;   /* the "paper page" in the spread */
  --ink:         #1c1a17;   /* body + line art (~15:1 on paper) */
  --ink-soft:    #4f4a40;   /* secondary text (~7:1 on paper) */
  --rule:        #2a2620;   /* hairlines */
  --rule-faint:  #c9bea4;   /* faint rules / borders */
  --accent:      #006747;   /* Tulane dark green (~6.1:1 on paper) */
  --accent-dark: #005037;   /* hover */

  /* Type */
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua",
                "URW Palladio L", "Hoefler Text", "Sorts Mill Goudy", Georgia,
                Cambria, "Times New Roman", Times, serif;
  --font-display: var(--font-serif);

  /* Spacing / layout */
  --wrap:        72rem;
  --wrap-narrow: 46rem;
  --gutter:      clamp(1.1rem, 4vw, 2.5rem);
  --section-pad: clamp(3rem, 8vw, 6rem);
  --header-h:    3.5rem;

  --radius: 3px;
  --shadow-page: 0 1px 2px rgba(28,26,23,.10), 0 6px 22px rgba(28,26,23,.10);
}

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

html {
  color-scheme: light;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-serif);
  font-size: clamp(1.02rem, 0.97rem + 0.25vw, 1.18rem);
  line-height: 1.65;
  font-kerning: normal;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

img, svg { max-width: 100%; }
img { height: auto; }

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.16em;
}
a:hover { color: var(--accent-dark); }

h1, h2, h3 { font-weight: 600; line-height: 1.12; letter-spacing: 0.01em; }

p { margin: 0 0 1rem; }
p:last-child { margin-bottom: 0; }

cite { font-style: italic; }

/* Section anchors clear the sticky header */
section[id] { scroll-margin-top: calc(var(--header-h) + 1.25rem); }

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

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%);
  white-space: nowrap; border: 0;
}

/* The inline SVG ornament sprite is defined once and hidden. */
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

/* Small-caps section label */
.label {
  display: block;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-variant-caps: all-small-caps;
  color: var(--ink-soft);
  margin: 0 0 0.4rem;
}
.label--inline { display: inline; }

/* Skip link */
.skip-link {
  position: absolute;
  left: 0.5rem; top: -3rem;
  z-index: 100;
  background: var(--ink);
  color: var(--paper);
  padding: 0.6rem 1rem;
  border-radius: var(--radius);
  text-decoration: none;
  transition: top 0.15s ease;
}
.skip-link:focus { top: 0.5rem; color: var(--paper); }

/* Focus ring */
:focus-visible {
  outline: 2.5px solid var(--accent);
  outline-offset: 2px;
  border-radius: 1px;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--paper); /* fallback for browsers without color-mix */
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--rule-faint);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--header-h);
  padding-block: 0.4rem;
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;            /* allow the text to ellipsize instead of pushing the CTA off-screen */
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
}
.wordmark:hover { color: var(--ink); }
.wordmark__mark { width: 1.05rem; height: 1.45rem; color: var(--accent); flex: none; }
.wordmark__text {
  font-size: 0.94rem;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.site-nav { display: flex; align-items: center; gap: 1.25rem; }
.site-nav__links {
  display: none;
  list-style: none;
  margin: 0; padding: 0;
  gap: 1.4rem;
}
.site-nav__links a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.95rem;
  padding-block: 0.3rem;
  border-bottom: 2px solid transparent;
}
.site-nav__links a:hover { color: var(--ink); }
.site-nav__links a[aria-current="true"] {
  color: var(--ink);
  border-bottom-color: var(--accent);
}

/* ---------- Buttons ---------- */
.btn {
  --btn-bg: transparent;
  --btn-fg: var(--ink);
  --btn-bd: var(--ink);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em;
  min-height: 2.85rem;
  padding: 0.65rem 1.3rem;
  font-family: var(--font-serif);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.1;
  color: var(--btn-fg);
  background: var(--btn-bg);
  border: 1.5px solid var(--btn-bd);
  border-radius: var(--radius);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.12s ease, background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn__icon { width: 1.05em; height: 1.05em; flex: none; }

.btn--primary {
  --btn-bg: var(--accent);
  --btn-fg: #faf7f0;
  --btn-bd: var(--accent);
}
.btn--primary:hover { --btn-bg: var(--accent-dark); --btn-bd: var(--accent-dark); color: #faf7f0; }

.btn--outline {
  --btn-bg: transparent;
  --btn-fg: var(--ink);
  --btn-bd: var(--ink);
}
.btn--outline:hover { --btn-bg: var(--ink); --btn-fg: var(--paper); color: var(--paper); }

.btn--small { min-height: 2.3rem; padding: 0.4rem 0.9rem; font-size: 0.9rem; }
.btn--large { min-height: 3.2rem; padding: 0.85rem 1.7rem; font-size: 1.1rem; }
.btn--block { width: 100%; }

/* ---------- Section scaffolding ---------- */
.section { padding-block: var(--section-pad); }
.section--tint { background: var(--paper-tint); }

.section__title {
  font-family: var(--font-display);
  font-size: clamp(1.9rem, 1.4rem + 2vw, 2.9rem);
  text-align: center;
  margin: 0 0 1rem;
}

.lede {
  max-width: 60ch;
  margin: 0 auto 2.5rem;
  text-align: center;
  font-size: 1.1em;
  color: var(--ink-soft);
}

/* Ornamental section head (rule, fleur, rule) */
.section-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin: 0 auto 1.25rem;
  max-width: 22rem;
  color: var(--accent);
}
.section-head__rule {
  flex: 1;
  height: 1px;
  background: linear-gradient(to var(--_d, right), transparent, var(--rule-faint));
}
.section-head__rule:last-child { --_d: left; }
.section-head__mark { width: 1.4rem; height: 1.95rem; flex: none; }

/* ============================================================ HERO ============================================================ */
.hero { padding-block: clamp(2rem, 6vw, 4rem); }

.hero__frame {
  position: relative;
  max-width: 56rem;
  margin-inline: auto;
  padding: clamp(2.2rem, 6vw, 4rem) clamp(1.4rem, 5vw, 3.5rem);
  text-align: center;
  background: var(--page);
  border: 1.5px solid var(--ink);
  border-radius: var(--radius);
  /* inner double rule */
  box-shadow:
    inset 0 0 0 5px var(--page),
    inset 0 0 0 6.5px var(--ink),
    var(--shadow-page);
}

/* Corner fleurs on the frame */
.fleur-corner {
  position: absolute;
  width: 1.2rem; height: 1.65rem;
  color: var(--accent);
  display: block;
}
.fleur-corner svg { width: 100%; height: 100%; display: block; }
.fleur-corner--tl { top: 0.7rem; left: 0.7rem; }
.fleur-corner--tr { top: 0.7rem; right: 0.7rem; transform: scaleX(-1); }
.fleur-corner--bl { bottom: 0.7rem; left: 0.7rem; transform: scaleY(-1); }
.fleur-corner--br { bottom: 0.7rem; right: 0.7rem; transform: scale(-1); }

.hero__eyebrow { color: var(--ink-soft); margin-bottom: 0.8rem; }

.hero__title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2.5rem, 1.4rem + 6.5vw, 5.4rem);
  line-height: 1.02;
  letter-spacing: 0.012em;
  margin: 0.1em auto 0.12em;
  color: var(--ink); /* solid fallback */
  text-wrap: balance;
}
/* Outlined "coloring-book" display treatment: ink outline, paper interior */
@supports (-webkit-text-stroke: 2px black) {
  .hero__title {
    -webkit-text-stroke: clamp(1.1px, 0.45vw, 2.2px) var(--ink);
    -webkit-text-fill-color: var(--page);
  }
}
@media (prefers-contrast: more) {
  .hero__title { -webkit-text-fill-color: var(--ink); }
}
@media (forced-colors: active) {
  .hero__title { -webkit-text-fill-color: CanvasText; -webkit-text-stroke-width: 0; }
}

.hero__subtitle {
  font-family: var(--font-display);
  font-size: clamp(1.1rem, 0.9rem + 1.2vw, 1.6rem);
  font-style: italic;
  font-weight: 400;
  color: var(--ink);
  margin: 0 0 1.2rem;
}

.emblem {
  display: block;
  width: clamp(13rem, 42vw, 19rem);
  height: auto;
  margin: 0.5rem auto 1.4rem;
  color: var(--ink);
}

.hero__tagline {
  max-width: 36ch;
  margin: 0 auto 1.8rem;
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 0.95rem + 0.7vw, 1.4rem);
  font-style: italic;
  line-height: 1.4;
  color: var(--ink);
}

.hero__cta { margin-bottom: 1rem; }

.hero__meta {
  font-size: 0.86rem;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  margin: 0;
}

/* ============================================================ WHAT IT IS: the spread ============================================================ */
.spread { max-width: 60rem; margin-inline: auto; }

.spread__book {
  background: var(--page);
  border: 1px solid var(--rule-faint);
  border-radius: var(--radius);
  box-shadow: var(--shadow-page);
  overflow: hidden;
}

.page { padding: clamp(1.4rem, 4vw, 2.4rem); }

.page--left { border-bottom: 1px solid var(--rule-faint); }

.page__book { color: var(--accent); margin-bottom: 0.7rem; }
.page__title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 1.2rem + 1.5vw, 2.1rem);
  margin: 0 0 0.35rem;
}
.page__etym { color: var(--ink-soft); margin: 0 0 0.5rem; }
.page__etym [lang] { font-style: italic; }
.page__cite {
  font-size: 0.86rem;
  letter-spacing: 0.06em;
  color: var(--ink-soft);
  padding-bottom: 0.9rem;
  margin: 0 0 1rem;
  border-bottom: 1px solid var(--rule-faint);
}
.page__block { margin-bottom: 1rem; }
.page__block p:not(.label) { text-align: justify; hyphens: auto; }

.page--right {
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;             /* center the drawing in the taller page */
  gap: 1rem;
  padding: clamp(1rem, 2.5vw, 1.5rem); /* tighter than the text page so the art runs larger */
  background:
    linear-gradient(to right, rgba(28,26,23,.05), transparent 6%);
}
.page__art {
  width: 100%;
  max-width: 32rem;                    /* was 22rem — let the full-page drawing fill the page */
  border: 1px solid var(--rule-faint);
  border-radius: 2px;
  background: #fff;
}
.page__caption {
  max-width: 30ch;
  text-align: center;
  font-style: italic;
  font-size: 1.05em;
  color: var(--ink);
  margin: 0;
}

.spread__legend,
.spread__note {
  max-width: 56ch;
  margin: 1.5rem auto 0;
  text-align: center;
  font-size: 0.98em;
  color: var(--ink-soft);
}
.spread__legend strong { color: var(--ink); }

/* ============================================================ THE FOUR BOOKS ============================================================ */
.books {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: clamp(1rem, 3vw, 1.6rem);
  counter-reset: book;
}
.book-card {
  position: relative;
  background: var(--page);
  border: 1px solid var(--rule-faint);
  border-radius: var(--radius);
  padding: clamp(1.4rem, 3.5vw, 2rem);
  box-shadow: var(--shadow-page);
}
.book-card__mark {
  display: block;
  width: 2.6rem; height: 2.6rem;
  color: var(--accent);
  margin-bottom: 0.8rem;
}
.book-card__mark svg { width: 100%; height: 100%; }
.book-card__title {
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 1.1rem + 1vw, 1.7rem);
  margin: 0 0 0.6rem;
}
.book-card__desc { margin-bottom: 0.9rem; }
.book-card__list {
  font-size: 0.92rem;
  color: var(--ink-soft);
  padding-top: 0.8rem;
  border-top: 1px solid var(--rule-faint);
  margin: 0;
  line-height: 1.7;
}
.book-card__list [lang] { font-style: italic; }

.books__footnote {
  text-align: center;
  margin: 2rem auto 0;
  max-width: 50ch;
  color: var(--ink-soft);
  font-size: 0.98em;
}

/* ============================================================ DOWNLOAD ============================================================ */
.downloads {
  display: grid;
  gap: clamp(1rem, 3vw, 1.6rem);
  max-width: 56rem;
  margin-inline: auto;
  align-items: start;
}
.dl-card {
  background: var(--page);
  border: 1px solid var(--rule-faint);
  border-radius: var(--radius);
  padding: clamp(1.5rem, 4vw, 2.2rem);
  box-shadow: var(--shadow-page);
  display: flex;
  flex-direction: column;
}
.dl-card--primary {
  border: 1.5px solid var(--accent);
  box-shadow: 0 1px 2px rgba(28,26,23,.1), 0 10px 30px rgba(0,103,71,.12);
}
.dl-card__badge { color: var(--ink-soft); }
.dl-card--primary .dl-card__badge { color: var(--accent); }
.dl-card__title {
  font-family: var(--font-display);
  font-size: clamp(1.4rem, 1.15rem + 1vw, 1.85rem);
  margin: 0 0 0.6rem;
}
.dl-card__desc { margin-bottom: 1rem; }
.dl-card__meta {
  font-size: 0.85rem;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  margin: 0 0 1.4rem;
  padding-top: 0.9rem;
  border-top: 1px solid var(--rule-faint);
}
.dl-card .btn { margin-top: auto; }

.downloads__note {
  text-align: center;
  max-width: 52ch;
  margin: 2rem auto 0;
  color: var(--ink-soft);
  font-size: 0.98em;
}

/* ============================================================ ABOUT ============================================================ */
.prose { font-size: 1.08em; }
.prose p { text-align: justify; hyphens: auto; }
.prose__contact {
  text-align: center;
  margin-top: 1.6rem;
  font-size: 0.96em;
  letter-spacing: 0.02em;
}
.dot { color: var(--rule-faint); margin-inline: 0.5rem; }

/* ============================================================ FOOTER ============================================================ */
.site-footer {
  background: var(--ink);
  color: var(--paper);
  padding-block: clamp(2.5rem, 6vw, 3.5rem);
  text-align: center;
}
.site-footer__inner { display: grid; gap: 0.4rem; justify-items: center; }
.site-footer__mark { width: 1.3rem; height: 1.8rem; color: #d8a39a; margin-bottom: 0.6rem; }
.site-footer__credit { margin: 0; font-size: 1.02em; }
.site-footer__credit strong { font-weight: 600; }
.site-footer__copy { margin: 0; font-size: 0.86rem; color: #c8c1b3; }
.site-footer__links { margin: 0.4rem 0 0; font-size: 0.92rem; }
.site-footer a { color: #f0d7d2; }
.site-footer a:hover { color: #fff; }
.site-footer .dot { color: #6b665c; }

/* ============================================================ RESPONSIVE ============================================================ */
@media (min-width: 40rem) {
  .books { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 48rem) {
  .site-nav__links { display: flex; }
  .site-nav .btn--small { display: none; } /* nav already has a Download link */
  .spread__book {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .page--left {
    border-bottom: 0;
    border-right: 1px solid var(--rule-faint);
  }
  .downloads { grid-template-columns: 1fr 1fr; }
  /* Lift the recommended edition slightly on wide screens */
  .dl-card--primary { transform: translateY(-0.4rem); }
}

@media (min-width: 60rem) {
  :root { --header-h: 4rem; }
}

/* ---------- Motion & contrast preferences ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .btn:hover { transform: none; }
  .dl-card--primary { transform: none; }
}

@media (prefers-contrast: more) {
  :root { --ink-soft: #36322b; --rule-faint: #8a8170; }
  a { text-decoration-thickness: 2px; }
}
