/* =========================================================
   Linen + Sunlight Poetry Experience
   Stillness-first. Thread & fabric motif.
   ========================================================= */

/* ---------- Root variables ---------- */
:root {
  --maxWidth: 860px;
  --padX: 22px;
  --padY: 64px;

  /* Typography */
  --bodyFont: ui-serif, Georgia, "Times New Roman", Times, serif;
  --titleFont: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;

  /* Text */
  --lightText: #1a1a1a;
  --darkText: #f2eee6;

  /* Linen + sunlight */
  --paperA: #fbf3e4;
  --paperB: #f3e7d3;

  /* Night */
  --nightA: #0d0f14;
  --nightB: #151a22;

  /* Accents */
  --accent: #c0841a;   /* honey */
  --accent2: #b45309;  /* amber */

  /* Texture */
  --grain: rgba(0, 0, 0, 0.03);
  --grainDark: rgba(255, 255, 255, 0.035);
}

/* ---------- Reset ---------- */
* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--bodyFont);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
}

/* ---------- Scroll container ---------- */
#app {
  height: 100vh;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
}

/* Anchor runway for the first poem (fixes sticky-header overlap) */
#app::before {
  content: "";
  display: block;
  height: 110px;          /* MUST match scroll-margin-top */
  pointer-events: none;
}


/* ---------- Section ---------- */
.poem-section {
  min-height: 100vh;
  scroll-snap-align: start;
  display: flex;
  align-items: center;
  padding: var(--padY) var(--padX);
  position: relative;
  isolation: isolate;
}

/* Ensure anchor jumps land below the sticky header */
.poem-section {
  scroll-margin-top: 110px; /* adjust to match header height */
}

/* ---------- Layout ---------- */
.wrap {
  width: 100%;
  max-width: var(--maxWidth);
  margin: 0 auto;
}
/* ---------- Container (aligns header with poem width) ---------- */
.container {
  width: 100%;
  max-width: var(--maxWidth);
  margin: 0 auto;
  padding: 0 var(--padX);
}

.poem-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 20px;
}

.poem-title {
  font-family: var(--titleFont);
  font-size: 14px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 650;
  opacity: 0.85;
  margin: 0;
}

.poem-title::after {
  content: "";
  display: block;
  width: 56px;
  height: 2px;
  margin-top: 10px;
  background: linear-gradient(
    90deg,
    rgba(192,132,26,0.9),
    rgba(180,83,9,0.5),
    transparent
  );
  border-radius: 2px;
}

.poem-meta {
  font-family: var(--titleFont);
  font-size: 12px;
  letter-spacing: 0.14em;
  opacity: 0.65;
  white-space: nowrap;
}

/* ---------- Poem body ---------- */
.poem-body {
  white-space: pre-wrap;
  font-size: 19px;
  line-height: 1.6;
  margin: 0;
}

/* ---------- Background layers ---------- */
.poem-section::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background: var(--bg);
}

.poem-section::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image:
    radial-gradient(var(--grain) 1px, transparent 1px),
    var(--motif);
  background-size:
    8px 8px,
    900px 900px;
  background-position:
    0 0,
    50% 50%;
}

/* =========================================================
   LIGHT THEME — Linen + Sunlight
   ========================================================= */
.light {
  color: var(--lightText);

  --bg:
    radial-gradient(1000px 650px at 18% 12%, rgba(192,132,26,0.16), transparent 58%),
    radial-gradient(900px 650px at 82% 22%, rgba(180,83,9,0.12), transparent 60%),
    radial-gradient(1200px 900px at 50% 110%, rgba(59,110,168,0.06), transparent 55%),
    linear-gradient(180deg, var(--paperA), var(--paperB));

  --motif: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='900' height='900'%3E%3Cdefs%3E%3Cpattern id='weave' width='14' height='14' patternUnits='userSpaceOnUse'%3E%3Cpath d='M0 7H14' stroke='%23181818' stroke-opacity='0.05' stroke-width='1'/%3E%3Cpath d='M7 0V14' stroke='%23181818' stroke-opacity='0.04' stroke-width='1'/%3E%3C/pattern%3E%3Cpattern id='stitch' width='26' height='26' patternUnits='userSpaceOnUse'%3E%3Cpath d='M0 13H26' stroke='%23181818' stroke-opacity='0.10' stroke-width='1.2' stroke-linecap='round' stroke-dasharray='2 6'/%3E%3Cpath d='M13 0V26' stroke='%23181818' stroke-opacity='0.08' stroke-width='1.1' stroke-linecap='round' stroke-dasharray='2 7'/%3E%3C/pattern%3E%3ClinearGradient id='threadGlow' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop offset='0' stop-color='%23c0841a' stop-opacity='0.14'/%3E%3Cstop offset='1' stop-color='%23b45309' stop-opacity='0.10'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='900' height='900' fill='url(%23weave)'/%3E%3Crect width='900' height='900' fill='url(%23stitch)'/%3E%3Cg fill='none' stroke='url(%23threadGlow)' stroke-width='2'%3E%3Cpath d='M60 240 C210 120, 390 420, 560 250 S770 150, 840 320'/%3E%3Cpath d='M80 640 C230 500, 380 770, 560 650 S760 560, 840 710'/%3E%3C/g%3E%3C/svg%3E");
}

