/* ── Tokens ── */
:root {
    --bg: #eaeae8;
    --bg-2: #e0e0de;
    --text: #111111;
    --text-2: #555555;
    --text-3: #636363;
    --border: #d0d0ce;
    --green: #1a3d2b;

    --font:
        system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --mono: "SF Mono", ui-monospace, "Fira Code", "Courier New", monospace;

    --width: 680px;
    --px: 1.5rem;
}

[data-theme="dark"] {
    --bg: #111111;
    --bg-2: #1a1a1a;
    --text: #e8e8e8;
    --text-2: #999999;
    --text-3: #888888;
    --border: #2a2a2a;
    --green: #4fa876;
}

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

/* ── Base ── */
html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    transition:
        background 0.2s,
        color 0.2s;
}

a {
    color: inherit;
    text-decoration: none;
}

/* ── Theme toggle ── */
#theme-toggle {
    position: fixed;
    top: 1.25rem;
    right: 1.25rem;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 6px;
    width: 30px;
    height: 30px;
    cursor: pointer;
    color: var(--text-3);
    transition:
        color 0.15s,
        border-color 0.15s,
        background 0.2s;
    padding: 0;
}

#theme-toggle:hover {
    color: var(--text);
    border-color: var(--text-3);
}

/* Show sun in dark mode, moon in light mode */
[data-theme="light"] #icon-moon {
    display: none;
}
[data-theme="dark"] #icon-sun {
    display: none;
}

/* ── Main ── */
main {
    max-width: var(--width);
    margin: 0 auto;
    padding: 0 var(--px);
}

section {
    padding-top: 3rem;
    padding-bottom: 0.5rem;
}

#work {
    padding-top: 2rem;
}

/* ── Section labels ── */
h2 {
    font-family: var(--mono);
    font-size: 0.6875rem;
    font-weight: 400;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--green);
    margin-bottom: 1rem;
}

/* ── Hero ── */
.hero-label {
    font-size: 0.75rem;
    font-family: var(--mono);
    color: var(--text-3);
    letter-spacing: 0.03em;
    margin-bottom: 1.5rem;
}

h1 {
    font-size: clamp(2.75rem, 8vw, 4.5rem);
    font-weight: 600;
    line-height: 1.05;
    letter-spacing: -0.035em;
    color: var(--green);
    margin-bottom: 1rem;
}

.bio {
    display: flex;
    flex-direction: column;
    gap: 0.875rem;
    color: var(--text-2);
    font-size: 0.9375rem;
    line-height: 1.65;
}

/* ── Work ── */
.entries {
    display: flex;
    flex-direction: column;
}

.entry {
    padding: 1.5rem 0;
    border-bottom: 1px solid var(--border);
}

.entries .entry:first-child {
    border-top: 1px solid var(--border);
}

.entry-top {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.2rem;
}

.entry-org {
    font-size: 0.8125rem;
    font-weight: 500;
    color: var(--text);
}

.entry-period {
    font-family: var(--mono);
    font-size: 0.6875rem;
    color: var(--text-3);
}

.entry-role {
    font-size: 0.9375rem;
    color: var(--text-2);
    margin-bottom: 0.4rem;
}

.entry-desc {
    font-size: 0.875rem;
    color: var(--text-3);
    max-width: 52ch;
    line-height: 1.6;
}

/* ── Sub-roles ── */
.sub-roles {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-bottom: 0.4rem;
}

.sub-role {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.sub-role .entry-role {
    margin-bottom: 0;
}

.sub-role .entry-period {
    flex-shrink: 0;
}

/* ── Writing ── */
.empty-state {
    font-size: 0.9375rem;
    color: var(--text-3);
}

/* ── Now ── */
.now-date {
    font-family: var(--mono);
    font-size: 0.6875rem;
    color: var(--text-3);
    margin-bottom: 1.25rem;
}

#now ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.625rem;
    max-width: 48ch;
}

#now li {
    font-size: 0.9375rem;
    color: var(--text-2);
    line-height: 1.55;
    padding-left: 1.1em;
    position: relative;
}

#now li::before {
    content: "–";
    position: absolute;
    left: 0;
    color: var(--green);
}

/* ── Footer ── */
footer {
    max-width: var(--width);
    margin: 5rem auto 0;
    padding: 2rem var(--px) 4rem;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
}

.footer-links {
    display: flex;
    gap: 1rem;
    align-items: center;
}

.footer-links a {
    display: flex;
    color: var(--text-3);
    transition: color 0.15s;
}

.footer-links a:hover {
    color: var(--green);
}

/* ── Responsive ── */
@media (max-width: 480px) {
    h1 {
        font-size: 2.5rem;
    }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }
    body,
    * {
        transition: none !important;
    }
}
