/* ===========================
   Fonts (self-hosted, SIL Open Font License)
   =========================== */

@font-face {
    font-family: 'EB Garamond';
    font-style: normal;
    font-weight: 400 600;
    font-display: swap;
    src: url(fonts/eb-garamond-latin-ext.woff2) format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: 'EB Garamond';
    font-style: normal;
    font-weight: 400 600;
    font-display: swap;
    src: url(fonts/eb-garamond-latin.woff2) format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'EB Garamond';
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: url(fonts/eb-garamond-italic-latin-ext.woff2) format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: 'EB Garamond';
    font-style: italic;
    font-weight: 400;
    font-display: swap;
    src: url(fonts/eb-garamond-italic-latin.woff2) format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
    font-family: 'Karla';
    font-style: normal;
    font-weight: 400 600;
    font-display: swap;
    src: url(fonts/karla-latin-ext.woff2) format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
    font-family: 'Karla';
    font-style: normal;
    font-weight: 400 600;
    font-display: swap;
    src: url(fonts/karla-latin.woff2) format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ===========================
   Base & Variables
   =========================== */

:root {
    --text: #1a1a1a;
    --text-secondary: #555;
    --text-tertiary: #888;
    --bg: #fafaf8;
    --border: #d4d0c8;
    --accent: #1a1a1a;
    --toggle-bg: #c8c4bc;
    --toggle-ball: #fafaf8;
    --font-serif: 'EB Garamond', Georgia, serif;
    --font-sans: 'Karla', 'Helvetica Neue', sans-serif;
    --max-width: 720px;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --text: #e0ddd8;
        --text-secondary: #a09a90;
        --text-tertiary: #706b63;
        --bg: #161614;
        --border: #2e2d2a;
        --accent: #e0ddd8;
        --toggle-bg: #3a3935;
        --toggle-ball: #e0ddd8;
    }
}

:root[data-theme="dark"] {
    --text: #e0ddd8;
    --text-secondary: #a09a90;
    --text-tertiary: #706b63;
    --bg: #161614;
    --border: #2e2d2a;
    --accent: #e0ddd8;
    --toggle-bg: #3a3935;
    --toggle-ball: #e0ddd8;
}

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

html {
    font-size: 18px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    font-weight: 400;
    color: var(--text);
    background-color: var(--bg);
    line-height: 1.7;
    transition: color 0.2s ease, background-color 0.2s ease;
}

::selection {
    background: var(--text);
    color: var(--bg);
}

/* ===========================
   Layout
   =========================== */

header, main, footer {
    max-width: var(--max-width);
    margin: 0 auto;
    padding-left: 1.5rem;
    padding-right: 1.5rem;
}

/* ===========================
   Navigation
   =========================== */

nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 2.5rem;
    padding-bottom: 2.5rem;
    border-bottom: 1px solid var(--border);
}

.wordmark {
    font-family: var(--font-serif);
    font-size: 1.25rem;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 1.75rem;
}

nav ul {
    list-style: none;
    display: flex;
    gap: 2rem;
}

nav a {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    transition: color 0.15s ease;
}

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

nav .nav-cta,
nav .nav-cta:hover {
    color: var(--bg);
}

.nav-cta {
    background: var(--text);
    padding: 0.55rem 0.95rem;
    border-radius: 2px;
    white-space: nowrap;
    transition: opacity 0.15s ease;
}

.nav-cta:hover {
    opacity: 0.8;
}

/* ===========================
   Theme Toggle
   =========================== */

.theme-toggle {
    appearance: none;
    border: none;
    background: var(--toggle-bg);
    width: 36px;
    height: 20px;
    border-radius: 10px;
    position: relative;
    cursor: pointer;
    padding: 0;
    flex-shrink: 0;
    transition: background 0.2s ease;
}

.theme-toggle-ball {
    display: block;
    width: 14px;
    height: 14px;
    border-radius: 7px;
    background: var(--toggle-ball);
    position: absolute;
    top: 3px;
    left: 3px;
    transition: transform 0.2s ease;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle-ball {
        transform: translateX(16px);
    }
}

:root[data-theme="dark"] .theme-toggle-ball {
    transform: translateX(16px);
}

/* ===========================
   Introduction
   =========================== */

