/* ============================================================
   loganfinney.com — shared stylesheet
   Design tokens live on :root; dark mode overrides them via
   [data-theme="dark"] (set by config.js) with a
   prefers-color-scheme fallback for first visits.
   ============================================================ */

:root {
    --bg: #faf9f7;
    --bg-rgb: 250, 249, 247;
    --bg-elevated: #ffffff;
    --bg-elevated-rgb: 255, 255, 255;
    --ink: #1c1b1a;
    --ink-soft: #4a4641;
    --ink-faint: #595550;
    --line: #e7e5e4;
    --accent: #245a41;
    --accent-ink: #1f4f39;
    --on-accent: #ffffff;
    --hero-scrim: rgba(250, 249, 247, 0);
    --shadow: 0 1px 3px rgba(28, 27, 26, 0.08), 0 8px 24px rgba(28, 27, 26, 0.06);
    --shadow-lift: 0 2px 6px rgba(28, 27, 26, 0.1), 0 16px 40px rgba(28, 27, 26, 0.12);
    --font-display: Georgia, Palatino, serif;
    --font-body: Verdana, Tahoma, sans-serif;
    --font-mono: 'Courier New', Courier, monospace;
}

[data-theme="dark"] {
    --bg: #131211;
    --bg-rgb: 19, 18, 17;
    --bg-elevated: #1d1b1a;
    --bg-elevated-rgb: 29, 27, 26;
    --ink: #f4f2f0;
    --ink-soft: #b8b2ac;
    --ink-faint: #b0aaa5;
    --line: #2d2a28;
    --accent: #6fbf98;
    --accent-ink: #9ad4b6;
    --on-accent: #131211;
    --hero-scrim: rgba(19, 18, 17, 0);
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.3);
    --shadow-lift: 0 2px 6px rgba(0, 0, 0, 0.5), 0 16px 40px rgba(0, 0, 0, 0.4);
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #131211;
        --bg-rgb: 19, 18, 17;
        --bg-elevated: #1d1b1a;
        --bg-elevated-rgb: 29, 27, 26;
        --ink: #f4f2f0;
        --ink-soft: #b8b2ac;
        --ink-faint: #b0aaa5;
        --line: #2d2a28;
        --accent: #6fbf98;
        --accent-ink: #9ad4b6;
        --on-accent: #131211;
        --hero-scrim: rgba(19, 18, 17, 0);
        --shadow: 0 1px 3px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.3);
        --shadow-lift: 0 2px 6px rgba(0, 0, 0, 0.5), 0 16px 40px rgba(0, 0, 0, 0.4);
    }
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg);
    color: var(--ink);
    line-height: 1.65;
    font-size: 1rem;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.3s, color 0.3s;
}

/* ---------- Header ---------- */

.site-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background-color: rgba(var(--bg-rgb), 0.82);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--line);
}

.header-content {
    max-width: 1100px;
    margin: 0 auto;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.logo {
    font-family: var(--font-display);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--ink);
    text-decoration: none;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.site-nav a {
    color: var(--ink-soft);
    text-decoration: none;
    font-size: 0.9rem;
    font-weight: 500;
    padding: 0.5rem 0.9rem;
    border-radius: 999px;
    transition: color 0.2s, background-color 0.2s;
}

.site-nav a:hover {
    color: var(--ink);
    background-color: var(--line);
}

.site-nav a[aria-current="page"] {
    color: var(--accent-ink);
    font-weight: 600;
}

#themeToggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.4rem;
    height: 2.4rem;
    margin-left: 0.35rem;
    background: none;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--ink-soft);
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s, background-color 0.2s;
}

#themeToggle:hover {
    color: var(--ink);
    background-color: var(--line);
}

#themeToggle svg {
    width: 1.1rem;
    height: 1.1rem;
}

/* Show/hide the correct toggle glyph per theme */
#themeToggle .icon-sun { display: none; }
#themeToggle .icon-moon { display: block; }
[data-theme="dark"] #themeToggle .icon-sun { display: block; }
[data-theme="dark"] #themeToggle .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) #themeToggle .icon-sun { display: block; }
    :root:not([data-theme="light"]) #themeToggle .icon-moon { display: none; }
}

/* ---------- Hero (home) ---------- */

.hero {
    position: relative;
    min-height: 82vh;
    display: flex;
    align-items: flex-end;
    overflow: hidden;
}

.hero-bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    opacity: 0;
    transition: opacity 1.2s ease-in-out;
}

.hero-bg.active {
    opacity: 1;
}

.hero::after {
    content: '';
    position: absolute;
    inset: 0;
    background:
        linear-gradient(78deg,
            rgba(var(--bg-rgb), 0.96) 0%,
            rgba(var(--bg-rgb), 0.93) 50%,
            var(--hero-scrim) 80%),
        linear-gradient(to top,
            rgba(var(--bg-rgb), 0.98) 0%,
            rgba(var(--bg-rgb), 0.55) 32%,
            var(--hero-scrim) 68%);
    pointer-events: none;
}

