/*
 * Typography-first personal site with light/dark themes.
 */

:root {
    --font-serif: "Source Serif 4", Georgia, serif;
    --font-sans: "Inter", system-ui, sans-serif;
    --font-mono: "IBM Plex Mono", ui-monospace, monospace;

    --measure: 38rem;
    --measure-wide: 44rem;
    --space: clamp(3.5rem, 8vw, 5.5rem);
}

html[data-theme="light"] {
    color-scheme: light;
    --bg: #f0ece3;
    --bg-band: #e6e0d4;
    --bg-raised: #faf7f1;
    --bg-soft: #f7f3eb;
    --text: #1a1814;
    --text-muted: #524e47;
    --text-faint: #7a746b;
    --border: #cfc8ba;
    --border-strong: #b8ae9c;
    --accent: #6b5340;
    --accent-dim: #8a735c;
    --link: #2f4f72;
    --link-hover: #1a334d;
    --topbar-bg: rgba(240, 236, 227, 0.92);
    --hero-glow: rgba(180, 155, 120, 0.28);
    --hero-glow-2: rgba(120, 150, 180, 0.12);
    --card-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset, 0 8px 24px rgba(60, 45, 30, 0.06);
}

html[data-theme="dark"] {
    color-scheme: dark;
    --bg: #0f1216;
    --bg-band: #141920;
    --bg-raised: #1a2030;
    --bg-soft: #131820;
    --text: #e8e6e1;
    --text-muted: #a3a099;
    --text-faint: #6f6b64;
    --border: #2a3140;
    --border-strong: #3a4458;
    --accent: #c4b08a;
    --accent-dim: #8a7f68;
    --link: #a8b8cc;
    --link-hover: #dce4ef;
    --topbar-bg: rgba(15, 18, 22, 0.92);
    --hero-glow: rgba(60, 80, 120, 0.35);
    --hero-glow-2: rgba(180, 150, 100, 0.08);
    --card-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 10px 28px rgba(0, 0, 0, 0.35);
}

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

html {
    scroll-behavior: smooth;
}

body {
    background-color: var(--bg);
    background-image:
        radial-gradient(ellipse 90% 55% at 50% -10%, var(--hero-glow), transparent 58%),
        radial-gradient(ellipse 60% 40% at 100% 20%, var(--hero-glow-2), transparent 50%);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 1.05rem;
    line-height: 1.7;
    -webkit-font-smoothing: antialiased;
    transition: background-color 0.25s ease, color 0.25s ease;
}

a {
    color: var(--link);
    text-decoration: none;
    transition: color 0.15s ease;
}

a:hover {
    color: var(--link-hover);
}

.page {
    min-height: 100vh;
}

/* Top bar */

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    padding: 1rem 1.5rem;
    background: var(--topbar-bg);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

.topbar-name {
    font-family: var(--font-serif);
    font-size: 1rem;
    font-weight: 500;
    color: var(--text);
    text-decoration: none;
}

.topbar-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 1.25rem;
}

.topbar-nav a {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-decoration: none;
}

