/* Clean, Editorial Theme — Diablo Lake (North Cascades) */
/* Activated via .theme-clean class on body */

body.theme-clean {
    /* Diablo Lake palette: glacial turquoise water, deep evergreen forest,
       misty alpine light. Tune the whole site from here. */
    --mist:        #F4F8F7; /* misty alpine background */
    --surface:     #FFFFFF; /* crisp chips (filter buttons) */
    --forest:      #1C3D33; /* deep evergreen — headings, toggle, active, link hover */
    --teal:        #0D746C; /* lake teal — link text, badges, social/toggle hover, focus (WCAG AA on mist & aqua) */
    --turquoise:   #2FB4A6; /* glacial turquoise — link underline, chevron, filter hover */
    --aqua:        #E4F3EF; /* pale glacial aqua — badge & chip fills */
    --border:      #D8E6E1; /* soft cool hairline */
    --ink:         #27352F; /* body text */
    --muted:       #5E726B; /* labels / secondary text (WCAG AA ≥4.5:1 on mist) */

    background-color: var(--mist);
    background-image: none;
    color: var(--ink);
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
    line-height: 1.6;
}

body.theme-clean .container {
    width: 90%;
    max-width: 1200px;
    margin: 40px auto;
    background-color: transparent;
    border: none;
    padding: 0;
}

/* Hide retro elements */
body.theme-clean marquee,
body.theme-clean .retro-img,
body.theme-clean .hit-counter,
body.theme-clean hr {
    display: none;
}

