/* leaftime.net hub and blog pages */

:root {
  --green-dark:  #1a2e1a;
  --green-mid:   #2d5a2d;
  --green-light: #e8f0e8;
  --green-accent:#3a7a3a;
  --text:        #222;
  --text-muted:  #555;
  --white:       #fff;
  --surface:     #fbfcfa;
  --rule:        #e2e8e2;
  --nav-h:       56px;
  --max-w:       960px;
  --read-w:      720px;
  --radius:      12px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 17px;
  line-height: 1.65;
  color: var(--text);
  background: var(--surface);
}

/* ── Navigation (matches leaftime.net) ─────────────────── */

#main-nav {
  position: sticky; top: 0; z-index: 100;
  height: var(--nav-h);
  background: rgba(26, 46, 26, 0.97);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
.nav-inner {
  max-width: var(--max-w); margin: 0 auto; height: 100%;
  display: flex; align-items: center; padding: 0 24px; gap: 32px;
}
.nav-brand {
  display: flex; align-items: center; gap: 10px;
  text-decoration: none; color: var(--white);
  font-weight: 600; font-size: 17px; letter-spacing: 0.01em; flex-shrink: 0;
}
.nav-brand img { height: 28px; width: 28px; }
.nav-brand small { font-weight: 400; opacity: 0.7; font-size: 13px; margin-left: 2px; }
.nav-links { display: flex; align-items: center; gap: 4px; list-style: none; margin-left: auto; }
.nav-links a {
  display: inline-block; padding: 6px 14px;
  color: rgba(255, 255, 255, 0.80); text-decoration: none;
  font-size: 14px; border-radius: 6px; transition: color 0.15s, background 0.15s;
}
.nav-links a:hover { color: var(--white); background: rgba(255,255,255,0.10); }
.nav-toggle {
  display: none; margin-left: auto; background: none; border: none;
  color: var(--white); font-size: 22px; cursor: pointer; padding: 4px 8px; line-height: 1;
}

/* ── Landing ───────────────────────────────────────────── */

main { position: relative; z-index: 1; padding: 40px 16px 60px; }

.landing { max-width: var(--max-w); margin: 0 auto; }
.landing header { text-align: center; padding: 56px 16px 40px; }
.landing h1 {
  font-size: clamp(34px, 6vw, 50px); font-weight: 700; color: var(--green-dark);
  letter-spacing: -0.02em; margin-bottom: 14px;
}
.landing .tagline { font-size: clamp(16px, 2.2vw, 19px); color: var(--text-muted); max-width: 640px; margin: 0 auto; }
.capabilities {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin: 8px 0 40px;
}
.capabilities article {
  background: var(--white); border: 1px solid var(--rule); border-radius: var(--radius);
  padding: 22px 22px 18px;
}
.capabilities h3 { font-size: 15px; color: var(--green-mid); margin-bottom: 8px; font-weight: 600; }
.landing a { color: var(--green-mid); }
.landing a:hover { color: var(--green-dark); }
.capabilities h3 a { text-decoration: none; }
.capabilities h3 a:hover { text-decoration: underline; }
.capabilities p { font-size: 15px; color: var(--text-muted); line-height: 1.55; }
.btn-primary {
  display: inline-block; background: var(--green-dark); color: var(--white);
  text-decoration: none; font-size: 15px; font-weight: 500;
  padding: 12px 28px; border-radius: 8px; transition: background 0.15s;
}
.btn-primary:hover { background: var(--green-mid); }
.landing .latest { border-top: 1px solid var(--rule); padding-top: 28px; }
.landing .latest h2 { font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 14px; }

/* ── Blog index ────────────────────────────────────────── */

