:root {
    --background: #f4f4f1;
    --text: #20201f;
    --muted: #676764;
    --faint: #aaa9a4;
    --line: rgba(32, 32, 31, 0.72);
    --hover: rgba(32, 32, 31, 0.055);
    --accent: #3f3f3c;
    --doodle-start: #181817;
    --doodle-end: #777773;
    --guide-blue: #526f9e;
    --guide-sage: #627965;
    --guide-rust: #9a5b48;
    --site-font: "Karla", sans-serif;
    color-scheme: light;
}

:root[data-accent="blue"] { --accent: #526f9e; --doodle-start: #38577f; --doodle-end: #7894bb; }
:root[data-accent="sage"] { --accent: #627965; --doodle-start: #435c48; --doodle-end: #849989; }
:root[data-accent="rust"] { --accent: #9a5b48; --doodle-start: #7e4334; --doodle-end: #bd7b67; }

:root[data-theme="dark"] {
    --background: #1b1b1a;
    --text: #eeeeea;
    --muted: #aaa9a4;
    --faint: #686865;
    --line: rgba(238, 238, 234, 0.68);
    --hover: rgba(238, 238, 234, 0.06);
    --doodle-start: #f3f3ef;
    --doodle-end: #8c8c87;
    color-scheme: dark;
}

:root[data-theme="dark"][data-accent="graphite"] { --accent: #fff; --doodle-start: #fff; --doodle-end: #d9d9d5; }
:root[data-theme="dark"][data-accent="blue"] { --accent: #8ca9d2; --doodle-start: #b5cae6; --doodle-end: #6988b4; }
:root[data-theme="dark"][data-accent="sage"] { --accent: #9bb49f; --doodle-start: #bfd0c1; --doodle-end: #78967e; }
:root[data-theme="dark"][data-accent="rust"] { --accent: #d1927e; --doodle-start: #e4b09f; --doodle-end: #ac6e5b; }

* {
    box-sizing: border-box;
}

html {
    scrollbar-gutter: stable;
    color: var(--text);
    background: var(--background);
    font-family: var(--site-font);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

body {
    min-width: 320px;
    margin: 0;
    background: var(--background);
    transition: color 150ms ease, background-color 150ms ease;
}

a {
    color: inherit;
}

.physics-canvas,
.doodle-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.physics-canvas { z-index: 0; }
.doodle-canvas { z-index: 10; }

@media (hover: none), (pointer: coarse) {
    .physics-canvas,
    .doodle-canvas {
        display: none;
    }

    :root[data-drawing="on"] .physics-canvas,
    :root[data-drawing="on"] .doodle-canvas {
        display: block;
    }

    :root[data-drawing="on"] body {
        touch-action: none;
    }

    :root[data-drawing="on"] a,
    :root[data-drawing="on"] button,
    :root[data-drawing="on"] summary,
    :root[data-drawing="on"] input,
    :root[data-drawing="on"] textarea,
    :root[data-drawing="on"] select {
        touch-action: manipulation;
    }
}

.drawing-toggle {
    display: none;
}

@media (hover: none), (pointer: coarse) {
    .drawing-toggle {
        position: fixed;
        right: 18px;
        bottom: max(18px, env(safe-area-inset-bottom));
        z-index: 20;
        display: inline-flex;
        align-items: center;
        gap: 7px;
        min-height: 36px;
        padding: 0 12px;
        border: 1px solid color-mix(in srgb, var(--text) 22%, transparent);
        border-radius: 999px;
        background: color-mix(in srgb, var(--background) 90%, transparent);
        color: var(--text);
        font: inherit;
        font-size: 12px;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        backdrop-filter: blur(8px);
    }

    .drawing-toggle:focus-visible {
        outline: 1px solid var(--text);
        outline-offset: 3px;
    }

    .drawing-toggle-dot {
        width: 7px;
        height: 7px;
        border-radius: 50%;
        background: var(--muted);
    }

    .drawing-toggle[aria-pressed="true"] .drawing-toggle-dot {
        background: var(--accent);
    }
}

.page {
    position: relative;
    z-index: 1;
    display: flex;
    width: 100%;
    max-width: 700px;
    min-height: 100vh;
    margin: 0 auto;
    padding: 0 40px;
    flex-direction: column;
}

.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 20px 0 16px;
    padding-bottom: 11px;
    border-bottom: 1px solid var(--line);
}

.name {
    position: relative;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.015em;
    text-decoration: none;
}

.name::after {
    position: absolute;
    right: -5px;
    bottom: -2px;
    left: -2px;
    height: 1px;
    background: var(--accent);
    content: "";
    opacity: 0;
    transform: scaleX(0.8);
    transition: opacity 150ms ease, transform 150ms ease;
}

.name:hover::after {
    opacity: 0.65;
    transform: scaleX(1);
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

.color-picker {
    display: flex;
    align-items: center;
    gap: 5px;
}

.color-swatch {
    width: 13px;
    height: 13px;
    padding: 0;
    border: 1px solid color-mix(in srgb, var(--text) 20%, transparent);
    border-radius: 2px;
    cursor: pointer;
    transition: transform 140ms ease, box-shadow 140ms ease;
}

.color-swatch:hover {
    transform: scale(1.12);
}

.color-swatch[aria-pressed="true"] { box-shadow: 0 0 0 1px var(--background), 0 0 0 2px var(--text); }
.color-swatch:focus-visible { outline: 1px solid var(--text); outline-offset: 3px; }
.swatch-graphite { background: #555552; }
.swatch-blue { background: #526f9e; }
.swatch-sage { background: #627965; }
.swatch-rust { background: #9a5b48; }

.theme-toggle {
    display: grid;
    width: 24px;
    height: 24px;
    padding: 0;
    place-items: center;
    border: 0;
    background: none;
    color: var(--muted);
    cursor: pointer;
    transition: color 150ms ease, transform 150ms ease;
}

.theme-toggle:hover {
    color: var(--text);
    transform: rotate(-9deg) scale(1.08);
}

.theme-toggle svg {
    grid-area: 1 / 1;
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.moon-icon,
:root[data-theme="dark"] .sun-icon {
    visibility: hidden;
}

:root[data-theme="dark"] .moon-icon {
    visibility: visible;
}

main {
    flex: 1;
}

.intro {
    margin-top: 26px;
    padding-bottom: 10px;
}

h1,
h2,
h3,
p {
    margin-top: 0;
}

h1,
h2 {
    margin-bottom: 8px;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.intro p {
    margin-bottom: 8px;
}

.intro a {
    text-underline-offset: 2px;
}

.experience {
    padding: 12px 0 12px;
}

.experience-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.experience-card {
    display: block;
    border: 1px solid transparent;
    border-radius: 8px;
    transition: background-color 150ms ease, border-color 150ms ease;
}

.experience-card[open] {
    background: transparent;
    border-color: transparent;
}

.experience-summary {
    display: flex;
    align-items: center;
    padding: 9px 12px;
    border-radius: 8px;
    cursor: pointer;
    list-style: none;
    -webkit-tap-highlight-color: transparent;
}

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

.experience-summary:focus-visible {
    outline: 1px solid var(--text);
    outline-offset: 2px;
}

.logo {
    display: flex;
    width: 46px;
    height: 46px;
    margin-right: 13px;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border: 1px solid color-mix(in srgb, var(--text) 18%, transparent);
    border-radius: 8px;
    overflow: hidden;
}

.logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    filter: grayscale(1);
}

.experience-copy {
    width: 100%;
    min-width: 0;
}

.experience-card h3 {
    margin-bottom: 0;
    font-size: 16px;
    font-weight: 600;
}

.experience-card p {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 13px;
}

.expand-icon {
    display: grid;
    width: 18px;
    height: 18px;
    margin-left: 16px;
    place-items: center;
    color: var(--muted);
    transition: transform 360ms cubic-bezier(0.22, 1, 0.36, 1);
}

.expand-icon svg {
    width: 15px;
    height: 15px;
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.8;
}

.experience-card[open]:not(.is-closing) .expand-icon {
    transform: rotate(90deg);
}

.experience-details {
    margin: -1px 12px 0 71px;
    padding: 0 0 12px;
}

.experience-details time {
    display: block;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 12px;
}

.experience-details p {
    max-width: 440px;
    color: var(--text);
    line-height: 1.55;
}

.draw-prompt {
    margin: 28px 0 20px;
    text-align: center;
}

.draw-prompt > p {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 12px;
}

.guide-shapes {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 22px;
}

.guide-shape {
    width: 84px;
    height: 84px;
    overflow: visible;
    fill: none;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 2 6;
    opacity: 0.3;
    animation: guide-trace 3.6s ease-in-out infinite;
}

.guide-shape:nth-child(1) { stroke: var(--guide-blue); }
.guide-shape:nth-child(2) { stroke: var(--guide-sage); animation-delay: 0.4s; }
.guide-shape:nth-child(3) { stroke: var(--guide-rust); animation-delay: 0.8s; }

@keyframes guide-trace {
    0%, 70%, 100% {
        opacity: 0.25;
        stroke-dashoffset: 0;
        transform: translateY(0);
    }
    18%, 45% {
        opacity: 0.8;
        stroke-dashoffset: -16;
        transform: translateY(-2px);
    }
}

.footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 16px 0;
    padding: 16px 0;
    border-top: 1px solid var(--line);
    font-size: 14px;
}

.footer p {
    width: 210px;
    margin: 0;
}

.social-links {
    display: flex;
    gap: 16px;
}

.social-links a:hover {
    color: var(--text);
    text-underline-offset: 3px;
}

@media (max-width: 640px) {
    .page {
        padding: 0 20px;
    }

    .header-controls {
        gap: 8px;
    }

    .experience-details {
        margin-left: 16px;
    }

    .footer {
        align-items: flex-start;
        flex-direction: column;
        gap: 16px;
    }

    .footer p {
        width: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .expand-icon {
        transition: none;
    }

    .guide-shape {
        animation: none;
    }
}
