/* Robert Luh · author site
   Fonts: Fraunces & Literata (SIL Open Font License), served locally, no external requests. */

@font-face {
  font-family: "Fraunces";
  src: url("fonts/fraunces.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Literata";
  src: url("fonts/literata.woff2") format("woff2");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Literata";
  src: url("fonts/literata-italic.woff2") format("woff2");
  font-weight: 200 900;
  font-style: italic;
  font-display: swap;
}

:root {
  --night: #131a2c;      /* header / hero sky */
  --night-2: #1d2640;
  --starlight: #e8ecf5;  /* text on night */
  --paper: #f5f6f8;      /* page background */
  --ink: #1f2638;        /* body text */
  --mist: #5d6579;       /* secondary text */
  --line: #d6dae2;
  --ember: #f0b23e;      /* accent on dark */
  --ember-deep: #9a5f00; /* accent on light (links) */
  --surface: #ffffff;

  --display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --text: "Literata", "Iowan Old Style", Georgia, serif;
  --measure: 36rem;
  --wide: 68rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #161c2c;
    --ink: #dfe3ec;
    --mist: #9aa2b6;
    --line: #2d3650;
    --ember-deep: #f0b23e;
    --surface: #1c2336;
    --night: #0e1322;
    --night-2: #161d33;
  }
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--text);
  font-size: 1.0625rem;
  line-height: 1.7;
  font-optical-sizing: auto;
  text-rendering: optimizeLegibility;
}

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

a { color: var(--ember-deep); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--ember); outline-offset: 3px; border-radius: 2px; }

h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 560;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 2.2em 0 0.6em;
}
h2 { font-size: 1.85rem; }
h3 { font-size: 1.35rem; }
h4 { font-size: 1.1rem; }

p { margin: 0 0 1.1em; }

.skip {
  position: absolute; left: -999px; top: 0;
  background: var(--ember); color: var(--night); padding: 0.5rem 1rem; z-index: 10;
}
.skip:focus { left: 1rem; top: 1rem; }

.wrap { max-width: var(--wide); margin: 0 auto; padding: 0 1.25rem; }

/* ---------- Sky: site header + hero share the same night ---------- */

.sky {
  position: relative;
  background:
    radial-gradient(ellipse 60% 80% at 85% -10%, rgba(240, 178, 62, 0.16), transparent 60%),
    linear-gradient(180deg, var(--night) 0%, var(--night-2) 100%);
  color: var(--starlight);
  overflow: hidden;
}
.sky::before {
  /* signal strip along the bottom of the inner page headers */
  content: "";
  position: absolute; left: 0; right: 0; bottom: 0.4rem;
  height: 4.5rem;
  background: url("signal.svg") center bottom / 100% 100% no-repeat;
  opacity: 0.55;
  pointer-events: none;
}
.sky:has(.hero)::before { display: none; }
.sky > * { position: relative; }