.topbar-nav a:hover {
    color: var(--text);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.theme-toggle {
    flex-shrink: 0;
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 500;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-muted);
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 0.35rem 0.7rem;
    cursor: pointer;
    transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

.theme-toggle:hover {
    color: var(--text);
    border-color: var(--border-strong);
}

/* Homepage hero */

.home-hero {
    max-width: var(--measure);
    margin: 0 auto;
    padding: clamp(4rem, 12vh, 7rem) 1.5rem var(--space);
}

.home-title {
    font-family: var(--font-serif);
    font-size: clamp(2.5rem, 7vw, 3.25rem);
    font-weight: 500;
    letter-spacing: -0.03em;
    line-height: 1.1;
    margin-bottom: 1.75rem;
    padding-left: 1rem;
    border-left: 3px solid var(--accent);
}

.home-thesis {
    font-family: var(--font-serif);
    font-size: clamp(1.25rem, 3.2vw, 1.45rem);
    font-weight: 400;
    line-height: 1.55;
    color: var(--text);
    margin-bottom: 1.5rem;
}

.home-role {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.65;
    margin-bottom: 1.75rem;
}

.home-role-now {
    color: var(--text);
}

.home-role a {
    color: var(--accent);
    text-decoration: underline;
    text-decoration-color: var(--accent-dim);
    text-underline-offset: 3px;
}

.home-role a:hover {
    color: var(--link-hover);
}

.home-role-sep {
    margin: 0 0.35rem;
    color: var(--text-faint);
}

.home-bio {
    color: var(--text-muted);
    font-size: 1.02rem;
    margin-bottom: 2rem;
}

.home-links {
    font-size: 0.92rem;
    color: var(--text-muted);
}

.home-links a {
    font-weight: 500;
    color: var(--link);
}

.home-links span {
    margin: 0 0.45rem;
    color: var(--text-faint);
}

/* Sections */

.home-section {
    max-width: var(--measure-wide);
    margin: 0 auto;
    padding: var(--space) 1.5rem;
    border-top: 1px solid var(--border);
}

.home-section-band {
    background: var(--bg-band);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

html[data-theme="light"] .home-section-band {
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

.home-section-tight {
    padding-top: clamp(2rem, 5vw, 3rem);
}

.section-raised {
    background: var(--bg-raised);
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    max-width: none;
    padding-left: max(1.5rem, calc((100vw - var(--measure-wide)) / 2 + 1.5rem));
    padding-right: max(1.5rem, calc((100vw - var(--measure-wide)) / 2 + 1.5rem));
}

.section-raised .section-lede,
.section-raised .investor-dl,
.section-raised .investor-note {
    max-width: var(--measure-wide);
    margin-left: auto;
    margin-right: auto;
}

.section-label {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--accent-dim);
    margin-bottom: 1.25rem;
}

.section-lede {
    color: var(--text-muted);
    font-size: 0.98rem;
    margin: -0.5rem 0 1.75rem;
    max-width: var(--measure);
}

/* Arc */

.arc-list {
    list-style: none;
    max-width: var(--measure);
    border-top: 1px solid var(--border);
}

.arc-list li {
    position: relative;
    padding: 0.75rem 0 0.75rem 1.25rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.98rem;
    line-height: 1.6;
}

.arc-list li::before {
    content: "·";
    position: absolute;
    left: 0;
    color: var(--text-faint);
}

.arc-list a {
    color: var(--text);
    font-weight: 500;
}

.arc-list a:hover {
    color: var(--link-hover);
}

.arc-list-flush {
    border-top: none;
    max-width: none;
}

/* Research */

.research-block {
    max-width: var(--measure);
    margin-bottom: 2rem;
}

.research-block:last-child {
    margin-bottom: 0;
}

.research-subhead {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-faint);
    margin-bottom: 0.85rem;
}

.research-prose {
    color: var(--text-muted);
    font-size: 0.98rem;
    line-height: 1.65;
}

.horizon-lede {
    margin-bottom: 1rem;
}

.horizon-list {
    list-style: none;
    border-top: none;
}

.horizon-list li {
    padding: 1rem 1.1rem;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-raised);
    box-shadow: var(--card-shadow);
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.65;
}

.horizon-list li + li {
    margin-top: 0.75rem;
}

.horizon-term {
    display: block;
    font-family: var(--font-serif);
    font-size: 1rem;
    font-weight: 500;
    color: var(--text);
    margin-bottom: 0.35rem;
}

.horizon-link {
    display: inline-block;
    margin-top: 0.5rem;
    font-size: 0.88rem;
    font-weight: 500;
}

.section-fold {
    margin-top: 1.5rem;
}

.section-fold summary {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    cursor: pointer;
    list-style: none;
}

.section-fold summary::-webkit-details-marker {
    display: none;
}

.section-fold summary::before {
    content: "+ ";
    color: var(--accent-dim);
}

.section-fold[open] summary::before {
    content: "− ";
}

.section-fold[open] summary {
    color: var(--text);
    margin-bottom: 1.25rem;
}