/* On narrow screens the text spans the full width: the photo shows clear in a
   band at the top, then fades to a near-solid veil where the text begins so
   hero text keeps WCAG AAA contrast */
@media (max-width: 720px) {
    .hero {
        min-height: 0;
        padding-top: 38vh;
    }

    .hero::after {
        background: linear-gradient(to bottom,
            var(--hero-scrim) 0%,
            var(--hero-scrim) 18vh,
            rgba(var(--bg-rgb), 0.96) 38vh);
    }

    .hero-content {
        padding-top: 1.5rem;
    }
}

.hero-content {
    position: relative;
    z-index: 2;
    max-width: 1100px;
    width: 100%;
    margin: 0 auto;
    padding: 6rem 1.5rem 4rem;
}

.hero .kicker {
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent-ink);
    margin-bottom: 0.75rem;
}

.hero h1 {
    font-family: var(--font-display);
    font-size: clamp(2.5rem, 7vw, 4.5rem);
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -0.015em;
    max-width: 14ch;
    margin-bottom: 1.25rem;
}

.hero .lede {
    font-size: 1.1rem;
    color: var(--ink);
    max-width: 62ch;
    margin-bottom: 0.75rem;
}

.hero .tagline {
    font-family: var(--font-display);
    font-style: italic;
    color: var(--ink-soft);
    margin-bottom: 2rem;
}

/* ---------- Buttons & social ---------- */

.cta-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: center;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.7rem 1.4rem;
    border-radius: 999px;
    font-size: 0.95rem;
    font-weight: 600;
    text-decoration: none;
    transition: transform 0.15s, box-shadow 0.15s, background-color 0.2s;
}

.btn-primary {
    background-color: var(--accent);
    color: var(--on-accent);
    box-shadow: var(--shadow);
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: var(--shadow-lift);
}

.btn-ghost {
    color: var(--ink);
    border: 1px solid var(--line);
    background-color: rgba(var(--bg-elevated-rgb), 0.65);
}

.btn-ghost:hover {
    background-color: var(--bg-elevated);
    transform: translateY(-1px);
}

.social-icons {
    display: flex;
    gap: 0.6rem;
    margin-top: 2rem;
}

.social-icons a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.6rem;
    height: 2.6rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    color: var(--ink-soft);
    background-color: rgba(var(--bg-elevated-rgb), 0.65);
    transition: color 0.2s, border-color 0.2s, transform 0.15s;
}

.social-icons a:hover {
    color: var(--accent-ink);
    border-color: var(--accent);
    transform: translateY(-1px);
}

.social-icons svg {
    width: 1.15rem;
    height: 1.15rem;
}

/* ---------- Page scaffolding ---------- */

.page {
    max-width: 1100px;
    margin: 0 auto;
    padding: 3.5rem 1.5rem 2rem;
}

.page-title {
    font-family: var(--font-display);
    font-size: clamp(2.2rem, 5vw, 3.2rem);
    font-weight: 700;
    letter-spacing: -0.015em;
    margin-bottom: 0.5rem;
}

.page-intro {
    color: var(--ink-soft);
    max-width: 62ch;
    margin-bottom: 1rem;
}

.section-title {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    margin: 3.5rem 0 1.5rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--line);
}

.subsection-title {
    margin: 2rem 0 1rem;
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--ink-soft);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.page a:not(.btn):not(.card):not(.story-list a) {
    color: var(--accent-ink);
    text-decoration: none;
    border-bottom: 1px solid var(--line);
    border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
    transition: border-color 0.2s;
}

.page a:not(.btn):not(.card):not(.story-list a):hover {
    border-bottom-color: var(--accent);
}

/* ---------- Cards ---------- */

.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
    gap: 1.25rem;
}

.card {
    display: block;
    background-color: var(--bg-elevated);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 1.4rem 1.5rem;
    text-decoration: none;
    color: inherit;
    box-shadow: var(--shadow);
    transition: transform 0.15s, box-shadow 0.15s, border-color 0.2s;
}

a.card:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lift);
    border-color: var(--accent);
    border-color: color-mix(in srgb, var(--accent) 40%, var(--line));
}

.card h2,
.card h3,
.card h4 {
    font-family: var(--font-body);
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.4;
    margin-bottom: 0.4rem;
}

.card p {
    font-size: 0.92rem;
    color: var(--ink-soft);
}

.card .card-meta {
    display: block;
    margin-top: 0.7rem;
    font-size: 0.8rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--ink-faint);
}

.card .card-kicker {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent-ink);
}

/* Story link lists rendered as compact cards */
.story-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(280px, 100%), 1fr));
    gap: 1rem;
}

