/* ==========================================================================
   Shanty Net — archival letterpress
   A broadside ballad sheet: warm paper, old-style serif, hairline rules.
   ========================================================================== */

:root {
  --paper:      #f4efe3;
  --paper-sunk: #eae2d1;
  --paper-card: #fbf8f1;
  --ink:        #1c1a16;
  --ink-soft:   #4d463c;
  --ink-faint:  #857a6a;
  --navy:       #1d3d57;
  --oxblood:    #8d3a22;
  --rule:       rgba(28, 26, 22, 0.24);
  --rule-soft:  rgba(28, 26, 22, 0.12);

  --display: "IM Fell English", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --smallcaps: "IM Fell English SC", "IM Fell English", Georgia, serif;
  --body: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;

  --measure: 34rem;
  --wrap: 64rem;
  --step: clamp(1.0625rem, 0.98rem + 0.4vw, 1.1875rem);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper:      #14120e;
    --paper-sunk: #1b1813;
    --paper-card: #1e1a15;
    --ink:        #ece3d2;
    --ink-soft:   #b6ab97;
    --ink-faint:  #8a7f6d;
    --navy:       #9fc2dd;
    --oxblood:    #d98a6c;
    --rule:       rgba(236, 227, 210, 0.26);
    --rule-soft:  rgba(236, 227, 210, 0.13);
  }
}

*, *::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: var(--step);
  line-height: 1.55;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

/* Faint laid-paper tooth. Two hairline gradients, no image weight. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.5;
  background:
    repeating-linear-gradient(90deg, rgba(120, 100, 70, 0.035) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(0deg,  rgba(120, 100, 70, 0.025) 0 1px, transparent 1px 4px);
}

a { color: inherit; text-underline-offset: 0.18em; text-decoration-thickness: 0.06em; text-decoration-color: var(--rule); }
a:hover { text-decoration-color: currentColor; color: var(--oxblood); }

h1, h2, h3 { font-family: var(--display); font-weight: 400; line-height: 1.12; letter-spacing: 0.005em; }

.wrap { width: min(100% - 2.5rem, var(--wrap)); margin-inline: auto; }

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

.skip {
  position: absolute; left: -999px; top: 0; z-index: 20;
  background: var(--ink); color: var(--paper); padding: 0.6rem 1rem;
}
.skip:focus { left: 0; }

:focus-visible { outline: 2px solid var(--oxblood); outline-offset: 3px; }

/* --------------------------------------------------------------- masthead */

.masthead {
  border-bottom: 1px solid var(--rule);
  box-shadow: 0 3px 0 -2px var(--rule);
  background: var(--paper);
}

.masthead-inner {
  display: flex;
  /* Centred, not baseline: the ship makes the wordmark taller than the nav,
     and baseline alignment drops the nav below the wordmark's text. */
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 1.1rem 0 0.95rem;
  flex-wrap: wrap;
}

.wordmark { text-decoration: none; display: flex; align-items: center; gap: 0.7rem; flex-wrap: wrap; }

/*
 * The source artwork is near-white line art on transparency, so it is
 * invisible on the paper ground. Inverting it gives dark ink lines in light
 * mode; in dark mode the original white is already right, so the filter is
 * dropped rather than a second asset being shipped.
 */
