/* =========================================================================
   One Way Bible — stylesheet
   Design thesis: directionality. Meaning travels one way, author -> reader.
   The signature is the "lane": a single left-edge rule that runs the length
   of the reading column, and one accent that only ever points forward.
   Palette drawn from the logo (dark ink, aged paper, a single road-sign
   marker), deliberately avoiding the cream/terracotta AI default.
   ========================================================================= */

:root {
  /* Palette — from the logo's world: ink, aged paper, sign-white, marker */
  --ink:        #1c1a17;   /* near-black, warm — primary text */
  --paper:      #f3efe6;   /* aged page — page background */
  --paper-deep: #e7e0d2;   /* slightly deeper paper — panels, rules */
  --sign:       #ffffff;   /* the sign's white */
  --marker:     #9a4a20;   /* a burnt sienna — the one accent, used sparingly */
  --muted:      #6b6455;   /* muted ink — captions, meta */
  --lane:       #cbbfa6;   /* the "lane" rule color */

  /* Type */
  --display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua",
             Georgia, serif;
  --body:    "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --util:    ui-monospace, "SFMono-Regular", "Menlo", "Consolas", monospace;

  --measure: 38rem;        /* reading column width */
  --gap:     clamp(1.5rem, 4vw, 3rem);
}

/* ---- 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: clamp(1.05rem, 0.95rem + 0.4vw, 1.2rem);
  line-height: 1.62;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* skip link for keyboard users */
.skip {
  position: absolute; left: -9999px; top: 0;
  background: var(--ink); color: var(--paper);
  padding: 0.6rem 1rem; z-index: 100;
}
.skip:focus { left: 0.5rem; top: 0.5rem; }

/* ---- layout scaffold ---------------------------------------------------- */
.wrap {
  width: 100%;
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: var(--gap);
}
.wrap--wide { max-width: 52rem; }

/* ---- header / masthead -------------------------------------------------- */
.masthead {
  border-bottom: 1px solid var(--paper-deep);
  padding-block: 1.4rem;
}
.masthead .wrap {
  display: flex;
  align-items: center;
  gap: 0.9rem;
}
/* The one-way mark, drawn in CSS so it scales and needs no image file. */
.mark {
  --h: 1.55rem;
  display: inline-flex;
  align-items: center;
  border: 2px solid var(--ink);
  border-radius: 4px;
  padding: 0.18rem 0.5rem 0.18rem 0.55rem;
  gap: 0.4rem;
  line-height: 1;
  flex: none;
}
.mark__text {
  font-family: var(--util);
  font-weight: 700;
  letter-spacing: 0.06em;
  font-size: 0.7rem;
  text-transform: uppercase;
}
.mark__arrow {
  width: 1.5rem; height: 2px;
  background: var(--ink);
  position: relative;
}
.mark__arrow::after {
  content: "";
  position: absolute; right: -1px; top: 50%;
  width: 0; height: 0;
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 8px solid var(--ink);
  transform: translateY(-50%);
}
.masthead__titles { display: flex; flex-direction: column; }
.masthead__name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.01em;
  color: var(--ink);
  text-decoration: none;
}
.masthead__tag {
  font-size: 0.8rem;
  color: var(--muted);
  font-style: italic;
}

/* ---- hero (home) -------------------------------------------------------- */
.hero {
  padding-block: clamp(3rem, 9vw, 6rem) clamp(2rem, 6vw, 4rem);
}
.hero__eyebrow {
  font-family: var(--util);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--marker);
  margin: 0 0 1rem;
}
.hero__title {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(2.1rem, 1.4rem + 3.4vw, 3.6rem);
  line-height: 1.08;
  letter-spacing: -0.012em;
  margin: 0 0 1.1rem;
  max-width: 15ch;
}
.hero__lede {
  font-size: 1.15rem;
  color: var(--ink);
  max-width: 46ch;
  margin: 0;
}
.hero__lede em { color: var(--marker); font-style: italic; }

/* ---- section label ------------------------------------------------------ */
.label {
  font-family: var(--util);
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 1.2rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--paper-deep);
}

