/* ==========================================================================
   Obsidian Star Digital — core design system
   Obsidian-black glass, silver studio identity, per-project brand accents.
   ========================================================================== */

/* ---- Fonts (self-hosted, no external requests) --------------------------- */
@font-face {
    font-family: 'Inter';
    font-weight: 400;
    font-style: normal;
    font-display: swap;
    src: url('../fonts/inter-400.woff2') format('woff2');
}
@font-face {
    font-family: 'Inter';
    font-weight: 500;
    font-style: normal;
    font-display: swap;
    src: url('../fonts/inter-500.woff2') format('woff2');
}
@font-face {
    font-family: 'Inter';
    font-weight: 600;
    font-style: normal;
    font-display: swap;
    src: url('../fonts/inter-600.woff2') format('woff2');
}
@font-face {
    font-family: 'Inter';
    font-weight: 700;
    font-style: normal;
    font-display: swap;
    src: url('../fonts/inter-700.woff2') format('woff2');
}
@font-face {
    font-family: 'JetBrains Mono';
    font-weight: 400;
    font-style: normal;
    font-display: swap;
    src: url('../fonts/jbmono-400.woff2') format('woff2');
}
@font-face {
    font-family: 'JetBrains Mono';
    font-weight: 500;
    font-style: normal;
    font-display: swap;
    src: url('../fonts/jbmono-500.woff2') format('woff2');
}
@font-face {
    font-family: 'JetBrains Mono';
    font-weight: 700;
    font-style: normal;
    font-display: swap;
    src: url('../fonts/jbmono-700.woff2') format('woff2');
}

/* ---- Tokens --------------------------------------------------------------- */
:root {
    --bg: #050609;
    --bg-2: #0a0c12;
    --surface: rgba(255, 255, 255, 0.035);
    --surface-2: rgba(255, 255, 255, 0.06);
    --line: rgba(255, 255, 255, 0.09);
    --line-bright: rgba(255, 255, 255, 0.18);
    --text: #f2f4f8;
    --text-dim: #a7adba;
    --text-faint: #6b7280;

    /* Studio accent: obsidian silver. Project pages/cards override these. */
    --accent: #e8ebf2;
    --accent-deep: #c9ced9;
    --accent-rgb: 232, 235, 242;

    --live: #34d399;
    --live-rgb: 52, 211, 153;
    --soon: #fbbf24;
    --soon-rgb: 251, 191, 36;

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;

    --radius: 20px;
    --container: 1160px;
}

/* Per-brand accents */
.theme-hotaisle {
    --accent: #ff6a35;
    --accent-deep: #f23b0c;
    --accent-rgb: 255, 106, 53;
}
.theme-array {
    --accent: #ef4b45;
    --accent-deep: #cb2723;
    --accent-rgb: 239, 75, 69;
}
.theme-ntn {
    --accent: #c084fc;
    --accent-deep: #9333ea;
    --accent-rgb: 192, 132, 252;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-sans);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

main {
    flex: 1;
    width: 100%;
}

/* Accent-tinted aurora at the top of every page */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    background:
        radial-gradient(110% 60% at 50% -12%, rgba(var(--accent-rgb), 0.10), transparent 62%),
        radial-gradient(70% 45% at 85% 108%, rgba(var(--accent-rgb), 0.05), transparent 60%),
        var(--bg);
}

/* Starfield canvas (painted by main.js) */
#starfield {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
}

::selection {
    background: rgba(var(--accent-rgb), 0.35);
    color: #fff;
}

img {
    max-width: 100%;
    height: auto;
}

a {
    color: inherit;
}

:focus-visible {
    outline: 2px solid rgba(var(--accent-rgb), 0.9);
    outline-offset: 3px;
    border-radius: 4px;
}

.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;
}

.container {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 24px;
}

/* Subtle custom scrollbar */
::-webkit-scrollbar {
    width: 11px;
}
::-webkit-scrollbar-track {
    background: var(--bg);
}
::-webkit-scrollbar-thumb {
    background: #1d212c;
    border-radius: 8px;
    border: 3px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover {
    background: #2a3040;
}

/* ---- Nav ------------------------------------------------------------------ */
.nav {
    position: sticky;
    top: 0;
    z-index: 50;
    background: rgba(5, 6, 9, 0.72);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--line);
}

.nav-inner {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    min-width: 0;
}

.brand img {
    width: 30px;
    height: 30px;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.35));
}

.brand-name {
    font-weight: 700;
    font-size: 0.92rem;
    letter-spacing: 0.14em;
    white-space: nowrap;
}

