:root {
    color-scheme: light dark;
    --bg: light-dark(#f5f6fa, #0b0d12);
    --surface: light-dark(#ffffff, #151922);
    --surface-2: light-dark(#eef0f6, #1d222d);
    --text: light-dark(#12151c, #eceff5);
    --muted: light-dark(#5b6472, #9aa3b2);
    --border: light-dark(#e2e5ee, #262c38);
    --accent: light-dark(#4f46e5, #8f9bff);
    --accent-2: light-dark(#0ea5e9, #5ad1ff);
    --accent-text: light-dark(#ffffff, #0b0d12);
    --shadow-color: light-dark(rgb(24 28 60 / 10%), rgb(0 0 0 / 45%));
    --shadow: 0 1px 2px var(--shadow-color), 0 12px 32px -8px var(--shadow-color);
    --radius: 18px;
}

:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; }
html:has(dialog[open]) { overflow: hidden; }

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(900px 420px at 12% -8%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%),
        radial-gradient(700px 380px at 92% -4%, color-mix(in srgb, var(--accent-2) 13%, transparent), transparent 70%),
        var(--bg);
    background-repeat: no-repeat;
    color: var(--text);
    font: 16px/1.6 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-underline-offset: 3px; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.skip {
    position: absolute;
    top: -100px;
    left: 16px;
    z-index: 20;
    padding: 8px 14px;
    border-radius: 10px;
    background: var(--accent);
    color: var(--accent-text);
    font-weight: 600;
    text-decoration: none;
}

.skip:focus { top: 12px; }

.wrap {
    width: 100%;
    max-width: 1160px;
    margin: 0 auto;
    padding-inline: clamp(16px, 4vw, 32px);
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
    background: color-mix(in srgb, var(--bg) 78%, transparent);
    backdrop-filter: saturate(160%) blur(14px);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
}

.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 64px; }
.site-nav { display: flex; align-items: center; gap: 4px; }

.nav-link {
    padding: 6px 12px;
    border-radius: 10px;
    color: var(--muted);
    font-size: .92rem;
    font-weight: 550;
    text-decoration: none;
}

.nav-link:hover { background: var(--surface-2); color: var(--text); }

.theme-toggle {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    margin-left: 4px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    color: var(--text);
    cursor: pointer;
}

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

main { flex: 1; padding-bottom: 72px; }

.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: .875rem; }
.site-footer .wrap { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; padding-block: 24px; }
.site-footer a { color: inherit; }

.brand {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: var(--text);
    font-weight: 700;
    letter-spacing: -.01em;
    text-decoration: none;
}

.brand-mark {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), var(--accent-2));
    color: var(--accent-text);
    font-size: .8rem;
    letter-spacing: .02em;
}

.hero { padding: clamp(36px, 8vw, 88px) 0 clamp(24px, 5vw, 44px); }

.eyebrow {
    display: inline-block;
    margin: 0 0 14px;
    padding: 4px 12px;
    border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    color: var(--accent);
    font-size: .8rem;
    font-weight: 650;
    letter-spacing: .02em;
}

.hero h1 {
    margin: 0 0 12px;
    background: linear-gradient(120deg, var(--text) 30%, var(--accent));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-size: clamp(2.25rem, 6vw, 3.75rem);
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -.035em;
}

.hero p { max-width: 60ch; margin: 0; color: var(--muted); font-size: clamp(1.05rem, 2vw, 1.2rem); }
.hero .button { display: inline-block; margin-top: 20px; }

.toolbar { display: grid; gap: 14px; margin-bottom: 28px; }

.search-box {
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 560px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface);
    color: var(--muted);
    box-shadow: 0 1px 2px var(--shadow-color);
    transition: border-color .15s ease, box-shadow .15s ease;
}

.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.search-box svg { flex: none; }

.search {
    flex: 1;
    min-width: 0;
    padding: 13px 0;
    border: 0;
    outline: 0;
    background: transparent;
    color: var(--text);
    font: inherit;
}

kbd {
    padding: 1px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--surface-2);
    color: var(--muted);
    font: 600 .78rem/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.chips { display: flex; flex-wrap: wrap; gap: 8px; }

.chip {
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
    color: var(--text);
    font: inherit;
    font-size: .9rem;
    font-weight: 550;
    cursor: pointer;
    transition: border-color .15s ease, background .15s ease;
}

.chip span { color: var(--muted); font-size: .8rem; }
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: var(--accent-text); }
.chip[aria-pressed="true"] span { color: inherit; opacity: .8; }

.count { margin: 0; color: var(--muted); font-size: .875rem; }
.empty { padding: 56px 0; color: var(--muted); text-align: center; }

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
    gap: 20px;
}

.card {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.card:hover, .card:focus-within { border-color: color-mix(in srgb, var(--accent) 60%, var(--border)); box-shadow: var(--shadow); transform: translateY(-3px); }

.card-cover { aspect-ratio: 16 / 9; overflow: hidden; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.card-cover img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; transition: transform .4s ease; }
.card:hover .card-cover img { transform: scale(1.03); }

.card-main { flex: 1; display: flex; gap: 14px; padding: 20px; }
.card-body { flex: 1; min-width: 0; }
.card h2 { margin: 0; font-size: 1.125rem; line-height: 1.3; letter-spacing: -.01em; }
.card-link { color: inherit; text-decoration: none; }
.card-link::after { content: ""; position: absolute; inset: 0; border-radius: var(--radius); }
.summary { margin: 8px 0 0; color: var(--muted); font-size: .95rem; }

.card-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    font-size: .85rem;
}

.card-news { flex: 1; min-width: 0; margin: 0; overflow: hidden; color: var(--muted); text-overflow: ellipsis; white-space: nowrap; }

.tag {
    display: inline-block;
    margin: 6px 0 0;
    padding: 1px 10px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    color: var(--accent);
    font-size: .78rem;
    font-weight: 600;
}

.open {
    position: relative;
    z-index: 1;
    margin-left: auto;
    font-size: .9rem;
    font-weight: 650;
    text-decoration: none;
    white-space: nowrap;
}

.open:hover { text-decoration: underline; }

.icon {
    flex: none;
    display: grid;
    place-items: center;
    width: 52px;
    height: 52px;
    border-radius: 14px;
    object-fit: cover;
}

.icon-glyph { background: color-mix(in srgb, var(--accent) 12%, transparent); font-size: 1.6rem; line-height: 1; }
.icon-letter { color: #fff; font-size: 1.4rem; font-weight: 700; }
.hue-0 { background: linear-gradient(135deg, #4f46e5, #7c3aed); }
.hue-1 { background: linear-gradient(135deg, #0891b2, #0ea5e9); }
.hue-2 { background: linear-gradient(135deg, #16a34a, #0d9488); }
.hue-3 { background: linear-gradient(135deg, #ea580c, #e11d48); }
.hue-4 { background: linear-gradient(135deg, #be185d, #9333ea); }
.hue-5 { background: linear-gradient(135deg, #6d28d9, #2563eb); }

.back { margin: 28px 0 24px; }
.back a { color: var(--muted); font-weight: 550; text-decoration: none; }
.back a:hover { color: var(--accent); }

.detail { max-width: 880px; }
.detail-head { display: flex; flex-wrap: wrap; align-items: center; gap: 18px; }
.detail-head > div { flex: 1; min-width: 200px; }
.detail-head h1 { margin: 0; font-size: clamp(1.9rem, 5vw, 2.75rem); font-weight: 800; line-height: 1.1; letter-spacing: -.03em; }
.detail-head .icon { width: 76px; height: 76px; border-radius: 20px; box-shadow: var(--shadow); }
.detail-head .icon-glyph { font-size: 2.2rem; }
.detail-head .icon-letter { font-size: 2rem; }
.lead { margin: 22px 0 0; color: var(--muted); font-size: 1.2rem; }

.button {
    padding: 11px 20px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 60%, var(--accent-2)));
    color: var(--accent-text);
    font-weight: 650;
    text-decoration: none;
    box-shadow: 0 6px 18px -6px color-mix(in srgb, var(--accent) 70%, transparent);
    transition: transform .15s ease, filter .15s ease;
}

.button:hover { filter: brightness(1.08); transform: translateY(-1px); }

.shots {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(46%, 240px), 1fr));
    gap: 14px;
    margin-top: 32px;
}

.shot { margin: 0; }

.shot a {
    display: block;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-2);
    cursor: zoom-in;
    transition: border-color .2s ease, box-shadow .2s ease;
}

.shot a:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.shot img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: top; transition: transform .4s ease; }
.shot a:hover img { transform: scale(1.04); }
.shot figcaption { margin-top: 6px; color: var(--muted); font-size: .85rem; }

.viewer {
    width: 100vw;
    max-width: none;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    margin: 0;
    padding: 0;
    border: 0;
    background: rgb(8 9 13 / 94%);
    color: #f2f4f8;
    overflow: hidden;
    touch-action: pan-y pinch-zoom;
}

.viewer[open] { display: grid; grid-template: auto 1fr / auto 1fr auto; align-items: center; animation: viewer-in .18s ease; }
.viewer::backdrop { background: rgb(8 9 13 / 94%); }

.viewer-bar { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; }
.viewer-count { font-size: .9rem; font-variant-numeric: tabular-nums; opacity: .8; }

.viewer-button {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 50%;
    background: rgb(255 255 255 / 10%);
    color: inherit;
    font: inherit;
    font-size: 1.25rem;
    line-height: 1;
    cursor: pointer;
    transition: background .15s ease;
}

.viewer-button:hover { background: rgb(255 255 255 / 22%); }
.viewer-button:focus-visible { outline-color: #fff; }
.viewer-prev, .viewer-next { margin: 0 12px; font-size: 1.75rem; }
.viewer-prev { grid-column: 1; }
.viewer-next { grid-column: 3; }

.viewer-stage {
    grid-column: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    min-width: 0;
    height: 100%;
    min-height: 0;
    margin: 0;
    padding-bottom: 20px;
}

.viewer-stage img {
    flex: 0 1 auto;
    min-height: 0;
    max-width: 100%;
    max-height: 100%;
    border-radius: 10px;
    object-fit: contain;
    transition: opacity .15s ease;
    user-select: none;
    -webkit-user-drag: none;
}

.viewer[data-loading] .viewer-stage img { opacity: .35; }
.viewer-stage figcaption { flex: none; max-width: 70ch; padding-inline: 16px; font-size: .95rem; text-align: center; opacity: .9; }

@keyframes viewer-in { from { opacity: 0; } }

.prose { margin-top: 36px; font-size: 1.05rem; }
.prose h2, .prose h3, .prose h4 { margin: 1.6em 0 .5em; line-height: 1.25; letter-spacing: -.01em; }
.prose p, .prose ul { margin: 0 0 1em; }
.prose code { padding: 2px 6px; border-radius: 6px; background: color-mix(in srgb, var(--text) 8%, transparent); font-size: .9em; }

.news { margin-top: 48px; padding-top: 32px; border-top: 1px solid var(--border); }
.news > h2 { margin: 0 0 24px; font-size: 1.5rem; letter-spacing: -.02em; }
.timeline { margin: 0; padding: 0; list-style: none; }

.timeline li {
    position: relative;
    padding: 0 0 28px 28px;
    border-left: 2px solid var(--border);
}

.timeline li:last-child { padding-bottom: 0; border-left-color: transparent; }

.timeline li::before {
    content: "";
    position: absolute;
    top: 5px;
    left: -7px;
    width: 12px;
    height: 12px;
    border: 2px solid var(--bg);
    border-radius: 50%;
    background: var(--accent);
}

.timeline li:target h3 { color: var(--accent); }
.timeline time { color: var(--muted); font-size: .85rem; font-weight: 600; }
.timeline h3 { margin: 2px 0 0; font-size: 1.1rem; line-height: 1.35; }
.timeline .prose { margin-top: 8px; font-size: 1rem; }
.timeline .prose > :last-child { margin-bottom: 0; }

@media (max-width: 640px) {
    .site-nav .nav-link:first-child { display: none; }
    .viewer-prev, .viewer-next { position: absolute; bottom: 16px; margin: 0; }
    .viewer-prev { left: 16px; }
    .viewer-next { right: 16px; }
    .viewer-stage { grid-column: 1 / -1; padding: 0 8px 76px; }
    .detail-head .button { width: 100%; text-align: center; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { animation: none !important; transition: none !important; }
    .card:hover, .card:focus-within, .button:hover { transform: none; }
}