/* ---- article list ------------------------------------------------------- */
.list { list-style: none; margin: 0; padding: 0; }
.list__item { padding-block: 1.4rem; border-bottom: 1px solid var(--paper-deep); }
.list__item:first-child { padding-top: 0; }
.list__link {
  text-decoration: none;
  color: var(--ink);
  display: grid;
  gap: 0.35rem;
}
.list__title {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.35rem;
  line-height: 1.2;
  transition: color 0.15s ease;
}
.list__link:hover .list__title,
.list__link:focus .list__title { color: var(--marker); }
.list__meta {
  font-family: var(--util);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--muted);
  text-transform: uppercase;
}
.list__blurb { color: var(--muted); font-size: 1rem; }

/* ---- article page ------------------------------------------------------- */
.article { padding-block: clamp(2.5rem, 7vw, 4.5rem) 3rem; }
.article__head { margin-bottom: 2.2rem; }
.article__eyebrow {
  font-family: var(--util);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.9rem;
}
.article__title {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.9rem, 1.3rem + 2.6vw, 2.9rem);
  line-height: 1.12;
  letter-spacing: -0.01em;
  margin: 0 0 0.8rem;
}
.article__meta {
  font-family: var(--util);
  font-size: 0.74rem;
  color: var(--muted);
  letter-spacing: 0.04em;
}

/* The reading lane: the "one way" rule running down the left of the prose. */
.prose {
  border-left: 2px solid var(--lane);
  padding-left: clamp(1.1rem, 3vw, 1.8rem);
  margin-left: -2px;
}
.prose > * + * { margin-top: 1.15em; }
.prose p { margin: 0; }
.prose h2 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.5rem;
  line-height: 1.2;
  margin-top: 2.4rem;
  letter-spacing: -0.005em;
}
.prose h3 {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.2rem;
  margin-top: 1.8rem;
}
.prose blockquote {
  margin: 1.6rem 0;
  padding-left: 1.1rem;
  border-left: 2px solid var(--marker);
  font-style: italic;
  color: #2c2822;
}
.prose blockquote p { margin: 0; }
.prose blockquote + blockquote { margin-top: 0.8rem; }
.prose a {
  color: var(--marker);
  text-underline-offset: 2px;
  text-decoration-thickness: 1px;
}
.prose em { font-style: italic; }
.prose strong { font-weight: 700; }
.prose hr {
  border: 0;
  height: 1px;
  background: var(--paper-deep);
  margin: 2.4rem 0;
}
/* Scripture reference styling — a light utility touch */
.prose .ref { font-family: var(--util); font-size: 0.86em; color: var(--muted); }

/* ---- back link ---------------------------------------------------------- */
.backlink {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--util);
  font-size: 0.76rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 2rem;
}
.backlink::before {
  /* an arrow that points back — the one place direction reverses, for return */
  content: "";
  width: 0; height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-right: 7px solid var(--muted);
}
.backlink:hover { color: var(--marker); }
.backlink:hover::before { border-right-color: var(--marker); }

/* ---- footer ------------------------------------------------------------- */
.foot {
  border-top: 1px solid var(--paper-deep);
  margin-top: 3rem;
  padding-block: 2.2rem 3rem;
  color: var(--muted);
  font-size: 0.85rem;
}
.foot p { margin: 0 0 0.5rem; }
.foot a { color: var(--marker); }