.blog-index { max-width: var(--read-w); margin: 0 auto; }
.blog-index h1 { font-size: 30px; color: var(--green-dark); margin: 24px 0 24px; letter-spacing: -0.01em; }
.post-list { list-style: none; }
.post-item { padding: 18px 0; border-top: 1px solid var(--rule); }
.post-item:last-child { border-bottom: 1px solid var(--rule); }
.post-item a { font-size: 20px; font-weight: 600; color: var(--green-dark); text-decoration: none; }
.post-item a:hover { color: var(--green-mid); text-decoration: underline; }
.post-meta { font-size: 13px; color: var(--text-muted); margin: 4px 0 6px; }
.post-summary { font-size: 15.5px; color: var(--text); }

/* ── Post ──────────────────────────────────────────────── */

article.post { max-width: var(--read-w); margin: 0 auto; }
.post-header { margin: 20px 0 36px; }
.post-header h1 {
  font-size: clamp(28px, 4.5vw, 38px); line-height: 1.2; color: var(--green-dark);
  letter-spacing: -0.015em; margin-bottom: 12px;
}
.post-header .subtitle { font-size: 19px; color: var(--text-muted); margin-bottom: 14px; line-height: 1.45; }
.post-header .byline { font-size: 14px; color: var(--text-muted); }

.post h2 { font-size: 24px; color: var(--green-dark); margin: 44px 0 14px; letter-spacing: -0.01em; }
.post h3 { font-size: 18px; color: var(--green-dark); margin: 30px 0 10px; }
.post p { margin: 0 0 18px; }
.post ul, .post ol { margin: 0 0 18px 1.4em; }
.post li { margin-bottom: 6px; }
.post a { color: var(--green-mid); }
.post a:hover { color: var(--green-dark); }
.post strong { font-weight: 600; }
.post code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; background: #eef2ee; padding: 1px 5px; border-radius: 4px; }

.post figure { margin: 26px 0 30px; }
.post figure img { width: 100%; height: auto; display: block; border-radius: 8px; }
.post figcaption, .post .caption { font-size: 14px; color: var(--text-muted); line-height: 1.5; margin-top: 10px; }

.post table { border-collapse: collapse; width: 100%; font-size: 15px; margin: 10px 0 22px; }
.post th, .post td { border-bottom: 1px solid var(--rule); padding: 8px 10px; text-align: left; vertical-align: top; }
.post th { background: var(--green-light); font-weight: 600; color: var(--green-dark); font-size: 14px; }
.post td:not(:first-child), .post th:not(:first-child) { text-align: right; white-space: nowrap; }
.table-wrap { overflow-x: auto; }

.post .sidebar {
  background: var(--green-light); border-left: 4px solid var(--green-mid);
  border-radius: 8px; padding: 18px 22px; margin: 36px 0;
}
.post .sidebar h2 { margin: 0 0 12px; font-size: 19px; }
.post .sidebar table { background: transparent; margin-bottom: 0; }
.post .sidebar th { background: transparent; }
.post .sidebar td, .post .sidebar th { text-align: left; white-space: normal; }
.post .sidebar td:first-child { width: 38%; }
@media (max-width: 600px) {
  .post .sidebar { padding: 16px; }
  .post .sidebar thead, .post .sidebar colgroup { display: none; }
  .post .sidebar table, .post .sidebar tbody { display: block; width: 100%; }
  .post .sidebar tr, .post .sidebar td { display: block; width: auto; }
  .post .sidebar td { padding: 2px 0; border: 0; }
  .post .sidebar td:first-child { width: auto; font-weight: 600; color: var(--green-dark); padding-top: 12px; }
  .post .sidebar tr { border-bottom: 1px solid var(--rule); padding-bottom: 10px; }
}

.post .references { font-size: 14.5px; color: var(--text-muted); }
.post .references li { margin-bottom: 8px; }

/* ── Image comparison slider (same classes as leaftime.net) ── */

