/* site.css - clientprism site stylesheet (Sigercon)
 *
 * One file for every page. Replaces the legacy default.css, custom01.css, custom02.css and imp.css
 * (originals in ~Claude\zOrig) and, once the pages link it, site-header.css.
 * Built 2026-11-04 from site-header.css plus the Keep list in css-consolidation-plan.md.
 *
 * Rules:
 *  - Colours, fonts, radii and spacing come from the tokens in @layer tokens - no hard-coded colours below.
 *  - No background images for bands or gradients (only the file-type icons in images/).
 *  - Everything sits in a cascade layer, so unlayered vendor CSS (phpGrid / jQuery UI theme)
 *    always wins over these rules and can never be overridden by accident.
 *  - No slider plugin: the parcel photo / map strip is CSS scroll-snap ("Image section"; FlexSlider retired 2026-11-04).
 *  - The include markup uses the shared component classes (.btn, .btn-outline, .scroll-x, .datatable,
 *    .num, .totalrow, .msg-error / .msg-ok / .msg-empty) - re-classed 2026-11-04 (migration step 2), so the
 *    per-section aliases (.yearmenu-btn, .tax-num, .value-msg, ...) are gone. log.php uses .login-form +
 *    .btn / .msg-error / .msg-ok and page_init.php fail_page() uses .msg-error + .page-msg since step 5
 *    (both inline <style> blocks are gone) - no aliases are left.
 */

@layer reset, tokens, base, layout, components, sections, print;

/* ======================================================================== reset */
@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  body { margin: 0; }
  img, svg, video, canvas { max-width: 100%; height: auto; }
  img { border: 0; }
  table { border-collapse: collapse; }
  button, input, select, textarea { font: inherit; }
}

/* ======================================================================== tokens */
@layer tokens {
  :root {
    /* Colours */
    --brand: #1f5fa8;          /* site blue - buttons, links */
    --brand-dark: #1a4f8b;     /* hover, borders */
    --brand-tint: #e5f2f8;     /* hover fill, current year */
    --title: #000066;          /* section headings, document title */
    --text: #333;
    --text-strong: #000;
    --bg: #fff;
    --on-brand: #fff;          /* text on brand-blue buttons */
    --input-border: #8a8a8a;
    --muted: #6c757d;
    --border: #c3c8cd;
    --border-light: #ddd;
    --rule: #000;              /* table head / total rules */
    --row-rule: #ccc;          /* rule between note rows */
    --table-head-bg: #f3f3f3;  /* .datatable column headings (from default.css th) */
    --disabled-bg: #e9ecef;
    --error: #8a1c13;  --error-bg: #fdecea;  --error-border: #f5c2bd;
    --ok: #1b5e20;     --ok-bg: #e8f5e9;     --ok-border: #c8e6c9;
    --footer-bg: #eee; --footer-text: #666;  /* #777 of default.css failed AA contrast on #eee */
    --focus: #1a73e8;

    /* Type */
    --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-size: 14px;         /* legacy body was 70% Verdana (about 11px) */
    --line: 1.4;

    /* Shape and space */
    --radius: 4px;
    --space: .75rem;
    --page-max: 1200px;        /* detail pages: fluid up to this width (open question in the plan) */

    /* Section title band - replaces dhtmlxGrid/codebase/imgs/sky_blue_grid.gif.
       Same colours as the 1x150 GIF: white top line, sky blue by 17px, back to white at 147px. */
    --sky-band: linear-gradient(to bottom, #fff 0, #e2efff 4px, #cce2ff 17px, #fff 147px);
  }
}

/* ======================================================================== base */
@layer base {
  body {
    background: var(--bg);
    color: var(--text);
    font: var(--font-size) / var(--line) var(--font);
  }

  h1, h2, h3 { margin: .5em 0; line-height: 1.25; }
  h1 { font-size: 1.4em; }
  h2 { font-size: 1.2em; }
  h3 { font-size: 1.1em; }

  a { color: var(--brand); }
  a:hover { color: var(--brand-dark); }

  /* One focus outline for every interactive element (was repeated per section) */
  :where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
    outline: 3px solid var(--focus);
    outline-offset: 2px;
  }
}

