/* Recovery Library — Content Styles
   Loaded AFTER the main site styles.css.
   Only contains library-specific content formatting. */

/* ── Library sub-navigation ────────────────────────────── */

.library-subnav {
  position: fixed;
  top: var(--header-h);
  left: 0;
  right: 0;
  z-index: 998;
  background: rgba(253,251,247,0.92);
  backdrop-filter: blur(10px);
  border-bottom: 2px solid rgba(52,152,219,0.15);
  padding: 0;
}

/* Push page content below fixed header + subnav */
body:has(.library-subnav) {
  padding-top: calc(var(--header-h) + 42px);
}

.library-subnav .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.library-subnav nav {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0;
  font-size: 14px;
  font-weight: 600;
}

.library-subnav a {
  color: var(--text);
  padding: 10px 16px;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  white-space: nowrap;
}

.library-subnav a.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.library-subnav a:hover {
  text-decoration: none;
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  background: rgba(52,152,219,0.06);
}

.subnav-toggle {
  display: none;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.6);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  align-items: center;
  gap: 6px;
}

.subnav-toggle .subnav-icon {
  font-size: 16px;
}

/* ── Paper layout (no hero banner) ────────────────────── */

.paper-content {
  padding-top: 2rem;
}

.paper-header {
  text-align: center;
  padding: 2rem 0 1.5rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 2rem;
}

.paper-header h1 {
  font-size: 2rem;
  margin: 0 0 0.4em;
}

.paper-subtitle {
  font-size: 1.15rem;
  color: var(--muted);
  margin: 0 0 0.5em;
  font-style: italic;
}

.paper-meta {
  font-size: 0.85rem;
  color: var(--faint);
  margin: 0 0 0.3em;
  letter-spacing: 0.3px;
}

.paper-author {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0;
  font-weight: 600;
}

/* ── Library content area ──────────────────────────────── */

.library-content {
  max-width: 48rem;
  font-family: 'Georgia', 'Times New Roman', serif;
  font-size: 17px;
  line-height: 1.65;
  padding-top: 2rem;
  padding-bottom: 3rem;
}

/* Links inside library content should be visible */
.library-content a {
  color: var(--color-primary);
}
.library-content a:hover {
  color: #2980b9;
}

/* ── Headings ──────────────────────────────────────────── */

.library-content h1 {
  font-size: 1.75rem;
  line-height: 1.25;
  margin: 2rem 0 0.75rem;
  letter-spacing: -0.01em;
}

.library-content h2 {
  font-size: 1.3rem;
  margin: 2.5rem 0 0.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(120,100,80,0.15);
}

.library-content h3 {
  font-size: 1.05rem;
  margin: 1.5rem 0 0.4rem;
}

/* ── Body text ─────────────────────────────────────────── */

.library-content p { margin-bottom: 1rem; }

.library-content blockquote {
  border-left: 3px solid var(--color-primary);
  padding: 0.75rem 1.25rem;
  margin: 1.25rem 0;
  background: rgba(243,156,18,0.06);
  font-size: 0.92rem;
}

.library-content blockquote p:last-child { margin-bottom: 0; }

/* ── Tables ────────────────────────────────────────────── */

.library-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: 0.9rem;
  font-family: Inter, system-ui, -apple-system, sans-serif;
}

.library-content th,
.library-content td {
  padding: 0.5rem 0.75rem;
  border: 1px solid rgba(120,100,80,0.15);
  text-align: left;
  vertical-align: top;
}

.library-content th {
  background: var(--bg-secondary);
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

/* ── Code ──────────────────────────────────────────────── */

.library-content code {
  font-family: 'SF Mono', 'Menlo', 'Consolas', monospace;
  font-size: 0.88em;
  background: var(--bg-secondary);
  padding: 0.15em 0.35em;
  border-radius: 3px;
}

.library-content pre {
  background: var(--bg-secondary);
  padding: 1rem;
  overflow-x: auto;
  margin: 1rem 0;
  border-radius: 4px;
}

.library-content pre code {
  background: none;
  padding: 0;
}

/* ── Lists ─────────────────────────────────────────────── */

.library-content ul,
.library-content ol {
  margin: 0.75rem 0 1rem 1.5rem;
}

.library-content li { margin-bottom: 0.3rem; }

/* ── Images ────────────────────────────────────────────── */

.doc-body img,
.page-body img,
.library-content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.5rem auto;
  border: 1px solid rgba(120,100,80,0.15);
  border-radius: 4px;
  cursor: zoom-in;
}

