/* ============================================================
   TIDEWRIGHT — Onda Campaign reference
   A drowned maritime logbook. One stylesheet, all pages.
   ------------------------------------------------------------
   Everything themeable lives in :root below. Change a token,
   change it everywhere. Fonts import from Google; to run fully
   offline, drop the files into /assets/fonts and swap the
   @import for @font-face (see README).
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,400;0,500;0,600;0,700;1,400;1,600&family=Newsreader:ital,wght@0,400;0,500;0,600;1,400;1,500&display=swap');

:root {
  /* — palette: a drowned logbook — */
  --ink:        #0c1618;  /* tide-ink, deepest background          */
  --fathom:     #132427;  /* raised surface / panels               */
  --brine:      #1c333700;/* (unused placeholder)                  */
  --brine-line: #24413f;  /* borders, hairlines, hovers            */
  --bone:       #e9e2d0;  /* primary text — warm parchment         */
  --ash:        #9fb0a8;  /* secondary text — seafoam grey         */
  --brass:      #c69749;  /* headings, dividers, primary accent    */
  --brass-dim:  #8a6b34;  /* quieter brass                         */
  --verdigris:  #6ba69a;  /* links, lore — oxidized copper         */
  --coral:      #bf5b45;  /* danger, DM-secret, the hidden things  */
  --coral-dim:  #5a2a22;  /* coral, drowned                        */

  /* — type — */
  --display: 'Cormorant Garamond', 'Iowan Old Style', Georgia, serif;
  --body:    'Newsreader', 'Iowan Old Style', Georgia, serif;

  /* — measure & rhythm — */
  --measure: 66ch;
  --rail: 15rem;
  --step: 1.6rem;
  --radius: 3px;
}

/* ---------- reset-ish ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--bone);
  font-family: var(--body);
  font-size: 1.12rem;
  line-height: 1.62;
  font-feature-settings: "liga" 1, "onum" 1, "kern" 1;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
/* faint deep-water gradient so the ink isn't flat */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(120% 80% at 50% -10%, #13282b 0%, transparent 60%),
    radial-gradient(90% 70% at 90% 110%, #0f2023 0%, transparent 55%);
}

img { max-width: 100%; height: auto; }
a { color: var(--verdigris); text-decoration: none; border-bottom: 1px solid transparent; transition: border-color .2s, color .2s; }
a:hover { border-bottom-color: var(--verdigris); }
a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--brass);
  outline-offset: 3px;
}

/* ---------- the signature: the tideline ---------- */
/* a hairline that recedes into dotted foam at both ends */
.tideline {
  border: 0;
  height: 1px;
  margin: var(--step) 0;
  background: linear-gradient(90deg,
    transparent 0%,
    var(--brine-line) 12%,
    var(--brass-dim) 50%,
    var(--brine-line) 88%,
    transparent 100%);
  position: relative;
}
.tideline::before,
.tideline::after {
  content: "· · ·";
  position: absolute;
  top: -0.72em;
  color: var(--brass-dim);
  letter-spacing: .3em;
  font-size: .7rem;
  opacity: .6;
}
.tideline::before { left: 0; }
.tideline::after  { right: 0; }

/* ---------- layout shells ---------- */
.page {
  max-width: 78rem;
  margin: 0 auto;
  padding: clamp(1.25rem, 4vw, 3rem);
}
/* content pages: rail + reading column */
.reader {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 3.5rem);
  max-width: 72rem;
  margin: 0 auto;
  padding: clamp(1.25rem, 4vw, 3rem);
}
.reader__body { max-width: var(--measure); }

/* ---------- masthead ---------- */
.masthead { text-align: center; padding: clamp(1.5rem, 6vw, 4rem) 0 0; }
.masthead__over {
  font-family: var(--body);
  text-transform: uppercase;
  letter-spacing: .42em;
  font-size: .74rem;
  color: var(--ash);
  margin: 0 0 1rem;
  padding-left: .42em;
}
.masthead__title {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(2.8rem, 9vw, 5.5rem);
  line-height: .95;
  margin: 0;
  color: var(--bone);
  letter-spacing: .01em;
}
.masthead__title em {
  font-style: italic;
  color: var(--brass);
  font-weight: 500;
}
.masthead__epigraph {
  font-family: var(--display);
  font-style: italic;
  font-size: clamp(1.05rem, 2.6vw, 1.4rem);
  color: var(--ash);
  max-width: 34ch;
  margin: 1.4rem auto 0;
  line-height: 1.4;
}

