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

:root {
    --bg: #FFFDF7;
    --surface: #FFFFFF;
    --ink: #0A0A0A;
    --ink-muted: #38382F;
    --ink-faint: #7A7A6E;
    --line: #0A0A0A;
    --dot: #0A0A0A;
    --card-bw: 3px;
    --chip-bw: 2.5px;
    color-scheme: light;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #121210;
        --surface: #1B1B17;
        --ink: #F5F3EA;
        --ink-muted: #C6C4B6;
        --ink-faint: #8C8A7C;
        --line: #F5F3EA;
        --dot: #F5F3EA;
        --card-bw: 2px;
        --chip-bw: 1.5px;
        color-scheme: dark;
    }
}
:root[data-theme="dark"] {
    --bg: #121210;
    --surface: #1B1B17;
    --ink: #F5F3EA;
    --ink-muted: #C6C4B6;
    --ink-faint: #8C8A7C;
    --line: #F5F3EA;
    --dot: #F5F3EA;
    --card-bw: 2px;
    --chip-bw: 1.5px;
    color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

body {
    background: var(--bg);
    color: var(--ink);
    font-family: 'Space Mono', monospace;
    line-height: 1.6;
    transition: background 0.2s ease, color 0.2s ease;
}

.bg-dots {
    position: fixed;
    inset: -20px;
    z-index: -1;
    pointer-events: none;
    background-image: radial-gradient(var(--dot) 1px, transparent 1px);
    background-size: 14px 14px;
    background-position: -7px -7px;
    filter: blur(1px);
    opacity: 0.30;
}

a { color: inherit; }

/* ===== MASTHEAD ===== */
#masthead {
    background: var(--surface);
    border-bottom: 2px solid var(--line);
    padding: 16px 24px;
}
.masthead-inner {
    max-width: 1040px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}
.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 15px;
    letter-spacing: 0.04em;
    text-decoration: none;
    color: var(--ink);
}
.brand-avatar {
    width: 34px; height: 34px;
    border-radius: 8px;
    display: block; object-fit: contain;
    flex-shrink: 0;
}
.masthead-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
}
.theme-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    flex: 0 0 auto;
    border: 1.5px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink);
    cursor: pointer;
    padding: 0;
}
.theme-toggle svg { width: 16px; height: 16px; }
.theme-toggle:hover { background: var(--ink); color: var(--bg); }
.theme-toggle .icon-sun { display: none; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
    :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
}
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="light"] .theme-toggle .icon-moon { display: block; }
:root[data-theme="light"] .theme-toggle .icon-sun { display: none; }

/* ===== HERO ===== */
#hero {
    max-width: 1040px;
    margin: 0 auto;
    padding: 64px 24px 44px;
}
.kicker {
    font-size: 12.5px;
    font-weight: 700;
    color: var(--ink-muted);
    margin-bottom: 18px;
}
#hero h1 {
    font-family: 'Archivo Black', sans-serif;
    font-size: clamp(34px, 6.5vw, 62px);
    line-height: 1.08;
    letter-spacing: -0.01em;
    text-wrap: balance;
    margin-bottom: 20px;
}
#hero mark {
    background: #3355FF;
    color: #FFFDF7;
    padding: 0 10px;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
    display: inline-block;
    transform: rotate(-1deg);
}
.hero-desc {
    font-family: 'Space Mono', monospace;
    font-size: 15px;
    color: var(--ink-muted);
    max-width: 50ch;
    line-height: 1.7;
}

/* ===== SHELF / GRID ===== */
#shelf {
    max-width: 1040px;
    margin: 0 auto;
    padding: 8px 24px 80px;
}
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
    gap: 40px 30px;
}

/* ===== CARD ===== */
.card {
    position: relative;
    background: var(--surface);
    border: var(--card-bw) solid var(--line);
    border-radius: 4px;
    padding: 22px 20px 20px;
    display: flex;
    flex-direction: column;
    box-shadow: 6px 6px 0 var(--line);
    transform: rotate(var(--rotate));
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.card:hover {
    transform: rotate(0deg) translate(-3px, -3px);
    box-shadow: 9px 9px 0 var(--accent);
}
@media (prefers-reduced-motion: reduce) {
    .card { transition: none; }
}

.tag {
    position: absolute;
    top: -14px;
    right: 16px;
    background: var(--accent);
    color: #FFFDF7;
    border: var(--chip-bw) solid var(--line);
    border-radius: 100px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 3px;
    transform: rotate(4deg);
}
.tag.is-new { background: #0A0A0A; }

.card-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}
.icon-box {
    width: 58px; height: 58px;
    border-radius: 13px;
    overflow: hidden;
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--surface);
}
.icon-box.is-glyph {
    background: #FFFFFF;
}
.icon-box.is-padded { padding: 8px; }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .icon-box.is-glyph { background: var(--surface); }
    :root:not([data-theme="light"]) .icon-box.is-line-art .card-icon { filter: invert(1) hue-rotate(180deg); }
}
:root[data-theme="dark"] .icon-box.is-glyph { background: var(--surface); }
:root[data-theme="dark"] .icon-box.is-line-art .card-icon { filter: invert(1) hue-rotate(180deg); }
.card-icon {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
}
.card-title { min-width: 0; }
.card-title h2 {
    font-family: 'Archivo Black', sans-serif;
    font-size: 19px;
    line-height: 1.2;
    color: var(--ink);
    text-wrap: balance;
}
.card-sub {
    font-size: 11.5px;
    color: var(--ink-faint);
    margin-top: 3px;
    line-height: 1.4;
}

.desc {
    font-size: 13px;
    color: var(--ink-muted);
    line-height: 1.65;
    margin-bottom: 16px;
}

.spec {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.06em;
    color: var(--accent);
    margin-bottom: 16px;
}

.btn {
    margin-top: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--accent);
    color: #FFFDF7;
    border: var(--chip-bw) solid var(--line);
    border-radius: 4px;
    padding: 10px 16px;
    font-family: 'Space Mono', monospace;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-decoration: none;
    box-shadow: 4px 4px 0 var(--line);
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.btn:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--line); }
.btn:active { transform: translate(4px, 4px); box-shadow: 0 0 0 var(--line); }

/* ===== FOOTER ===== */
#site-footer {
    text-align: center;
    padding: 22px 24px;
    border-top: var(--card-bw) solid var(--line);
}
#site-footer p {
    display: inline-flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 7px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.03em;
    color: var(--ink-muted);
}
.copyright-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 17px;
    height: 17px;
    border: 1.6px solid var(--ink);
    border-radius: 50%;
    font-size: 10px;
    line-height: 1;
    color: var(--ink);
}
.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
#site-footer a { text-decoration: underline; }

/* ===== RESPONSIVE ===== */
@media (max-width: 560px) {
    #hero { padding: 44px 20px 32px; }
    #shelf { padding: 4px 20px 56px; }
    .grid { grid-template-columns: 1fr; gap: 40px; }
    .card { transform: rotate(0deg); }
    .card:hover { transform: translate(-2px, -2px); }
    #masthead { padding: 14px 20px; }
}
