:root {
    --bg:         #111111;
    --panel:      #1e1e1e;
    --win-bg:     #1a1a2e;
    --border-lo:  #222244;
    --border-hi:  #6666cc;
    --accent:     #4444bb;
    --green:      #a8d8ae;
    --green-dim:  #65be94;
    --blue-link:  #7799ff;
    --blue-hover: #aabbff;
    --white:      #dddddd;
    --mono:       'Courier New', Courier, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--mono);
    background-color: var(--bg);
    color: var(--green);
    line-height: 1.6;
    min-height: 100vh;
}

a { color: var(--blue-link); text-decoration: none; }
a:hover { color: var(--blue-hover); }

img { max-width: 100%; display: block; }

/* ── WINDOW CHROME utility ─────────────────────────────────────
    Reused on header, cards, footer. Mimics Mac OS raised window.
───────────────────────────────────────────────────────────────── */
.win {
    background-color: var(--win-bg);
    border: 2px ridge var(--border-hi);
    box-shadow:
    inset 1px 1px 0 var(--border-hi),
    inset -1px -1px 0 var(--border-lo),
    2px 2px 6px rgba(0,0,0,0.6);
}

.win-title-bar {
    background: linear-gradient(90deg, #333388 0%, #222266 50%, #333388 100%);
    padding: 3px 8px;
    font-size: 0.7rem;
    font-weight: bold;
    letter-spacing: 0.08em;
    color: #ccccff;
    border-bottom: 1px solid var(--border-lo);
    display: flex;
    align-items: center;
    gap: 6px;
    user-select: none;
}

.win-title-bar .dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    border: 1px solid rgba(0,0,0,0.4);
    flex-shrink: 0;
}
.dot-close  { background: #cc4444; }
.dot-min    { background: #ccaa00; }
.dot-max    { background: #44aa44; }
.dot-there  { background: #00ffd9; }

/* ── BEGIN HEADER ──────────────────────────────────────────────── */
.site-header {
    position: fixed;
    top: 0; left: 0; right: 0;
    z-index: 1000;
    background: var(--bg);
    padding: 6px 12px 8px;
}

.header-win {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    padding: 0 10px;
    min-height: 42px;
    gap: 8px;
}

/* Clock — left column */
#clock {
    font-family: var(--mono);
    font-size: 0.72rem;
    color: var(--green);
    white-space: nowrap;
    letter-spacing: 0.04em;
}

/* Site name — center column */
.site-name {
    font-family: var(--mono);
    font-size: 1rem;
    font-weight: bold;
    letter-spacing: 0.12em;
    color: #aabbff;
    text-align: center;
    white-space: nowrap;
    text-transform: uppercase;
}

/* Nav — right column */
.header-nav {
    display: flex;
    justify-content: flex-end;
    gap: 0;
}

.header-nav a {
    font-family: var(--mono);
    font-size: 0.72rem;
    font-weight: bold;
    letter-spacing: 0.08em;
    color: var(--green-dim);
    padding: 6px 10px;
    border-left: 1px solid var(--border-lo);
    transition: background 0.15s, color 0.15s;
}
.header-nav a:first-child { border-left: none; }
.header-nav a:hover {
    background: rgba(100,100,200,0.15);
    color: var(--blue-hover);
}

/* Mobile hamburger (hidden on desktop) */
.nav-toggle {
    display: none;
    background: none;
    border: 1px solid var(--border-hi);
    color: var(--green);
    font-family: var(--mono);
    font-size: 0.8rem;
    padding: 4px 8px;
    cursor: pointer;
}
/* ── END HEADER ──────────────────────────────────────────────── */

/* ── MAIN CONTENT ──────────────────────────────────────────────── */
.site-content {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 16px 48px;
    /* Push below fixed header — adjusted in JS for exactness */
    padding-top: 90px;
}

/* ── HERO ──────────────────────────────────────────────────────── */
.hero {
    text-align: center;
    padding: 28px 0 20px;
}

.hero h1 {
    font-family: var(--mono);
    font-size: clamp(1.1rem, 4vw, 1.8rem);
    font-weight: bold;
    letter-spacing: 0.06em;
    color: #ff9944;
    text-decoration: underline;
    line-height: 1.35;
}

.hero h1 a { color: inherit; }
.hero h1 a:hover { color: #ffbb77; }

/* ── SERVICE CARDS ─────────────────────────────────────────────── */
.services-section { padding: 10px 0 30px; }

.services-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.service-card {
    border-radius: 6px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.service-card:hover {
    transform: translateY(-6px);
    box-shadow:
    inset 1px 1px 0 var(--border-hi),
    inset -1px -1px 0 var(--border-lo),
    4px 8px 16px rgba(0,0,80,0.5);
}

.card-image {
    width: 100%;
    height: 190px;
    background-color: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.card-image img {
    max-height: 160px;
    max-width: 90%;
    object-fit: contain;
    margin: auto;
}

.card-content {
    padding: 16px 20px 18px;
    border-top: 1px solid var(--border-lo);
}

.card-title {
    font-family: var(--mono);
    font-size: 0.95rem;
    font-weight: bold;
    letter-spacing: 0.1em;
    color: var(--green);
}

/* ── BEGIN FOOTER ──────────────────────────────────────────────── */
.site-footer {
    background: var(--bg);
    padding: 8px 12px 12px;
    margin-top: 10px;
}

.footer-win {
    padding: 12px 16px;
}

.footer-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 12px;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    list-style: none;
}

.footer-links li a {
    font-family: var(--mono);
    font-size: 0.72rem;
    letter-spacing: 0.06em;
    color: var(--green-dim);
    padding: 4px 10px;
    border-right: 1px solid var(--border-lo);
    display: block;
}
.footer-links li:last-child a { border-right: none; }
.footer-links li a:hover { color: var(--blue-hover); }

.social-icons {
    display: flex;
    gap: 12px;
    align-items: center;
}

.social-icons a img {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    opacity: 0.75;
    transition: opacity 0.15s;
}
.social-icons a:hover img { opacity: 1; }

.footer-copy {
    font-size: 0.65rem;
    color: var(--border-hi);
    letter-spacing: 0.06em;
    text-align: center;
    margin-top: 10px;
    border-top: 1px solid var(--border-lo);
    padding-top: 8px;
}
/* ── END FOOTER ──────────────────────────────────────────────── */

/* ─────────────────────────────────────────────────────────────────
    RESPONSIVE
───────────────────────────────────────────────────────────────── */
@media (max-width: 700px) {
    .header-win {
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    padding: 6px 8px;
    gap: 4px;
    }

    /* Clock top-left, hamburger top-right */
    #clock       { grid-column: 1; grid-row: 1; font-size: 0.65rem; }
    .nav-toggle  { grid-column: 2; grid-row: 1; display: block; }

    /* Site name spans full width below */
    .site-name   {
    grid-column: 1 / -1;
    grid-row: 2;
    font-size: 0.85rem;
    text-align: left;
    letter-spacing: 0.08em;
    }

    /* Nav hidden by default on mobile, shown when .open */
    .header-nav {
    grid-column: 1 / -1;
    grid-row: 3;
    flex-direction: column;
    gap: 0;
    display: none;
    border-top: 1px solid var(--border-lo);
    margin-top: 4px;
    }
    .header-nav.open { display: flex; }
    .header-nav a {
    border-left: none;
    border-top: 1px solid var(--border-lo);
    padding: 8px 6px;
    font-size: 0.8rem;
    }
    .header-nav a:first-child { border-top: none; }

    .site-content { padding-top: 100px; }

    .hero { padding: 16px 0 12px; }
    .hero h1 { font-size: clamp(1rem, 5.5vw, 1.4rem); }

    .services-grid {
    grid-template-columns: 1fr;
    gap: 18px;
    }

    .service-card { width: 100%; }
    .card-image { height: 150px; }

    .footer-inner { flex-direction: column; align-items: flex-start; gap: 10px; }
    .footer-links { flex-wrap: wrap; }
}

@media (min-width: 701px) and (max-width: 960px) {
    .services-grid {
    grid-template-columns: repeat(2, 1fr);
    }
}

/* Subtle scanline overlay for that monitor feel */
body::after {
    content: '';
    position: fixed;
    inset: 0;
    background: repeating-linear-gradient(
    to bottom,
    transparent 0px,
    transparent 3px,
    rgba(0,0,0,0.06) 3px,
    rgba(0,0,0,0.06) 4px
    );
    pointer-events: none;
    z-index: 9999;
}

/* ================================================================
   PATCH: Add to the bottom of the_style.css
   ================================================================ */


/* ================================================================
   PRINT STYLES
   Tested against Firefox "Print to PDF" and physical printers.
   Goals: white background, black text, no wasted ink on chrome,
   URLs printed after links so offline readers can follow sources.
   ================================================================ */

@media print {

  /* ── Reset colors ─────────────────────────────────────────── */
  *,
  *::before,
  *::after {
    background: #fff !important;
    color: #000 !important;
    box-shadow: none !important;
    text-shadow: none !important;
    border-color: #ccc !important;
  }

  /* ── Hide chrome — don't waste ink ───────────────────────── */
  .site-header,
  .site-footer,
  .article-footer,
  .share-row,
  .newsletter-nudge,
  .hero-terminal,
  .services-section,
  .nav-toggle,
  .header-nav,
  .win-title-bar {
    display: none !important;
  }

  /* ── Remove fixed header from print layout ────────────────── */
  .site-content {
    padding-top: 0 !important;
    margin: 0 !important;
    max-width: 100% !important;
  }

  /* ── Article layout ───────────────────────────────────────── */
  .article-page {
    max-width: 100% !important;
  }

  .article-header {
    border: none !important;
    border-bottom: 2px solid #000 !important;
    border-radius: 0 !important;
    margin-bottom: 1.5rem !important;
    padding-bottom: 0.5rem !important;
  }

  .article-header-body {
    padding: 0 0 1rem 0 !important;
  }

  .article-title {
    font-size: 1.6rem !important;
    font-weight: bold !important;
    color: #000 !important;
    line-height: 1.3 !important;
    margin-bottom: 0.5rem !important;
  }

  .article-preview {
    font-style: italic !important;
    color: #444 !important;
    font-size: 0.95rem !important;
  }

  .article-section-label {
    font-size: 0.65rem !important;
    letter-spacing: 0.12em !important;
    color: #666 !important;
  }

  .article-body {
    font-size: 11pt !important;
    line-height: 1.7 !important;
    color: #000 !important;
  }

  .article-body p { margin-bottom: 0.8rem !important; }

  .article-body h2 {
    font-size: 1rem !important;
    font-weight: bold !important;
    border-bottom: 1px solid #999 !important;
    color: #000 !important;
    page-break-after: avoid !important;
  }

  /* ── Resource boxes ─────────────────────────────────────── */
  .resource-box,
  .article-note {
    border: 1px solid #999 !important;
    border-radius: 0 !important;
    page-break-inside: avoid !important;
  }

  .resource-box-body { padding: 10px 14px !important; }
  .resource-box-body h3 { color: #333 !important; }

  /* ── Tags ────────────────────────────────────────────────── */
  .tag {
    border: 1px solid #999 !important;
    color: #333 !important;
    padding: 1px 4px !important;
    font-size: 0.65rem !important;
  }

  /* ── Print URLs after links ──────────────────────────────── */
  /* Lets offline readers follow sources */
  .article-body a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.75em;
    color: #555 !important;
    word-break: break-all;
  }
  /* Don't print URL for anchor-only links */
  .article-body a[href^="#"]::after { content: "" !important; }

  /* ── Page break hints ────────────────────────────────────── */
  h1, h2, h3 { page-break-after: avoid; }
  .resource-box { page-break-inside: avoid; }
  img { page-break-inside: avoid; max-width: 100% !important; }

  /* ── Scanline overlay — kill it for print ────────────────── */
  body::after { display: none !important; }

  /* ── Footer credit (replaces full site footer) ───────────── */
  .article-page::after {
    content: "peoplesinfrastructure.org";
    display: block;
    margin-top: 2rem;
    padding-top: 0.5rem;
    border-top: 1px solid #ccc;
    font-size: 0.75rem;
    color: #666 !important;
    background: #fff !important;
  }
}


/* ================================================================
   LIGHT THEME (follows OS/browser preference automatically)
   No JavaScript, no cookies required.
   Add this after the print block.
   ================================================================ */

@media (prefers-color-scheme: light) {
  :root {
    --bg:        #f4f4f0;
    --input-bg:  #ffffff;
    --panel:     #ffffff;
    --win-bg:    #f0f0f8;
    --border-lo: #bbbbcc;
    --border-hi: #5555aa;
    --accent:    #3333aa;
    --green:     #1a3a1a;
    --green-dim: #3a5a3a;
    --blue-link: #0033cc;
    --blue-hover:#0055ff;
    --white:     #111111;
    --mono:      'Courier New', Courier, monospace;
  }

  /* Title bar gradient inverted */
  .win-title-bar {
    background: linear-gradient(90deg, #aaaadd 0%, #8888bb 50%, #aaaadd 100%) !important;
    color: #222244 !important;
  }

  /* Scanline — much lighter in light mode */
  body::after {
    background: repeating-linear-gradient(
      to bottom,
      transparent 0px, transparent 3px,
      rgba(0,0,0,0.02) 3px, rgba(0,0,0,0.02) 4px
    ) !important;
  }

  /* Links */
  a { color: var(--blue-link); }
  a:hover { color: var(--blue-hover); }

  /* Hero terminal cursor */
  .cursor { color: var(--green); }
  .hero-title { color: #cc5500 !important; }
  .hero-title:hover { color: #aa3300 !important; }

  /* ── Newsletter form — light theme overrides ───────────────── */
  .nl-field input[type="email"],
  .nl-field input[type="text"] {
    background-color: #ffffff;
    border-color: var(--border-hi) !important;
    color: #111111 !important;
  }
  .nl-field input::placeholder {
    color: #666688 !important;
    opacity: 1 !important;
  }
  .nl-field label {
    color: var(--green-dim) !important;
  }
  .nl-submit {
    color: var(--accent) !important;
    border-color: var(--border-hi) !important;
  }
  .nl-archive-link {
    color: var(--green-dim) !important;
  }
}