/* ======================================================================== layout */
@layer layout {
  /* Page shell: one <div class="page"> around header, main and footer (parcel.php, log.php).
     Replaces #wrapper > #bcenter > #main_container (+ #bLeft / #bright / #right_container02) - CSS step 3.
     A bordered white card, fluid up to --page-max, centred, with a 1rem gutter on narrow screens.
     No fixed widths, no floats. */
  .page {
    max-width: var(--page-max);
    margin: .75rem max(1rem, (100% - var(--page-max)) / 2) 1rem;
    padding: 0 1rem 1rem;
    background: var(--bg);
    border: 1px solid var(--border-light);
  }

  /* Site header (header.php) */
  .site-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .75rem 1.5rem;
    padding: .5rem 1rem;
  }
  .page > .site-header { padding-inline: 0; }
  .site-logo img { display: block; }
  .site-nav { display: flex; flex-wrap: wrap; gap: .4rem; margin-left: auto; }
  .site-user { display: flex; align-items: center; gap: .75rem; }
  .site-user form { margin: 0; }

  /* Site footer (footer.php) - grey band from default.css #footer_bar, without background.png */
  .site-footer {
    clear: both;
    margin-top: 2em;
    padding: .35rem 1rem;
    border-top: 1px solid var(--border-light);
    background: var(--footer-bg);
    color: var(--footer-text);
    text-align: center;
  }
  .site-footer p { margin: 0; }
  .site-footer a { color: var(--footer-text); }
}