.site-header {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding-top: 1.1rem; padding-bottom: 1.1rem;
  flex-wrap: wrap;
}
.brand {
  font-family: var(--display);
  font-size: 1.25rem; font-weight: 600;
  color: var(--starlight); text-decoration: none;
  letter-spacing: 0.01em;
}
.brand:hover { color: #fff; }

.nav { display: flex; gap: 0.25rem 1.4rem; flex-wrap: wrap; align-items: center; font-size: 0.97rem; }
.nav a { color: rgba(232, 236, 245, 0.8); text-decoration: none; padding: 0.2rem 0; }
.nav a:hover { color: #fff; }
.nav a[aria-current="page"] { color: #fff; box-shadow: inset 0 -2px 0 var(--ember); }
.nav .lang { border: 1px solid rgba(232, 236, 245, 0.35); border-radius: 999px; padding: 0.1rem 0.7rem; font-size: 0.85rem; }
.nav .lang:hover { border-color: var(--ember); }

/* Home hero */
.hero { padding-block: 4rem 4.5rem; }
.hero h1 {
  font-size: clamp(3.2rem, 11vw, 7.5rem);
  font-weight: 300;
  letter-spacing: -0.035em;
  line-height: 0.95;
  margin: 0;
  font-variation-settings: "opsz" 144;
}

/* the signal: a bundle of waves drifting slowly through the hero */
.signal {
  display: block;
  width: 100%;
  height: clamp(5rem, 12vw, 9rem);
  margin: 1.4rem 0 0.4rem;
  overflow: hidden;
}
.signal path { fill: none; stroke-width: 1.4; vector-effect: non-scaling-stroke; }
.signal .w1 { stroke: #f0b23e; stroke-opacity: 0.95; stroke-width: 1.8; }
.signal .w2 { stroke: #f6c566; stroke-opacity: 0.65; }
.signal .w3 { stroke: #ffffff; stroke-opacity: 0.6; }
.signal .w4 { stroke: #e8ecf5; stroke-opacity: 0.35; }
.signal .w5 { stroke: #f0b23e; stroke-opacity: 0.4; }
.signal .w6 { stroke: #9fb4ff; stroke-opacity: 0.4; }
.signal-track { animation: drift 40s linear infinite; }
@keyframes drift { to { transform: translateX(-1200px); } }
.hero p {
  max-width: 34rem;
  margin: 0;
  font-size: 1.2rem;
  line-height: 1.55;
  color: rgba(232, 236, 245, 0.85);
}

/* Inner page title band */
.page-head { padding-block: 2.5rem 5rem; }
.page-head h1 {
  font-size: clamp(2.3rem, 6vw, 3.8rem);
  font-weight: 400;
  letter-spacing: -0.025em;
  margin: 0;
}
.page-head p { margin: 0.8rem 0 0; color: rgba(232, 236, 245, 0.8); font-size: 1.1rem; max-width: 36rem; }

/* ---------- Content ---------- */

main { padding: 3.5rem 0 4.5rem; }
.prose { max-width: var(--measure); }
.prose > h2:first-child, .prose > h3:first-child { margin-top: 0; }
.lede { font-size: 1.2rem; line-height: 1.6; }

blockquote {
  margin: 1.5em 0;
  padding: 0 0 0 1.3rem;
  border-left: 2px solid var(--ember);
  font-style: italic;
}
blockquote p:last-child { margin-bottom: 0; }

.note { color: var(--mist); font-size: 0.95rem; font-style: italic; }
.refs { color: var(--mist); font-size: 0.88rem; line-height: 1.55; padding-left: 0; list-style: none; }
.refs li { margin-bottom: 0.5em; overflow-wrap: anywhere; }

hr { border: 0; border-top: 1px solid var(--line); margin: 3rem 0; }

/* Book list on home */
.shelf { display: grid; gap: 4.5rem; }
.book {
  display: grid;
  grid-template-columns: minmax(0, 13rem) minmax(0, 1fr);
  gap: 2.5rem;
  align-items: start;
}
.book .cover { display: block; }
.book .cover img, .book-hero .cover img {
  width: 100%;
  border-radius: 2px 4px 4px 2px;
  box-shadow: 0 1px 2px rgba(19, 26, 44, 0.25), 0 14px 28px -10px rgba(19, 26, 44, 0.45);
  background: var(--night-2);
}
.book h2 { margin: 0 0 0.25rem; font-size: 2.2rem; font-weight: 500; }
.book h2 a { color: inherit; text-decoration: none; }
.book h2 a:hover { color: var(--ember-deep); }
.genre { color: var(--mist); margin: 0 0 1rem; font-style: italic; }
.book p { max-width: var(--measure); }

.actions { display: flex; flex-wrap: wrap; gap: 0.6rem 1.2rem; align-items: center; margin-top: 1.2rem; }
.button {
  display: inline-block;
  background: var(--night);
  color: var(--starlight);
  text-decoration: none;
  padding: 0.55rem 1.15rem;
  border-radius: 999px;
  font-size: 0.95rem;
  line-height: 1.3;
}
.button:hover { background: var(--night-2); color: #fff; }
@media (prefers-color-scheme: dark) {
  .button { background: var(--ember); color: var(--night); }
  .button:hover { background: #f6c566; color: var(--night); }
}

/* Book detail page */
.book-hero {
  display: grid;
  grid-template-columns: minmax(0, 15rem) minmax(0, 1fr);
  gap: 3rem;
  align-items: start;
}
.book-hero .cover { position: sticky; top: 1.5rem; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 0.2rem 1.2rem; margin: 0 0 1.8rem; font-size: 0.95rem; }
.facts dt { color: var(--mist); }
.facts dd { margin: 0; }

.buy {
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 1.1rem 0;
  margin: 2rem 0;
  display: grid;
  gap: 0.5rem;
  font-size: 0.97rem;
}
.buy div { display: flex; flex-wrap: wrap; gap: 0.3rem 1rem; align-items: baseline; }
.buy strong { font-weight: 600; min-width: 7.5rem; }

.figure { margin: 2rem 0; }
.figure img { border-radius: 3px; }
.figure figcaption { color: var(--mist); font-size: 0.9rem; margin-top: 0.6rem; font-style: italic; }

.cast { display: grid; gap: 0.2rem; }
.cast h4 { margin: 1.6em 0 0.3em; }

/* Publications */
.year { margin-top: 2.6rem; font-size: 1.05rem; color: var(--mist); font-weight: 500; font-family: var(--text); letter-spacing: 0.02em; }
.pubs { list-style: none; padding: 0; margin: 0; }
.pubs li { padding: 0.9rem 0; border-top: 1px solid var(--line); }
.pubs li:last-child { border-bottom: 1px solid var(--line); }
.pubs .title { font-weight: 600; display: block; line-height: 1.4; }
.pubs .meta { color: var(--mist); font-size: 0.93rem; display: block; margin-top: 0.2rem; }
.pubs .links { font-size: 0.93rem; display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 0.3rem; }

/* About */
.about { display: grid; grid-template-columns: minmax(0, 14rem) minmax(0, 1fr); gap: 3rem; align-items: start; }
.portrait img { border-radius: 3px; filter: saturate(0.9); }
.portrait dl { margin: 1.2rem 0 0; font-size: 0.95rem; }
.portrait dt { color: var(--mist); }
.portrait dd { margin: 0 0 0.6rem; }

/* Home about strip */
.author-strip { max-width: 46rem; }
.author-strip h2 { margin-top: 0; }

/* ---------- Footer ---------- */

.site-footer {
  background: var(--night);
  color: rgba(232, 236, 245, 0.75);
  font-size: 0.92rem;
  padding: 2.2rem 0;
}
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.8rem 2rem; }
.site-footer a { color: rgba(232, 236, 245, 0.9); }
.site-footer a:hover { color: var(--ember); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 0.4rem 1.4rem; }

/* ---------- Small screens ---------- */

@media (max-width: 720px) {
  body { font-size: 1rem; }
  .hero { padding-block: 2.5rem 3rem; }
  .page-head { padding-block: 2rem 4rem; }
  .book, .book-hero, .about { grid-template-columns: 1fr; gap: 1.5rem; }
  .book .cover, .book-hero .cover { max-width: 11rem; position: static; }
  .portrait { max-width: 14rem; }
  main { padding: 2.5rem 0 3.5rem; }
  .buy strong { min-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  .signal-track { animation: none; }
}

@media print {
  .sky, .site-footer, .actions, .buy { background: none !important; color: #000 !important; }
  .sky::before, .signal { display: none; }
}

.shelf-title { margin: 0 0 2.5rem; font-size: 1.05rem; font-family: var(--text); font-weight: 500; color: var(--mist); letter-spacing: 0.02em; }
