/* Haya Ballad Library - Shared CSS for library, essay, and intro pages */

:root {
  --bg: #1a1a18;
  --fg: #e8e4dc;
  --muted: #9a9a8a;
  --accent: #4a9c6a;
  --accent-hover: #3a7c52;
  --border: #3a3a32;
  --highlight: #2a2a24;
  --link: #6abf8a;
  --max-w: 780px;
  --serif: 'Libre Baskerville', Georgia, 'Times New Roman', serif;
  --sans: system-ui, Segoe UI, Roboto, Arial, sans-serif;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font: 400 17px/1.65 var(--serif);
  -webkit-font-smoothing: antialiased;
}

/* ── Typography ── */
h1, h2, h3, h4 {
  font-family: var(--serif);
  font-weight: 700;
  line-height: 1.25;
  margin: 0 0 0.5em;
}
h1 { font-size: 2em; }
h2 { font-size: 1.45em; margin-top: 2em; }
h3 { font-size: 1.15em; margin-top: 1.5em; }

p { margin: 0 0 1em; }
em, i { font-style: italic; }
strong { font-weight: 700; }

a {
  color: var(--link);
  text-decoration: underline;
  text-underline-offset: 3px;
}
a:hover { color: var(--accent-hover); }

/* ── Page layout ── */
.page-wrapper {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page-header {
  border-bottom: 1px solid var(--border);
  padding: 1.2em 2em;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
}

.page-header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1em;
  position: relative;
}

.site-title {
  font-size: 1.05em;
  font-family: var(--sans);
  font-weight: 400;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}
.site-title:hover { color: var(--fg); }

.main-content {
  flex: 1;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 3em 2em 5em;
  width: 100%;
}

.page-footer {
  border-top: 1px solid var(--border);
  padding: 1.5em 2em;
  text-align: center;
  font-size: 0.8em;
  color: var(--muted);
  font-family: var(--sans);
}

/* ── Navigation menu ── */
.nav-menu {
  display: flex;
  gap: 0;
  font-family: var(--sans);
  font-size: 0.8em;
}

.nav-menu a {
  padding: 0.3em 0.75em;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.03em;
  border-radius: 3px;
  transition: color 0.15s, background 0.15s;
}
.nav-menu a:hover {
  color: var(--fg);
  background: var(--highlight);
}

/* Hamburger nav - always visible */
.nav-hamburger {
  display: block;
  background: none;
  border: none;
  font-size: 1.4em;
  cursor: pointer;
  color: var(--fg);
  padding: 0;
  line-height: 1;
}

.nav-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.12);
  min-width: 200px;
  z-index: 1000;
  padding: 0.5em 0;
}
.nav-dropdown.open { display: block; }
.nav-dropdown a,
.nav-dropdown button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.6em 1.2em;
  color: var(--fg);
  text-decoration: none;
  font-family: var(--sans);
  font-size: 0.9em;
  background: none;
  border: none;
  cursor: pointer;
}
.nav-dropdown a:hover,
.nav-dropdown button:hover { background: var(--highlight); }

.nav-relative {
  position: relative;
}

/* ── Essay page styles ── */
.essay-title {
  font-size: 2em;
  margin-bottom: 0.2em;
  line-height: 1.2;
}

.essay-nav-prev-next {
  display: flex;
  justify-content: space-between;
  margin-top: 4em;
  padding-top: 1.5em;
  border-top: 1px solid var(--border);
  font-family: var(--sans);
  font-size: 0.85em;
}
.essay-nav-prev-next a {
  color: var(--muted);
  text-decoration: none;
}
.essay-nav-prev-next a:hover { color: var(--fg); }

/* ── Intro page styles ── */
.intro-ballad-name {
  font-size: 2.2em;
  margin-bottom: 0.1em;
}

.intro-performer {
  font-family: var(--sans);
  font-size: 0.95em;
  color: var(--muted);
  margin-bottom: 2em;
}

.intro-begin-btn {
  display: inline-block;
  margin-top: 2em;
  padding: 0.7em 2em;
  background: var(--accent);
  color: #fff;
  text-decoration: none;
  font-family: var(--sans);
  font-size: 0.9em;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border-radius: 3px;
  transition: background 0.15s;
}
.intro-begin-btn:hover {
  background: var(--accent-hover);
  color: #fff;
}