/* ======================================================================== components */
@layer components {

  /* ---- Buttons: .btn (solid) / .btn-outline (logout) ---- */
  .btn {
    display: inline-block;
    padding: .3rem .9rem;
    border: 1px solid var(--brand-dark);
    border-radius: var(--radius);
    background: var(--brand);
    color: var(--on-brand);
    text-decoration: none;
    cursor: pointer;
  }
  .btn:hover {
    background: var(--brand-dark);
    color: var(--on-brand);
  }
  .btn-outline {
    padding: .3rem .9rem;
    border: 1px solid var(--brand-dark);
    border-radius: var(--radius);
    background: var(--bg);
    color: var(--brand);
    cursor: pointer;
  }
  .btn-outline:hover { background: var(--brand-tint); color: var(--brand-dark); }

  /* Header nav buttons: class="btn navbtn" */
  .navbtn { text-transform: uppercase; letter-spacing: .03em; font-size: 13px; }
  .navbtn[aria-current="page"] { background: var(--brand-dark); box-shadow: inset 0 -3px 0 var(--brand-tint); }
  /* Divider between the client lists and the detail chain (header.php) */
  .site-nav .navsep { align-self: stretch; width: 1px; margin-inline: .2rem; background: var(--row-rule); }
  .btn[aria-disabled="true"],
  .btn[aria-disabled="true"]:hover {
    background: var(--disabled-bg);
    border-color: var(--border);
    color: var(--muted);
    cursor: not-allowed;
  }

  /* ---- Sections: .section > .sectiontitle (sky band) > h2.titlecell, then .sectiondata ---- */
  .section { width: 100%; margin-block: 0 1rem; }
  .sectiontitle {
    padding: .3rem .75rem;
    background: var(--bg) var(--sky-band) no-repeat;
    background-size: 100% 150px;                  /* the GIF's height - short bars show its top part */
  }
  .titlecell {
    margin: 0;
    padding-inline: .6rem;
    font-size: 1em;
    font-weight: bold;
    text-transform: uppercase;
    color: var(--title);
    text-align: center;
  }
  .clear-both { clear: both; }

  /* ---- Horizontal scroll box for wide tables (Values, Taxes, Abatements / Exemptions) ---- */
  .scroll-x {
    overflow-x: auto;
    margin: .5rem 0 1rem;
  }

  /* ---- Data table: .datatable (+ .num, .totalrow). Replaces .tax-table / .red-table / .note-table basics ---- */
  .datatable { width: 100%; border: 0; }
  .datatable th,
  .datatable td { padding: .2rem .75rem; vertical-align: top; }
  .datatable thead th {
    border-bottom: 1px solid var(--rule);
    background: var(--table-head-bg);
    font-weight: bold;
  }
  .datatable tbody th { font-weight: normal; }    /* row headers (jurisdiction, type) are not headings visually */
  .num { text-align: right; font-variant-numeric: tabular-nums; }
  .totalrow > *,
  .datatable .totalrow > * {                      /* beats .datatable tbody th - the Totals label is bold too */ font-weight: bold; border-top: 1px solid var(--rule); }

  /* ---- Messages: errors role="alert" (red), status role="status" (green), empty-data notes ----
     .page-msg = full-page modifier for page_init.php fail_page() (class="msg-error page-msg") */
  .msg-error,
  .msg-ok {
    margin: .5rem 0 1rem;
    padding: .4rem .6rem;
    border: 1px solid var(--error-border);
    border-radius: var(--radius);
    background: var(--error-bg);
    color: var(--error);
  }
  .msg-ok {
    border-color: var(--ok-border);
    background: var(--ok-bg);
    color: var(--ok);
  }
  .msg-empty { margin: .5rem 0 1rem; }

  /* Full-page error message (page_init.php fail_page()): centred, larger; link colour + focus outline from @layer base */
  .page-msg { max-width: 32rem; margin: 2.5rem auto; padding: .8rem 1rem; font-size: 1rem; line-height: 1.5; }

  /* ---- File-type icons: a.File.xt-<ext> - the site's original images (32x32 GIFs shown at 16px).
     Add a rule here for new types. ---- */
  a.File { position: relative; display: inline-block; padding-left: 22px; }
  a.File::before {
    content: "";
    position: absolute; left: 0; top: 50%;
    width: 16px; height: 16px; margin-top: -8px;
    background: url("images/blanklogo.gif") no-repeat center / contain;   /* other / unknown types */
  }
  a.File.xt-pdf::before { background-image: url("images/pdflogo.gif"); }
  a.File:is(.xt-doc, .xt-docx, .xt-rtf, .xt-odt, .xt-txt, .xt-wpd)::before { background-image: url("images/doclogo.gif"); }
  a.File:is(.xt-xls, .xt-xlsx, .xt-xlsm, .xt-csv, .xt-ods)::before { background-image: url("images/xlslogo.gif"); }
  a.File:is(.xt-mp4, .xt-mov, .xt-avi, .xt-wmv, .xt-m4v, .xt-mpg, .xt-mpeg, .xt-webm)::before { background-image: url("images/vidlogo.gif"); }

  /* ---- Login form component (log.php): .login-form > fieldset > .field + .btn, messages .msg-error / .msg-ok.
     Moved from log.php's inline <style> (CSS step 5, 2026-11-04); focus outline from @layer base. ---- */
  .login-form { max-width: 22rem; margin: 2.5rem auto; padding: 1.5rem; }
  .login-form fieldset { margin: 0; padding: 0; border: 0; }
  .login-form legend { margin-bottom: 1rem; padding: 0; font-size: 1.25rem; font-weight: bold; }
  .login-form .field { margin-bottom: 1rem; }
  .login-form label { display: block; margin-bottom: .25rem; font-weight: 600; }
  .login-form input[type="text"],
  .login-form input[type="password"] {
    width: 100%;
    padding: .5rem .6rem;
    border: 1px solid var(--input-border);
    border-radius: var(--radius);
    font-size: 1rem;
  }
  .login-form .btn { padding: .55rem 1.5rem; font-size: 1rem; }
  .login-form :is(.msg-error, .msg-ok) { margin: 0 0 1rem; padding: .6rem .8rem; }
}

