/* ═══════════════════════════════════════════════════════
   Tokens
   ═══════════════════════════════════════════════════════ */
:root {
    color-scheme: dark;

    /* surfaces */
    --bg-void: #020202;
    --bg-deep: #050505;
    --bg: #080808;
    --bg-panel: #0d0d0d;
    --bg-elevated: #111111;

    /* lines */
    --border: #1e1e1e;
    --border-hot: #333333;
    --border-glow: rgb(255 255 255 / 0.10);

    /* ink */
    --text: #e8e8e8;
    --text-muted: #767676;
    --text-faint: #404040;
    --white: #f8f8f8;
    --chrome: #ffffff;
    --warn: #ffb703;

    /* type */
    --font-display: "Cormorant Garamond", Georgia, "Times New Roman", serif;
    --font-body: "Outfit", system-ui, sans-serif;
    --font-mono: "JetBrains Mono", ui-monospace, monospace;
    --font-bio: "Share Tech Mono", var(--font-mono);

    /* space */
    --space-xs: 0.5rem;
    --space-sm: 1rem;
    --space-md: 1.75rem;
    --space-lg: 3rem;
    --space-xl: 5rem;

    /* shape */
    --radius: 2px;
    --card-radius: 3px;
    --max: 44rem;

    /* motion */
    --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
    --transition-fast: 160ms var(--ease);
    --transition-base: 240ms var(--ease);

    /* overlay intensity — tweak in one place */
    --grain-opacity: 0.028;
    --scanline-opacity: 0.032;
    --grid-opacity: 0.38;
}

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

html {
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100svh;
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 1rem;
    line-height: 1.65;
    color: var(--text);
    background-color: var(--bg-void);
    background-image:
        radial-gradient(ellipse 80% 60% at 50% -10%, rgb(255 255 255 / 0.04), transparent 55%),
        linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 55%, var(--bg-void) 100%);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

img,
svg {
    max-width: 100%;
}

button {
    font: inherit;
}

::selection {
    background: var(--chrome);
    color: var(--bg-deep);
}

/* One consistent focus ring for every interactive element. */
:where(a, button):focus-visible {
    outline: 2px solid var(--chrome);
    outline-offset: 4px;
    border-radius: var(--radius);
}

/* Skip-link target support if you add one later. */
:target {
    scroll-margin-top: var(--space-lg);
}

/* ═══════════════════════════════════════════════════════
   Overlay layers
   ═══════════════════════════════════════════════════════ */
.grain,
.grid-bg,
.scanlines {
    pointer-events: none;
    position: fixed;
    inset: 0;
    contain: strict;
}