/* ---------- headings within pages ---------- */
.reader__body h1, .prose h1 {
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(2.2rem, 6vw, 3.4rem);
  line-height: 1.02;
  margin: .2rem 0 .3rem;
  color: var(--bone);
}
.reader__body h2, .prose h2 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.8rem;
  color: var(--brass);
  margin: 2.4rem 0 .5rem;
  letter-spacing: .01em;
}
.reader__body h3, .prose h3 {
  font-family: var(--body);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .16em;
  font-size: .86rem;
  color: var(--ash);
  margin: 1.8rem 0 .4rem;
}
.prose p { margin: 0 0 1.1rem; }
.prose p + p { text-indent: 0; }
.subtitle {
  font-family: var(--display);
  font-style: italic;
  color: var(--ash);
  font-size: 1.2rem;
  margin: 0 0 1rem;
}
.dropcap::first-letter {
  font-family: var(--display);
  font-size: 3.4em;
  line-height: .72;
  float: left;
  padding: .06em .12em 0 0;
  color: var(--brass);
  font-weight: 600;
}

/* ---------- banner markers (carried from Notion) ---------- */
.marker {
  display: inline-flex;
  align-items: center;
  gap: .45em;
  font-family: var(--body);
  text-transform: uppercase;
  letter-spacing: .18em;
  font-size: .68rem;
  font-weight: 600;
  padding: .32em .7em .3em;
  border-radius: 100px;
  border: 1px solid currentColor;
  background: rgba(0,0,0,.25);
  vertical-align: middle;
}
.marker--canon   { color: var(--brass);     box-shadow: 0 0 14px -6px var(--brass); }
.marker--fluid   { color: var(--verdigris); box-shadow: 0 0 14px -6px var(--verdigris); }
.marker--infra   { color: var(--ash); }
.marker--outdated{ color: var(--coral); opacity: .8; }

/* ---------- "At a Glance" block ---------- */
.glance {
  background: var(--fathom);
  border: 1px solid var(--brine-line);
  border-left: 3px solid var(--brass);
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem 1.2rem;
  margin: 1.4rem 0 1.8rem;
}
.glance__label {
  font-family: var(--body);
  text-transform: uppercase;
  letter-spacing: .22em;
  font-size: .7rem;
  color: var(--brass);
  margin: 0 0 .7rem;
}
.glance dl { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1.1rem; margin: 0; }
.glance dt {
  font-family: var(--body);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .72rem;
  color: var(--ash);
  white-space: nowrap;
}
.glance dd { margin: 0; color: var(--bone); }

/* ---------- read-aloud (boxed text) ---------- */
.read-aloud {
  position: relative;
  font-family: var(--display);
  font-style: italic;
  font-size: 1.2rem;
  line-height: 1.5;
  color: var(--bone);
  background: linear-gradient(180deg, rgba(107,166,154,.06), rgba(107,166,154,.02));
  border: 1px solid var(--brine-line);
  border-radius: var(--radius);
  padding: 1.3rem 1.5rem 1.3rem 2.4rem;
  margin: 1.6rem 0;
}
.read-aloud::before {
  content: "\201C";           /* a hanging opening quote */
  position: absolute;
  left: .55rem; top: .1rem;
  font-family: var(--display);
  font-size: 3.2rem;
  color: var(--verdigris);
  opacity: .5;
}
.read-aloud__tag {
  display: block;
  font-family: var(--body);
  font-style: normal;
  text-transform: uppercase;
  letter-spacing: .2em;
  font-size: .64rem;
  color: var(--verdigris);
  margin-bottom: .5rem;
}

/* ---------- DM secret / behind the screen ---------- */
.secret {
  border: 1px solid var(--coral-dim);
  border-left: 3px solid var(--coral);
  background: linear-gradient(180deg, rgba(191,91,69,.07), rgba(191,91,69,.02));
  border-radius: var(--radius);
  padding: 1.1rem 1.3rem;
  margin: 1.5rem 0;
}
.secret > summary {
  cursor: pointer;
  list-style: none;
  font-family: var(--body);
  text-transform: uppercase;
  letter-spacing: .2em;
  font-size: .72rem;
  color: var(--coral);
  display: flex;
  align-items: center;
  gap: .5em;
}
.secret > summary::-webkit-details-marker { display: none; }
.secret > summary::before { content: "\25B8"; transition: transform .2s; }
.secret[open] > summary::before { transform: rotate(90deg); }
.secret > summary + * { margin-top: .9rem; }
.secret p:last-child { margin-bottom: 0; }