/* ---- focus + motion ----------------------------------------------------- */
a:focus-visible, .skip:focus-visible {
  outline: 2px solid var(--marker);
  outline-offset: 3px;
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* =========================================================================
   Library additions — topic grid (home), two-panel topic pages, filed-under
   ========================================================================= */

/* ---- home: topic grid --------------------------------------------------- */
.hero--home { padding-block: clamp(2.6rem, 7vw, 4.5rem) clamp(1.5rem, 4vw, 2.5rem); }

.topicgrid {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 1px;
  background: var(--paper-deep);
  border: 1px solid var(--paper-deep);
}
.topicgrid__item { background: var(--paper); }
.topicgrid__link {
  display: grid;
  gap: 0.4rem;
  padding: 1.4rem 1.3rem 1.2rem;
  text-decoration: none;
  color: var(--ink);
  height: 100%;
  transition: background 0.15s ease;
}
.topicgrid__link:hover, .topicgrid__link:focus { background: var(--sign); }
.topicgrid__name {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.25rem;
  line-height: 1.15;
}
.topicgrid__link:hover .topicgrid__name { color: var(--marker); }
.topicgrid__blurb { color: var(--muted); font-size: 0.95rem; line-height: 1.4; }
.topicgrid__count {
  font-family: var(--util);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.2rem;
}

/* ---- two-panel library layout ------------------------------------------ */
.library { padding-block: clamp(2rem, 5vw, 3.2rem) 3rem; }
.library__inner {
  display: grid;
  grid-template-columns: 15rem 1fr;
  gap: clamp(1.8rem, 5vw, 3.5rem);
  align-items: start;
}

/* left rail */
.rail { position: sticky; top: 1.5rem; }
.rail__label {
  font-family: var(--util);
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.9rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--paper-deep);
}
.rail__list { list-style: none; margin: 0; padding: 0; }
.rail__link {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.55rem 0.7rem;
  text-decoration: none;
  color: var(--ink);
  border-left: 2px solid transparent;
  border-radius: 0 3px 3px 0;
  transition: background 0.12s ease, border-color 0.12s ease;
}
.rail__link:hover { background: var(--paper-deep); }
.rail__link.is-current {
  border-left-color: var(--marker);
  background: var(--sign);
  font-weight: 700;
}
.rail__name { font-size: 0.98rem; line-height: 1.25; }
.rail__count {
  font-family: var(--util);
  font-size: 0.7rem;
  color: var(--muted);
  flex: none;
}

/* right panel */
.panel__head { margin-bottom: 1.8rem; }
.panel__title {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.7rem, 1.2rem + 2vw, 2.4rem);
  line-height: 1.1;
  margin: 0 0 0.4rem;
}
.panel__blurb { color: var(--muted); font-size: 1.05rem; margin: 0; }
.panel__empty { color: var(--muted); font-style: italic; }

.group { margin-top: 2rem; }
.group:first-of-type { margin-top: 0; }
.group__label {
  font-family: var(--util);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--marker);
  margin: 0 0 0.6rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--paper-deep);
}
.reslist { list-style: none; margin: 0; padding: 0; }
.reslist__item { border-bottom: 1px solid var(--paper-deep); }
.reslist__link {
  display: grid;
  gap: 0.25rem;
  padding: 1rem 0.2rem;
  text-decoration: none;
  color: var(--ink);
}
.reslist__title {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.18rem;
  line-height: 1.2;
  transition: color 0.15s ease;
}
.reslist__link:hover .reslist__title,
.reslist__link:focus .reslist__title { color: var(--marker); }
.reslist__blurb { color: var(--muted); font-size: 0.96rem; line-height: 1.4; }
.reslist__meta {
  font-family: var(--util);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ---- filed-under (bottom of an article) -------------------------------- */
.filed {
  margin-top: 3rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--paper-deep);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}
.filed__label {
  font-family: var(--util);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.filed__tag {
  font-family: var(--util);
  font-size: 0.78rem;
  text-decoration: none;
  color: var(--marker);
  border: 1px solid var(--lane);
  border-radius: 3px;
  padding: 0.22rem 0.6rem;
  transition: background 0.12s ease;
}
.filed__tag:hover { background: var(--sign); }

/* ---- responsive: collapse two-panel on narrow screens ------------------ */
@media (max-width: 40rem) {
  .library__inner { grid-template-columns: 1fr; gap: 1.6rem; }
  .rail { position: static; }
  .rail__list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
  }
  .rail__link {
    border-left: none;
    border: 1px solid var(--paper-deep);
    border-radius: 999px;
    padding: 0.4rem 0.85rem;
  }
  .rail__link.is-current { border-color: var(--marker); }
}