.grain {
    z-index: 3;
    opacity: var(--grain-opacity);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.grid-bg {
    z-index: 0;
    opacity: var(--grid-opacity);
    background-image:
        linear-gradient(rgb(255 255 255 / 0.025) 1px, transparent 1px),
        linear-gradient(90deg, rgb(255 255 255 / 0.025) 1px, transparent 1px);
    background-size: 52px 52px;
    -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, #000 15%, transparent 68%);
    mask-image: radial-gradient(ellipse 80% 60% at 50% 30%, #000 15%, transparent 68%);
}

.scanlines {
    z-index: 2;
    opacity: var(--scanline-opacity);
    background-image: repeating-linear-gradient(
        0deg,
        transparent 0 2px,
        rgb(0 0 0 / 0.5) 2px 4px
    );
}

.hero,
.section,
.footer {
    position: relative;
    z-index: 1;
}

/* ═══════════════════════════════════════════════════════
   Warning popup
   ═══════════════════════════════════════════════════════ */
.warning-popup {
    position: fixed;
    top: max(1rem, env(safe-area-inset-top));
    left: 50%;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    max-width: min(34rem, calc(100% - 1.5rem));
    padding: 0.8rem 0.95rem;
    background: rgb(12 12 12 / 0.96);
    backdrop-filter: blur(6px);
    border: 1px solid rgb(255 255 255 / 0.16);
    border-left: 3px solid var(--warn);
    border-radius: var(--card-radius);
    box-shadow: 0 14px 40px -18px rgb(0 0 0 / 0.85);
    transform: translate(-50%, -12px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition:
        opacity var(--transition-base),
        transform var(--transition-base),
        visibility 0s linear var(--transition-base);
}

.warning-popup.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
    pointer-events: auto;
    transition-delay: 0s;
}

.warning-popup__content {
    font-size: 0.92rem;
    line-height: 1.45;
    color: var(--text);
}

.warning-popup__close {
    flex-shrink: 0;
    border: 0;
    background: transparent;
    color: var(--text-muted);
    font-size: 1.15rem;
    line-height: 1;
    /* 44px hit target without changing the visual box */
    padding: 0.5rem;
    margin: -0.5rem;
    cursor: pointer;
    transition: color var(--transition-fast);
}

.warning-popup__close:hover {
    color: var(--white);
}

/* ═══════════════════════════════════════════════════════
   Hero
   ═══════════════════════════════════════════════════════ */
.hero {
    text-align: center;
    padding: var(--space-xl) var(--space-sm) var(--space-lg);
    max-width: var(--max);
    margin-inline: auto;
}

.hero__frame {
    position: relative;
    display: inline-block;
    padding: 6px;
    margin-bottom: var(--space-md);
    border: 1px solid var(--border-hot);
    background: linear-gradient(150deg, rgb(22 22 22 / 0.96) 0%, rgb(10 10 10 / 0.99) 100%);
    box-shadow:
        0 0 0 1px rgb(255 255 255 / 0.025),
        0 0 60px -16px rgb(255 255 255 / 0.05),
        0 32px 64px -32px rgb(0 0 0 / 0.98);
}

.hero__corner {
    position: absolute;
    width: 12px;
    height: 12px;
    border-color: var(--border-hot);
    border-style: solid;
    pointer-events: none;
}

.hero__corner--tl { inset-block-start: -2px; inset-inline-start: -2px; border-width: 1px 0 0 1px; }
.hero__corner--tr { inset-block-start: -2px; inset-inline-end: -2px; border-width: 1px 1px 0 0; }
.hero__corner--bl { inset-block-end: -2px; inset-inline-start: -2px; border-width: 0 0 1px 1px; }
.hero__corner--br { inset-block-end: -2px; inset-inline-end: -2px; border-width: 0 1px 1px 0; }

.hero__avatar {
    display: block;
    width: 120px;
    height: 120px;
    object-fit: cover;
    filter: grayscale(1) contrast(1.1) brightness(0.96);
    border-radius: var(--radius);
}

.hero__eyebrow {
    margin: 0 0 var(--space-xs);
    font-family: var(--font-bio);
    font-size: 0.66rem;
    letter-spacing: 0.32em;
    text-transform: lowercase;
    color: var(--text-faint);
}

.hero__title {
    margin: 0 0 var(--space-sm);
    font-family: var(--font-display);
    font-size: clamp(2.75rem, 8vw, 4.2rem);
    font-weight: 600;
    letter-spacing: 0.025em;
    line-height: 1.06;
    text-wrap: balance;
    color: var(--white);
    text-shadow:
        0 0 100px rgb(255 255 255 / 0.06),
        0 1px 0 rgb(255 255 255 / 0.10);
}

.hero__tagline {
    margin: 0 0 var(--space-md);
    font-size: 0.98rem;
    font-weight: 300;
    font-style: italic;
    letter-spacing: 0.04em;
    text-wrap: pretty;
    color: var(--text-muted);
}

/* Wrap the .guns-link elements in <div class="hero__links"> —
   gap replaces the old margin-right / :last-of-type hack. */
.hero__links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    margin-top: var(--space-sm);
}

/* ═══════════════════════════════════════════════════════
   Guns link
   ═══════════════════════════════════════════════════════ */
.guns-link {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    gap: 0.45rem;
    padding: 0.9rem 1.75rem 1rem;
    min-width: min(18rem, 100%);
    font-family: var(--font-bio);
    text-decoration: none;
    color: var(--text-muted);
    background: var(--bg-panel);
    border: 1px solid var(--border-hot);
    border-radius: var(--card-radius);
    box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.04);
    transition:
        background var(--transition-base),
        border-color var(--transition-base),
        color var(--transition-fast),
        box-shadow var(--transition-base),
        transform var(--transition-base);
}