/* ---------- stat quick-reference ---------- */
.statblock {
  background: var(--fathom);
  border: 1px solid var(--brine-line);
  border-top: 3px solid var(--coral);
  border-radius: var(--radius);
  padding: 1rem 1.2rem 1.1rem;
  margin: 1.4rem 0;
}
.statblock__name {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.3rem;
  color: var(--bone);
  margin: 0 0 .1rem;
}
.statblock__type {
  font-style: italic; color: var(--ash); font-size: .92rem; margin: 0 0 .7rem;
}
.statblock__core {
  display: flex; flex-wrap: wrap; gap: .3rem 1.4rem;
  border-top: 1px solid var(--brine-line);
  border-bottom: 1px solid var(--brine-line);
  padding: .6rem 0; margin: .4rem 0 .7rem;
}
.statblock__core span { font-size: .95rem; }
.statblock__core b {
  font-family: var(--body);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: .68rem;
  color: var(--ash);
  font-weight: 600;
  display: block;
}
.statblock__core var {
  font-style: normal;
  font-variant-numeric: tabular-nums;
  color: var(--bone);
  font-size: 1.05rem;
}
.abilities { display: grid; grid-template-columns: repeat(6, 1fr); gap: .4rem; text-align: center; }
.abilities div { border: 1px solid var(--brine-line); border-radius: var(--radius); padding: .4rem .2rem; }
.abilities b {
  display: block; font-family: var(--body); text-transform: uppercase;
  letter-spacing: .1em; font-size: .62rem; color: var(--ash);
}
.abilities var { font-style: normal; font-variant-numeric: tabular-nums; color: var(--bone); }
.statblock__trait { margin: .8rem 0 0; font-size: .95rem; color: var(--ash); }
.statblock__trait b { color: var(--bone); }
.statblock__actions {
  font-family: var(--body); text-transform: uppercase; letter-spacing: .16em;
  font-size: .66rem; color: var(--coral); margin: 1rem 0 .2rem;
  border-top: 1px solid var(--brine-line); padding-top: .7rem;
}
.h-note { font-weight: 400; font-size: 1rem; color: var(--ash); }

/* ---------- lore / clue ---------- */
.lore {
  background: rgba(107,166,154,.05);
  border: 1px dashed var(--brine-line);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin: 1.4rem 0;
}
.lore__label {
  font-family: var(--body); text-transform: uppercase; letter-spacing: .2em;
  font-size: .68rem; color: var(--verdigris); margin: 0 0 .5rem;
}

/* ---------- tags ---------- */
.tags { display: flex; flex-wrap: wrap; gap: .4rem; margin: 1rem 0; padding: 0; list-style: none; }
.tags li {
  font-size: .72rem; letter-spacing: .08em; color: var(--ash);
  border: 1px solid var(--brine-line); border-radius: 100px;
  padding: .2em .7em; background: rgba(0,0,0,.2);
}

/* ---------- hub: section cards ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 1.1rem;
  margin: 2rem 0;
}
.card {
  display: block;
  background: var(--fathom);
  border: 1px solid var(--brine-line);
  border-radius: var(--radius);
  padding: 1.4rem 1.4rem 1.5rem;
  color: var(--bone);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.card:hover {
  transform: translateY(-3px);
  border-color: var(--brass-dim);
  box-shadow: 0 12px 30px -18px #000;
}
.card__index {
  font-family: var(--display); font-style: italic; color: var(--brass);
  font-size: 1.1rem;
}
.card h2 {
  font-family: var(--display); font-weight: 600; font-size: 1.55rem;
  margin: .2rem 0 .35rem; color: var(--bone);
}
.card p { margin: 0; color: var(--ash); font-size: .96rem; line-height: 1.45; }

/* ---------- canon index: grouped contents list ---------- */
/* an indexed table of contents — headings with indented entries,
   in place of a card grid */