.wordmark-ship {
  width: 2.6rem;
  height: 2.6rem;
  flex: none;
  filter: invert(1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .wordmark-ship { filter: none; }
}
.wordmark:hover { color: inherit; }
.wordmark-name {
  font-family: var(--smallcaps);
  font-size: 1.5rem;
  letter-spacing: 0.07em;
}
.wordmark-rule { flex: 0 0 2.5rem; height: 1px; background: var(--rule); align-self: center; }
.wordmark-tag {
  font-family: var(--smallcaps);
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: lowercase;
  color: var(--ink-faint);
}

.nav { display: flex; gap: 1.4rem; align-items: baseline; font-family: var(--smallcaps); font-size: 0.9rem; letter-spacing: 0.1em; }
.nav a, .nav button {
  text-decoration: none;
  color: var(--ink-soft);
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  letter-spacing: inherit;
  cursor: pointer;
}
.nav a:hover, .nav button:hover { color: var(--oxblood); }

/* ------------------------------------------------------------------- hero */

.hero { padding: clamp(3rem, 8vw, 6rem) 0 2.5rem; text-align: center; }

.hero-eyebrow {
  font-family: var(--smallcaps);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  font-size: 0.72rem;
  color: var(--ink-faint);
  margin: 0 0 1.4rem;
}

.hero-title {
  font-size: clamp(2.4rem, 7vw, 4.4rem);
  margin: 0 auto 1.5rem;
  max-width: 16ch;
}

.hero-title::after {
  content: "";
  display: block;
  width: 4.5rem;
  height: 1px;
  background: var(--rule);
  margin: 1.6rem auto 0;
  box-shadow: 0 3px 0 -1px var(--rule);
}

.hero-lede {
  max-width: 46ch;
  margin: 0 auto 2.2rem;
  color: var(--ink-soft);
  font-size: 1.02em;
}

/* ----------------------------------------------------------------- search */

.search { display: flex; gap: 0.6rem; max-width: 30rem; margin: 0 auto; }
.page-index .search { margin: 1.5rem 0 0; }

.search input {
  flex: 1;
  font: inherit;
  font-size: 1rem;
  padding: 0.62rem 0.85rem;
  background: var(--paper-card);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 0;
}
.search input::placeholder { color: var(--ink-faint); font-style: italic; }

.search button {
  font-family: var(--smallcaps);
  font-size: 0.9rem;
  letter-spacing: 0.12em;
  padding: 0.62rem 1.3rem;
  background: var(--ink);
  color: var(--paper);
  border: 1px solid var(--ink);
  cursor: pointer;
}
.search button:hover { background: var(--oxblood); border-color: var(--oxblood); }

.search-results {
  list-style: none;
  margin: 1.2rem auto 0;
  padding: 0;
  max-width: 34rem;
  text-align: left;
  border-top: 1px solid var(--rule-soft);
}
.page-index .search-results { margin-inline: 0; }
.search-results li { border-bottom: 1px solid var(--rule-soft); }
.search-results a { display: flex; justify-content: space-between; gap: 1rem; padding: 0.6rem 0.2rem; text-decoration: none; }
.search-results a:hover { background: var(--paper-sunk); }
.search-results .r-meta { font-family: var(--smallcaps); font-size: 0.78rem; letter-spacing: 0.08em; color: var(--ink-faint); white-space: nowrap; }
.search-empty { padding: 0.9rem 0.2rem; color: var(--ink-faint); font-style: italic; }

/* ------------------------------------------------------------ band titles */

.band { padding: 2.6rem 0; }
/* Heading that introduces the sticky rail directly beneath it. */
.band-tight { padding-bottom: 0.6rem; }

.band-title {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-family: var(--smallcaps);
  font-size: 0.88rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin: 0 0 1.5rem;
}
.band-title::before, .band-title::after { content: ""; flex: 1; height: 1px; background: var(--rule-soft); }

/* ------------------------------------------------------------ letter rail */

.rail {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.15rem;
  font-family: var(--smallcaps);
}

.rail-item {
  display: grid;
  place-items: center;
  min-width: 2.1rem;
  padding: 0.35rem 0.2rem;
  font-size: 1rem;
  letter-spacing: 0.05em;
  text-decoration: none;
  color: var(--ink);
  border: 1px solid transparent;
}
.rail-item:hover { border-color: var(--rule); color: var(--oxblood); }
.rail-item.is-empty { color: var(--rule); pointer-events: none; }

.sticky-rail {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  padding: 0.5rem 0;
  margin-top: 2rem;
}

/* --------------------------------------------------------------- A–Z list */

.page-head { padding: 3rem 0 0; }
.page-head h1 { font-size: clamp(2rem, 5vw, 3rem); margin: 0 0 0.6rem; }
.page-sub { color: var(--ink-soft); max-width: 52ch; margin: 0; }

.az { padding-bottom: 4rem; }
.az-group { padding-top: 2.6rem; }

.az-letter {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: 1.6rem;
  margin: 0 0 1rem;
  color: var(--oxblood);
}
.az-letter::after { content: ""; flex: 1; height: 1px; background: var(--rule); }

.az-list {
  list-style: none;
  margin: 0;
  padding: 0;
  columns: 2;
  column-gap: 3rem;
}
@media (min-width: 60rem) { .az-list { columns: 3; } }

.az-list li { break-inside: avoid; border-bottom: 1px solid var(--rule-soft); }
.az-list a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.42rem 0;
  text-decoration: none;
}
.az-list a:hover { color: var(--oxblood); }
.az-title { text-decoration: underline; text-decoration-color: var(--rule-soft); text-underline-offset: 0.2em; }
.az-type {
  font-family: var(--smallcaps);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--ink-faint);
  white-space: nowrap;
}

/* ------------------------------------------------------------------ cards */

.cards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  border-top: 1px solid var(--rule-soft);
  border-left: 1px solid var(--rule-soft);
}
.card {
  background: transparent;
  border-right: 1px solid var(--rule-soft);
  border-bottom: 1px solid var(--rule-soft);
}
.card a { display: block; padding: 1rem 1.1rem; text-decoration: none; height: 100%; }
.card a:hover { background: var(--paper-card); color: var(--oxblood); }
.card-title { display: block; font-family: var(--display); font-size: 1.15rem; line-height: 1.25; }
.card-meta { display: block; margin-top: 0.4rem; font-family: var(--smallcaps); font-size: 0.72rem; letter-spacing: 0.1em; color: var(--ink-faint); }

