/* =========================================================================
   Aubrey Clayton — site styles
   One stylesheet for every page. Edit colors/fonts here once and they change
   everywhere. No build step, no dependencies to update.
   ========================================================================= */

:root {
  /* --- Palette: scholarly cloth-binding (ink, paper, oxblood) --- */
  --ink:    #16202e;   /* near-black blue, like iron-gall ink   */
  --paper:  #f0f0f1;   /* neutral off-white, softer than pure white */
  --accent: #8a1c2b;   /* oxblood / library red (links, rules)   */
  --accent-dark: #5f121d;
  --muted:  #55606f;   /* secondary text                         */
  --rule:   #d8d8dc;   /* hairline dividers (neutral)            */
  --paper-2:#e8e8ea;   /* subtle panel background (neutral)      */

  /* --- Type --- */
  --display: "Newsreader", Georgia, "Times New Roman", serif;
  --body:    "Newsreader", Georgia, "Times New Roman", serif;
  --ui:      system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --measure: 62ch;     /* comfortable reading width */
}

/* --- Reset-ish --- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--body);
  font-size: 1.125rem;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-dark); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* --- Layout container --- */
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 clamp(1.25rem, 4vw, 3rem); }
.narrow { max-width: 760px; }

/* =========================================================================
   Header / navigation  (identical on every page — if you change a nav link,
   change it in all .html files)
   ========================================================================= */
.site-header {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}
.site-header .wrap {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem 2rem;
  flex-wrap: wrap;
  padding-top: 1.4rem;
  padding-bottom: 1.4rem;
}
.wordmark {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.5rem;
  letter-spacing: .2px;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.wordmark:hover { color: var(--ink); }
.nav {
  font-family: var(--ui);
  font-size: .82rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  display: flex;
  flex-wrap: wrap;
  gap: 1.1rem 1.4rem;
  margin: 0;
}
.nav a { color: var(--muted); text-decoration: none; }
.nav a:hover { color: var(--accent); }
.nav a[aria-current="page"] { color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent); }

/* =========================================================================
   Generic page building blocks
   ========================================================================= */
main { padding: clamp(2.5rem, 6vw, 5rem) 0 3rem; }

.eyebrow {
  font-family: var(--ui);
  font-size: .78rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0 0 1.75rem;
}
h1.page-title {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(2rem, 5vw, 3rem);
  line-height: 1.1;
  margin: 0 0 1.5rem;
  letter-spacing: -.01em;
}
h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(1.4rem, 3vw, 1.8rem);
  line-height: 1.2;
  margin: 2.6rem 0 1rem;
}
h3 { font-family: var(--display); font-weight: 600; font-size: 1.25rem; margin: 2rem 0 .5rem; }
p { max-width: var(--measure); }
.lead { font-size: 1.28rem; line-height: 1.55; max-width: var(--measure); }

.hr { border: 0; border-top: 1px solid var(--rule); margin: 2.5rem 0; max-width: 1080px; }

/* =========================================================================
   Home page
   ========================================================================= */
.hero { display: grid; grid-template-columns: 1.3fr .9fr; gap: clamp(1.5rem, 5vw, 3.5rem); align-items: start; }
.hero-copy .kicker {
  font-family: var(--ui); font-size: .8rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--accent); margin: 0 0 1.75rem;
}
.hero h1 {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(1.75rem, 3.4vw, 2.2rem); line-height: 1.16;
  letter-spacing: -.01em; margin: 0 0 1.1rem; text-wrap: balance;
}
.hero .lead { color: var(--ink); }

/* Embedded video (responsive 16:9) */
.video-embed { margin: 2.75rem 0 0; max-width: 100%; }
.video-frame {
  position: relative; aspect-ratio: 16 / 9;
  background: #000; border-radius: 2px; overflow: hidden;
  box-shadow: 0 1px 0 var(--rule);
}
.video-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }

/* Whimsical interspersed images on the book page */
.whimsy { margin: 2.5rem auto; text-align: center; }
.whimsy img { max-width: 100%; height: auto; border-radius: 2px; }
.whimsy.photo img { box-shadow: 0 1px 0 var(--rule); }

/* Bayes equation — the site's signature motif */
.bayes {
  font-family: var(--display);
  font-style: italic;
  font-size: clamp(1.15rem, 2.4vw, 1.5rem);
  border-left: 2px solid var(--accent);
  padding: .3rem 0 .3rem 1.1rem;
  margin: 2rem 0 .4rem;
  color: var(--ink);
}
.bayes-cite { font-family: var(--ui); font-size: .8rem; letter-spacing: .04em; color: var(--muted); margin: 0; }
.bayes .bar { font-style: normal; display: inline-block; }