/* ======================================================================== sections (only what is unique) */
@layer sections {

  /* ---- Year menu (yearmenu.php): record title left, tax years right ---- */
  .yearmenu {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .5rem 1.5rem;
    margin: .5rem 0 1rem;
    padding: .5rem 1rem;
    background: var(--bg);
  }
  .yearmenu-title { display: flex; flex-direction: column; color: var(--text-strong); }
  .yearmenu-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-left: auto; }
  .yearmenu-years { display: flex; flex-wrap: wrap; gap: .3rem; }
  .yearmenu-years .yearmenu-year {
    display: inline-block;
    min-width: 3.5rem;
    padding: .3rem .6rem;
    border: 1px solid var(--rule);
    text-align: center;
    font-weight: bold;
  }
  .yearmenu-years a.yearmenu-year:hover { background: var(--brand-tint); }
  .yearmenu-years .is-current { background: var(--brand-tint); }
  .yearmenu-years .is-disabled { color: var(--muted); }
  .yearmenu .msg-error { margin: 0; }

  /* ---- Information (infosection.php): facts left, photo/map slider right; address / facts as a grid ---- */
  #Information .InfoWrap { display: flex; flex-wrap: wrap; gap: .75rem 1.25rem; align-items: flex-start; }
  #Information .InfoLeft {
    flex: 1 1 20rem;
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: 0 1.25rem;
    align-items: start;
  }
  #Information .InfoLeft > :is(.InfoLegal, .docsection) { grid-column: 1 / -1; }
  #Information .InfoAddress { margin: 0 0 .5rem; }
  #Information .info-facts {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
    gap: .25rem 1.25rem;
    margin: 0 0 .75rem;
  }
  #Information .info-facts > div { display: flex; gap: .4rem; align-items: baseline; }
  #Information .info-facts dt { font-weight: bold; color: var(--text-strong); }   /* replaces .f_black_11_b (removed from the markup) */
  #Information .info-facts dd { margin: 0; }
  #Information .info-legal { grid-template-columns: 1fr; }

  /* ---- Image section (imagesection.php): photo + map strip - CSS scroll-snap, one slide wide.
     Swipe / trackpad / arrow keys work without JS; the include's inline script adds Previous / Next
     and the "n / total" counter. Replaces FlexSlider 1.8 + jQuery (2026-11-04). ---- */
  #Information .InfoImage { flex: 0 1 320px; max-width: 100%; min-width: 0; }
  #Information .InfoImage img { display: block; width: 100%; height: auto; }
  #Information .InfoImage .msg-error { margin: 0 0 .5rem; }
  .photo-strip-track {
    display: flex;
    margin: 0;
    padding: 0;
    list-style: none;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    overscroll-behavior-x: contain;
    scrollbar-width: thin;
    border: 1px solid var(--border-light);
    border-radius: var(--radius);
  }
  .photo-strip-slide { flex: 0 0 100%; scroll-snap-align: start; scroll-snap-stop: always; }
  .photo-strip-slide a { display: block; }
  .photo-strip-slide a:focus-visible { outline-offset: -3px; }   /* keep the outline inside the scroll box (not clipped) */
  .photo-strip-nav { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-top: .4rem; }
  .photo-strip-nav[hidden] { display: none; }
  .photo-strip-nav .btn-outline { min-width: 2.5rem; padding: .1rem .6rem; font-size: 1.2rem; line-height: 1.2; }
  .photo-strip-count { color: var(--muted); font-variant-numeric: tabular-nums; }
  @media (prefers-reduced-motion: no-preference) {
    .photo-strip-track { scroll-behavior: smooth; }
  }

  /* ---- Values (valuesection.php): pinned row labels + horizontally scrolling cards ---- */
  .valuesection .value-table { border-collapse: separate; border-spacing: 0; }
  .valuesection .value-table th,
  .valuesection .value-table td { padding: .2rem .75rem; white-space: nowrap; vertical-align: top; }
  .valuesection .value-table td { border-left: 1px solid var(--border); }
  .valuesection .value-label {
    position: sticky; left: 0; z-index: 1;
    min-width: 6rem;
    background: var(--bg);
    text-align: left;
    font-weight: bold;
  }
  .valuesection thead .value-label span,
  .valuesection .value-card span { display: block; }
  .valuesection .value-card { min-width: 10rem; text-align: center; font-weight: normal; border-left: 1px solid var(--border); }
  .valuesection .value-year { font-weight: bold; }
  .valuesection .value-card.is-prior :is(.value-type, .value-status) { font-style: italic; }
  .valuesection .value-amt { display: inline-block; min-width: 6.5rem; text-align: right; font-variant-numeric: tabular-nums; }
  .valuesection .value-per { display: inline-block; min-width: 5.5rem; margin-left: .75rem; color: var(--muted); font-size: .85em; }
  .valuesection .value-group > * { padding-top: 1rem; }
  .valuesection .totalrow td .value-per { font-weight: normal; }

  /* ---- Taxes (taxsection.php) ---- */
  .taxsection .tax-table :is(th, td) { white-space: nowrap; }
  .taxsection .tax-jur { text-align: left; }
  .taxsection thead .tax-jur { font-weight: bold; }
  .taxsection .tax-jur sup { margin-left: .15em; font-size: .7em; color: var(--muted); }

  /* ---- Abatements / Exemptions (reductionsection.php) ---- */
  .reductionsection .red-table :is(th, td) { white-space: nowrap; }
  .reductionsection .red-left { text-align: left; }
  .reductionsection .red-mid { text-align: center; }

  /* ---- Bill detail (billdetailsection.php, on bill.php) ---- */
  .billdetailsection .billdetail-table :is(th, td) { white-space: nowrap; }
  .billdetailsection .billdetail-jur { text-align: left; }
  .billdetailsection thead .billdetail-jur { font-weight: bold; }

  /* ---- Notes (notesection.php): one row per note, newest first ---- */
  .notesection .note-table { margin: .5rem 0 1rem; }
  .notesection .note-table :is(th, td) { text-align: left; }
  .notesection .note-table tbody tr { border-bottom: 1px solid var(--row-rule); }
  .notesection .note-date { width: 10rem; white-space: nowrap; }
  .notesection .note-author { width: 8rem; overflow-wrap: anywhere; }
  .notesection .note-text { white-space: pre-line; overflow-wrap: anywhere; }
  @media (max-width: 40rem) {                     /* phones: give the note text the room */
    .notesection :is(.note-date, .note-author) { width: auto; }
    .notesection .note-date { white-space: normal; }
  }

  /* ---- Documents (docsection.php): short list in Information (InfoDocuments), full list (documents) ---- */
  .docsection .doc-zip { margin-left: .5rem; text-transform: none; font-weight: normal; }
  .docsection .doc-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr));
    gap: .4rem 1.25rem;
    margin: .5rem 0 1rem;
    padding: 0;
    list-style: none;
  }
  .docsection.InfoDocuments .doc-list { grid-template-columns: 1fr; }
  .doc-type { color: var(--muted); font-size: .85em; }

  /* ---- Document viewer (showdoc.php) ---- */
  .docview-body { display: flex; flex-direction: column; min-height: 100vh; }
  .docview { display: flex; flex-direction: column; flex: 1; padding: 0 1rem 1rem; }
  .docview-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1.5rem; margin: .25rem 0 .75rem; }
  .docview-title { margin: 0; font-size: 1.15rem; color: var(--title); overflow-wrap: anywhere; }
  .docview-title .doc-type { font-size: .8em; font-weight: normal; }
  .docview-actions { display: flex; align-items: center; gap: 1rem; margin: 0; }
  .docview-frame { flex: 1; width: 100%; min-height: 70vh; border: 1px solid var(--border); }
  .docview .msg-ok { margin: 1em 0; padding: .8rem 1rem; }

  /* ---- Tax bill (bill.php): payee box + bill facts side by side, parcel detail facts ---- */
  .billview .bill-wrap {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
    gap: .75rem 1.25rem;
    align-items: start;
    margin: .5rem 0 1rem;
  }
  .billview .bill-payee { padding: .5rem .75rem; border: 1px solid var(--rule); }
  .billview .bill-payee h3 { margin: 0 0 .25rem; font-size: 1em; }
  .billview .bill-payee address { font-style: normal; }
  .billview .bill-facts {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: .25rem .75rem;
    margin: .5rem 0;
  }
  .billview .bill-facts dt { font-weight: bold; color: var(--text-strong); }
  .billview .bill-facts dd { margin: 0; overflow-wrap: anywhere; }
  .billview .bill-facts dd.num { text-align: left; }   /* tabular digits, but aligned with the other values */
  .billview .bill-postmark { margin: .5rem 0 0; font-weight: bold; }

  /* ---- Property report (propreport.php): print-ready heading + fact columns; Values / Taxes are the shared sections ---- */
  .report-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: .5rem 1rem;
    margin: .25rem 0 .75rem;
  }
  .report-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: .25rem 1rem;
    align-items: start;
    padding-bottom: .5rem;
    border-bottom: 1px solid var(--rule);
    margin-bottom: 1rem;
  }
  .report-logo { display: none; }                 /* the site header shows the logo on screen; shown when printed */
  .report-head p { margin: 0; }
  .report-client { font-weight: bold; color: var(--text-strong); }
  .report-head .report-name { margin: .1rem 0; font-size: 1.3em; color: var(--title); }
  .report-date { white-space: nowrap; color: var(--muted); }
  .report-cols {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
    gap: .5rem 1.5rem;
    align-items: start;
  }
  .report-facts {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    gap: .25rem .75rem;
    margin: .5rem 0;
  }
  .report-facts > div { display: contents; }
  .report-facts dt { font-weight: bold; color: var(--text-strong); }
  .report-facts dd { margin: 0; overflow-wrap: anywhere; }
}

