/* site-liveobservatory.css
 * Shared stylesheet for LiveObservatory — one design system across every
 * page (index, place, item), not a copy of the <style> block per file.
 * Extracted from the original static Etna prototype so nothing about the
 * look changes, just where it lives.
 */

  :root {
    /* Light theme — aged field-notebook paper, not bright cream. Shared token set across the volcano genre. */
    --bg: #eae6da;
    --surface: #f8f6ef;
    --surface-2: #e2dcc7;
    --border: #d1c7ab;
    --text: #221d16;
    --text-muted: #6d6350;
    --ember: #c1501f;
    --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', monospace;
    --font-serif: 'Newsreader', Georgia, serif;

    --alert: #a8790a; /* default; overridden by [data-alert] below */
  }
  body[data-alert="green"]  { --alert: #3f7a4c; }
  body[data-alert="yellow"] { --alert: #a8790a; }
  body[data-alert="orange"] { --alert: #c1501f; }
  body[data-alert="red"]    { --alert: #b23434; }

  * { box-sizing: border-box; }

  body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-serif);
    line-height: 1.5;
  }

  a { color: var(--text); text-decoration-color: var(--text-muted); }
  a:hover { text-decoration-color: var(--ember); }
  a:focus-visible, button:focus-visible {
    outline: 2px solid var(--ember);
    outline-offset: 3px;
  }

  .wrap { max-width: 1080px; margin: 0 auto; padding: 0 20px; }

  /* ---------- masthead ---------- */
  .masthead {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
  }
  .masthead-inner {
    padding: 14px 0;
    display: flex;
    align-items: baseline;
    gap: 12px;
  }
  .masthead-title {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1.05rem;
    letter-spacing: -0.01em;
    color: var(--text);
    text-decoration: none; /* now an <a>, not a <span> */
  }
  .masthead-title:hover { color: var(--ember); }
  .masthead-tagline {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-muted);
    letter-spacing: 0.03em;
  }

  /* ---------- status bar ---------- */
  .statusbar {
    border-top: 4px solid var(--alert);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
  }
  .statusbar-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 16px 32px;
    align-items: baseline;
    justify-content: space-between;
    padding: 22px 0;
  }
  .place-name {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: clamp(1.6rem, 3vw, 2.4rem);
    letter-spacing: -0.01em;
    margin: 0;
  }
  .place-meta {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-muted);
    letter-spacing: 0.02em;
    margin-top: 4px;
    cursor: help;
  }
  .alert-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-mono);
    text-align: right;
  }
  .alert-dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--alert);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--alert) 25%, transparent);
    animation: pulse 2.4s ease-in-out infinite;
    flex-shrink: 0;
  }
  @media (prefers-reduced-motion: reduce) { .alert-dot { animation: none; } }
  @keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.45; }
  }
  .alert-code {
    color: var(--alert);
    font-weight: 700;
    font-size: 0.95rem;
  }
  .alert-time { display: block; color: var(--text-muted); font-size: 0.72rem; margin-top: 2px; }

  /* ---------- hero ---------- */
  .hero {
    position: relative;
    height: min(52vw, 420px);
    min-height: 220px;
    overflow: hidden;
    background: #000;
  }
  .hero img { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0.92; }
  .hero-img-link { display: block; width: 100%; height: 100%; }
  .hero-overlay {
    position: absolute; inset: auto 0 0 0;
    padding: 28px 20px 22px;
    background: linear-gradient(to top, rgba(10,8,5,0.92), rgba(10,8,5,0.15) 80%);
    color: #f3ede0; /* hero always sits on a photo + dark scrim, independent of site theme */
  }
  .hero-overlay .wrap { padding: 0; }
  .hero-tag {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    color: var(--ember);
    text-transform: uppercase;
  }
  .hero-caption {
    font-family: var(--font-serif);
    font-style: italic;
    color: #cabfa4;
    font-size: 0.95rem;
    margin-top: 6px;
  }
  .hero-caption a { color: #cabfa4; }

  .hero-title {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1.1rem;
    color: #f3ede0;
    margin-top: 6px;
  }

  /* ---------- hero tiles (upper-left, stacked) ----------
   * .hero-tiles is the one positioned element; .hero-weather and .hero-special
   * are normal-flow children inside it, so any number of tiles stacks cleanly
   * without each one needing its own top offset computed by hand. */
  .hero-tiles {
    position: absolute;
    top: 16px;
    left: 20px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    z-index: 2;
  }
  .hero-weather {
    padding: 9px 15px;
    background: rgba(10,8,5,0.6);
    border-radius: 3px;
    line-height: 1.3;
  }
  .hero-weather-fig {
    display: block;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1.25rem;
    color: #f3ede0;
  }
  .hero-weather-sub {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.02em;
    color: #cabfa4;
  }

  /* air quality: same big-figure language as .hero-weather, since it's the
   * same kind of thing — a continuous reading, not a status announcement */
  .hero-aqi {
    padding: 9px 15px;
    background: rgba(10,8,5,0.6);
    border-radius: 3px;
    line-height: 1.3;
  }
  .hero-aqi-fig {
    display: block;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1.25rem;
    color: #f3ede0;
  }
  .hero-aqi-sub {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.02em;
    color: #cabfa4;
  }

  /* alert status: label + message like .hero-special, but with a neutral
   * edge rather than the ember accent — this one's a routine fixture once
   * wired up, not a rare surprise, so it shouldn't compete visually with
   * the special tile for attention. Shows either an active alert or a calm
   * "no active alerts" line — same tile either way, content differs. */
  .hero-alert-status {
    padding: 9px 15px;
    background: rgba(10,8,5,0.6);
    border-radius: 3px;
    border-left: 3px solid #cabfa4;
    line-height: 1.3;
    max-width: 260px;
  }
  .hero-alert-status-label {
    display: block;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.66rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #cabfa4;
  }
  .hero-alert-status-message {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-clamp: 2;
    overflow: hidden;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: #f3ede0;
    margin-top: 2px;
  }
  .hero-alert-status-more {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.66rem;
    color: var(--ember);
    margin-top: 4px;
    text-decoration: none;
  }
  .hero-alert-status-more:hover {
    text-decoration: underline;
  }

  /* special tile: same dark-scrim box language as .hero-weather, but with an
   * ember accent edge — this one is meant to stand out as a surprise, not
   * blend in as a fixture the way the weather tile does. */
  .hero-special {
    padding: 9px 15px;
    background: rgba(10,8,5,0.6);
    border-radius: 3px;
    border-left: 3px solid var(--ember);
    line-height: 1.3;
    max-width: 260px;
  }
  .hero-special-label {
    display: block;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.66rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--ember);
  }
  .hero-special-message {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: #f3ede0;
    margin-top: 2px;
  }

  /* ---------- hero: pending variant (no confirmed live image yet) ---------- */
  .hero--pending {
    background: linear-gradient(165deg, var(--surface-2), var(--surface) 68%);
    display: flex;
    align-items: center;
  }
  .hero--pending .wrap { width: 100%; }
  .hero-pending-panel {
    max-width: 640px;
    padding: 8px 0;
    border-left: 5px solid var(--alert);
    padding-left: 22px;
  }
  .hero-pending-headline {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: clamp(1.2rem, 2.6vw, 1.7rem);
    color: var(--text);
    line-height: 1.35;
    margin: 10px 0 12px;
  }
  .hero-pending-note {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-muted);
    line-height: 1.5;
  }
  .hero-pending-note a { color: var(--text-muted); }

  /* ---------- hero: mobile ----------
   * height: min(52vw, 420px) works fine on desktop, but on a phone-width
   * viewport 52vw shrinks to ~150-220px -- nowhere near enough room for the
   * 3-tile stack (top) and the title/caption (bottom) to coexist without
   * overlapping, since both are position:absolute within that short box.
   * Below this width they drop out of absolute positioning and stack in
   * normal flow under the photo instead. The source order (image, tiles,
   * overlay) already matches this stacking, so no markup changes needed --
   * only the tiles/overlay need color/background adjustments here since
   * they were designed assuming they'd always sit on top of the photo. */
  @media (max-width: 640px) {
    .hero {
      height: auto;
      min-height: 0;
    }
    .hero img {
      height: auto;
      aspect-ratio: 16 / 9;
    }
    .hero-tiles {
      position: static;
      padding: 12px 16px 0;
    }
    .hero-weather, .hero-aqi, .hero-alert-status, .hero-special {
      max-width: none;
    }
    .hero-overlay {
      position: static;
      background: none;
      padding: 14px 16px 18px;
    }
    .hero-title { color: var(--text); }
    .hero-caption, .hero-caption a { color: var(--text-muted); }
  }

  /* ---------- cam row (below hero) ---------- */
  .camrow { padding: 22px 0 4px; }
  .camrow-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
  }
  .camcard {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 3px;
    overflow: hidden;
  }
  .camcard img {
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    display: block;
    background: var(--surface-2);
  }
  .camcard-img-link { display: block; }
  .camcard.is-pending { border-style: dashed; }
  .camcard-placeholder {
    aspect-ratio: 4 / 3;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface-2);
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.03em;
    color: var(--text-muted);
    text-align: center;
    padding: 12px;
    text-transform: uppercase;
  }
  .camcard-label { padding: 12px 14px 14px; }
  .camcard-name {
    display: block;
    font-family: var(--font-mono);
    font-weight: 600;
    font-size: 0.82rem;
    color: var(--ember);
    letter-spacing: 0.02em;
  }
  .camcard-desc {
    display: block;
    font-family: var(--font-serif);
    font-size: 0.88rem;
    color: var(--text);
    margin: 4px 0 8px;
  }
  .camcard-src { font-family: var(--font-mono); font-size: 0.7rem; color: var(--text-muted); }
  .camcard-src a { color: var(--text-muted); }
  .camcard-standalone {
    display: block;
    margin-top: 6px;
    font-family: var(--font-mono);
    font-size: 0.7rem;
  }
  .camcard-standalone a { color: var(--ember); font-weight: 600; }

  /* ---------- cards grid ---------- */
  main { padding: 8px 0 8px; }
  .grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 28px;
  }
  .card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 3px;
    overflow: hidden;
    position: relative;
  }
  .card:hover { border-color: var(--ember); }
  .card.is-pending { border-style: dashed; opacity: 0.8; }
  .card-body { padding: 0 22px 22px; }
  .card-body-standalone { padding-top: 20px; }
  .tag {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    border: 1px solid var(--border);
    border-radius: 2px;
    padding: 2px 6px;
    margin-bottom: 12px;
    text-transform: uppercase;
  }
  .tag.pending { color: var(--ember); border-color: var(--ember); }
  .tag.live { color: var(--alert); border-color: var(--alert); }
  .card-tagrow {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 12px;
  }
  .card-tagrow .tag { margin-bottom: 0; }
  .card-updated {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    color: var(--text-muted);
    letter-spacing: 0.02em;
    white-space: nowrap;
  }
  .card-updated.stale { color: var(--ember); }
  .card-media {
    position: relative;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    margin: 0 0 12px;
    background: var(--surface-2);
  }
  .card-media-link { display: block; height: 100%; }
  .card-img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  /* text-only rows (no photo) get the same footprint as an image, filled with
     their notes instead — scrolls internally rather than growing the card,
     so a long incident summary doesn't blow out row height like a bare <p> would */
  .card-textbox {
    display: block;
    width: 100%;
    height: 100%;
    box-sizing: border-box;
    overflow-y: auto;
    padding: 14px 16px;
    font-family: var(--font-serif);
    font-size: 0.95rem;
    line-height: 1.5;
    color: #f3ede0;
    background: #332b1f;
    text-decoration: none;
  }
  .card h3 {
    font-family: var(--font-mono);
    font-size: 0.82rem;
    margin: 0 0 8px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--ember);
  }
  .card h3 a { color: var(--ember); }
  .card .ts {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-muted);
    display: block;
    margin-bottom: 8px;
  }
  .card p { margin: 0 0 10px; font-size: 0.95rem; }
  .card p:last-child { margin-bottom: 0; }
  .card .src {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-muted);
  }
  .card .src a { color: var(--text-muted); }

  .log-entry + .log-entry {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid var(--border);
  }

  .weather-fig {
    font-family: var(--font-mono);
    font-size: 2rem;
    font-weight: 700;
    color: var(--text);
  }
  .weather-sub { font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-muted); }

  /* ---------- quick links ---------- */
  .quicklinks {
    margin-top: 20px;
    padding: 18px 22px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 3px;
  }
  .quicklinks h4 {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0 0 10px;
    font-weight: 600;
  }
  .quicklinks ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 10px 22px; }
  .quicklinks a { font-size: 0.9rem; }

  /* ---------- site nav (category filter, driven by subject_types) ---------- */
  .site-nav {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
  }
  .site-nav-inner {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 20px;
    padding: 10px 0;
  }
  .site-nav-link {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    text-decoration: none;
    padding: 3px 2px;
    border-bottom: 2px solid transparent;
  }
  .site-nav-link:hover { color: var(--text); }
  .site-nav-link.is-active {
    color: var(--ember);
    border-bottom-color: var(--ember);
    font-weight: 600;
  }
  .site-nav-count { color: var(--text-muted); font-size: 0.75rem; }

  /* ---------- index: place listing ---------- */
  .place-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-top: 28px;
  }
  .place-card {
    position: relative;
    display: block;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 3px;
    text-decoration: none;
    /* no padding here — .place-card-body owns all of it, so its percentage
       left-padding measures against the same width the bg image/fade use */
  }
  .place-card:hover { border-color: var(--ember); }
  .place-card.has-image { min-height: 150px; }
  .place-card-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 55%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    z-index: 0;
  }
  .place-card-fade {
    position: absolute;
    top: 0;
    left: 0;
    width: 55%;
    height: 100%;
    background: linear-gradient(to right, transparent 0%, transparent 71%, var(--surface) 85%);
    z-index: 1;
  }
  .place-card-body { position: relative; z-index: 2; padding: 20px 22px 22px; }
  .place-card.has-image .place-card-body { padding-left: 58%; }
  .place-card-type {
    font-family: var(--font-mono);
    font-size: 0.65rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ember);
  }
  .place-card-name {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 1.3rem;
    margin: 8px 0 6px;
    color: var(--text);
  }
  .place-card-desc {
    font-family: var(--font-serif);
    font-size: 0.92rem;
    color: var(--text);
    margin: 0 0 10px;
  }
  .place-card-meta {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-muted);
  }
  .empty-state {
    font-family: var(--font-serif);
    font-style: italic;
    color: var(--text-muted);
    padding: 40px 0;
    text-align: center;
  }

  /* ---------- page-intro (index page header text) ---------- */
  .page-intro {
    margin-top: 24px;
    max-width: 640px;
    font-size: 1rem;
  }

  /* ---------- item page (standalone single-content-row page) ---------- */
  .wrap-narrow { max-width: 860px; margin: 0 auto; padding: 0 20px; }

  .item-back {
    display: inline-block;
    margin: 18px 0 10px;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
  }
  .item-back:hover { color: var(--ember); }

  .item-hero { background: #000; max-width: 860px; margin: 0 auto; }
  .item-hero img { width: 100%; display: block; }

  .item-title {
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: clamp(1.4rem, 2.8vw, 2rem);
    letter-spacing: -0.01em;
    margin: 22px 0 6px;
  }
  .item-tag {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ember);
  }
  .item-desc {
    font-size: 1.05rem;
    margin: 14px 0 20px;
    max-width: 640px;
  }
  .item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 28px;
    padding: 16px 20px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    margin-bottom: 30px;
  }
  .item-meta span { color: var(--text-muted); }
  .item-meta a { color: var(--text); font-weight: 600; }
  .item-pending-note {
    padding: 40px 20px;
    text-align: center;
    font-family: var(--font-serif);
    font-style: italic;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: 3px;
    margin-bottom: 20px;
  }

  /* ---------- cross-page jump targets (place.php cards ⇄ item.php back-links) ---------- */
  .hero, .camcard, .card { scroll-margin-top: 16px; }
  :target { animation: lo-target-flash 1.6s ease; }
  @keyframes lo-target-flash {
    0%   { outline: 3px solid var(--ember); outline-offset: 2px; }
    100% { outline: 3px solid transparent; outline-offset: 2px; }
  }

  /* ---------- site footer (nav + network cross-links) ---------- */
  .site-footer {
    margin-top: 48px;
    background: var(--surface);
    border-top: 1px solid var(--border);
  }
  .site-footer-inner {
    padding: 22px 0 26px;
    display: flex;
    flex-direction: column;
    gap: 16px;
  }
  .footer-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 4px 20px;
  }
  .footer-nav-link {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
    text-decoration: none;
  }
  .footer-nav-link:hover { color: var(--ember); }
  .footer-nav-link.is-active { color: var(--ember); font-weight: 600; }
  .footer-network {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 6px 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    font-family: var(--font-mono);
    font-size: 0.78rem;
  }
  .footer-network-label {
    color: var(--text-muted);
    letter-spacing: 0.03em;
  }
  .footer-network a { color: var(--text); font-weight: 600; text-decoration: none; }
  .footer-network a:hover { color: var(--ember); }