body.theme-clean .blink {
    animation: none;
    color: var(--teal);
    font-weight: 600;
    font-size: 0.85em;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: var(--aqua);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Typography */
body.theme-clean h1,
body.theme-clean h2,
body.theme-clean h3 {
    font-family: 'Playfair Display', serif;
    color: var(--forest);
    text-shadow: none;
    text-align: left;
    margin-top: 40px;
    margin-bottom: 20px;
    font-weight: 600;
}

body.theme-clean h1 {
    font-size: 3rem;
    margin-bottom: 10px;
    margin-top: 20px;
    letter-spacing: -0.5px;
}

body.theme-clean h2 {
    font-size: 2rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
    margin-top: 60px;
}

body.theme-clean h3 {
    font-size: 1.4rem;
}

body.theme-clean .center {
    text-align: left;
    max-width: 800px;
}

body.theme-clean .center p {
    max-width: 700px;
    margin-bottom: 1.8rem;
    font-size: 1.05rem;
    line-height: 1.6;
}

/* Small "views are my own" disclaimer, tucked under the intro paragraph */
body.theme-clean .center p.disclaimer {
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: -0.5rem;
    margin-bottom: 1.6rem;
    line-height: 1.5;
}

/* Footnote under the projects table (e.g. the "may be offline" note) */
body.theme-clean .table-note {
    font-size: 0.78rem;
    color: var(--muted);
    margin-top: 14px;
    line-height: 1.4;
}

/* Links */
body.theme-clean a {
    color: var(--teal);
    text-decoration: none;
    border-bottom: 1px solid var(--turquoise);
    transition: all 0.2s ease;
    font-weight: 500;
}

body.theme-clean a:hover {
    background-color: transparent;
    color: var(--forest);
    border-bottom-color: var(--forest);
}

body.theme-clean a:visited {
    color: var(--teal);
}

/* Tables -> Clean Grid */
body.theme-clean table {
    width: 100%;
    border-collapse: collapse;
    border: none;
    margin-top: 20px;
}

body.theme-clean th,
body.theme-clean td {
    border: none;
    border-bottom: 1px solid var(--border);
    padding: 16px 10px;
    text-align: left;
    vertical-align: top;
}

body.theme-clean th {
    background-color: transparent;
    color: var(--muted);
    font-family: 'Inter', sans-serif;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

/* Links cell — Case Study | Website | Code, separated by muted pipes */
body.theme-clean td.links {
    color: var(--muted);
}

/* First cell: bold friendly name on top, description as a subheading under it */
body.theme-clean .proj-name {
    display: block;
    font-weight: 700;
}
body.theme-clean .proj-desc {
    display: block;
    margin-top: 3px;
    font-family: 'Inter', sans-serif;
    font-weight: 400;
    font-size: 0.8rem;
    color: var(--muted);
    line-height: 1.4;
}

/* Case-study header metadata: Source / Website */
body.theme-clean .cs-meta {
    font-size: 0.85rem;
    color: var(--muted);
    margin-top: 10px;
    line-height: 1.6;
    overflow-wrap: anywhere;
}

/* Case-study screenshot gallery (desktop + mobile pairs) */
body.theme-clean .cs-shots-note {
    font-size: 0.8rem;
    color: var(--muted);
    margin: 0 0 24px 0;
}
body.theme-clean .cs-shots {
    display: flex;
    flex-direction: column;
    gap: 42px;
    margin-top: 4px;
}
body.theme-clean .cs-shot {
    margin: 0;
}
body.theme-clean .cs-shot-row {
    display: flex;
    gap: 20px;
    align-items: flex-end;
    flex-wrap: wrap;
}
body.theme-clean .shot-frame {
    display: block;
    border: 1px solid var(--border);
    overflow: hidden;
    background: var(--surface);
    box-shadow: 0 8px 24px rgba(28, 61, 51, 0.10);
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}
body.theme-clean .shot-frame:hover {
    box-shadow: 0 14px 34px rgba(28, 61, 51, 0.18);
    transform: translateY(-2px);
}
body.theme-clean .shot-frame img {
    display: block;
    width: 100%;
    height: auto;
}
body.theme-clean .shot-frame.desktop {
    flex: 1 1 420px;
    min-width: 0;
    border-radius: 10px;
}
body.theme-clean .shot-frame.mobile {
    flex: 0 0 auto;
    width: 180px;
    border-radius: 18px;
}
body.theme-clean .cs-shot figcaption {
    margin-top: 14px;
    font-size: 0.85rem;
    color: var(--muted);
    line-height: 1.5;
}
@media screen and (max-width: 640px) {
    body.theme-clean .cs-shot-row { gap: 16px; justify-content: center; }
    body.theme-clean .shot-frame.desktop { flex-basis: 100%; }
    body.theme-clean .shot-frame.mobile { width: 188px; }
}

/* Tighter spacing for the Selected Writings lists (scoped to the accordions) */
body.theme-clean details.accordion-section ul li {
    padding: 4px 0;
    line-height: 1.4;
}

/* Sections */
body.theme-clean .projects-section {
    border: none !important; /* Override inline styles */
    padding: 0;
    margin-bottom: 40px;
}

/* Lists */
body.theme-clean ul {
    list-style-type: none;
    padding: 0;
}

body.theme-clean ul li {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    line-height: 1.5;
}

body.theme-clean ul li i {
    color: var(--muted);
    font-style: normal;
    font-size: 0.9em;
}

/* Accordions */
body.theme-clean details.accordion-section summary {
    cursor: pointer;
    list-style: none;
    outline: none;
    display: flex;
    align-items: center;
    border-bottom: 1px solid var(--border);
    padding-bottom: 10px;
    margin-top: 60px;
    margin-bottom: 20px;
}

body.theme-clean details.accordion-section summary::-webkit-details-marker {
    display: none;
}

body.theme-clean details.accordion-section summary::before {
    content: none !important;
}

body.theme-clean details.accordion-section summary h2 {
    margin: 0;
    border-bottom: none;
    padding-bottom: 0;
    flex-grow: 1;
}

body.theme-clean details.accordion-section summary::after {
    content: "↓";
    font-size: 1.5rem;
    color: var(--teal); /* ≥3:1 against the page for a discernible expand/collapse control */
    transition: transform 0.3s ease;
}

body.theme-clean details[open].accordion-section summary::after {
    transform: rotate(180deg);
}

body.theme-clean details[open].accordion-section {
    animation: fadeIn 0.3s ease-in-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-5px); }
    to { opacity: 1; transform: translateY(0); }
}