.index { max-width: 48rem; margin: 1.5rem auto 0; }
.index__group { margin: 0 0 2.2rem; }
.index__head {
  font-family: var(--body);
  text-transform: uppercase;
  letter-spacing: .26em;
  font-size: .72rem;
  color: var(--brass);
  margin: 0 0 .2rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--brass-dim);
}
.index__list { list-style: none; margin: 0; padding: 0; }
.index__item {
  display: grid;
  grid-template-columns: 1.8rem 1fr;
  column-gap: 1rem;
  align-items: baseline;
  padding: .8rem 0 .85rem 1.4rem;   /* the indentation under each heading */
  border-bottom: 1px solid var(--brine-line);
}
.index__item:last-child { border-bottom: 0; }
.index__num {
  font-family: var(--display);
  font-style: italic;
  color: var(--brass-dim);
  font-size: 1.05rem;
  text-align: right;
}
.index__title {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.35rem;
  line-height: 1.1;
  margin: 0;
}
.index__title a { color: var(--bone); border-bottom: 0; }
.index__title a:hover { color: var(--brass); }
.index__desc { margin: .2rem 0 0; color: var(--ash); font-size: .96rem; line-height: 1.45; }

/* ---------- side rail nav ---------- */
.rail { position: sticky; top: 2rem; align-self: start; }
.rail__home {
  font-family: var(--display); font-size: 1.5rem; color: var(--bone);
  display: inline-block; margin-bottom: 1.2rem;
}
.rail__home:hover { border-bottom-color: transparent; color: var(--brass); }
.rail__back { font-size: .82rem; color: var(--ash); letter-spacing: .04em; }
.rail nav { margin-top: 1.4rem; }
.rail nav a {
  display: block; padding: .32rem 0; color: var(--ash);
  font-size: .95rem; border-bottom: 0;
}
.rail nav a:hover, .rail nav a[aria-current="page"] { color: var(--brass); }
.rail nav a[aria-current="page"] { font-weight: 600; }
.rail nav a.rail__sub { padding-left: .9rem; font-size: .88rem; }

/* ---------- misc ---------- */
.eyebrow {
  font-family: var(--body); text-transform: uppercase; letter-spacing: .28em;
  font-size: .72rem; color: var(--ash); margin: 0 0 .4rem;
}
.footer {
  text-align: center; color: var(--ash); font-size: .82rem;
  padding: 3rem 0 1.5rem; font-style: italic;
}
blockquote {
  border-left: 2px solid var(--brass-dim); margin: 1.4rem 0; padding: .2rem 0 .2rem 1.2rem;
  font-family: var(--display); font-style: italic; color: var(--ash);
}

/* ---------- ledger table (lexicon, reagents, bestiary) ---------- */
/* wrap every table in .ledger-wrap so wide tables scroll instead of
   breaking the reading column */
.ledger-wrap {
  overflow-x: auto;
  margin: 1.4rem 0;
  border: 1px solid var(--brine-line);
  border-radius: var(--radius);
}
.ledger { width: 100%; border-collapse: collapse; font-size: .96rem; }
.ledger th, .ledger td {
  text-align: left;
  padding: .5rem .85rem;
  border-bottom: 1px solid var(--brine-line);
  vertical-align: top;
}
.ledger thead th {
  font-family: var(--body);
  text-transform: uppercase;
  letter-spacing: .14em;
  font-size: .66rem;
  color: var(--brass);
  background: var(--fathom);
  white-space: nowrap;
}
.ledger tbody tr:last-child td { border-bottom: 0; }
.ledger tbody tr:hover { background: rgba(107,166,154,.05); }
/* the term/name column — a highlighted lexeme */
.ledger .term {
  font-family: var(--display);
  font-size: 1.08rem;
  color: var(--brass);
  white-space: nowrap;
}
.ledger var { font-style: normal; font-variant-numeric: tabular-nums; }

/* ---------- framed plate (maps, illustrations) ---------- */
.plate {
  border: 1px solid var(--brine-line);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 1.4rem 0;
  background: var(--fathom);
}
.plate a { display: block; border: 0; }
.plate img { display: block; width: 100%; }
.plate figcaption {
  font-size: .78rem;
  color: var(--ash);
  font-style: italic;
  padding: .6rem .9rem;
  border-top: 1px solid var(--brine-line);
}

/* ---------- entrance ---------- */
@keyframes surface { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.page > *, .reader > * { animation: surface .5s ease both; }
.reader > *:nth-child(2) { animation-delay: .06s; }

/* ---------- responsive ---------- */
@media (max-width: 46rem) {
  .reader { grid-template-columns: 1fr; }
  .rail { position: static; }
  .rail nav { display: flex; flex-wrap: wrap; gap: .2rem 1rem; }
  .abilities { grid-template-columns: repeat(3, 1fr); }
}

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