  /* ------------------------------------------------------------------
     smw.org - single self-contained file.
     The ONLY external calls are the IP-echo lookups in the script at
     the bottom (ipify, with icanhazip as fallback). Everything visual
     is inline CSS + inline SVG, no asset fetches.
  ------------------------------------------------------------------ */

  :root {
    /* Sky is clamped: the top ~60% (--sky-top -> --sky-mid) is the "content
       band" and stays dark enough for white text to clear WCAG AA; the pale
       --sky-low + glow only appear in the bottom strip, behind the fixed
       skyline, where no text sits. See the contrast audit. */
    --sky-top: #2b5e92;
    --sky-mid: #3a76b0;
    --sky-low: #dceaf5;
    --glow:    #fff4d6;

    --peak-far:  #b9cbdd;
    --peak-mid:  #8fa9c4;
    --peak-near: #5c7c9c;

    /* navy-tinted frosted glass: dark enough that white text on it passes,
       still reads as translucent glass over the sky */
    --panel:        rgba(18, 42, 74, 0.30);
    --panel-brd:    rgba(255, 255, 255, 0.30);
    --plank:        rgba(18, 42, 74, 0.32);
    --plank-brd:    rgba(255, 255, 255, 0.28);

    --ink:      #ffffff;
    /* hierarchy comes from size/weight, not from fading text toward the bg */
    --ink-soft: rgba(255, 255, 255, 0.92);
    --ink-dim:  rgba(255, 255, 255, 0.82);
    --shadow:   rgba(12, 26, 44, 0.5);

    --accent:   #ffd27a;
    --accent-2: #cfe8ff;
    --danger:   #ff8a76;   /* severe-weather + civil/public-safety alerts */

    --mono: "SF Mono", ui-monospace, "Cascadia Code", "Cascadia Mono",
            "Consolas", "Roboto Mono", monospace;
    --sans: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  }

  @media (prefers-color-scheme: dark) {
    :root {
      --sky-top: #101a30;
      --sky-mid: #2c3e63;
      --sky-low: #241f38;
      --glow:    #b9886a;

      --peak-far:  #33445f;
      --peak-mid:  #24334c;
      --peak-near: #161f30;

      --panel:     rgba(12, 18, 32, 0.5);
      --panel-brd: rgba(255, 255, 255, 0.16);
      --plank:     rgba(10, 16, 28, 0.46);
      --plank-brd: rgba(255, 255, 255, 0.14);

      --ink:      #f3f6fd;
      --ink-soft: rgba(243, 246, 253, 0.88);
      --ink-dim:  rgba(243, 246, 253, 0.76);
      --shadow:   rgba(0, 0, 0, 0.55);
      --danger:   #ff9b8a;
    }
  }

  * { box-sizing: border-box; }

  html { scroll-behavior: smooth; }

  body {
    margin: 0;
    min-height: 100%;
    font-family: var(--sans);
    color: var(--ink);
    background: var(--sky-mid);
  }

  /* --- fixed backdrop: sky + clouds + skyline --------------------- */
  .backdrop {
    position: fixed;
    inset: 0;
    z-index: -1;
    overflow: hidden;
    background:
      radial-gradient(80% 34% at 50% 118%, var(--glow) 0%, transparent 62%),
      linear-gradient(to bottom,
        var(--sky-top) 0%,
        var(--sky-mid) 60%,
        #6fa6d6 77%,
        var(--sky-low) 100%);
  }
  @media (prefers-color-scheme: dark) {
    .backdrop {
      background:
        radial-gradient(80% 34% at 50% 118%, var(--glow) 0%, transparent 62%),
        linear-gradient(to bottom,
          var(--sky-top) 0%,
          var(--sky-mid) 62%,
          #3a3350 80%,
          var(--sky-low) 100%);
    }
  }

  .stars {
    position: absolute;
    inset: 0;
    opacity: 0;
    background-image:
      radial-gradient(1.4px 1.4px at 20% 18%, #fff, transparent),
      radial-gradient(1.2px 1.2px at 68% 12%, #fff, transparent),
      radial-gradient(1.6px 1.6px at 82% 28%, #fff, transparent),
      radial-gradient(1px 1px at 42% 34%, #fff, transparent),
      radial-gradient(1.3px 1.3px at 12% 46%, #fff, transparent),
      radial-gradient(1px 1px at 55% 24%, #fff, transparent),
      radial-gradient(1.5px 1.5px at 91% 8%, #fff, transparent),
      radial-gradient(1px 1px at 33% 8%, #fff, transparent);
  }
  @media (prefers-color-scheme: dark) { .stars { opacity: 0.9; } }

  .cloud {
    position: absolute;
    background: #fff;
    border-radius: 999px;
    opacity: 0.9;
    filter: blur(0.5px);
    will-change: transform;
  }
  @media (prefers-color-scheme: dark) { .cloud { opacity: 0.28; } }

  .cloud::before, .cloud::after {
    content: "";
    position: absolute;
    background: inherit;
    border-radius: 999px;
  }
  .cloud-1 { width: 180px; height: 46px; top: 12%; left: 8%;  animation: drift 90s ease-in-out infinite alternate; }
  .cloud-1::before { width: 90px; height: 90px; top: -45px; left: 20px; }
  .cloud-1::after  { width: 70px; height: 70px; top: -30px; left: 100px; }

  .cloud-2 { width: 140px; height: 36px; top: 22%; right: 12%; opacity: 0.8; animation: drift 70s ease-in-out infinite alternate-reverse; }
  .cloud-2::before { width: 70px; height: 70px; top: -34px; left: 15px; }
  .cloud-2::after  { width: 55px; height: 55px; top: -22px; left: 78px; }

  .cloud-3 { width: 110px; height: 30px; top: 7%; left: 54%; opacity: 0.75; animation: drift 110s ease-in-out infinite alternate; }
  .cloud-3::before { width: 55px; height: 55px; top: -26px; left: 12px; }
  .cloud-3::after  { width: 42px; height: 42px; top: -16px; left: 60px; }

  @keyframes drift {
    from { transform: translateX(-6vw); }
    to   { transform: translateX(6vw); }
  }

  .skyline {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 44vh;
    min-height: 220px;
    line-height: 0;
  }

  /* --- content -------------------------------------------------- */
  /* main is a wrapping flex row, not a column: every direct child
     (panels, .home-grid, the hero, the closing site-summary strip)
     defaults to a full-width "row" of its own via flex-basis: 100%, so
     visually it still reads as a stack - `order` on each panel places
     it same as before. The only thing that opts a panel OUT of that
     full-width row is `.panel-half` (below), which lets two adjacent
     half panels share a row on wide viewports. align-items: flex-start
     (not stretch) so a short panel next to a tall one doesn't get
     force-stretched, matching .home-grid's own align-items: start. */
  main {
    max-width: 900px;
    margin: 0 auto;
    padding: clamp(3rem, 12vh, 8rem) 20px 26vh;
    display: flex;
    flex-flow: row wrap;
    align-items: flex-start;
    gap: 22px;
  }
  main > * {
    flex: 1 1 100%;
    min-width: 0;
  }
  @media (max-width: 560px) {
    main { padding: clamp(2rem, 9vh, 5rem) 16px 15vh; gap: 18px; }
    .skyline { height: 34vh; }
    .panel { padding: 18px 16px 16px; }
    .wx-temp { font-size: 2.2rem; }
  }

  /* weather spans full width; position + waypoints sit below, side by side */
  .home-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 22px;
    align-items: start;
  }
  @media (max-width: 720px) {
    .home-grid { grid-template-columns: 1fr; }
  }

  /* --- admin-controlled half-width panels -----------------------
     Opt-in per panel via settings.json panelWidth (layout.js toggles
     this class). Same breakpoint as .home-grid above: side by side at
     >=720px, full-width stacked below it. Two adjacent .panel-half
     panels share a flex row; an odd one out just sits alone at half
     width, which is an acceptable edge case for an admin-chosen layout. */
  .panel-half {
    flex: 1 1 100%;
  }
  @media (min-width: 720px) {
    .panel-half {
      flex: 1 1 calc(50% - 11px);
    }
  }


  .hero {
    text-align: center;
    margin-bottom: 6px;
  }
  .hero h1 {
    margin: 0;
    font-size: clamp(2.4rem, 9vw, 4.5rem);
    font-weight: 700;
    letter-spacing: -0.03em;
    text-shadow: 0 2px 22px var(--shadow);
  }
  .hero .tag {
    margin: 0.5rem 0 0;
    font-size: clamp(0.85rem, 2.4vw, 1.05rem);
    color: var(--ink); /* primary copy over bare sky - full white to clear AA */
    text-shadow: 0 1px 10px var(--shadow);
    letter-spacing: 0.01em;
  }

  .panel {
    background: var(--panel);
    border: 1px solid var(--panel-brd);
    border-radius: 20px;
    padding: 22px 22px 20px;
    -webkit-backdrop-filter: blur(16px) saturate(130%);
    backdrop-filter: blur(16px) saturate(130%);
    box-shadow: 0 12px 40px -18px var(--shadow);
    animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) backwards;
  }
  .home-grid > .panel { animation-delay: 0.08s; }
  .home-grid > .panel:nth-child(2) { animation-delay: 0.14s; }

  @keyframes rise {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
  }

  .panel h2 {
    margin: 0 0 14px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    color: var(--ink-soft);
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px 9px;
  }
  .panel h2 .dot {
    width: 7px; height: 7px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent);
  }

  .status {
    margin: 12px 4px 0;
    font: 400 0.78rem/1.4 var(--mono);
    color: var(--ink-dim);
  }
  .status::before { content: "› "; color: var(--accent); }
  .status.err { color: var(--danger); }

  /* "site summary" - the closing strip: what this page does, how it's
     built, and the utility links. Stays pinned last even when the admin
     reorders the panels (layout.js only touches [data-panel] children). */
  .hero { order: -1; }
  .site-summary {
    order: 999;
    margin-top: 6px;
    text-align: center;
    font: 400 0.72rem/1.5 var(--mono);
    color: var(--ink-dim);
    /* the lowest content and closest to the pale strip, so it gets its
       own surface rather than relying on the sky behind it */
    padding: 13px 18px;
    border-radius: 14px;
    background: rgba(14, 33, 58, 0.44);
    border: 1px solid rgba(255, 255, 255, 0.14);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
  }
  .site-summary a { color: var(--ink-soft); }
  .site-summary .ss-features { margin: 0; color: var(--ink-soft); }
  .site-summary .ss-meta { margin: 6px 0 0; font-size: 0.66rem; color: var(--ink-dim); }
  .edit-link {
    color: var(--ink-soft);
    text-decoration: none;
    border-bottom: 1px dotted currentColor;
  }
  .edit-link:hover { color: var(--ink); }

  /* --- position lens ---------------------------------------- */
  h2 .lens-btn {
    margin-left: 8px;
    width: 22px; height: 22px;
    padding: 3px;
    vertical-align: -5px;
    color: var(--ink-soft);
    background: transparent;
    border: 1px solid var(--panel-brd);
    border-radius: 6px;
    cursor: pointer;
  }
  h2 .lens-btn { margin-left: 0; }
  h2 .lens-btn svg { width: 100%; height: 100%; display: block; }
  h2 .lens-btn:hover { color: var(--ink); border-color: var(--accent); }
  h2 .lens-btn:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
  h2 .lens-btn-alert {
    color: #ff9d3d;
    border-color: color-mix(in srgb, #ff9d3d 45%, var(--panel-brd));
  }
  h2 .lens-btn-alert::after {
    content: "";
    position: absolute;
    inset: -3px;
    border-radius: 8px;
    border: 1px solid #ff9d3d;
    opacity: 0;
    animation: lensAlertPing 3.4s ease-out infinite;
  }
  h2 .lens-btn-alert { position: relative; }
  h2 .lens-btn-alert:hover { color: #ffb454; border-color: #ff9d3d; }
  @keyframes lensAlertPing { 0% { transform: scale(0.8); opacity: 0.6; } 70%,100% { transform: scale(1.5); opacity: 0; } }
  @media (prefers-reduced-motion: reduce) { h2 .lens-btn-alert::after { animation: none; } }

  @media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .cloud { animation: none; }
    .panel { animation: none; }
  }