.story-list li {
    display: flex;
}

.story-list a {
    flex: 1;
    display: block;
    background-color: var(--bg-elevated);
    border: 1px solid var(--line);
    border-left: 3px solid var(--accent);
    border-radius: 10px;
    padding: 1rem 1.2rem;
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.45;
    color: var(--ink);
    text-decoration: none;
    transition: transform 0.15s, box-shadow 0.15s;
}

.story-list a:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

/* Unlinked story entries share the card look without hover affordance */
.story-list .story-plain {
    flex: 1;
    display: block;
    background-color: var(--bg-elevated);
    border: 1px solid var(--line);
    border-left: 3px solid var(--ink-faint);
    border-radius: 10px;
    padding: 1rem 1.2rem;
    font-size: 0.95rem;
    font-weight: 500;
    line-height: 1.45;
    color: var(--ink-soft);
}

/* ---------- Resume timeline ---------- */

.timeline {
    position: relative;
    padding-left: 1.75rem;
}

.timeline::before {
    content: '';
    position: absolute;
    left: 0.35rem;
    top: 0.5rem;
    bottom: 0.5rem;
    width: 2px;
    background-color: var(--line);
}

.timeline-entry {
    position: relative;
    padding-bottom: 2.25rem;
}

.timeline-entry:last-child {
    padding-bottom: 0.5rem;
}

.timeline-entry::before {
    content: '';
    position: absolute;
    left: -1.75rem;
    top: 0.45rem;
    width: 0.75rem;
    height: 0.75rem;
    border-radius: 50%;
    background-color: var(--accent);
    border: 2px solid var(--bg);
}

.timeline-entry h3 {
    font-size: 1.1rem;
    font-weight: 600;
    line-height: 1.4;
}

.timeline-entry .entry-org {
    color: var(--accent-ink);
    font-weight: 500;
}

.timeline-entry .entry-dates {
    display: block;
    font-family: var(--font-mono);
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--ink-soft);
    margin: 0.15rem 0 0.6rem;
}

.timeline-entry p {
    color: var(--ink-soft);
    max-width: 68ch;
    margin-bottom: 0.5rem;
}

.timeline-entry blockquote {
    margin: 0.75rem 0 0.75rem 0.25rem;
    padding-left: 1rem;
    border-left: 3px solid var(--accent);
    color: var(--ink-soft);
    font-style: italic;
    max-width: 64ch;
}

/* ---------- Footer ---------- */

.site-footer {
    border-top: 1px solid var(--line);
    margin-top: 5rem;
    padding: 2.5rem 1.5rem;
}

.footer-content {
    max-width: 1100px;
    margin: 0 auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    color: var(--ink-faint);
    font-size: 0.9rem;
}

.footer-content a {
    color: var(--ink-soft);
    text-decoration: none;
}

.footer-content a:hover {
    color: var(--accent-ink);
}

/* ---------- Accessibility ---------- */

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 200;
    background-color: var(--ink);
    color: var(--bg);
    padding: 0.6rem 1.2rem;
    border-radius: 0 0 8px 0;
}

.skip-link:focus {
    left: 0;
}

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
    .header-content {
        padding: 0.75rem 1rem;
    }

    .logo {
        font-size: 1.05rem;
    }

    .site-nav {
        gap: 0;
    }

    .site-nav a {
        font-size: 0.85rem;
        padding: 0.45rem 0.55rem;
    }

    #themeToggle {
        margin-left: 0.15rem;
    }

    .hero {
        min-height: 72vh;
    }

    .hero-content {
        padding: 4rem 1rem 2.5rem;
    }

    .page {
        padding: 2.5rem 1rem 1.5rem;
    }

    .cta-buttons .btn {
        flex: 1 1 100%;
        justify-content: center;
    }
}

/* ---------- Contact ---------- */

.contact-line {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 1.5rem;
    margin-top: 1.75rem;
    font-size: 0.95rem;
    color: var(--ink-soft);
}

.contact-line a {
    color: var(--accent-ink);
    text-decoration: none;
    border-bottom: 1px solid var(--line);
    border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}

.contact-handle {
    font-weight: 600;
    color: var(--ink);
}

a.contact-handle {
    text-decoration: none;
    border-bottom: 1px solid var(--line);
    border-bottom: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
}

a.contact-handle:hover {
    color: var(--accent-ink);
}

@media (max-width: 360px) {
    .header-content {
        padding: 0.7rem 0.75rem;
        gap: 0.35rem 0.5rem;
        flex-wrap: wrap;
    }

    .logo {
        font-size: 0.95rem;
    }

    .site-nav a {
        font-size: 0.8rem;
        padding: 0.4rem 0.35rem;
    }

    #themeToggle {
        width: 2.1rem;
        height: 2.1rem;
    }
}