.intro-section {
  margin-top: 2.5em;
}

.intro-section h2 {
  font-size: 0.8em;
  font-family: var(--sans);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin-bottom: 0.75em;
  margin-top: 0;
  padding-bottom: 0.4em;
  border-bottom: 1px solid var(--border);
}

.annotations-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.88em;
  line-height: 1.5;
}

.annotations-list li {
  padding: 0.5em 0;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 3.5em 1fr;
  gap: 0.5em;
}
.annotations-list li:last-child { border-bottom: none; }

.anno-linenum {
  font-family: var(--sans);
  font-size: 0.85em;
  color: var(--accent);
  font-weight: 700;
  padding-top: 0.05em;
}

/* ── Library landing page ── */
.library-hero {
  padding: 1.75em 0 2.5em;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2.5em;
}

.library-hero h1 {
  font-size: 2.6em;
  margin-bottom: 0.2em;
  line-height: 1.15;
}

.library-hero .subtitle {
  font-size: 1.25em;
  color: var(--muted);
  margin-bottom: 0;
  font-style: italic;
  text-align: center;
}

.library-hero .intro-text {
  font-size: 0.97em;
  max-width: 620px;
  line-height: 1.75;
}

.section-heading {
  font-size: 0.75em;
  font-family: var(--sans);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  margin: 0 0 0 0;
  padding-bottom: 0.5em;
  border-bottom: 1px solid var(--border);
}

/* Essays index */
.essays-grid {
  display: grid;
  gap: 0;
  margin-bottom: 4em;
}

.essay-entry {
  padding: 1em 0;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 1em;
}
.essay-entry:first-child { border-top: 1px solid var(--border); }

.essay-entry-title {
  font-family: var(--serif);
  font-size: 1.1em;
  font-weight: 700;
}
.essay-entry-title a,
.essay-nav-item {
  color: var(--fg);
  text-decoration: none;
  font-size: 1em;
  font-weight: 700;
}
.essay-entry-title a:hover,
.essay-nav-item:hover { color: var(--accent); }

.essay-entry-read {
  font-family: var(--sans);
  font-size: 0.78em;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: 0.04em;
}
.essay-entry-read:hover { color: var(--accent); }

/* Ballads list */
.ballads-list {
  display: grid;
  gap: 0;
  margin-bottom: 4em;
}

.ballad-entry {
  padding: 1.2em 0;
  border-bottom: 1px solid var(--border);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 1.5em;
  align-items: start;
}
.ballad-entry:first-child { border-top: 1px solid var(--border); }

.ballad-entry-left {}

.ballad-entry-title {
  font-size: 1.1em;
  font-weight: 700;
  margin-bottom: 0.1em;
}
.ballad-entry-title a {
  color: var(--fg);
  text-decoration: none;
}
.ballad-entry-title a:hover { color: var(--accent); }

.ballad-entry-performer {
  font-family: var(--sans);
  font-size: 0.8em;
  color: var(--muted);
  margin-bottom: 0.4em;
}

.ballad-entry-blurb {
  font-size: 0.88em;
  line-height: 1.55;
  color: #b8b4ac;
  max-width: 580px;
}

.ballad-entry-links {
  display: flex;
  flex-direction: column;
  gap: 0.4em;
  align-items: flex-end;
  min-width: 90px;
}

.ballad-link-intro {
  font-family: var(--sans);
  font-size: 0.78em;
  color: var(--muted);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: 0.04em;
}
.ballad-link-intro:hover { color: var(--accent); }

.ballad-link-listen {
  font-family: var(--sans);
  font-size: 0.78em;
  color: #fff;
  background: var(--accent);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: 0.04em;
  padding: 0.3em 0.7em;
  border-radius: 3px;
}
.ballad-link-listen:hover { background: var(--accent-hover); }

/* ── Responsive ── */
@media (max-width: 640px) {
  .main-content { padding: 2em 1.2em 4em; }
  .page-header { padding: 1em 1.2em; }
  h1 { font-size: 1.6em; }
  .library-hero h1 { font-size: 1.9em; }

  .nav-menu { display: none; }

  .ballad-entry {
    grid-template-columns: 1fr;
  }
  .ballad-entry-links {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
  }
  .annotations-list li {
    grid-template-columns: 1fr;
  }
}