/* ── Lightbox ──────────────────────────────────────────── */

.lightbox-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.85);
  z-index: 1000;
  cursor: zoom-out;
  padding: 2rem;
  justify-content: center;
  align-items: center;
}

.lightbox-overlay.active {
  display: flex;
}

.lightbox-overlay img {
  max-width: 95vw;
  max-height: 92vh;
  object-fit: contain;
  border-radius: 4px;
  box-shadow: 0 4px 30px rgba(0,0,0,0.5);
  border: none;
  cursor: zoom-out;
  margin: 0;
}

/* ── Horizontal rules ──────────────────────────────────── */

.library-content hr {
  border: none;
  border-top: 1px solid rgba(120,100,80,0.15);
  margin: 2rem 0;
}

/* ── Footnotes ─────────────────────────────────────────── */

.library-content .footnotes {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(120,100,80,0.15);
}

.library-content .footnotes ol { padding-left: 1.25rem; }
.library-content .footnotes li { margin-bottom: 0.5rem; }
.library-content .footnotes a { color: var(--muted); }

.library-content sup a {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 600;
}

/* ── Table of contents ─────────────────────────────────── */

.toc {
  font-family: Inter, system-ui, -apple-system, sans-serif;
  font-size: 0.88rem;
  background: var(--bg-secondary);
  border: 1px solid rgba(120,100,80,0.15);
  border-radius: var(--radius);
  padding: 0.75rem 1.25rem;
  margin-bottom: 2rem;
}

.toc summary {
  cursor: pointer;
  user-select: none;
}

.toc summary:hover { color: var(--color-primary); }

.toc ul {
  margin: 0.5rem 0 0.25rem 1.25rem;
  list-style: none;
}

.toc li { margin-bottom: 0.2rem; }

.toc a {
  color: var(--text);
  text-decoration: none;
}

.toc a:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

/* ── Disclaimer banner ─────────────────────────────────── */

.disclaimer {
  background: rgba(243,156,18,0.06);
  border: 1px solid rgba(201,166,28,0.4);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
  font-size: 0.85rem;
  font-family: Inter, system-ui, -apple-system, sans-serif;
  line-height: 1.5;
  color: var(--muted);
}

.disclaimer strong { color: var(--text); }

/* ── Doc footer nav ────────────────────────────────────── */

.doc-footer-nav {
  margin-top: 3rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(120,100,80,0.15);
  font-size: 0.9rem;
}

/* ── Phase/feasibility line inside hero ─────────────────── */

.doc-phase {
  color: rgba(255,255,255,0.85);
  font-family: Inter, system-ui, -apple-system, sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.03em;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
  margin: 0.3rem 0 0;
}

/* ── Hero banner ───────────────────────────────────────── */

.hero-banner {
  background-size: cover;
  background-position: center 40%;
  border-radius: var(--radius);
  padding: 3.5rem 2rem 3rem;
  margin: 1rem auto 0;
  max-width: var(--maxw);
  text-align: center;
}

.hero-banner h1 {
  color: #ffffff;
  font-size: 2.1rem;
  margin: 0 0 0.5rem;
  letter-spacing: 0.02em;
  font-weight: 700;
  text-shadow:
    0 2px 12px rgba(0,0,0,0.7),
    0 0 30px rgba(0,0,0,0.4);
}

.hero-subtitle {
  color: rgba(255,255,255,0.85);
  font-family: Inter, system-ui, -apple-system, sans-serif;
  font-size: 0.92rem;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-shadow: 0 1px 6px rgba(0,0,0,0.6);
  margin: 0;
}

.hero-eyebrow {
  color: rgba(255,255,255,0.55);
  font-family: Inter, system-ui, -apple-system, sans-serif;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-shadow: 0 1px 4px rgba(0,0,0,0.5);
  margin: 0 0 0.4rem;
}

/* Compact hero for inner pages */
.hero-compact {
  padding: 2rem 2rem 1.75rem;
}

.hero-compact h1 {
  font-size: 1.6rem;
}

