/* =============================================================
   site.css — single master stylesheet for jeffmclaren.ca (Phase D3b)
   Mobile-first. No external dependencies. No UIkit, no Bootstrap.
   ============================================================= */

/* -------------------------------------------------------------
   1. Tokens
   ------------------------------------------------------------- */
:root {
    --bg:          #FAF8F4;
    --surface:     #FFFFFF;
    --text:        #1A1A1A;
    --text-muted:  #5C5C5C;
    --rule:        #E8E2D9;
    --red:         #B91C1C;
    --red-deep:    #7F1414;
    --red-soft:    #FAEDED;
    --gold:        #B8893A;

    --serif: 'Source Serif 4', Georgia, serif;
    --sans:  'Source Sans 3', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;

    --fs-body:     17px;
    --fs-small:    14px;
    --fs-label:    13px;
    --fs-h3:       22px;
    --fs-h2:       30px;
    --fs-h1:       44px;
    --lh-body:     1.65;
    --lh-tight:    1.15;

    --measure:     680px;
    --gutter:      48px;
    --sidebar-w:   220px;
    --contact-w:   240px;
    --page-max:    1280px;
}

/* -------------------------------------------------------------
   2. Reset / base
   ------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: var(--fs-body);
    line-height: var(--lh-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

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

hr {
    border: 0;
    border-top: 1px solid var(--rule);
    margin: 2.5rem 0;
}

/* -------------------------------------------------------------
   3. Typography
   ------------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--serif);
    font-weight: 600;
    line-height: var(--lh-tight);
    letter-spacing: -0.01em;
    color: var(--text);
    margin: 0 0 .75em 0;
}
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); margin-top: 1.6em; }
h3 { font-size: var(--fs-h3); margin-top: 1.4em; }

p {
    margin: 0 0 1.5rem 0;
}

a {
    color: var(--red);
    text-decoration: none;
    transition: color 0.15s ease, text-decoration-color 0.15s ease;
}
a:hover, a:focus {
    color: var(--red-deep);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}

strong, b { font-weight: 700; }
em, i    { font-style: italic; }

ul, ol { margin: 0 0 1.5rem 1.25rem; padding: 0; }
li     { margin-bottom: .35rem; }

blockquote {
    margin: 2rem 0;
    padding: 1rem 1.25rem 1rem 1.5rem;
    background: var(--red-soft);
    border-left: 3px solid var(--gold);
    font-family: var(--serif);
    font-style: italic;
    color: var(--text);
}
blockquote p:last-child { margin-bottom: 0; }

/* Section labels (smallcaps in sans) */
.section-label {
    font-family: var(--sans);
    font-size: var(--fs-label);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0 0 1rem 0;
}

/* Muted body text */
.muted, .meta { color: var(--text-muted); }

.text-center { text-align: center; }

/* -------------------------------------------------------------
   4. Header band (cream, NOT red)
   ------------------------------------------------------------- */
.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--red);
}

.site-header__inner {
    max-width: var(--page-max);
    margin: 0 auto;
    padding: 1.5rem 1.25rem 1rem;
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto auto;
    grid-template-areas:
        "wordmark hamburger"
        "tagline  hamburger"
        "nav      nav";
    align-items: end;
    gap: .25rem 1rem;
}

.site-wordmark {
    grid-area: wordmark;
    font-family: var(--serif);
    font-style: italic;
    font-weight: 600;
    font-size: clamp(2rem, 6vw, 3rem);
    color: var(--red);
    text-decoration: none;
    line-height: 1;
    letter-spacing: -0.015em;
}
.site-wordmark:hover { color: var(--red-deep); text-decoration: none; }

.site-tagline {
    grid-area: tagline;
    margin: 0;
    font-family: var(--sans);
    font-size: var(--fs-small);
    color: var(--text-muted);
    letter-spacing: 0.01em;
}

/* -------------------------------------------------------------
   5. Navigation
   ------------------------------------------------------------- */
.site-nav {
    grid-area: nav;
    margin-top: 1rem;
}
.site-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 1.75rem;
}
.site-nav a {
    color: var(--text);
    font-family: var(--sans);
    font-size: var(--fs-small);
    font-weight: 500;
    letter-spacing: 0.02em;
    padding: .35rem 0;
    display: inline-block;
}
.site-nav a:hover, .site-nav a:focus { color: var(--red); text-decoration: none; }
.site-nav a.is-active { color: var(--red); border-bottom: 1px solid var(--red); }

/* Mobile hamburger toggle (CSS-only via :checked) */
.site-nav__toggle { display: none; }
.site-nav__hamburger {
    grid-area: hamburger;
    display: none;
    align-self: center;
    cursor: pointer;
    width: 32px;
    height: 26px;
    flex-direction: column;
    justify-content: space-between;
    padding: 4px 2px;
}
.site-nav__hamburger span {
    display: block;
    height: 2px;
    background: var(--text);
    border-radius: 1px;
    transition: transform .2s ease, opacity .2s ease;
}