.brand-name .digital {
    font-family: var(--font-mono);
    font-weight: 400;
    color: var(--text-dim);
    letter-spacing: 0.22em;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 6px;
}

.nav-links a {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    color: var(--text-dim);
    text-decoration: none;
    padding: 8px 12px;
    border-radius: 8px;
    transition: color 0.25s ease, background 0.25s ease;
}

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

/* ---- Buttons ---------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 14px 26px;
    border-radius: 999px;
    border: 1px solid var(--line-bright);
    background: var(--surface);
    color: var(--text);
    font-family: var(--font-sans);
    font-weight: 600;
    font-size: 0.98rem;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.3s ease, border-color 0.3s ease, box-shadow 0.3s ease, background 0.3s ease;
}

.btn:hover {
    transform: translateY(-2px);
    border-color: rgba(var(--accent-rgb), 0.7);
    box-shadow: 0 8px 30px -8px rgba(var(--accent-rgb), 0.45);
}

.btn svg {
    width: 20px;
    height: 20px;
    flex: none;
}

.btn-solid {
    background: var(--accent);
    border-color: transparent;
    color: #08090d;
}

.btn-solid:hover {
    background: var(--accent);
    filter: brightness(1.08);
    box-shadow: 0 10px 38px -8px rgba(var(--accent-rgb), 0.6);
}

.btn-discord:hover {
    border-color: #5865f2;
    box-shadow: 0 8px 30px -8px rgba(88, 101, 242, 0.55);
}

.btn-discord svg {
    color: #7d87f5;
}

/* ---- Hero (homepage) ------------------------------------------------------- */
.hero {
    text-align: center;
    padding: 88px 0 64px;
}

.hero-logo {
    display: inline-block;
    animation: float 7s ease-in-out infinite;
}

.hero-logo img {
    width: min(460px, 76vw);
    filter: drop-shadow(0 0 26px rgba(240, 243, 250, 0.28))
            drop-shadow(0 0 80px rgba(170, 180, 210, 0.16));
    transition: filter 0.5s ease;
}

.hero-logo:hover img {
    filter: drop-shadow(0 0 34px rgba(240, 243, 250, 0.42))
            drop-shadow(0 0 110px rgba(170, 180, 210, 0.26));
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-14px); }
}

.eyebrow {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.34em;
    text-transform: uppercase;
    color: rgba(var(--accent-rgb), 0.85);
}

.hero .eyebrow {
    display: block;
    margin-top: 34px;
}

.tagline {
    margin-top: 14px;
    font-size: clamp(1.05rem, 2.6vw, 1.35rem);
    font-weight: 300;
    letter-spacing: 0.04em;
    color: var(--text-dim);
}

.hero-cta {
    margin-top: 38px;
    display: flex;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
}

/* Binary divider ornament */
.binary-divider {
    display: flex;
    align-items: center;
    gap: 18px;
    max-width: 560px;
    margin: 0 auto;
    padding: 26px 24px;
    overflow: hidden;
}

.binary-divider::before,
.binary-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--line-bright));
}

.binary-divider::after {
    background: linear-gradient(90deg, var(--line-bright), transparent);
}

.binary-divider span {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.3em;
    color: var(--text-faint);
    white-space: nowrap;
}

/* ---- Projects section ------------------------------------------------------- */
.projects-section {
    padding: 34px 0 60px;
}

.section-head {
    text-align: center;
    margin-bottom: 46px;
}

.section-head h2 {
    margin-top: 12px;
    font-size: clamp(1.7rem, 4vw, 2.4rem);
    font-weight: 700;
    letter-spacing: -0.015em;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 26px;
}

/* ---- Project cards ----------------------------------------------------------- */
.card {
    position: relative;
    display: flex;
    flex-direction: column;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.015));
    overflow: hidden;
    transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.3, 1.1), border-color 0.35s ease, box-shadow 0.35s ease;
    will-change: transform;
}

.card:hover,
.card:focus-within {
    transform: translateY(-7px);
    border-color: rgba(var(--accent-rgb), 0.6);
    box-shadow:
        0 24px 60px -20px rgba(var(--accent-rgb), 0.4),
        0 0 40px -10px rgba(var(--accent-rgb), 0.25);
}

