/* ===============================================================================
   Stylesheet: style.css
   Purpose:    Layout and styling for the LAVO NEPA initiation tool. One page:
               a fixed-width form panel beside a map that fills the rest of the
               viewport, collapsing to a stacked layout on narrow screens.
   Author:     Jamie F. Weleber
   Created:    July 8, 2026
   =============================================================================== */

/* Color palette — National Park Service greens with warm off-white paper.
   Chosen to read as an NPS document rather than a generic web form. */
:root {
    --nps-green: #1e4b2d;         /* header band, primary actions, section rules */
    --nps-green-dark: #163a22;    /* hover state for the green */
    --paper: #f7f6f1;             /* page background — slightly warm, not stark white */
    --panel: #ffffff;             /* form panel surface */
    --border: #d9d7cd;            /* hairline borders against the warm paper */
    --text: #22261f;              /* body text — near-black with a green tint */
    --text-muted: #6b6f66;        /* hints, placeholders, secondary labels */
    --danger: #b23b2e;            /* validation/error messaging */
}

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

body {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    background: var(--paper);
    color: var(--text);
    /* Full-height flex column so the map area can consume all leftover space
       below the fixed header without a calc() height hack. */
    display: flex;
    flex-direction: column;
    height: 100vh;
    overflow: hidden;
}

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
    background: var(--nps-green);
    color: #fff;
    flex-shrink: 0;   /* header keeps its height; the map area flexes instead */
}
.header-inner {
    padding: 12px 20px;
    display: flex;
    align-items: baseline;
    gap: 14px;
    flex-wrap: wrap;
}
.site-header h1 { font-size: 18px; font-weight: 700; }
.site-header h1 a { color: #fff; text-decoration: none; }
.header-sub {
    font-size: 12px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.8);
}

/* ============================================================
   INTRO MODAL
   Full-screen overlay + centered card shown on load. .hidden is
   toggled by app.js to dismiss it.
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;   /* above the header and the Leaflet controls */
    padding: 20px;
}
.modal-overlay.hidden { display: none; }
.modal-card {
    background: var(--panel);
    max-width: 560px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;   /* scroll on very short screens rather than clip */
    border-radius: 8px;
    padding: 26px 30px;
    box-shadow: 0 14px 44px rgba(0, 0, 0, 0.35);
}
.modal-card h2 { color: var(--nps-green); font-size: 20px; margin-bottom: 14px; }
.modal-card p { margin-bottom: 12px; line-height: 1.55; font-size: 14px; }
.modal-card ul { margin: 0 0 12px 22px; }
.modal-card li { margin-bottom: 6px; line-height: 1.5; font-size: 14px; }
/* The no-save warning gets an amber highlight + orange rule so it reads as the
   one thing not to skip — echoing the accent used for map geometry. */
.modal-warn {
    background: #fff4e5;
    border-left: 4px solid #f57c00;
    padding: 12px 14px;
    border-radius: 4px;
}
.modal-card #intro-dismiss {
    margin-top: 6px;
    background: var(--nps-green);
    color: #fff;
    border: none;
    border-radius: 5px;
    padding: 11px 22px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.modal-card #intro-dismiss:hover { background: var(--nps-green-dark); }

/* ============================================================
   LAYOUT — form panel + map
   Flexbox split: the form is a fixed 420px column, the map takes
   the rest. flex-shrink:0 on the form stops it collapsing when the
   map's min-width would otherwise squeeze it.
   ============================================================ */
.site-main { flex: 1; min-height: 0; }   /* min-height:0 lets the child flex scroll */
.app-layout {
    display: flex;
    height: 100%;
}
.form-panel {
    width: 420px;
    flex-shrink: 0;
    background: var(--panel);
    border-right: 1px solid var(--border);
    overflow-y: auto;   /* long forms scroll independently of the map */
    padding: 20px;
}
.map-panel { flex: 1; min-width: 0; }
#map { height: 100%; width: 100%; }

/* ============================================================
   FORM CONTROLS
   ============================================================ */
.field { margin-bottom: 18px; }
.field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}
.field .req { color: var(--danger); }
.field input,
.field textarea,
.field select {
    width: 100%;
    padding: 9px 11px;
    border: 1px solid var(--border);
    border-radius: 5px;
    font: inherit;
    font-size: 14px;
    background: #fff;
    color: var(--text);
    resize: vertical;   /* textareas grow vertically only, never break layout width */
}
.field input:focus,
.field textarea:focus,
.field select:focus {
    outline: none;
    border-color: var(--nps-green);
    box-shadow: 0 0 0 3px rgba(30, 75, 45, 0.12);
}
.field input::placeholder,
.field textarea::placeholder { color: var(--text-muted); }

/* Guidance text under a field (e.g. the Purpose & Need explainer). Sits between
   the label and the control, muted so it reads as help, not content. */
.field-help {
    font-size: 12px;
    line-height: 1.45;
    color: var(--text-muted);
    margin: -2px 0 7px;
}

/* Fieldsets group related inputs (Project Information / narratives / screening).
   The default browser fieldset border is heavy, so soften it and lift the legend
   into an NPS-green section label. */
.field-group {
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 14px 16px 2px;
    margin-bottom: 20px;
}
.field-group legend {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--nps-green);
    padding: 0 6px;
}

.actions { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
#generate-btn {
    background: var(--nps-green);
    color: #fff;
    border: none;
    border-radius: 5px;
    padding: 11px 20px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
#generate-btn:hover { background: var(--nps-green-dark); }
/* Disabled state during generation so the user can't double-submit while the
   server is building the packet. */
#generate-btn:disabled { opacity: 0.6; cursor: default; }

.status { font-size: 13px; color: var(--text-muted); }
.status.error { color: var(--danger); }
.status.busy { color: var(--nps-green); }

.hint {
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-muted);
    border-top: 1px solid var(--border);
    padding-top: 14px;
}

/* ============================================================
   RESPONSIVE — stack the panel above the map on narrow screens.
   Below 760px the side-by-side split stops making sense, so switch
   to a vertical layout and give the map a fixed height. We also
   release the body's overflow lock so the page can scroll.
   ============================================================ */
@media (max-width: 760px) {
    body { overflow: auto; height: auto; }
    .app-layout { flex-direction: column; height: auto; }
    .form-panel { width: 100%; border-right: none; border-bottom: 1px solid var(--border); }
    /* flex:none is essential here: the base rule sets flex:1 (flex-basis:0%),
       and in a column flex container an explicit height loses to a 0% basis —
       the panel would collapse to 0. Resetting flex lets height:60vh win. */
    .map-panel { flex: none; height: 60vh; }
}