/* ======================================================================== print (replaces imp.css) */
@layer print {
  @media print {
    :root { --text: #000; --title: #000; --muted: #333; --table-head-bg: transparent; }
    body { background: #fff; color: #000; }
    a { color: #000; text-decoration: none; }

    .site-header, .site-nav, .site-user, .yearmenu-actions,
    .docview-actions, .doc-zip, .photo-strip-nav, .report-toolbar { display: none !important; }

    .page { max-width: none; margin: 0; padding: 0; border: 0; }
    .sectiontitle { background: none; border-bottom: 1px solid #000; }
    .site-footer { background: none; border-top: 1px solid #000; color: #000; }

    /* Print whole tables, not just the visible part of the scroll box */
    .scroll-x { overflow: visible; }
    .photo-strip-track { overflow: hidden; }   /* print the slide in view (first photo, or the map) */
    .valuesection .value-label { position: static; }
    thead { display: table-header-group; }      /* repeat column headings on each printed page */
    tr, .info-facts > div, .doc-list li, .bill-payee, .bill-facts { break-inside: avoid; }
    .sectiontitle { break-after: avoid; }

    /* Property report (propreport.php): Letter, own margins, "Page n of N" (named page - other pages keep the browser default) */
    @page report {
      size: letter portrait;
      margin: 12mm 12mm 14mm;
      @bottom-right { content: "Page " counter(page) " of " counter(pages); font: 8pt system-ui, sans-serif; color: #000; }
    }
    .propreport { page: report; font-size: 10pt; }
    .propreport .report-logo { display: block; width: 30mm; height: auto; }
    .propreport .report-head { grid-template-columns: auto minmax(0, 1fr) auto; }
    .propreport .report-date { color: #000; }
    #ReportProperty, #ReportAssessor, .propreport .valuesection { break-inside: avoid; }
    .propreport .site-footer { font-size: 8pt; }
  }
}