/* Per-card brand accents on the homepage grid */
.card--hotaisle { --accent: #ff6a35; --accent-deep: #f23b0c; --accent-rgb: 255, 106, 53; }
.card--array    { --accent: #ef4b45; --accent-deep: #cb2723; --accent-rgb: 239, 75, 69; }
.card--ntn      { --accent: #c084fc; --accent-deep: #9333ea; --accent-rgb: 192, 132, 252; }

.card-media {
    position: relative;
    height: 195px;
    display: grid;
    place-items: center;
    border-bottom: 1px solid var(--line);
    background: radial-gradient(130% 105% at 50% -5%, rgba(var(--accent-rgb), 0.16), transparent 68%);
}

.card-media img,
.card-media svg {
    height: 132px;
    width: auto;
    filter: drop-shadow(0 6px 22px rgba(var(--accent-rgb), 0.35));
    transition: transform 0.4s ease;
}

.card:hover .card-media img,
.card:hover .card-media svg {
    transform: scale(1.06);
}

.chip {
    position: absolute;
    top: 14px;
    right: 14px;
    font-family: var(--font-mono);
    font-size: 0.64rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    padding: 6px 11px;
    border-radius: 999px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.chip-live {
    color: var(--live);
    border: 1px solid rgba(var(--live-rgb), 0.45);
    background: rgba(var(--live-rgb), 0.1);
}

.chip-soon {
    color: var(--soon);
    border: 1px solid rgba(var(--soon-rgb), 0.4);
    background: rgba(var(--soon-rgb), 0.08);
}

.card-body {
    display: flex;
    flex-direction: column;
    flex: 1;
    padding: 26px 28px 28px;
    gap: 10px;
}

.card-body h3 {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.card-tags {
    font-family: var(--font-mono);
    font-size: 0.68rem;
    letter-spacing: 0.22em;
    color: rgba(var(--accent-rgb), 0.9);
}

.card-body p {
    color: var(--text-dim);
    line-height: 1.65;
    font-size: 0.97rem;
}

.card-cta {
    margin-top: auto;
    padding-top: 16px;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--accent);
}

.card-cta svg {
    width: 18px;
    height: 18px;
    transition: transform 0.3s ease;
}

.card:hover .card-cta svg {
    transform: translateX(5px);
}

/* Whole card is clickable */
.card-link::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 1;
    border-radius: var(--radius);
}

.card-link {
    text-decoration: none;
    color: inherit;
}

/* ---- Footer ------------------------------------------------------------------ */
.footer {
    margin-top: 70px;
    border-top: 1px solid var(--line);
    padding: 44px 0 52px;
}

.footer-inner {
    max-width: var(--container);
    margin: 0 auto;
    padding: 0 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    flex-wrap: wrap;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-dim);
    font-size: 0.88rem;
}

.footer-brand img {
    width: 24px;
    height: 24px;
    opacity: 0.85;
}

.footer-binary {
    font-family: var(--font-mono);
    font-size: 0.66rem;
    letter-spacing: 0.26em;
    color: var(--text-faint);
}

.footer-links {
    display: flex;
    gap: 20px;
}

.footer-links a {
    font-family: var(--font-mono);
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    color: var(--text-dim);
    text-decoration: none;
    transition: color 0.25s ease;
}

.footer-links a:hover {
    color: var(--text);
}

/* ---- Reveal-on-scroll (activated by main.js) ----------------------------------
   Implemented as an animation, not a transition, so it never competes with the
   cards' own transition shorthand; main.js removes the classes on animationend. */
.reveal {
    opacity: 0;
}

.reveal.in {
    animation: reveal-in 0.7s ease var(--reveal-delay, 0ms) both;
}

@keyframes reveal-in {
    from {
        opacity: 0;
        transform: translateY(26px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

/* ---- Responsive ---------------------------------------------------------------- */
@media (max-width: 720px) {
    .nav-inner {
        height: 58px;
    }

    .brand-name {
        font-size: 0.8rem;
    }

    .nav-links a {
        padding: 8px 8px;
        font-size: 0.72rem;
    }

    .hero {
        padding: 60px 0 44px;
    }

    .card-body {
        padding: 22px 22px 24px;
    }

    .footer-inner {
        flex-direction: column;
        text-align: center;
    }
}

@media (max-width: 460px) {
    .nav-hide-sm,
    .brand-name .digital {
        display: none;
    }

    .brand {
        gap: 9px;
    }

    .brand img {
        width: 24px;
        height: 24px;
    }

    .brand-name {
        font-size: 0.74rem;
    }

    .binary-divider span {
        font-size: 0.56rem;
        letter-spacing: 0.14em;
    }

    .projects-grid {
        grid-template-columns: 1fr;
    }
}

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

    .hero-logo {
        animation: none;
    }

    .reveal {
        opacity: 1;
    }

    .reveal.in {
        animation: none;
    }

    .card,
    .card-media img,
    .card-media svg,
    .btn {
        transition: none;
    }
}