/* =========================================================
   Poems Navigation — Readable & Clear
   ========================================================= */

.site-header--poems {
  position: sticky;
  top: 0;
  z-index: 30;

  background: linear-gradient(
    to bottom,
    rgba(255,255,255,0.98),
    rgba(255,255,255,0.92)
  );

  border-bottom: 1px solid rgba(0,0,0,0.12);
  backdrop-filter: blur(10px);
}

/* Nav layout */
.site-header--poems .site-nav {
  display: flex;
  gap: 22px;
  padding: 14px 0;
}

/* Nav links — THIS is the big fix */
.site-header--poems .nav-link {
  font-size: 16px;          /* ↑ was too small before */
  font-weight: 600;         /* clearer letterforms */
  letter-spacing: 0.04em;   /* improves readability */
  opacity: 0.95;
  color: #1a1a1a;
  padding: 6px 2px;
  text-decoration: none;
}

/* Hover/focus */
.site-header--poems .nav-link:hover,
.site-header--poems .nav-link:focus-visible {
  opacity: 1;
  text-decoration: underline;
}

/* Dark poem compatibility */
.poem-section.dark ~ .site-header--poems {
  background: linear-gradient(
    to bottom,
    rgba(13,15,20,0.98),
    rgba(13,15,20,0.9)
  );
  border-bottom-color: rgba(255,255,255,0.18);
}

.poem-section.dark ~ .site-header--poems .nav-link {
  color: #f2eee6;
}

/* =========================================================
   DARK THEME — Night + Thread
   ========================================================= */
.dark {
  color: var(--darkText);
  --grain: var(--grainDark);

  --bg:
    radial-gradient(900px 600px at 18% 18%, rgba(139,92,246,0.18), transparent 58%),
    radial-gradient(1000px 700px at 82% 25%, rgba(192,132,26,0.14), transparent 60%),
    linear-gradient(180deg, var(--nightA), var(--nightB));

  --motif: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='900' height='900'%3E%3Cdefs%3E%3Cpattern id='weave' width='14' height='14' patternUnits='userSpaceOnUse'%3E%3Cpath d='M0 7H14' stroke='%23f2eee6' stroke-opacity='0.05' stroke-width='1'/%3E%3Cpath d='M7 0V14' stroke='%23f2eee6' stroke-opacity='0.04' stroke-width='1'/%3E%3C/pattern%3E%3Cpattern id='stitch' width='26' height='26' patternUnits='userSpaceOnUse'%3E%3Cpath d='M0 13H26' stroke='%23f2eee6' stroke-opacity='0.10' stroke-width='1.2' stroke-linecap='round' stroke-dasharray='2 6'/%3E%3Cpath d='M13 0V26' stroke='%23f2eee6' stroke-opacity='0.08' stroke-width='1.1' stroke-linecap='round' stroke-dasharray='2 7'/%3E%3C/pattern%3E%3ClinearGradient id='threadGlow' x1='0' y1='0' x2='1' y2='1'%3E%3Cstop offset='0' stop-color='%23f59e0b' stop-opacity='0.12'/%3E%3Cstop offset='1' stop-color='%238b5cf6' stop-opacity='0.10'/%3E%3C/linearGradient%3E%3C/defs%3E%3Crect width='900' height='900' fill='url(%23weave)'/%3E%3Crect width='900' height='900' fill='url(%23stitch)'/%3E%3Cg fill='none' stroke='url(%23threadGlow)' stroke-width='2'%3E%3Cpath d='M60 240 C210 120, 390 420, 560 250 S770 150, 840 320'/%3E%3Cpath d='M80 640 C230 500, 380 770, 560 650 S760 560, 840 710'/%3E%3C/g%3E%3C/svg%3E");
}