/* -------------------------------------------------------------
   6. Page grid (3 cols desktop, stacked mobile)
   ------------------------------------------------------------- */
.layout {
    max-width: var(--page-max);
    margin: 0 auto;
    padding: 4rem 1.25rem 5rem;
    display: grid;
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr) var(--contact-w);
    grid-template-areas: "sidebar main contact";
    gap: var(--gutter);
}

.layout-main    { grid-area: main; min-width: 0; max-width: var(--measure); }
.layout-sidebar { grid-area: sidebar; }
.layout-contact { grid-area: contact; }

/* -------------------------------------------------------------
   7. Sidebar (article index)
   ------------------------------------------------------------- */
.site-sidebar__panel { /* the <details> wrapper */
    border: 0;
}
.site-sidebar__panel > summary {
    list-style: none;
    cursor: pointer;
}
.site-sidebar__panel > summary::-webkit-details-marker { display: none; }
.site-sidebar__panel > summary::marker { content: ''; }

.site-sidebar__list {
    list-style: none;
    margin: 0;
    padding: 0;
}
.site-sidebar__list li { margin: 0; }
.site-sidebar__list a {
    display: block;
    padding: .35rem 0;
    color: var(--text);
    font-family: var(--serif);
    font-size: 16px;
    line-height: 1.4;
    border-bottom: 1px dotted transparent;
}
.site-sidebar__list a:hover {
    color: var(--red);
    text-decoration: underline;
    text-underline-offset: 3px;
}
.site-sidebar__list a.is-active {
    color: var(--red);
    font-weight: 700;
}

/* -------------------------------------------------------------
   8. Contact card (right column)
   ------------------------------------------------------------- */
.contact-card {
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: 4px;
    padding: 1rem;
}
.contact-card__photo {
    width: 100%;
    border-radius: 3px;
    margin-bottom: 1rem;
}
.contact-card__name {
    font-family: var(--serif);
    font-weight: 600;
    font-size: 18px;
    margin: 0 0 .25rem 0;
    color: var(--text);
}
.contact-card__line {
    font-family: var(--sans);
    font-size: var(--fs-small);
    color: var(--text-muted);
    margin: 0 0 .25rem 0;
    word-break: break-word;
}
.contact-card__line a { color: var(--red); }
.contact-card__note {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--rule);
    font-size: var(--fs-small);
    color: var(--text-muted);
    line-height: 1.5;
}

/* -------------------------------------------------------------
   9. Article body / prose
   ------------------------------------------------------------- */
.prose {
    font-family: var(--sans);
}
.prose h1 {
    font-size: var(--fs-h1);
    margin-top: 0;
    margin-bottom: 1rem;
}
.prose h2 { margin-top: 2.5rem; }
.prose p {
    margin: 0 0 1.5rem 0;
}
.prose a {
    text-decoration: underline;
    text-decoration-color: rgba(185, 28, 28, .35);
    text-decoration-thickness: 1px;
    text-underline-offset: 2px;
}
.prose a:hover {
    text-decoration-color: var(--red-deep);
}

/* Article meta (date, byline) */
.article-meta {
    font-family: var(--sans);
    font-size: var(--fs-small);
    color: var(--text-muted);
    margin: -.25rem 0 2rem 0;
}
.article-meta .article-meta__date {
    color: var(--gold);
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    font-size: var(--fs-label);
}

/* Raised cap on the first paragraph following h1 inside .prose.has-dropcap.
   No float, no top padding/margin: the giant letter sits on the same baseline
   as the rest of its line; the line-height grows to accommodate it. */
.prose.has-dropcap > h1 + p::first-letter,
.article-body p:first-of-type::first-letter,
.drop-cap::first-letter {
    font-family: var(--serif);
    font-size: 3em;
    line-height: 1;
    font-weight: 600;
    color: var(--red);
}

/* Pull-quote utility */
.pull-quote {
    margin: 2.5rem 0;
    padding: 1.25rem 1.5rem;
    background: var(--red-soft);
    border-left: 3px solid var(--gold);
    font-family: var(--serif);
    font-style: italic;
    font-size: 1.1rem;
    color: var(--text);
}

/* Generic callout */
.callout {
    margin: 2rem 0;
    padding: 1.25rem 1.5rem;
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: 4px;
}

/* Accordion (<details>/<summary>) used for the threats and platform sections
   and for the converted vote-history snapshot. Scoped explicitly so the
   sidebar's own <details> styling is unaffected. */