.guns-link:hover,
.guns-link:focus-visible {
    background: var(--chrome);
    color: var(--bg-void);
    border-color: var(--chrome);
    box-shadow:
        0 0 0 1px var(--chrome),
        0 0 56px -10px rgb(255 255 255 / 0.30);
    transform: translateY(-2px);
}

.guns-link__line {
    display: inline-flex;
    align-items: baseline;
    flex-wrap: wrap;
    justify-content: center;
    line-height: 1.3;
}

.guns-link__brand {
    font-size: 0.80rem;
    letter-spacing: 0.34em;
    text-transform: lowercase;
    opacity: 0.7;
    transition: opacity var(--transition-fast);
}

.guns-link__slash {
    margin-inline: 0.02em;
    font-size: 0.92rem;
    opacity: 0.35;
}

.guns-link__user {
    font-size: 1rem;
    letter-spacing: 0.16em;
    color: var(--white);
    transition: color var(--transition-fast);
}

.guns-link__hint {
    font-family: var(--font-mono);
    font-size: 0.60rem;
    font-weight: 500;
    letter-spacing: 0.24em;
    text-transform: uppercase;
    color: var(--text-faint);
    transition: color var(--transition-fast);
}

/* Grouped hover/focus children — one block instead of three pairs. */
.guns-link:is(:hover, :focus-visible) .guns-link__brand { opacity: 1; }
.guns-link:is(:hover, :focus-visible) .guns-link__user { color: var(--bg-void); }
.guns-link:is(:hover, :focus-visible) .guns-link__hint { color: rgb(0 0 0 / 0.45); }

/* ═══════════════════════════════════════════════════════
   Layout
   ═══════════════════════════════════════════════════════ */
main {
    max-width: calc(var(--max) + 6rem);
    margin-inline: auto;
    padding: var(--space-lg) var(--space-sm) var(--space-xl);
}

.section + .section {
    margin-top: var(--space-xl);
}

.section__head {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-md);
}

.section__title {
    display: flex;
    align-items: center;
    gap: 0.5em;
    flex-shrink: 0;
    margin: 0;
    font-family: var(--font-bio);
    font-size: 0.68rem;
    font-weight: 400;
    letter-spacing: 0.38em;
    text-transform: uppercase;
    color: var(--text-muted);
}

.section__title::before {
    content: "";
    width: 4px;
    height: 4px;
    flex-shrink: 0;
    background: var(--text-faint);
    border-radius: 50%;
}

.section__rule {
    flex: 1;
    min-width: 2rem;
    height: 1px;
    margin: 0;
    border: 0;
    background: linear-gradient(90deg, var(--border-hot) 0%, transparent 88%);
}

/* ═══════════════════════════════════════════════════════
   Projects
   ═══════════════════════════════════════════════════════ */
.projects {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 17rem), 1fr));
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--card-radius);
    overflow: hidden;
}

.project-card {
    position: relative;
    overflow: hidden;
    background: var(--bg-panel);
    transition: background var(--transition-base);
}

.project-card::after {
    content: "";
    position: absolute;
    inset-block: 0;
    inset-inline-start: 0;
    width: 2px;
    background: var(--chrome);
    opacity: 0;
    transition: opacity var(--transition-fast);
}

/* :focus-within so keyboard users get the same affordance as mouse users. */
.project-card:hover,
.project-card:focus-within {
    background: var(--bg-elevated);
    z-index: 1;
}

.project-card:is(:hover, :focus-within)::after {
    opacity: 1;
}

.project-card__link {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    height: 100%;
    padding: 1.25rem 1.5rem 1.25rem 1.65rem;
    text-decoration: none;
    color: inherit;
}

.project-card__name {
    font-family: var(--font-display);
    font-size: 1.22rem;
    font-weight: 600;
    line-height: 1.25;
    color: var(--white);
    transition: color var(--transition-fast);
}

.project-card__desc {
    flex: 1;
    font-size: 0.84rem;
    font-weight: 300;
    line-height: 1.5;
    text-wrap: pretty;
    color: var(--text-muted);
}

.project-card__arrow {
    display: inline-block;
    margin-top: 0.75rem;
    font-family: var(--font-bio);
    font-size: 0.7rem;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--text-faint);
    transition:
        color var(--transition-fast),
        letter-spacing var(--transition-base);
}