.intro {
    padding: 5rem 0 4rem;
}

.intro h1 {
    font-family: var(--font-serif);
    font-size: 3rem;
    font-weight: 400;
    line-height: 1.15;
    letter-spacing: -0.025em;
    margin-bottom: 1.5rem;
}

.lead {
    font-size: 1.05rem;
    color: var(--text-secondary);
    line-height: 1.75;
    max-width: 540px;
}

/* ===========================
   Horizontal rules
   =========================== */

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

/* ===========================
   Sections
   =========================== */

section {
    padding: 3.5rem 0;
}

.section-label {
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--text-tertiary);
    margin-bottom: 2rem;
}

.section-content p {
    color: var(--text-secondary);
    line-height: 1.75;
    margin-bottom: 1rem;
}

.section-content h3 {
    font-family: var(--font-serif);
    font-size: 1.1rem;
    font-weight: 500;
    margin-top: 2.5rem;
    margin-bottom: 1.25rem;
    color: var(--text);
}

.section-content h3:first-child {
    margin-top: 0;
}

/* ===========================
   Timeline entries (edu/exp)
   =========================== */

.entry {
    margin-bottom: 1.75rem;
}

.entry-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.entry-title {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
}

.entry-date {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    font-variant-numeric: tabular-nums;
}

.entry-org {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-top: 0.15rem;
}

.entry-detail {
    font-size: 0.9rem;
    margin-top: 0.4rem;
    color: var(--text-secondary);
}

.entry-points {
    list-style: none;
    margin-top: 0.5rem;
}

.entry-points li {
    position: relative;
    font-size: 0.9rem;
    line-height: 1.7;
    color: var(--text-secondary);
    padding-left: 1rem;
    margin-bottom: 0.2rem;
}

.entry-points li::before {
    content: "—";
    position: absolute;
    left: 0;
    color: var(--text-tertiary);
}

/* ===========================
   Skills
   =========================== */

.skills-legend {
    font-size: 0.75rem;
    color: var(--text-tertiary);
    margin-bottom: 1.5rem;
}

.dot {
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    vertical-align: middle;
    margin-right: 0.2rem;
}

.dot-filled {
    background: var(--text-secondary);
}

.dot-hollow {
    border: 1px solid var(--text-tertiary);
}

.skill-group {
    display: flex;
    align-items: baseline;
    gap: 1rem;
    margin-bottom: 0.85rem;
}

.skill-group-label {
    flex: 0 0 6.5rem;
    font-size: 0.7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
}

.skill-list {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem 1.1rem;
    font-size: 0.88rem;
    color: var(--text-secondary);
}

.skill-list li::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    margin-right: 0.4rem;
    vertical-align: middle;
}

.skill-primary::before {
    background: var(--text-secondary);
}

.skill-working::before {
    border: 1px solid var(--text-tertiary);
}

/* ===========================
   Projects
   =========================== */

.project {
    margin-bottom: 2.5rem;
    padding-bottom: 2.5rem;
    border-bottom: 1px solid var(--border);
}

.project:last-child {
    border-bottom: none;
    margin-bottom: 0;
    padding-bottom: 0;
}

.project-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.project-header h3 {
    font-family: var(--font-serif);
    font-size: 1.15rem;
    font-weight: 500;
    margin: 0;
}

.project-title-group {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.project-link {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    letter-spacing: 0.02em;
    transition: color 0.15s ease;
}

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

.project-date {
    font-size: 0.8rem;
    color: var(--text-tertiary);
    font-variant-numeric: tabular-nums;
}

.project p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.75;
    margin-bottom: 0.75rem;
}

.project .project-outcome {
    font-size: 0.88rem;
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
}

.outcome-label {
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-tertiary);
    margin-right: 0.5rem;
}

.project-tech {
    font-size: 0.78rem;
    color: var(--text-tertiary);
    letter-spacing: 0.02em;
    margin-top: 0.75rem;
}

/* ===========================
   Contact
   =========================== */

.contact-list {
    list-style: none;
    margin-top: 1rem;
}

.contact-list li {
    margin-bottom: 0.5rem;
}

.contact-list a {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.95rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 1px;
    transition: border-color 0.15s ease;
}

.contact-list a:hover {
    border-color: var(--text);
}

