:root {
    color-scheme: dark;
    --bg: light-dark(#fbfaf9, #0d0d0f);
    --text: light-dark(#1c1b19, #e8e6e3);
    --muted: light-dark(#6f6c67, #8a8783);
    --accent: light-dark(#c2410c, #e07850);
    --accent-fill: #c2410c;
    --border: light-dark(#e2ded8, #26262b);
    --end: light-dark(#85827c, #8a8783);
    --icon: light-dark(#1c1b19, #8a8783);
    --icon-hover: light-dark(#c2410c, #e8e6e3);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica,
        Arial, sans-serif;
}

:root {
    --sun: block;
    --moon: none;
}

:root[data-theme="light"] {
    color-scheme: light;
    --sun: none;
    --moon: block;
}

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

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 120px 32px 80px;
}

a {
    color: inherit;
}

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

img {
    display: block;
    max-width: 100%;
}

/* ---------- theme toggle ---------- */

.masthead {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
}

.theme-toggle {
    flex: none;
    margin-top: -10px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: none;
    background: none;
    color: var(--text);
    cursor: pointer;
}

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

.theme-toggle svg {
    width: 24px;
    height: 24px;
    transition: transform 0.45s cubic-bezier(0.34, 1.4, 0.64, 1);
}

.theme-toggle:hover .sun,
.theme-toggle:focus-visible .sun {
    transform: rotate(45deg);
}

.theme-toggle:hover .moon,
.theme-toggle:focus-visible .moon {
    transform: rotate(-20deg);
}

@media (prefers-reduced-motion: reduce) {
    .theme-toggle svg {
        transition: none;
    }

    .theme-toggle:hover .sun,
    .theme-toggle:focus-visible .sun,
    .theme-toggle:hover .moon,
    .theme-toggle:focus-visible .moon {
        transform: none;
    }

    .theme-toggle:hover {
        color: var(--accent);
    }
}

.theme-toggle .sun {
    display: var(--sun);
}

.theme-toggle .moon {
    display: var(--moon);
}

/* ---------- intro ---------- */

h1 {
    margin: 0 0 12px;
    font-size: 46px;
    line-height: 1.1;
    letter-spacing: -0.025em;
}

.tagline {
    margin: 0 0 8px;
}

.blurb {
    margin: 0 0 16px;
    max-width: 60ch;
}

.blurb a {
    font-weight: 700;
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}

.blurb a:hover {
    text-decoration: none;
}

.icons {
    display: flex;
    gap: 8px;
    margin-left: -10px;
}

.icons a {
    display: block;
    padding: 10px;
    color: var(--icon);
}

.icons a:hover {
    color: var(--icon-hover);
}

.icons svg {
    width: 26px;
    height: 26px;
}

/* ---------- projects ---------- */

h2 {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 96px 0 0;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--muted);
}

h2::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--border);
}

.project {
    display: grid;
    grid-template-columns: 45% 1fr;
    gap: 40px;
    align-items: start;
    padding: 40px 0;
    border-bottom: 1px solid var(--border);
}

.project:last-of-type {
    border-bottom: none;
}

.project:nth-of-type(even) {
    grid-template-columns: 1fr 45%;
}

.project:nth-of-type(even) .shot-btn {
    grid-column: 2;
    grid-row: 1;
}

.shot {
    width: 100%;
    height: auto;
    border: 1px solid var(--border);
    border-radius: 6px;
}

.shot-btn {
    display: block;
    width: 100%;
    padding: 0;
    border: none;
    background: none;
    cursor: zoom-in;
}

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

h3 {
    margin: 0 0 12px;
    font-size: 28px;
    line-height: 1.15;
    letter-spacing: -0.02em;
}

h3 a {
    text-decoration: none;
    border-bottom: 1px solid transparent;
}

h3 a:hover {
    border-bottom-color: currentColor;
}

.ext {
    display: inline-block;
    width: 0.5em;
    height: 0.5em;
    margin-left: 0.24em;
    vertical-align: 0.06em;
    color: var(--muted);
}

.ext-box {
    display: inline-block;
    width: 0.72em;
    height: 0.72em;
    margin-left: 0.3em;
    vertical-align: -0.02em;
}

.project p {
    margin: 0 0 16px;
}

/* ---------- source link ---------- */

.source {
    display: none;
}

.source {
    margin-left: auto;
    font-size: 13px;
    color: var(--muted);
    text-decoration: none;
}

.source:hover,
.source:hover .ext {
    color: var(--text);
}

.source:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
}

h4 {
    margin: 0 0 10px;
    font-size: 13px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 600;
}

.project ul {
    list-style: disc;
    margin: 0 0 18px;
    padding-left: 22px;
}

.project li {
    margin-bottom: 6px;
}

.tags {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.tag {
    font-size: 12px;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--accent-fill);
    color: #fff;
}

/* ---------- lightbox ---------- */

#lightbox {
    max-width: 92vw;
    max-height: 92vh;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg);
    overflow: hidden;
}

#lightbox::backdrop {
    background: rgb(0 0 0 / 0.75);
}

#lightbox img {
    max-width: 92vw;
    /* Match the dialog cap so tall shots shrink instead of clipping. */
    max-height: 92vh;
    width: auto;
    height: auto;
    cursor: zoom-out;
}

/* ---------- footer ---------- */

footer {
    margin-top: 72px;
    text-align: center;
    color: var(--muted);
}

footer .end {
    display: block;
    font-size: 30px;
    font-weight: 800;
    color: var(--end);
    text-transform: uppercase;
    letter-spacing: 0.28em;
    /* letter-spacing pads the right edge; pull it back to centre */
    text-indent: 0.28em;
}

footer .break {
    display: block;
    margin-top: 10px;
    font-size: 15px;
    font-weight: 400;
    letter-spacing: 0.01em;
}

@media (max-width: 720px) {
    main {
        padding-top: 64px;
    }

    h1 {
        font-size: 34px;
    }

    h3 {
        font-size: 24px;
    }

    .project,
    .project:nth-of-type(even) {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .project:nth-of-type(even) .shot-btn {
        grid-column: 1;
    }

    footer .end {
        font-size: 22px;
    }
}