.section-fold .principles-list,
.section-fold .reads-index,
.section-fold .timeline-compact {
    margin-top: 0;
}

.home-bio-collapsed {
    margin-top: 1rem;
}

.home-bio-collapsed .home-bio {
    margin-top: 0.75rem;
    margin-bottom: 0;
}

/* Raised section (legacy) */

.investor-dl {
    display: flex;
    flex-direction: column;
    gap: 0;
    border-top: 1px solid var(--border);
    margin-bottom: 2rem;
}

.investor-row {
    display: grid;
    grid-template-columns: 8.5rem 1fr;
    gap: 1rem 2rem;
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--border);
    align-items: start;
}

.investor-row dt {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--accent-dim);
    padding-top: 0.1rem;
}

.investor-row dd {
    color: var(--text-muted);
    font-size: 0.98rem;
    line-height: 1.65;
    margin: 0;
}

.investor-note {
    font-size: 0.95rem;
    color: var(--text-muted);
    line-height: 1.65;
    max-width: var(--measure);
}

.investor-note a {
    font-weight: 500;
    white-space: nowrap;
}

/* Focus */

.focus-grid {
    display: grid;
    gap: 2rem;
}

.focus-item h3 {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.focus-item p {
    color: var(--text-muted);
    font-size: 0.98rem;
    max-width: 36rem;
}

/* Building beliefs */

.beliefs-grid {
    display: grid;
    gap: 2rem;
    max-width: var(--measure);
}

.beliefs-item h3 {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    font-weight: 500;
    margin-bottom: 0.65rem;
}

.beliefs-item ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.beliefs-item li {
    position: relative;
    padding-left: 1rem;
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
}

.beliefs-item li::before {
    content: "·";
    position: absolute;
    left: 0;
    color: var(--accent-dim);
}

/* Writing */

.writing-preview,
.writing-archive {
    display: flex;
    flex-direction: column;
    gap: 0;
    border-top: 1px solid var(--border);
}

.writing-item {
    padding: 1.35rem 0;
    border-bottom: 1px solid var(--border);
}

.writing-item time {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-faint);
    letter-spacing: 0.04em;
}

.writing-item h3 {
    font-family: var(--font-serif);
    font-size: 1.12rem;
    font-weight: 500;
    margin: 0.35rem 0 0.5rem;
    line-height: 1.35;
}

.writing-item h3 a {
    color: var(--text);
    text-decoration: none;
}

.writing-item h3 a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

.writing-body {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.7;
    margin-bottom: 0.75rem;
}

.writing-body i {
    color: var(--text);
    font-style: italic;
}

.writing-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.writing-tag {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-faint);
    padding: 0.2rem 0.5rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--bg-raised);
}

.principles-list {
    list-style: none;
    margin: 0;
    padding: 0;
    border-top: 1px solid var(--border);
}

.principles-list li {
    padding: 1.1rem 0;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.98rem;
    line-height: 1.65;
}

.principles-list strong {
    color: var(--text);
    font-weight: 500;
}

.section-fold .research-block:first-of-type {
    margin-top: 1.25rem;
}

.home-contact .section-fold {
    margin-bottom: 0;
}

.writing-more {
    margin-top: 1.25rem;
    font-size: 0.9rem;
}

.writing-more a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
}

.writing-more a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

.writing-status {
    margin-top: 1.5rem;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-faint);
    letter-spacing: 0.04em;
}

.page-title {
    font-family: var(--font-serif);
    font-size: clamp(1.75rem, 4vw, 2.25rem);
    font-weight: 500;
    margin: 0 0 0.75rem;
    line-height: 1.2;
}

.page-intro {
    padding-top: 2rem;
}

.page-back {
    margin-top: 1rem;
    font-size: 0.88rem;
}

.page-back a {
    color: var(--text-muted);
    text-decoration: none;
}

.page-back a:hover {
    color: var(--link-hover);
}

.text-control {
    margin-top: 1.25rem;
    padding: 0;
    border: 0;
    background: none;
    font-family: var(--font-sans);
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--accent);
    cursor: pointer;
}