.project-card:is(:hover, :focus-within) .project-card__name { color: var(--chrome); }

.project-card:is(:hover, :focus-within) .project-card__arrow {
    color: var(--text-muted);
    letter-spacing: 0.3em;
}

/* ═══════════════════════════════════════════════════════
   Stats
   ═══════════════════════════════════════════════════════ */
.stats__note {
    margin: 0 0 var(--space-md);
    font-size: 0.77rem;
    line-height: 1.6;
    text-wrap: pretty;
    color: var(--text-muted);
}

.stats__note code {
    font-family: var(--font-mono);
    font-size: 0.84em;
    padding: 0.12em 0.4em;
    background: var(--bg-elevated);
    border: 1px solid var(--border-hot);
    border-radius: var(--radius);
    color: var(--white);
}

/* Was flex-column + flex-wrap (wrap does nothing there) with a
   media query to flip direction. One wrapping row handles both. */
.stats__grid {
    display: flex;
    flex-wrap: wrap;
    gap: 1px;
    background: var(--border);
    border: 1px solid var(--border);
    border-radius: var(--card-radius);
    overflow: hidden;
}

.stats__figure {
    flex: 1 1 20rem;
    min-width: 0;
    margin: 0;
    padding: var(--space-sm);
    background: var(--bg-panel);
    transition: background var(--transition-base);
}

.stats__figure:hover {
    background: var(--bg-elevated);
}

.stats__img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: var(--radius);
    opacity: 0.92;
    transition: opacity var(--transition-base);
}

.stats__figure:hover .stats__img {
    opacity: 1;
}

/* ═══════════════════════════════════════════════════════
   Donate
   ═══════════════════════════════════════════════════════ */
.donate__list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 18rem), 1fr));
    gap: 1rem;
}

.wallet-card {
    padding: 0.9rem;
    background: var(--bg-panel);
    border: 1px solid var(--border-hot);
    border-radius: var(--card-radius);
}

.wallet-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}

.wallet-name {
    font-family: var(--font-display);
    font-size: 0.95rem;
    color: var(--white);
}

.wallet-address {
    padding: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    background: var(--bg-elevated);
    border-radius: var(--radius);
    color: var(--text-muted);
    overflow-wrap: anywhere;
}

.copy-btn {
    flex-shrink: 0;
    padding: 0.35rem 0.7rem;
    font-family: var(--font-mono);
    font-size: 0.82rem;
    color: var(--text);
    background: transparent;
    border: 1px solid var(--border-hot);
    border-radius: 999px;
    cursor: pointer;
    transition:
        background var(--transition-fast),
        color var(--transition-fast),
        border-color var(--transition-fast);
}

.copy-btn:hover {
    background: var(--chrome);
    color: var(--bg-void);
    border-color: var(--chrome);
}

.copy-status {
    height: 1rem;
    margin-top: 0.5rem;
    font-family: var(--font-mono);
    font-size: 0.78rem;
    color: var(--text-muted);
    opacity: 0;
    transition: opacity 220ms ease;
}

.copy-status.is-visible {
    opacity: 1;
}

/* ═══════════════════════════════════════════════════════
   Footer
   ═══════════════════════════════════════════════════════ */
.footer {
    padding: var(--space-lg) var(--space-sm);
    text-align: center;
    border-top: 1px solid var(--border);
}

.footer__text {
    margin: 0;
    font-family: var(--font-mono);
    font-size: 0.62rem;
    letter-spacing: 0.26em;
    text-transform: uppercase;
    color: var(--text-faint);
}

/* ═══════════════════════════════════════════════════════
   Preferences
   ═══════════════════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* The grain/scanline overlays are the first thing to hurt anyone who
   needs higher contrast or is sensitive to visual noise. */
@media (prefers-reduced-transparency: reduce), (prefers-contrast: more) {
    :root {
        --grain-opacity: 0;
        --scanline-opacity: 0;
        --grid-opacity: 0;
        --text-muted: #a0a0a0;
        --text-faint: #6e6e6e;
        --border: #3a3a3a;
        --border-hot: #5a5a5a;
    }
}

@media (hover: none) {
    /* Kill lift-on-tap sticking on touch devices. */
    .guns-link:hover {
        transform: none;
    }
}