.prose details,
.vote-snapshot details {
    border-bottom: 1px solid var(--rule);
    padding: 0.5rem 0;
}
.prose details summary,
.vote-snapshot details summary {
    cursor: pointer;
    padding: 0.5rem 0;
    font-weight: 600;
    list-style: none;
    position: relative;
    padding-right: 2rem;
    transition: color 0.15s ease;
}
.prose details summary::-webkit-details-marker,
.vote-snapshot details summary::-webkit-details-marker { display: none; }
.prose details summary::marker,
.vote-snapshot details summary::marker { content: ''; }
.prose details summary::after,
.vote-snapshot details summary::after {
    content: '+';
    position: absolute;
    right: 0.5rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.25em;
    color: var(--red);
    transition: transform 0.2s ease;
}
.prose details[open] summary::after,
.vote-snapshot details[open] summary::after {
    content: '\2212'; /* minus sign */
}
.prose details summary:hover,
.vote-snapshot details summary:hover { color: var(--red); }
.prose details > *:not(summary),
.vote-snapshot details > *:not(summary) {
    padding: 0.5rem 0 1rem 0;
}

/* When a section is open, hide the redundant "read more…" label but keep the
   collapse-icon (–) clickable. The icon uses rem so it survives font-size: 0. */
.prose details[open] > summary,
.vote-snapshot details[open] > summary {
    font-size: 0;
    line-height: 0;
    padding: 0;
    margin-bottom: 0.5rem;
    min-height: 1.5rem;
}
.prose details[open] > summary::after,
.vote-snapshot details[open] > summary::after {
    font-size: 1.5rem;
    line-height: 1;
}

/* Article footer (copyright, "Added on") */
.article-footer {
    margin-top: 3rem;
    padding-top: 1.5rem;
    border-top: 1px solid var(--rule);
    font-family: var(--sans);
    font-size: var(--fs-small);
    color: var(--text-muted);
}

/* -------------------------------------------------------------
   10. Article index (articles.php)
   ------------------------------------------------------------- */
.articles-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 2.5rem;
    margin-top: 2rem;
}
.articles-grid__item {
    border-bottom: 1px solid var(--rule);
    padding-bottom: 2rem;
}
.articles-grid__item:last-child { border-bottom: 0; }
.articles-grid__title {
    font-family: var(--serif);
    font-weight: 600;
    font-size: 1.35rem;
    line-height: 1.25;
    margin: 0 0 .5rem 0;
}
.articles-grid__title a { color: var(--text); }
.articles-grid__title a:hover { color: var(--red); }
.articles-grid__meta {
    font-family: var(--sans);
    font-size: var(--fs-label);
    color: var(--gold);
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin: 0 0 .75rem 0;
    font-weight: 600;
}
.articles-grid__preview {
    margin: 0;
    color: var(--text-muted);
    font-size: 16px;
    line-height: 1.55;
}

/* -------------------------------------------------------------
   11. Figures, images, infographics
   ------------------------------------------------------------- */
figure {
    margin: 2rem 0;
}
figure img { border-radius: 4px; }
figcaption {
    margin-top: .5rem;
    font-family: var(--sans);
    font-size: var(--fs-small);
    color: var(--text-muted);
    text-align: center;
    font-style: italic;
}

/* Responsive video embed (YouTube etc). Reserves 16:9 space before the iframe
   loads so there's no layout shift; caps width on wide screens. */
.video-embed {
    position: relative;
    width: 100%;
    max-width: 720px;
    aspect-ratio: 16 / 9;
    margin: 1.5rem auto;
    background: var(--rule);
}
.video-embed iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* Inline images that the legacy markup put with align attributes */
img[align="left"]  { float: left;  margin: .25rem 1.25rem 1rem 0; max-width: 50%; }
img[align="right"] { float: right; margin: .25rem 0 1rem 1.25rem; max-width: 50%; }
img[align="center"]{ margin: 1rem auto; }
.prose::after {
    content: "";
    display: block;
    clear: both;
}

/* -------------------------------------------------------------
   12. Footer
   ------------------------------------------------------------- */
.site-footer {
    margin-top: 4rem;
    padding: 2rem 1.25rem 3rem;
    border-top: 1px solid var(--red);
    background: var(--surface);
}
.site-footer__inner {
    max-width: var(--page-max);
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 2rem;
    font-family: var(--sans);
    font-size: var(--fs-small);
    color: var(--text-muted);
}
.site-footer__col { min-width: 0; }
.site-footer__heading {
    font-size: var(--fs-label);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin: 0 0 .5rem 0;
}
.site-footer__nav {
    list-style: none;
    margin: 0;
    padding: 0;
}
.site-footer__nav li { margin: 0 0 .25rem 0; }
.site-footer__nav a { color: var(--text); }
.site-footer__nav a:hover { color: var(--red); }
.site-footer__copy { margin: 0; }