/* Portrait with graceful fallback if the photo file isn't present yet */
.portrait { position: relative; }
.portrait img { border-radius: 2px; box-shadow: 0 1px 0 var(--rule); width: 100%; }
.portrait-fallback {
  display: none;
  aspect-ratio: 4 / 5;
  background: var(--paper-2);
  border: 1px solid var(--rule);
  color: var(--muted);
  align-items: center;
  justify-content: center;
  font-family: var(--display);
  font-size: 3rem;
  letter-spacing: .1em;
}
.portrait figcaption { font-family: var(--ui); font-size: .78rem; color: var(--muted); margin-top: .5rem; }

/* =========================================================================
   Reference lists (Writing, Teaching, Appearances, Reviews)
   Each entry: venue (eyebrow) + linked title + date. Bibliographic feel.
   ========================================================================= */
.reflist { list-style: none; margin: 1.5rem 0 0; padding: 0; max-width: 820px; }
.reflist > li { padding: 1.25rem 0; border-top: 1px solid var(--rule); }
.reflist > li:first-child { border-top: 0; }
.ref-venue {
  font-family: var(--ui); font-size: .74rem; letter-spacing: .12em;
  text-transform: uppercase; color: var(--accent); margin: 0 0 .35rem;
}
.ref-title { font-size: 1.18rem; line-height: 1.35; margin: 0; }
.ref-title a { color: var(--ink); text-decoration: none; background-image: linear-gradient(var(--accent), var(--accent)); background-size: 0% 1px; background-repeat: no-repeat; background-position: 0 100%; transition: background-size .2s ease; }
.ref-title a:hover { background-size: 100% 1px; color: var(--ink); }
.ref-date { font-family: var(--ui); font-size: .82rem; color: var(--muted); margin: .3rem 0 0; }

/* Simple link rows (reviews/press with several links) */
.linkrows { columns: 2; column-gap: 2.5rem; max-width: 820px; margin-top: 1rem; }
.linkrows p { break-inside: avoid; margin: .2rem 0 1rem; }
@media (max-width: 640px){ .linkrows { columns: 1; } }

/* =========================================================================
   Book page
   ========================================================================= */
.buy-row { display: flex; flex-wrap: wrap; gap: .7rem; margin: 1.5rem 0 1rem; }
.btn {
  font-family: var(--ui); font-size: .85rem; letter-spacing: .03em;
  text-decoration: none; color: var(--paper); background: var(--ink);
  padding: .7rem 1.1rem; border-radius: 2px; border: 1px solid var(--ink);
  display: inline-block;
}
.btn:hover { background: var(--accent); border-color: var(--accent); color: var(--paper); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--ink); color: var(--paper); }

blockquote.praise {
  margin: 0 0 1.6rem; padding: 0 0 0 1.2rem; border-left: 2px solid var(--rule);
  max-width: var(--measure);
}
blockquote.praise p { font-size: 1.1rem; font-style: italic; margin: 0 0 .4rem; }
blockquote.praise cite { font-family: var(--ui); font-style: normal; font-size: .82rem; color: var(--muted); }

/* =========================================================================
   Contact page + form
   ========================================================================= */
.contact-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: clamp(2rem, 6vw, 4rem); align-items: start; }
.contact-form label { display: block; margin: 0 0 1.1rem; font-family: var(--ui); font-size: .82rem; letter-spacing: .04em; color: var(--muted); }
.contact-form input, .contact-form textarea {
  display: block; width: 100%; margin-top: .35rem;
  font-family: var(--body); font-size: 1rem; color: var(--ink);
  background: #fff; border: 1px solid var(--rule); border-radius: 2px;
  padding: .7rem .8rem;
}
.contact-form input:focus, .contact-form textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.contact-form button { font-family: var(--ui); font-size: .9rem; letter-spacing: .03em; cursor: pointer; color: var(--paper); background: var(--ink); border: 1px solid var(--ink); border-radius: 2px; padding: .75rem 1.4rem; }
.contact-form button:hover { background: var(--accent); border-color: var(--accent); }
.form-status { font-family: var(--ui); font-size: .9rem; margin-top: 1rem; min-height: 1.2em; }
.form-status.ok { color: #1f6b3a; }
.form-status.err { color: var(--accent); }
.contact-meta h3 { margin-top: 0; }
.contact-meta a { word-break: break-word; }

/* =========================================================================
   Footer
   ========================================================================= */
.site-footer { border-top: 1px solid var(--rule); margin-top: 4rem; padding: 2.2rem 0 2.8rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; gap: 1rem 2rem; align-items: center; justify-content: space-between; }
.social { display: flex; gap: 1.3rem; flex-wrap: wrap; font-family: var(--ui); font-size: .82rem; letter-spacing: .04em; margin: 0; }
.social a { color: var(--muted); text-decoration: none; }
.social a:hover { color: var(--accent); }
.colophon { font-family: var(--ui); font-size: .74rem; color: var(--muted); margin: 1rem 0 0; }

/* =========================================================================
   Responsive
   ========================================================================= */
@media (max-width: 820px) {
  .hero { grid-template-columns: 1fr; }
  .portrait { max-width: 340px; }
  .contact-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  body { font-size: 1.06rem; }
  .site-header .wrap { flex-direction: column; align-items: flex-start; gap: .8rem; }
}

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