/* ---- masthead nav (added) ---------------------------------------------- */
.masthead__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.masthead__brand { display: flex; align-items: center; gap: 0.9rem; }
.masthead__nav {
  display: flex;
  gap: 1.4rem;
  font-family: var(--util);
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.masthead__nav a {
  color: var(--muted);
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
  transition: color 0.12s ease, border-color 0.12s ease;
}
.masthead__nav a:hover { color: var(--marker); border-bottom-color: var(--marker); }

/* ---- inline diagrams (overlap / bridge models) ------------------------- */
.diagram {
  margin: 2.4rem 0;
  /* pull out of the prose lane slightly so the pair has room to breathe */
  margin-left: calc(-1 * clamp(1.1rem, 3vw, 1.8rem));
  padding-left: clamp(1.1rem, 3vw, 1.8rem);
}
.diagram__pair {
  display: grid;
  grid-template-columns: 1fr;
  gap: clamp(1.6rem, 5vw, 2.6rem);
  align-items: start;
}
.diagram__cell {
  display: grid;
  grid-template-columns: minmax(0, 20rem) 1fr;
  gap: clamp(1rem, 3vw, 1.8rem);
  align-items: center;
}
.diagram__svg {
  width: 100%;
  height: auto;
  background: var(--sign);
  border: 1px solid var(--paper-deep);
  border-radius: 4px;
  padding: 0.4rem;
}
.diagram__cap {
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--muted);
}
.diagram__cap em { color: var(--marker); font-style: italic; }
.diagram__tag {
  display: inline-block;
  font-family: var(--util);
  font-size: 0.64rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  margin-right: 0.4rem;
  vertical-align: 0.06em;
}
.diagram__tag--no  { color: #7a2f1a; border: 1px solid #d8bfae; background: #f7ede6; }
.diagram__tag--yes { color: #2f5a2a; border: 1px solid #bcd0b6; background: #eef4ec; }

/* SVG element styling (driven by the site palette) */
.d-ring        { fill: none; stroke: var(--ink); stroke-width: 1.5; }
.d-label       { font-family: var(--display); font-size: 11px; fill: var(--ink); text-anchor: middle; }
.d-label--mid  { font-weight: 700; }
.d-telos       { font-family: var(--util); font-size: 9px; fill: var(--marker); letter-spacing: 0.03em; }
.d-telos-line  { stroke: var(--marker); stroke-width: 1.4; fill: none; }
.d-arrowhead   { fill: var(--marker); }
.d-arrowhead-ink { fill: var(--ink); }
.d-bridge      { stroke: var(--ink); stroke-width: 1.2; stroke-dasharray: 3 2; fill: none; }
.d-bridge-label{ font-family: var(--util); font-size: 8.5px; fill: var(--muted); text-anchor: middle; }
.d-reject      { stroke: #b1502f; stroke-width: 2.5; stroke-linecap: round; opacity: 0.72; }

@media (max-width: 34rem) {
  .diagram__cell { grid-template-columns: 1fr; gap: 0.8rem; }
}

/* ---- home welcome (above first topic in panel) ------------------------- */
.welcome {
  padding-bottom: 1.6rem;
  margin-bottom: 1.8rem;
  border-bottom: 1px solid var(--paper-deep);
}
.welcome__title {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.8rem, 1.3rem + 2.4vw, 2.7rem);
  line-height: 1.08;
  letter-spacing: -0.012em;
  margin: 0.6rem 0 0.8rem;
  max-width: 16ch;
}
.welcome__lede { color: var(--ink); font-size: 1.08rem; max-width: 46ch; margin: 0; }
.panel__head--home .panel__title { font-size: clamp(1.4rem, 1.1rem + 1.4vw, 1.9rem); }

/* ---- tag chips (shared) ------------------------------------------------ */
.tag {
  display: inline-block;
  font-family: var(--util);
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--muted);
  border: 1px solid var(--paper-deep);
  border-radius: 999px;
  padding: 0.12rem 0.6rem;
  margin: 0 0.3rem 0.3rem 0;
  transition: color 0.12s ease, border-color 0.12s ease;
}
.tag:hover { color: var(--marker); border-color: var(--marker); }

/* tags inside a resource listing */
.reslist__tags { display: block; margin-top: 0.4rem; }

/* ---- tag pages --------------------------------------------------------- */
.tagpage { padding-block: clamp(2rem, 5vw, 3.2rem) 3rem; }
.tagpage__head { margin-bottom: 1.8rem; }
.reslist--tag .reslist__item { padding-block: 0.2rem; }
.reslist__home {
  font-family: var(--util);
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-top: 0.15rem;
}

/* ---- filed footer: rows for topic + tags ------------------------------- */
.filed { display: block; }
.filed__row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.7rem;
}
.filed__row:last-child { margin-bottom: 0; }
.filed__tag--topic {
  font-family: var(--util);
  font-size: 0.78rem;
  text-decoration: none;
  color: var(--marker);
  border: 1px solid var(--lane);
  border-radius: 3px;
  padding: 0.22rem 0.6rem;
}
.filed__tag--topic:hover { background: var(--sign); }