/* ---------- Responsive ---------- */
@media (max-width: 520px) {
  .poem-body { font-size: 16.5px; }
  .poem-title { font-size: 12px; }
}

/* ---------- noscript ---------- */
.noscript {
  padding: 24px;
  font-family: var(--titleFont);
}

/* ---------- Threshold page styling ---------- */
#threshold .poem-header {
  display: none;
}

#threshold .poem-body {
  font-family: var(--titleFont);
  letter-spacing: 0.04em;
  line-height: 1.8;
  font-size: 18px;
  opacity: 0.9;
  white-space: pre-line;
}

#threshold .poem-body::first-line {
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}


/* =========================================================
   Poems Dropdown TOC (header)
   ========================================================= */

.poems-dropdown-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

/* Button matches your nav vibe */
.poems-dropdown-btn {
  appearance: none;
  border: 0;
  background: transparent;
  cursor: pointer;

  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.04em;
  opacity: 0.95;
  color: #1a1a1a;
  padding: 6px 2px;
}

.poems-dropdown-btn:hover,
.poems-dropdown-btn:focus-visible {
  opacity: 1;
  text-decoration: underline;
  outline: none;
}

/* Dropdown panel */
.poems-dropdown-panel {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;

  width: min(720px, calc(100vw - 24px));
  max-height: min(62vh, 520px);
  overflow: auto;

  padding: 14px 14px 10px;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 14px;
  background: rgba(255,255,255,0.98);
  backdrop-filter: blur(10px);
  box-shadow: 0 12px 30px rgba(0,0,0,0.12);

  display: none;
  z-index: 60;
}

.poems-dropdown-panel.open {
  display: block;
}

/* List: 1 col mobile, 2–3 cols larger screens */
.poems-dropdown-list {
  list-style: none;
  padding: 0;
  margin: 0;

  columns: 1;
  column-gap: 22px;
}

@media (min-width: 760px) {
  .poems-dropdown-list { columns: 2; }
}
@media (min-width: 1040px) {
  .poems-dropdown-list { columns: 3; }
}

.poems-dropdown-list li {
  break-inside: avoid;
  margin: 6px 0;
}

.poems-dropdown-link {
  display: inline-block;
  text-decoration: none;
  color: #1a1a1a;
  opacity: 0.9;
  padding: 4px 2px;
}

.poems-dropdown-link:hover,
.poems-dropdown-link:focus-visible {
  opacity: 1;
  text-decoration: underline;
  outline: none;
}

/* Dark poem compatibility */
.poem-section.dark ~ .site-header--poems .poems-dropdown-btn,
.poem-section.dark ~ .site-header--poems .poems-dropdown-link {
  color: #f2eee6;
}

.poem-section.dark ~ .site-header--poems .poems-dropdown-panel {
  background: rgba(13,15,20,0.96);
  border-color: rgba(255,255,255,0.18);
}



/* =========================================================
   Nav layout for poems dropdown below links
   ========================================================= */

.site-header--poems .site-nav {
  flex-wrap: wrap;
  align-items: center;
}

.site-header--poems .poems-nav-row {
  width: 100%;
  margin-top: 8px;
  display: flex;
  justify-content: flex-start;
}

/* =========================================================
   Footer (Poems + site-wide friendly)
   ========================================================= */
.site-footer {
  padding: 18px 0 26px;
  border-top: 1px solid rgba(0,0,0,0.12);
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(10px);
}

.site-footer small {
  font-family: var(--titleFont);
  letter-spacing: 0.04em;
  opacity: 0.85;
}

.site-footer a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.site-footer a:hover,
.site-footer a:focus-visible {
  opacity: 1;
}

/* Dark compatibility */
.dark .site-footer,
.poem-section.dark ~ .site-footer {
  background: rgba(13,15,20,0.92);
  border-top-color: rgba(255,255,255,0.18);
}

/* =========================================================
   Subtle Rights link (Poems page)
   ========================================================= */
.footer-rights {
  font-size: 0.75rem;
  opacity: 0.55;
  letter-spacing: 0.04em;
}

.footer-rights a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px dotted currentColor;
  text-underline-offset: 3px;
}

.footer-rights a:hover,
.footer-rights a:focus-visible {
  opacity: 0.9;
}
/* Hide Rights & Use link in top nav on Poems page only */
.site-nav a[href="/rights/"] {
  display: none;
}