/* The toggle button in clean view */
body.theme-clean #theme-toggle {
    background-color: var(--forest);
    color: #FFF;
    border: none;
    font-family: 'Inter', sans-serif;
    font-weight: 500;
    padding: 10px 20px;
    border-radius: 30px;
    font-size: 0.9rem;
    box-shadow: 0 4px 12px rgba(28, 61, 51, 0.18);
    transition: background-color 0.2s;
}

body.theme-clean #theme-toggle:hover {
    background-color: var(--teal);
}

/* Mobile Responsiveness for Clean Theme */
@media screen and (max-width: 768px) {
    body.theme-clean .container {
        width: 100%;
        margin: 0 auto;
        padding: 0 20px 96px; /* bottom padding so the list clears the fixed theme toggle */
        box-sizing: border-box;
    }

    body.theme-clean h1 {
        font-size: 2.2rem;
    }

    body.theme-clean h2 {
        font-size: 1.6rem;
    }

    /* Transform tables into stacked cards */
    body.theme-clean table,
    body.theme-clean tbody,
    body.theme-clean tr,
    body.theme-clean th,
    body.theme-clean td {
        display: block;
        width: 100%;
        box-sizing: border-box;
    }

    body.theme-clean tr {
        margin-bottom: 16px;
        border-bottom: 2px solid var(--border);
    }

    body.theme-clean th {
        display: none; /* Hide headers, the data is self-explanatory in card layout */
    }

    body.theme-clean td {
        border-bottom: none;
        padding: 4px 0;
    }

    /* The first cell (Policy Question) acts as the card header */
    body.theme-clean td:first-child {
        font-weight: 600;
        font-family: 'Playfair Display', serif;
        font-size: 1.25rem;
        color: var(--forest);
        padding-bottom: 2px;
        line-height: 1.3;
    }

    /* Hide the column-header row in card view */
    body.theme-clean tr:not(.project-item) {
        display: none;
    }

    /* Long repo names / URLs wrap instead of forcing width */
    body.theme-clean td {
        overflow-wrap: anywhere;
    }

    /* Compact card body: the links row on its own line, then status · date. */
    body.theme-clean td.links {
        display: block;
        padding: 4px 0;
    }
    body.theme-clean td:nth-child(3),
    body.theme-clean td:nth-child(4) {
        display: inline;
        padding: 0;
        font-size: 0.85rem;
        color: var(--muted);
    }
    body.theme-clean td:nth-child(4)::before { content: " · Last updated: "; color: var(--muted); }

    /* Ensure touch targets for links are >= 44px */
    body.theme-clean ul li {
        padding: 16px 0; /* Larger padding for touch */
    }

    /* Keep underlines on content links so they aren't distinguished by color
       alone (WCAG 1.4.1). Only the table's links row drops the underline — its
       dedicated column and pipe separators carry the structure there. */
    body.theme-clean a {
        display: inline-block;
        padding: 4px 0; /* vertical touch area */
    }

    /* Space the pipe separators in the links row for easier tapping */
    body.theme-clean td.links a {
        padding: 4px 6px;
        border-bottom: none;
    }
    body.theme-clean td.links a:first-child {
        padding-left: 0;
    }

    /* Reposition and scale toggle button for mobile */
    body.theme-clean #theme-toggle {
        top: auto;
        bottom: 20px;
        right: 20px;
        padding: 12px 24px; /* Ensure touch target >= 44px */
        font-size: 1rem;
        box-shadow: 0 4px 16px rgba(28, 61, 51, 0.28);
    }
}

/* Headshot & Socials (Clean) */
body.theme-clean .headshot {
    border-radius: 50%;
    border: none;
    box-shadow: 0 8px 24px rgba(28, 61, 51, 0.12);
    margin-bottom: 24px;
    margin-top: 10px;
    width: 120px;
    height: 120px;
    object-fit: cover;
}

body.theme-clean .social-links {
    margin: 20px 0 40px 0;
    display: flex;
    gap: 16px;
}

