:root {
    --muted: #969696;
    --surface: #151515;
    --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
}

body[data-theme="light"] {
    --muted: #6b6b6b;
    --surface: #fff;
}

*, *::before, *::after { box-sizing: border-box; }
button, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; text-transform: inherit; }
button:focus-visible, a:focus-visible {
    outline: 2px solid var(--fg);
    outline-offset: 5px;
}
.content { max-width: 1200px; padding: 32px 40px 24px; }
.intro { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px 14px; margin-bottom: 4px; }
.intro h1 { font-size: 20px; font-weight: 300; margin: 0; }
.intro .bio { font-size: 12px; margin: 0; color: var(--muted); }
.contact-links { margin: 0 48px 0 auto; gap: 16px; }
.contact-links a { font-size: 11px; }
.ui-toggles { position: absolute; top: 23px; left: auto; right: 34px; }
.ui-btn { border: 0; background: transparent; color: var(--muted); }

.highlights { position: relative; z-index: 10; margin-bottom: 20px; }
.projects-list { display: flex; flex-wrap: wrap; gap: 0 20px; list-style: none; margin: 0; padding: 0; }
.project-item { position: relative; }
.project-trigger {
    display: block;
    min-height: 44px;
    padding: 8px 0;
    border: 0;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
    font-weight: 300;
    cursor: pointer;
    text-underline-offset: 6px;
    text-decoration-thickness: 1px;
}
.project-trigger[aria-expanded="true"] { color: var(--fg); text-decoration-line: underline; }
.project-trigger:active { opacity: .65; }
.project-preview {
    position: absolute;
    top: calc(100% + 6px);
    left: 0;
    width: 300px;
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: 0 12px 36px #0003;
    transform-origin: 24px top;
}
.project-preview::before { content: ""; position: absolute; inset: -12px 0 auto; height: 12px; }
.project-preview[hidden] { display: none; }
.project-preview-heading { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.project-preview-heading img { width: 40px; height: 40px; border-radius: 10px; object-fit: contain; background: #000; }
.project-preview-heading h2 { margin: 0; font-size: 16px; font-weight: 400; }
.project-preview-description { margin: 0 0 16px; font-size: 13px; line-height: 1.65; color: var(--muted); font-weight: 400; }
.project-links { display: flex; gap: 18px; }
.project-links a { color: var(--fg); font-size: 12px; text-decoration: none; font-weight: 400; }
.project-links a:hover { text-decoration: underline; text-underline-offset: 4px; }

/* The screen leads; a fixed stage preserves every image's aspect ratio. */
.gallery { position: relative; width: min(100%, 820px); margin: 0 auto; }
.gallery-stage { display: block; width: 100%; height: clamp(380px, 74svh, 820px); padding: 0; border: 0; border-radius: 18px; background: transparent; color: inherit; cursor: default; pointer-events: none; }
.gallery-stage:focus-visible { outline-offset: 8px; }
.gallery-media { display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center; width: 100%; height: 100%; isolation: isolate; }
.gallery-media > * {
    grid-area: 1 / 1;
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    min-height: 0;
    min-width: 0;
    border-radius: 18px;
    object-fit: contain;
    box-shadow: 0 0 0 1px var(--border);
    pointer-events: auto;
    user-select: none;
    -webkit-user-drag: none;
}
.gallery-footer { display: flex; justify-content: space-between; padding-top: 24px; font-size: 10px; color: var(--muted); }
.gallery-footer a { color: inherit; text-decoration: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

@media (hover: hover) and (pointer: fine) {
    .project-trigger:hover, .contact-links a:hover { color: var(--fg); }
}
@media (max-width: 800px) {
    .content { padding-inline: 24px; }
    .ui-toggles { right: 18px; }
}
@media (max-width: 600px) {
    .content { padding: 24px 20px 20px; }
    .intro h1 { font-size: 18px; }
    .intro { margin-bottom: 4px; gap: 6px 12px; padding-right: 26px; }
    .intro .bio { font-size: 11px; }
    .contact-links { flex-basis: 100%; margin: 2px 0 0; gap: 16px; }
    .contact-links a { font-size: 10px; }
    .ui-toggles { right: 12px; top: 16px; }
    .projects-list { gap: 0 18px; }
    .project-trigger { font-size: 11px; }
    .project-item { position: static; }
    .project-preview { top: calc(100% + 6px); width: min(320px, 100%); }
    .highlights { margin-bottom: 12px; }
    .gallery { width: 100%; }
    .gallery-stage { height: clamp(340px, 70svh, 680px); }
    .gallery-footer { padding-top: 20px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}
