/**
 * Avatar Studios — design-system.css
 * Tokens, reset, typography, layout utilities.
 * Matches the React/Vite experiment exactly.
 */

/* ================================================================
   CUSTOM PROPERTIES (Design Tokens)
   ================================================================ */
:root {
    /* Colours */
    --color-bg: #050505;
    --color-bg-alt: #080808;
    --color-black: #000000;
    --color-red: #ff0033;
    --color-red-dim: rgba(255, 0, 51, 0.1);
    --color-red-mid: rgba(255, 0, 51, 0.3);
    --color-white: #ffffff;
    --color-zinc-900: #18181b;
    --color-zinc-800: #27272a;
    --color-zinc-700: #3f3f46;
    --color-zinc-600: #52525b;
    --color-zinc-500: #71717a;
    --color-zinc-400: #a1a1aa;
    --color-zinc-300: #d4d4d8;
    --color-zinc-200: #e4e4e7;

    /* Borders */
    --border-subtle: rgba(255, 255, 255, 0.05);
    --border-mid: rgba(255, 255, 255, 0.10);

    /* Typography */
    --font-sans: 'Space Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    /* Font weights */
    --fw-light: 300;
    --fw-regular: 400;
    --fw-medium: 500;
    --fw-semi: 600;
    --fw-bold: 700;
    --fw-black: 700;
    /* Space Grotesk max weight is 700 */

    /* Spacing */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;
    --space-16: 4rem;
    --space-20: 5rem;
    --space-24: 6rem;
    --space-32: 8rem;

    /* Container */
    --container-max: 1400px;
    --container-pad: clamp(1.5rem, 4vw, 6rem);

    /* Transitions */
    --ease-expo: cubic-bezier(0.9, 0, 0.1, 1);
    --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --dur-fast: 200ms;
    --dur-mid: 400ms;
    --dur-slow: 700ms;

    /* Z-index layers */
    --z-base: 1;
    --z-above: 10;
    --z-nav: 100;
    --z-overlay: 200;
    --z-cursor: 9000;
}

/* ================================================================
   RESET
   ================================================================ */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

body {
    font-family: var(--font-sans);
    font-weight: var(--fw-regular);
    background-color: var(--color-bg);
    color: var(--color-white);
    line-height: 1.6;
    overflow-x: hidden;
    cursor: none;
    /* Hide system cursor on desktop — custom cursor via JS */
}

/* Restore cursor on touch devices */
@media (hover: none),
(pointer: coarse) {
    body {
        cursor: auto;
    }
}

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--dur-fast) var(--ease-smooth);
}

img,
video,
canvas {
    display: block;
    max-width: 100%;
}

ul,
ol {
    list-style: none;
}

button {
    font-family: inherit;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
}

input,
textarea,
select {
    font-family: inherit;
    font-size: inherit;
}

/* ================================================================
   ACCESSIBILITY
   ================================================================ */
.skip-link {
    position: absolute;
    top: -100%;
    left: 1rem;
    z-index: calc(var(--z-cursor) + 1);
    background: var(--color-red);
    color: var(--color-white);
    padding: 0.75rem 1.5rem;
    font-size: 0.875rem;
    font-weight: var(--fw-bold);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    transition: top 0.2s;
}

.skip-link:focus {
    top: 1rem;
}

.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;
}

:focus-visible {
    outline: 2px solid var(--color-red);
    outline-offset: 3px;
}

/* ================================================================
   LAYOUT
   ================================================================ */
.container {
    width: 100%;
    max-width: var(--container-max);
    margin-inline: auto;
    padding-inline: var(--container-pad);
}

.site-main {
    min-height: 60vh;
}

/* ================================================================
   TYPOGRAPHY SCALE
   ================================================================ */
.text-xs {
    font-size: 0.65rem;
}

.text-sm {
    font-size: 0.75rem;
}

.text-base {
    font-size: 1rem;
}

.text-lg {
    font-size: 1.125rem;
}

.text-xl {
    font-size: 1.25rem;
}

.text-2xl {
    font-size: 1.5rem;
}

.text-3xl {
    font-size: 1.875rem;
}

.text-4xl {
    font-size: 2.25rem;
}

.text-5xl {
    font-size: 3rem;
}

.font-light {
    font-weight: var(--fw-light);
}

.font-medium {
    font-weight: var(--fw-medium);
}

.font-bold {
    font-weight: var(--fw-bold);
}

.font-black {
    font-weight: var(--fw-black);
}

.font-mono {
    font-family: var(--font-mono);
}

.tracking-tight {
    letter-spacing: -0.02em;
}

.tracking-tighter {
    letter-spacing: -0.04em;
}

.tracking-tight-xl {
    letter-spacing: -0.05em;
}

.tracking-wide {
    letter-spacing: 0.05em;
}

.tracking-wider {
    letter-spacing: 0.1em;
}

.tracking-widest {
    letter-spacing: 0.2em;
}

.uppercase {
    text-transform: uppercase;
}

.leading-tight {
    line-height: 1.05;
}

.leading-snug {
    line-height: 1.25;
}

.text-muted {
    color: var(--color-zinc-700);
}