/* ------------------------------------------------------------- song page */

.song { padding: 3rem 0 4rem; }

.song-head { text-align: center; padding-bottom: 2rem; }

.song-eyebrow { margin: 0 0 1rem; font-family: var(--smallcaps); font-size: 1rem; letter-spacing: 0.2em; }
.song-eyebrow a { color: var(--ink-faint); text-decoration: none; }
.song-eyebrow a:hover { color: var(--oxblood); }

.song-title { font-size: clamp(2.2rem, 6vw, 3.6rem); margin: 0; }

.song-alt { margin: 0.7rem 0 0; font-style: italic; color: var(--ink-faint); }

.song-meta {
  margin: 1.1rem 0 0;
  font-family: var(--smallcaps);
  font-size: 0.82rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.song-meta .sep { margin: 0 0.7rem; color: var(--rule); }

.song-tools { display: flex; gap: 0.5rem; justify-content: center; margin-top: 1.8rem; }
.tool {
  font-family: var(--smallcaps);
  font-size: 0.76rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 0.42rem 0.9rem;
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid var(--rule);
  cursor: pointer;
}
.tool:hover { color: var(--oxblood); border-color: var(--oxblood); }
.tool[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }

/* --------------------------------------------------- post body (verbatim) */

/*
 * body_html arrives already stripped to content and is rendered untouched:
 * its <p>, <br> and <pre> ARE the stanza structure. Everything below is
 * presentation only — nothing here depends on classes the extractor would
 * have to add.
 */

.post-body {
  max-width: var(--measure);
  margin: 0 auto;
  border-top: 1px solid var(--rule);
  box-shadow: 0 3px 0 -2px var(--rule);
  padding-top: 2.8rem;
}

/* Prose posts (news, reviews, histories) read wider than verse. */
.page-post .post-body { max-width: 40rem; }

/* A stanza is a <p> of <br>-separated lines: tight leading within the
   stanza, a clear gap between them, and never a hyphenated break. */
.post-body p {
  margin: 0 0 1.75rem;
  line-height: 1.62;
  overflow-wrap: break-word;
  hyphens: none;
}

.post-body.is-song p { line-height: 1.7; }

/* A <p> per stanza: the gap between paragraphs IS the stanza break. */
.post-body.density-stanzas > p,
.post-body.density-stanzas > pre { margin-bottom: 1.75rem; }

/* One line per block, no stanza breaks encoded: set them as consecutive
   verse rather than as 40 separated paragraphs. Some posts alternate
   <p> and <pre> line by line, so both need the tight margin. */
.post-body.density-lines > p,
.post-body.density-lines > pre { margin-bottom: 0.15rem; }
.post-body.density-lines > p:empty { margin-bottom: 1.6rem; }

/* Verse lines sit flush. Anything else would impose a structure the
   source does not have: text-indent cannot distinguish a soft wrap from a
   <br>, so a hanging indent would step every line after the first. */
.post-body.is-song > p { text-align: left; }

.post-body a { color: var(--navy); }
.post-body a:hover { color: var(--oxblood); }

.post-body em, .post-body i { font-style: italic; color: var(--ink-soft); }
.post-body strong { font-weight: 600; }

/* The old theme used .accent as a colour highlight; keep it distinct. */
.post-body .accent {
  color: var(--oxblood);
  font-style: italic;
}

/* Chorus: marked in the margin rather than by indenting the words. */
.post-body .chorus {
  display: block;
  position: relative;
  padding-left: 0.9rem;
  border-left: 2px solid var(--rule);
  font-style: italic;
}

/* <pre> holds verse whose spacing was significant — wrap it on narrow
   screens instead of forcing a horizontal scroll. */
.post-body pre {
  font-family: var(--body);
  font-size: 1em;
  line-height: 1.62;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  margin: 0 0 1.75rem;
}

.post-body blockquote {
  margin: 0 0 1.75rem;
  padding-left: 1.1rem;
  border-left: 2px solid var(--rule-soft);
  color: var(--ink-soft);
  font-style: italic;
}

.post-body dl { margin: 0 0 1.75rem; }
.post-body dt { font-family: var(--smallcaps); letter-spacing: 0.12em; font-size: 0.8rem; text-transform: uppercase; color: var(--ink-faint); }
.post-body dd { margin: 0 0 0.9rem; }

.post-body ul, .post-body ol { padding-left: 1.3rem; margin: 0 0 1.75rem; }
.post-body li { margin-bottom: 0.45rem; }

.post-body address { font-style: italic; color: var(--ink-faint); }

.post-body img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 0 1.75rem;
  border: 1px solid var(--rule-soft);
  padding: 0.4rem;
  background: var(--paper-card);
}