.text-control:hover {
    color: var(--link-hover);
}

/* Work index */

.work-index {
    list-style: none;
    border-top: 1px solid var(--border);
}

.work-index > li {
    display: grid;
    grid-template-columns: 7.5rem 1fr;
    gap: 1rem 1.5rem;
    padding: 1.25rem 0;
    border-bottom: 1px solid var(--border);
    align-items: start;
}

.work-index-meta {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-faint);
    padding-top: 0.15rem;
}

.work-index a,
.work-index-title {
    font-family: var(--font-serif);
    font-size: 1.08rem;
    font-weight: 500;
    color: var(--text);
}

.work-index a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

.work-index-title {
    display: block;
    margin-bottom: 0.25rem;
}

.work-index p {
    color: var(--text-muted);
    font-size: 0.92rem;
    margin-top: 0.25rem;
}

.work-details {
    margin-top: 1.5rem;
}

.work-details summary {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    list-style: none;
}

.work-details summary::-webkit-details-marker {
    display: none;
}

.work-details summary::before {
    content: "+ ";
    font-family: var(--font-mono);
    color: var(--accent-dim);
}

.work-details[open] summary::before {
    content: "− ";
}

.work-details[open] summary {
    margin-bottom: 1rem;
    color: var(--text);
}

.work-index-nested {
    margin-bottom: 1.5rem;
}

.featured-video {
    border: 1px solid var(--border);
    border-radius: 2px;
    overflow: hidden;
    aspect-ratio: 16 / 9;
    max-width: var(--measure);
}

.featured-video iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

/* Reads */

.reads-index {
    list-style: none;
    border-top: 1px solid var(--border);
}

.reads-index li {
    padding: 1rem 0;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.98rem;
}

.reads-index a {
    font-weight: 500;
    color: var(--text);
}

.reads-index a:hover {
    color: var(--link-hover);
}

/* Timeline */

.timeline-compact {
    list-style: none;
    border-top: 1px solid var(--border);
    font-size: 0.95rem;
}

.timeline-compact li {
    display: grid;
    grid-template-columns: 6.5rem 1fr;
    gap: 1rem;
    padding: 0.85rem 0;
    border-bottom: 1px solid var(--border);
    color: var(--text-muted);
}

.timeline-compact time {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-faint);
}

/* Contact */

.home-contact p {
    color: var(--text-muted);
    font-size: 0.98rem;
}

.contact-grid {
    display: grid;
    gap: 2rem;
    max-width: var(--measure);
    margin-top: 2rem;
    margin-bottom: 2rem;
}

.contact-subhead {
    font-family: var(--font-serif);
    font-size: 1.05rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
}

.contact-grid p {
    color: var(--text-muted);
    font-size: 0.98rem;
}

.contact-grid a {
    font-weight: 500;
}

.contact-secondary {
    font-size: 0.88rem;
    color: var(--text-faint);
}

.contact-secondary a {
    color: var(--text-muted);
}

/* Footer */

.site-footer {
    max-width: var(--measure-wide);
    margin: 0 auto;
    padding: 2rem 1.5rem 3rem;
    border-top: 1px solid var(--border);
}

.site-footer p {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--text-faint);
    letter-spacing: 0.02em;
}

/* Responsive */

@media (max-width: 640px) {
    .topbar {
        flex-direction: column;
        align-items: flex-start;
    }

    .topbar-actions {
        width: 100%;
        justify-content: space-between;
    }

    .work-index > li,
    .timeline-compact li,
    .investor-row {
        grid-template-columns: 1fr;
        gap: 0.35rem;
    }

    .section-raised {
        padding-left: 1.5rem;
        padding-right: 1.5rem;
    }
}

@media (min-width: 720px) {
    .focus-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 2.5rem;
    }

    .focus-item p {
        max-width: none;
    }

    .contact-grid {
        grid-template-columns: 1fr 1fr;
        gap: 2.5rem;
        max-width: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    body {
        transition: none;
    }
}