/* ===========================
   Footer
   =========================== */

footer {
    padding-bottom: 3rem;
}

/* Border on the inner element so it lines up with the nav and hr rules, which sit inside the side padding. */
footer p {
    padding-top: 3rem;
    border-top: 1px solid var(--border);
    font-size: 0.75rem;
    color: var(--text-tertiary);
    letter-spacing: 0.02em;
}

footer a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px solid var(--border);
    transition: border-color 0.15s ease;
}

footer a:hover {
    border-color: var(--text-tertiary);
}

/* ===========================
   Secondary pages (404, privacy, booking)
   =========================== */

a.wordmark {
    color: var(--text);
    text-decoration: none;
    text-transform: none;
}

.lead a,
.section-content p a {
    color: var(--text);
    text-decoration: none;
    border-bottom: 1px solid var(--border);
    transition: border-color 0.15s ease;
}

.lead a:hover,
.section-content p a:hover {
    border-color: var(--text);
}

.booking-page header,
.booking-page main,
.booking-page footer {
    max-width: 1040px;
}

.booking-page .intro {
    padding-bottom: 2.5rem;
}

.cal-embed {
    width: 100%;
    min-height: 640px;
    padding-bottom: 3.5rem;
}

/* ===========================
   Responsive
   =========================== */

@media (max-width: 600px) {
    html {
        font-size: 16px;
    }

    .intro {
        padding: 3.5rem 0 3rem;
    }

    .intro h1 {
        font-size: 2.2rem;
    }

    /* No room for the section links next to the booking button; it's one page, so scrolling covers them. */
    nav ul {
        display: none;
    }

    .nav-right {
        gap: 1.25rem;
    }

    .entry-header {
        flex-direction: column;
        gap: 0.1rem;
    }

    .project-header {
        flex-direction: column;
        gap: 0.25rem;
    }

    .skill-group {
        flex-direction: column;
        gap: 0.25rem;
    }

    .skill-group-label {
        flex: none;
    }
}

/* ===========================
   Print / PDF résumé
   =========================== */

@media print {
    @page {
        margin: 14mm 13mm;
    }

    html {
        font-size: 10.5pt;
    }

    :root,
    :root[data-theme="dark"],
    :root:not([data-theme="light"]) {
        --text: #000;
        --text-secondary: #1f1f1f;
        --text-tertiary: #555;
        --bg: #fff;
        --border: #bbb;
    }

    body {
        background: #fff;
        line-height: 1.45;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    header, main, footer {
        max-width: none;
        padding-left: 0;
        padding-right: 0;
    }

    /* Screen-only chrome */
    .nav-right,
    footer,
    .resume-link,
    hr {
        display: none !important;
    }

    /* Name becomes the résumé header */
    nav {
        display: block;
        border-bottom: 1px solid var(--border);
        padding-top: 0;
        padding-bottom: 0.5rem;
    }

    .wordmark {
        font-size: 20pt;
    }

    .intro {
        padding: 0.75rem 0 0.5rem;
    }

    .intro h1 {
        font-size: 14pt;
        margin-bottom: 0.5rem;
    }

    .intro h1 br {
        display: none;
    }

    .lead {
        font-size: 9.5pt;
        max-width: none;
    }

    section {
        padding: 0.6rem 0;
    }

    .section-label {
        margin-bottom: 0.6rem;
        border-bottom: 1px solid var(--border);
        padding-bottom: 0.2rem;
    }

    .section-content h3 {
        margin-top: 1rem;
        margin-bottom: 0.5rem;
    }

    .entry {
        margin-bottom: 0.85rem;
    }

    .project {
        margin-bottom: 0.9rem;
        padding-bottom: 0.9rem;
    }

    /* Keep records intact across page boundaries */
    .entry,
    .project,
    .skill-group {
        break-inside: avoid;
        page-break-inside: avoid;
    }

    .section-label,
    .section-content h3 {
        break-after: avoid;
        page-break-after: avoid;
    }

    /* Spell out link targets for paper */
    .contact-list a[href^="http"]::after {
        content: " (" attr(href) ")";
        font-size: 0.85em;
        color: var(--text-tertiary);
        word-break: break-all;
    }

    .contact-list a {
        border-bottom: none;
    }
}