/* -------------------------------------------------------------
   13. Vote-history snapshot containment.
      The legacy snapshot still uses uk-* classnames internally; cap its
      width and reset a few glaring legacy patterns so it reads cleanly
      inside the new layout.
   ------------------------------------------------------------- */
.vote-snapshot { max-width: 100%; }
.vote-snapshot p > h2,
.vote-snapshot p > h1,
.vote-snapshot p > h3 { display: inline; font-size: inherit; font-family: inherit; font-weight: 400; margin: 0; letter-spacing: normal; }
.vote-snapshot h1 { font-size: var(--fs-h2); margin-bottom: 1rem; }
.vote-snapshot h2 { font-size: 1.2rem; font-weight: 700; font-family: var(--sans); display: inline-block; margin: .25rem 0; }
.vote-snapshot .uk-hidden { display: none; }
.vote-snapshot ul, .vote-snapshot ol { margin-left: 1.5rem; }
.vote-snapshot li { margin-bottom: 1.25rem; }
.vote-snapshot hr { margin: 1.5rem 0; }
.vote-snapshot a.uk-button-link { color: var(--red); font-size: var(--fs-small); }

/* -------------------------------------------------------------
   14. Responsive — tablet (≤960px)
       Layout collapses: sidebar -> horizontal scroll above content,
       main + contact stack vertically.
   ------------------------------------------------------------- */
@media (max-width: 960px) {
    .layout {
        grid-template-columns: 1fr;
        grid-template-areas:
            "sidebar"
            "main"
            "contact";
        gap: 2rem;
        padding: 2rem 1.25rem 3rem;
    }
    .layout-sidebar {
        overflow-x: auto;
        margin-bottom: 1rem;
        border-bottom: 1px solid var(--rule);
        padding-bottom: 1rem;
    }
    .site-sidebar__list {
        display: flex;
        gap: 1.25rem;
        flex-wrap: nowrap;
        white-space: nowrap;
    }
    .site-sidebar__list a {
        white-space: nowrap;
        padding: .25rem .5rem;
        font-size: var(--fs-small);
    }
    .site-sidebar__panel > summary { display: none; }
    .layout-main { max-width: 100%; }

    .site-footer__inner { grid-template-columns: 1fr 1fr; }
}

/* -------------------------------------------------------------
   15. Responsive — mobile (≤640px)
       Single column. Hamburger nav. Sidebar becomes a <details> at the
       bottom of the page. Contact card moves to the footer area.
   ------------------------------------------------------------- */
@media (max-width: 640px) {
    .site-header__inner {
        grid-template-columns: 1fr auto;
        grid-template-areas:
            "wordmark hamburger"
            "tagline  hamburger"
            "nav      nav";
    }
    .site-nav__hamburger { display: flex; }
    .site-nav { display: none; }
    .site-nav__toggle:checked ~ .site-nav { display: block; }
    .site-nav ul {
        flex-direction: column;
        gap: .25rem;
        padding-top: 1rem;
    }
    .site-nav a {
        padding: .5rem 0;
        border-bottom: 1px solid var(--rule);
    }

    .layout {
        grid-template-areas:
            "main"
            "contact"
            "sidebar";
        padding: 1.5rem 1rem 2.5rem;
    }
    .layout-sidebar { order: 3; }
    .layout-contact { order: 2; }
    .layout-main    { order: 1; }

    .layout-sidebar {
        overflow-x: visible;
        margin-bottom: 0;
        padding: 1rem;
        border: 1px solid var(--rule);
        border-radius: 4px;
        background: var(--surface);
    }
    .site-sidebar__panel > summary {
        display: block;
        font-family: var(--sans);
        font-size: var(--fs-label);
        font-weight: 600;
        letter-spacing: 0.08em;
        text-transform: uppercase;
        color: var(--text-muted);
        padding: .5rem 0;
    }
    .site-sidebar__panel > summary::after {
        content: "▾";
        float: right;
        margin-left: .5rem;
        color: var(--red);
        transition: transform .2s ease;
    }
    .site-sidebar__panel[open] > summary::after { transform: rotate(180deg); display: inline-block; }

    .site-sidebar__list {
        display: block;
        white-space: normal;
        margin-top: .5rem;
    }
    .site-sidebar__list a {
        white-space: normal;
        padding: .35rem 0;
        font-size: 16px;
    }

    h1, .prose h1 { font-size: 2rem; }
    h2 { font-size: 1.5rem; }
    h3 { font-size: 1.2rem; }

    .site-footer__inner {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

/* -------------------------------------------------------------
   16. Print
   ------------------------------------------------------------- */
@media print {
    .site-header, .site-footer, .layout-sidebar, .layout-contact, .site-nav { display: none; }
    .layout { grid-template-columns: 1fr; max-width: 100%; padding: 0; }
    body { background: white; color: black; font-size: 11pt; }
    a { color: black; text-decoration: underline; }
}