/* Star chart background variants */
.hero-stars-1 {
  background-image:
    linear-gradient(to bottom, rgba(9,9,32,0.45), rgba(9,9,32,0.7)),
    url('images/thumb/hero-stars-january.png');
  background-image:
    linear-gradient(to bottom, rgba(9,9,32,0.45), rgba(9,9,32,0.7)),
    image-set(url('images/thumb/hero-stars-january.webp') type('image/webp'),
              url('images/thumb/hero-stars-january.png') type('image/png'));
}
.hero-stars-2 {
  background-image:
    linear-gradient(to bottom, rgba(9,9,32,0.45), rgba(9,9,32,0.7)),
    url('images/thumb/hero-stars-april.png');
  background-image:
    linear-gradient(to bottom, rgba(9,9,32,0.45), rgba(9,9,32,0.7)),
    image-set(url('images/thumb/hero-stars-april.webp') type('image/webp'),
              url('images/thumb/hero-stars-april.png') type('image/png'));
}
.hero-stars-3 {
  background-image:
    linear-gradient(to bottom, rgba(9,9,32,0.45), rgba(9,9,32,0.7)),
    url('images/thumb/hero-stars-july.png');
  background-image:
    linear-gradient(to bottom, rgba(9,9,32,0.45), rgba(9,9,32,0.7)),
    image-set(url('images/thumb/hero-stars-july.webp') type('image/webp'),
              url('images/thumb/hero-stars-july.png') type('image/png'));
}
.hero-stars-4 {
  background-image:
    linear-gradient(to bottom, rgba(9,9,32,0.45), rgba(9,9,32,0.7)),
    url('images/thumb/hero-stars-october.png');
  background-image:
    linear-gradient(to bottom, rgba(9,9,32,0.45), rgba(9,9,32,0.7)),
    image-set(url('images/thumb/hero-stars-october.webp') type('image/webp'),
              url('images/thumb/hero-stars-october.png') type('image/png'));
}

/* Hide duplicate h1 in body (title is in hero banner) */
.doc-body > h1:first-child,
.page-body > h1:first-child,
.library-content > h1:first-child {
  display: none;
}

/* ── Thumbnail grid (index page) ───────────────────────── */

.thumbnail-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin: 1.5rem 0 0.5rem;
}

.thumbnail-grid a {
  display: block;
  text-decoration: none;
  border: 1px solid rgba(120,100,80,0.15);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
}

.thumbnail-grid a:hover {
  border-color: var(--color-primary);
  box-shadow: 0 2px 8px rgba(0,0,0,0.12);
  text-decoration: none;
}

.thumbnail-grid img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
  border: none;
  margin: 0;
  border-radius: 0;
  cursor: default;
}

.thumbnail-grid .thumb-label {
  font-family: Inter, system-ui, -apple-system, sans-serif;
  font-size: 0.75rem;
  color: var(--muted);
  padding: 0.4rem 0.5rem;
  line-height: 1.3;
  text-align: center;
}

.thumbnail-grid a:hover .thumb-label {
  color: var(--color-primary);
}

/* NZ watermark background (index page) */
.nz-watermark {
  background-image: url('images/thumb/nz-watermark.png');
  background-image: image-set(url('images/thumb/nz-watermark.webp') type('image/webp'),
                              url('images/thumb/nz-watermark.png') type('image/png'));
  background-repeat: no-repeat;
  background-position: center top 4rem;
  background-size: 22rem auto;
  background-attachment: scroll;
}

/* ── Responsive ────────────────────────────────────────── */

@media (max-width: 980px) {
  .subnav-toggle { display: inline-flex; }

  .library-subnav .container {
    padding-top: 6px;
    padding-bottom: 6px;
  }

  .library-subnav nav {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(253,251,247,0.98);
    backdrop-filter: blur(12px);
    border-bottom: 2px solid rgba(52,152,219,0.15);
    flex-direction: column;
    padding: 8px 0;
    box-shadow: 0 8px 24px rgba(120,100,80,0.12);
    z-index: 100;
  }

  .library-subnav nav.open { display: flex; }

  .library-subnav a {
    padding: 10px 24px;
    border-bottom: none;
    margin-bottom: 0;
  }

  .library-subnav a:hover {
    border-bottom: none;
    background: rgba(52,152,219,0.08);
  }
}

@media (max-width: 600px) {
  .library-content { font-size: 16px; }
  .library-content table { font-size: 0.82rem; }
  .library-content th,
  .library-content td { padding: 0.35rem 0.5rem; }
  .hero-banner { padding: 2.5rem 1rem 2rem; }
  .hero-banner h1 { font-size: 1.6rem; }
  .hero-compact { padding: 1.5rem 1rem 1.25rem; }
  .hero-compact h1 { font-size: 1.3rem; }
  .nz-watermark { background-size: 16rem auto; background-position: center top 3rem; }
  .thumbnail-grid { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
  .thumbnail-grid img { height: 110px; }
}