.text-dim {
    color: var(--color-zinc-500);
}

.text-red {
    color: var(--color-red);
}

/* ================================================================
   SECTION / PAGE HEADERS — shared across sections
   ================================================================ */
.section-header {
    margin-bottom: var(--space-16);
}

.section-label-wrap {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.section-label-line {
    width: 3rem;
    height: 1px;
    background: var(--color-red);
    flex-shrink: 0;
}

.section-label {
    font-size: 0.625rem;
    font-weight: var(--fw-black);
    text-transform: uppercase;
    letter-spacing: 0.8em;
    color: var(--color-red);
}

.section-title {
    font-size: clamp(2rem, 4vw, 3.75rem);
    font-weight: var(--fw-black);
    text-transform: uppercase;
    letter-spacing: -0.03em;
    line-height: 1.05;
    color: var(--color-white);
    margin-bottom: var(--space-6);
}

.section-subtitle {
    font-size: clamp(1rem, 1.5vw, 1.375rem);
    font-weight: var(--fw-light);
    color: var(--color-zinc-400);
    line-height: 1.7;
    max-width: 56ch;
}

/* ================================================================
   BUTTONS
   ================================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.875rem 2.5rem;
    font-size: 0.6875rem;
    font-weight: var(--fw-black);
    text-transform: uppercase;
    letter-spacing: 0.45em;
    border-radius: 2px;
    transition:
        background var(--dur-mid) var(--ease-expo),
        color var(--dur-mid) var(--ease-expo),
        border-color var(--dur-mid) var(--ease-expo),
        transform 0.15s var(--ease-smooth);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    white-space: nowrap;
}

.btn:active {
    transform: scale(0.98);
}

.btn--primary {
    background: var(--color-white);
    color: var(--color-black);
    border: 1px solid transparent;
}

.btn--primary:hover {
    background: var(--color-red);
    color: var(--color-white);
}

.btn--outline {
    background: transparent;
    color: var(--color-white);
    border: 1px solid var(--border-mid);
}

.btn--outline:hover {
    background: var(--color-white);
    color: var(--color-black);
    border-color: var(--color-white);
}

.btn--sm {
    padding: 0.625rem 1.5rem;
    font-size: 0.625rem;
}

/* CTA magnetic button */
.btn--cta-magnetic {
    position: relative;
    padding: 1.5rem 5rem;
    background: var(--color-white);
    color: var(--color-black);
    font-size: 0.6875rem;
    font-weight: var(--fw-black);
    text-transform: uppercase;
    letter-spacing: 0.55em;
    border-radius: 2px;
    overflow: hidden;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: color var(--dur-mid) var(--ease-expo);
}

.btn--cta-magnetic:hover {
    color: var(--color-white);
}

.btn--cta-magnetic .cta-btn-fill {
    position: absolute;
    inset: 0;
    background: var(--color-red);
    transform: translateY(100%);
    transition: transform var(--dur-slow) var(--ease-expo);
    z-index: 0;
}

.btn--cta-magnetic:hover .cta-btn-fill {
    transform: translateY(0);
}

.btn--cta-magnetic .btn-text {
    position: relative;
    z-index: 1;
}

/* Form submit button */
.btn--form-submit {
    position: relative;
    padding: 1rem 3rem;
    background: var(--color-white);
    color: var(--color-black);
    font-size: 0.6875rem;
    font-weight: var(--fw-black);
    text-transform: uppercase;
    letter-spacing: 0.45em;
    border: 1px solid transparent;
    border-radius: 2px;
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    transition:
        background var(--dur-mid) var(--ease-expo),
        color var(--dur-mid) var(--ease-expo);
}

.btn--form-submit:hover {
    background: var(--color-red);
    color: var(--color-white);
}

.btn--form-submit:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-loading {
    display: none;
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

.btn--form-submit.is-loading .btn-loading {
    display: block;
}

.btn--form-submit.is-loading .btn-text {
    opacity: 0.6;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ================================================================
   SCROLLBAR STYLING
   ================================================================ */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: var(--color-bg);
}

::-webkit-scrollbar-thumb {
    background: var(--color-zinc-700);
    border-radius: 2px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--color-red);
}

/* ================================================================
   SELECTION
   ================================================================ */
::selection {
    background: var(--color-red);
    color: var(--color-white);
}

/* ================================================================
   PAGE CONTENT WRAP (for fallback templates)
   ================================================================ */
.page-content-wrap {
    padding-top: 8rem;
    padding-bottom: var(--space-24);
}

/* ================================================================
   CATEGORY TAG + READ TIME (insight cards)
   ================================================================ */
.insight-category-tag {
    font-size: 0.625rem;
    font-weight: var(--fw-black);
    text-transform: uppercase;
    letter-spacing: 0.4em;
    color: var(--color-red);
    border: 1px solid var(--color-red-dim);
    padding: 0.2rem 0.6rem;
    border-radius: 2px;
}

.insight-read-time {
    font-size: 0.625rem;
    font-weight: var(--fw-bold);
    text-transform: uppercase;
    letter-spacing: 0.3em;
    color: var(--color-zinc-500);
    font-family: var(--font-mono);
}