body.theme-clean .social-links a {
    color: var(--forest);
    border: none;
    padding: 8px; /* Touch target */
    border-radius: 50%;
    background-color: var(--aqua);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

body.theme-clean .social-links a:hover {
    color: #FFF;
    background-color: var(--teal);
    transform: translateY(-2px);
}

/* Filter Buttons (Clean) */
body.theme-clean .filter-bar {
    background: transparent;
    border: none;
    padding: 0;
    margin-bottom: 30px;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

body.theme-clean .filter-btn {
    background-color: var(--surface);
    color: var(--ink);
    font-family: 'Inter', sans-serif;
    font-size: 0.9rem;
    font-weight: 500;
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 12px 16px;
    cursor: pointer;
    transition: all 0.2s ease;
}

body.theme-clean .filter-btn:focus-visible,
body.theme-clean #theme-toggle:focus-visible,
body.theme-clean details.accordion-section summary:focus-visible,
body.theme-clean a:focus-visible {
    outline: 3px solid var(--teal);
    outline-offset: 2px;
}

body.theme-clean .filter-btn:hover {
    border-color: var(--turquoise);
    color: var(--teal);
    background-color: var(--aqua);
}

body.theme-clean .filter-btn.active {
    background-color: var(--forest);
    color: #FFF;
    border-color: var(--forest);
}

/* Desktop refinements (clean): tighter spacing, smaller text, thicker delineation.
   Scoped to >=769px so the mobile card layout is untouched. */
@media screen and (min-width: 769px) {
    body.theme-clean {
        font-size: 15px;
        line-height: 1.5;
    }
    body.theme-clean .container { margin: 28px auto; }

    body.theme-clean h1 { font-size: 2.4rem; margin-top: 16px; margin-bottom: 8px; }
    body.theme-clean h2 {
        font-size: 1.55rem;
        margin-top: 40px;
        margin-bottom: 12px;
        padding-bottom: 8px;
        border-bottom: 2px solid var(--border); /* thicker delineation */
    }
    body.theme-clean h3 { font-size: 1.15rem; margin-top: 30px; margin-bottom: 10px; }

    body.theme-clean .center p {
        font-size: 0.95rem;
        line-height: 1.5;
        margin-bottom: 1.1rem;
    }

    body.theme-clean th,
    body.theme-clean td {
        padding: 9px 10px;
        font-size: 0.9rem;
        border-bottom: 2px solid var(--border); /* thicker row delineation */
    }
    body.theme-clean th { font-size: 0.72rem; }

    body.theme-clean ul li {
        padding: 8px 0;
        font-size: 0.92rem;
        border-bottom: 2px solid var(--border);
    }

    body.theme-clean details.accordion-section summary {
        margin-top: 40px;
        border-bottom: 2px solid var(--border); /* thicker section delineation */
    }

    body.theme-clean .filter-bar { margin-bottom: 20px; }
    body.theme-clean .filter-btn { font-size: 0.82rem; padding: 8px 14px; }
    body.theme-clean .social-links { margin: 16px 0 28px 0; }

    /* Keep the Links, Status and (now friendly) date columns on a single line;
       only the first column (the question) is allowed to wrap. */
    body.theme-clean th:not(:first-child),
    body.theme-clean td:not(:first-child) {
        white-space: nowrap;
    }
}

/* Mobile compaction: with sections collapsed by default, the intro + both
   section headers + footer should fit within a single phone viewport.
   Placed last so it wins over the base headshot/social-links rules. */
@media screen and (max-width: 768px) {
    body.theme-clean h1 {
        font-size: 1.8rem;
        margin-top: 10px;
        margin-bottom: 6px;
    }

    body.theme-clean .center p {
        font-size: 0.9rem;
        line-height: 1.4;
        margin-bottom: 0.6rem;
    }

    body.theme-clean .social-links {
        margin: 8px 0 14px 0;
    }

    body.theme-clean h2 {
        font-size: 1.5rem;
    }

    body.theme-clean h3 {
        margin-top: 16px;
        margin-bottom: 8px;
    }

    body.theme-clean details.accordion-section summary {
        margin-top: 18px;
        margin-bottom: 12px;
    }

    /* Keep the 5 filter chips on a single, centered row on phones */
    body.theme-clean .filter-bar {
        flex-wrap: nowrap;
        justify-content: center;
        gap: 6px;
    }
    body.theme-clean .filter-btn {
        padding: 9px 12px;
        font-size: 0.82rem;
        white-space: nowrap;
    }
}