/* Surviving YouTube / SoundCloud embeds, kept and made fluid. */
.post-body iframe {
  display: block;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  margin: 0 0 1.75rem;
  border: 1px solid var(--rule-soft);
}

.post-body table { width: 100%; border-collapse: collapse; margin: 0 0 1.75rem; }
.post-body td, .post-body th { border-bottom: 1px solid var(--rule-soft); padding: 0.4rem 0.6rem; text-align: left; }

.post-body sup, .post-body sub { font-size: 0.7em; line-height: 0; }

/* ------------------------------------------------------------- archive list */

.archive-list { list-style: none; margin: 2.5rem 0 4rem; padding: 0; }
.archive-list li { padding: 1.2rem 0; border-bottom: 1px solid var(--rule-soft); }
.archive-list a { display: flex; align-items: baseline; justify-content: space-between; gap: 1.5rem; text-decoration: none; }
.archive-list a:hover .arc-title { color: var(--oxblood); }
.arc-title { font-family: var(--display); font-size: 1.35rem; line-height: 1.25; }
.arc-meta { font-family: var(--smallcaps); font-size: 0.75rem; letter-spacing: 0.1em; color: var(--ink-faint); white-space: nowrap; }
.arc-excerpt { margin: 0.5rem 0 0; color: var(--ink-faint); font-size: 0.92rem; max-width: 60ch; }

.band-foot { text-align: center; margin: 1.8rem 0 0; font-family: var(--smallcaps); letter-spacing: 0.1em; font-size: 0.85rem; }
.band-foot a { text-decoration: none; color: var(--ink-soft); }
.band-foot a:hover { color: var(--oxblood); }


/* ------------------------------------------------------------------ prose */

.notes { margin-top: 4rem; }
.prose { max-width: 40rem; margin-inline: auto; color: var(--ink-soft); }
.prose-page { padding: 0 0 4rem; }
.prose p { margin: 0 0 1.2rem; }
.prose h2 { font-size: 1.5rem; color: var(--ink); margin: 2.4rem 0 0.8rem; }
.prose .lede { font-size: 1.12em; color: var(--ink); }
.prose ul { padding-left: 1.2rem; }
.prose li { margin-bottom: 0.5rem; }

.related { border-top: 1px solid var(--rule-soft); }

/* ----------------------------------------------------------------- footer */

.footer {
  border-top: 1px solid var(--rule);
  box-shadow: 0 -3px 0 -2px var(--rule);
  margin-top: 4rem;
  padding: 3rem 0 4rem;
  text-align: center;
  color: var(--ink-faint);
  font-size: 0.88rem;
}
.footer p { margin: 0 0 0.7rem; max-width: 44ch; margin-inline: auto; }
.footer-mark { font-size: 1.6rem; color: var(--rule); }
.footer-links { font-family: var(--smallcaps); letter-spacing: 0.1em; }
.footer a { color: inherit; }

/* --------------------------------------------------- session (sing) mode */

body.session .masthead,
body.session .footer,
body.session .related,
body.session .song-tools .js-print,
body.session .song-alt { display: none; }

body.session .post-body {
  max-width: 100%;
  margin: 0 auto;
  border-top: 0;
  box-shadow: none;
  padding-top: 1rem;
  font-size: clamp(1.35rem, 3.4vw, 2rem);
  line-height: 1.5;
}
body.session .post-body p { margin-bottom: 2.2rem; }
body.session .song-title { font-size: clamp(1.6rem, 4vw, 2.2rem); }
body.session .song { padding-top: 1.5rem; }
body.session .song-tools { position: fixed; bottom: 1rem; right: 1rem; margin: 0; z-index: 10; }
body.session .tool { background: var(--paper); }

/* ------------------------------------------------------------------ print */

@media print {
  :root { --paper: #fff; --ink: #000; --ink-soft: #222; --ink-faint: #555; --rule: #999; --rule-soft: #ccc; }
  body { font-size: 11.5pt; }
  body::before, .masthead, .footer, .song-tools, .related, .rail, .search, .search-results, .skip { display: none !important; }
  .song { padding: 0; }
  .song-head { text-align: left; padding-bottom: 1rem; }
  .post-body { max-width: 100%; margin: 0; border-top: 1px solid #999; box-shadow: none; padding-top: 1rem; }
  .post-body p, .post-body pre { page-break-inside: avoid; }
  .post-body iframe { display: none; }
  a { text-decoration: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

.image-lost {
  margin: 0 0 1.75rem;
  padding: 1.1rem 1.2rem;
  border: 1px dashed var(--rule);
  color: var(--ink-faint);
  font-style: italic;
  font-size: 0.9rem;
}