.map-comparison {
  position: relative; aspect-ratio: 1 / 1; overflow: hidden;
  border-radius: 8px; background: #1a2e1a; cursor: col-resize; touch-action: pan-y;
}
.map-pane { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.slider-handle {
  position: absolute; top: 0; bottom: 0; width: 3px;
  background: rgba(255, 255, 255, 0.85); cursor: ew-resize; z-index: 8; left: 50%;
  touch-action: none; transform: translateX(-50%);
}
.slider-grip {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255, 255, 255, 0.92); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: #555; user-select: none;
}
.slider-label {
  position: absolute; top: 10px; z-index: 9; font-size: 12px; font-weight: 600;
  color: #fff; background: rgba(0,0,0,0.55); padding: 3px 9px; border-radius: 4px; pointer-events: none;
}
.slider-label.before { left: 10px; }
.slider-label.after  { right: 10px; }
.map-legend { display: flex; flex-direction: column; gap: 3px; margin-top: 8px; }
.legend-bar { height: 10px; border-radius: 3px; }
.legend-bar.plasma { background: linear-gradient(to right, #0d0887, #7e03a8, #cc4778, #f89540, #f0f921); }
.legend-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); }

/* ── Footer ─────────────────────────────────────────────── */

footer {
  position: relative; z-index: 1; background: var(--green-dark);
  color: rgba(255, 255, 255, 0.6); font-size: 12px; line-height: 1.6;
  padding: 22px 24px; text-align: center; margin-top: 40px;
}
footer a { color: rgba(255,255,255,0.85); }

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

@media (max-width: 768px) {
  body { font-size: 16px; }
  .capabilities { grid-template-columns: 1fr; }
  .nav-toggle { display: block; }
  .nav-links {
    display: none; position: absolute; top: var(--nav-h); left: 0; right: 0;
    flex-direction: column; align-items: stretch;
    background: rgba(26, 46, 26, 0.98); padding: 12px 16px; gap: 4px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }
  .nav-links.open { display: flex; }
  .nav-links a { padding: 10px 14px; }
  .nav-inner { position: relative; }
}

/* ── Figure lightbox (tap to enlarge) ───────────────────────── */
.post figure img.zoomable { cursor: zoom-in; }
html.lightbox-open { overflow: hidden; }
.lightbox {
  position: fixed; inset: 0; z-index: 1000; background: #141914;
  display: flex; flex-direction: column;
}
.lightbox[hidden] { display: none; }
.lightbox-scroll {
  flex: 1; min-height: 0; overflow: auto; display: flex;
  align-items: center; justify-content: center; padding: 48px 12px 8px;
  -webkit-overflow-scrolling: touch;
}
.lightbox-scroll img {
  max-width: min(100%, 1600px); max-height: 100%; height: auto; background: #fff;
  border-radius: 4px; cursor: zoom-in;
}
.lightbox.zoomed .lightbox-scroll { display: block; }
.lightbox.zoomed .lightbox-scroll img { max-width: none; max-height: none; width: 220%; cursor: zoom-out; }
.lightbox-caption {
  flex: 0 0 auto; max-height: 32vh; overflow: auto; margin: 0;
  padding: 10px 16px 18px; color: #e8ece8; font-size: 14px; line-height: 1.5;
  max-width: 820px; align-self: center;
}
.lightbox-caption:empty { display: none; }
.lightbox-close {
  position: absolute; top: 8px; right: 10px; z-index: 1; width: 40px; height: 40px;
  border: 0; border-radius: 50%; background: rgba(255, 255, 255, 0.15); color: #fff;
  font-size: 26px; line-height: 40px; cursor: pointer;
}
.lightbox-close:hover, .lightbox-close:focus-visible { background: rgba(255, 255, 255, 0.3); }
@media (min-width: 900px) { .lightbox.zoomed .lightbox-scroll img { width: 160%; } }
.zoom-wrap { position: relative; display: block; }
.zoom-badge {
  position: absolute; bottom: 6px; right: 6px; width: 30px; height: 30px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border: 0; border-radius: 8px; background: rgba(26, 46, 26, 0.72); color: #fff;
  cursor: zoom-in; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25); transition: background 0.15s;
}
.zoom-badge:hover, .zoom-wrap:hover .zoom-badge { background: rgba(26, 46, 26, 0.92); }
