/*
  Shared theme tokens and base primitives.
  Dark mode is the default; light mode is selected with [data-theme="light"].
*/

@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:ital,wght@0,400;0,500;0,600;1,400&display=swap");

/* Theme tokens */
:root,
[data-theme="dark"] {
    --surface-base:         #181818;
    --surface-raised:       #202020;
    --surface-island:       #272727;
    --surface-inset:        #141414;
    --surface-hover:        #2e2e2e;
    --surface-hover-raised: #383838;
    --surface-active:       #1b3260;

    --border:        #2e2e2e;
    --border-strong: #484848;
    --border-hover:  #646464;

    --text-primary:   #e4e4e4;
    --text-secondary: #a3a3a3;
    --text-muted:     #747474;

    --accent:        #94a3b8;   /* slate-400 */
    --accent-hover:  #cbd5e1;   /* slate-300 */
    --accent-active: #64748b;   /* slate-500 */
    --accent-muted:  rgba(148, 163, 184, 0.13);
    --accent-soft:   rgba(148, 163, 184, 0.08);

    --shadow-panel:      0 1px 3px rgba(0,0,0,0.25), 0 4px 16px rgba(0,0,0,0.15);
    --shadow-card-hover: 0 4px 24px rgba(148,163,184,0.12);
    --scrim: rgba(0,0,0,0.55);
}

[data-theme="light"] {
    --surface-base:         #f8fafc;   /* slate-50  */
    --surface-raised:       #ffffff;
    --surface-island:       #ffffff;
    --surface-inset:        #f1f5f9;   /* slate-100 */
    --surface-hover:        #e9eef4;
    --surface-hover-raised: #dde4ec;
    --surface-active:       #e2e8f0;

    --border:        #e2e8f0;
    --border-strong: #cbd5e1;
    --border-hover:  #94a3b8;

    --text-primary:   #0f172a;   /* slate-900 */
    --text-secondary: #64748b;   /* slate-500 */
    --text-muted:     #94a3b8;   /* slate-400 */

    --accent:        #475569;    /* slate-600 */
    --accent-hover:  #334155;    /* slate-700 */
    --accent-active: #1e293b;    /* slate-800 */
    --accent-muted:  rgba(71, 85, 105, 0.12);
    --accent-soft:   rgba(71, 85, 105, 0.06);

    --shadow-panel:      0 1px 2px rgba(15,23,42,0.05), 0 4px 16px rgba(15,23,42,0.06);
    --shadow-card-hover: 0 4px 24px rgba(71,85,105,0.14);
    --scrim: rgba(15,23,42,0.35);
}

/* Shared tokens */
:root {
    --radius-sm:   4px;
    --radius-md:   8px;
    --radius-lg:   12px;
    --radius-xl:   16px;
    --radius-pill: 999px;

    --font-ui:         "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --font-ui-title:   "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
    --font-ui-display: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono:       "JetBrains Mono", ui-monospace, monospace;

    --ease:      0.18s cubic-bezier(.2,.7,.2,1);
    --ease-fast: 0.12s ease;
    --ease-slow: 0.55s cubic-bezier(.2,.7,.2,1);

    --maxw:   1080px;
    --gutter: clamp(20px, 5vw, 48px);
}

/* Base reset */

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

html,
body {
    margin: 0;
    padding: 0;
}

html {
    color-scheme: dark;
    scrollbar-gutter: stable;
}

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

body {
    font-family: var(--font-ui);
    font-size: 15px;
    line-height: 1.55;
    color: var(--text-primary);
    background: var(--surface-base);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition: color var(--ease), background-color var(--ease);
    min-height: 100vh;
}

a {
    color: inherit;
    text-decoration: none;
}

button {
    font: inherit;
    color: inherit;
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
}

input,
textarea,
select {
    font: inherit;
    color: inherit;
}

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

::selection {
    background: var(--accent-muted);
    color: var(--text-primary);
}

/* Typography primitives */
.t-display {
    font-family: var(--font-ui-display);
    font-weight: 600;
    font-size: clamp(42px, 6.4vw, 76px);
    line-height: 1.02;
    letter-spacing: -0.035em;
    color: var(--text-primary);
    text-wrap: balance;
}
.t-title {
    font-family: var(--font-ui-title);
    font-weight: 600;
    font-size: clamp(28px, 3.2vw, 36px);
    line-height: 1.1;
    letter-spacing: -0.025em;
    color: var(--text-primary);
}
.t-eyebrow {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}
.t-lede {
    font-size: clamp(17px, 1.8vw, 19px);
    line-height: 1.5;
    color: var(--text-secondary);
    text-wrap: pretty;
}
.t-mono {
    font-family: var(--font-mono);
}

.t-shimmer {
    background: linear-gradient(92deg, var(--text-secondary), var(--accent) 50%, var(--text-secondary));
    background-size: 200% 100%;
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
    animation: t-shimmer 8s ease-in-out infinite;
}
@keyframes t-shimmer {
    0%,
    100% {
        background-position: 100% 50%;
    }

    50% {
        background-position: 0% 50%;
    }
}

/* Status pill */

.pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    padding: 5px 10px 5px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius-pill);
    background: color-mix(in oklab, var(--surface-raised) 75%, transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.pill__dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-muted);
    animation: pill-pulse 2.4s ease-in-out infinite;
}
@keyframes pill-pulse {
    0%,
    100% {
        box-shadow: 0 0 0 4px var(--accent-muted);
        opacity: 1;
    }

    50% {
        box-shadow: 0 0 0 8px transparent;
        opacity: 0.7;
    }
}

/* Buttons */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-ui);
    font-size: 13.5px;
    font-weight: 500;
    padding: 10px 18px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-strong);
    background: var(--surface-raised);
    color: var(--text-primary);
    transition: background var(--ease), border-color var(--ease), color var(--ease), transform var(--ease);
}

.btn:hover {
    background: var(--surface-hover);
    border-color: var(--border-hover);
}

.btn:active {
    background: var(--surface-hover-raised);
}

.btn--accent {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.btn--accent:hover {
    background: var(--accent-hover);
    border-color: var(--accent-hover);
}

.btn--accent:active {
    background: var(--accent-active);
    border-color: var(--accent-active);
}

.btn--ghost {
    background: transparent;
    border-color: transparent;
    color: var(--text-secondary);
}

.btn--ghost:hover {
    color: var(--text-primary);
    background: var(--surface-hover);
}

.btn .arrow {
    transition: transform var(--ease);
}

.btn:hover .arrow {
    transform: translateX(2px);
}

/* Card primitive */

.card {
    position: relative;
    background: color-mix(in oklab, var(--surface-island) 88%, transparent);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    overflow: hidden;
    transition: transform var(--ease), border-color var(--ease), box-shadow var(--ease);
}
.card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow-card-hover);
}

.card--spotlight::before {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(600px circle at var(--mx, 50%) var(--my, 0%), var(--accent-muted), transparent 40%);
    opacity: 0;
    transition: opacity var(--ease);
    pointer-events: none;
    z-index: 1;
}

.card--spotlight:hover::before {
    opacity: 1;
}

.card--spotlight > * {
    position: relative;
    z-index: 2;
}

/* Tags and chips */

.tag {
    font-size: 10.5px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-secondary);
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    background: var(--surface-hover);
    transition: background var(--ease-fast), color var(--ease-fast);
}

.tag.is-accent {
    background: var(--accent-muted);
    color: var(--accent);
}

.chip-group {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 6px;
    background: color-mix(in oklab, var(--surface-raised) 80%, transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.chip {
    font-size: 12.5px;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    transition: color var(--ease-fast), background var(--ease-fast);
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.chip:hover {
    color: var(--text-primary);
    background: var(--surface-hover);
}

.chip.is-active {
    color: var(--accent);
    background: var(--accent-muted);
}

/* Topbar */

.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    background: color-mix(in oklab, var(--surface-base) 10%, transparent);
    backdrop-filter: saturate(1.8) blur(24px);
    -webkit-backdrop-filter: saturate(1.8) blur(24px);
    border-bottom: 1px solid transparent;
    transition: border-color var(--ease), background var(--ease);
}

.topbar.is-scrolled {
    border-bottom-color: var(--border);
}

/* Motion helpers */

.page-enter {
    animation: page-enter 0.32s cubic-bezier(.2,.7,.2,1) both;
}

@keyframes page-enter {
    from {
        opacity: 0;
        transform: translateY(6px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.reveal {
    opacity: 0;
    transform: translateY(14px);
    transition: opacity var(--ease-slow), transform var(--ease-slow);
}

.reveal.is-in {
    opacity: 1;
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    .pill__dot,
    .t-shimmer {
        animation: none !important;
    }

    .reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }

    .page-enter {
        animation: none;
    }
}

/* Layout helpers */

.shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

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

.section {
    padding: 56px 0;
    border-top: 1px solid var(--border);
}

.section:first-of-type {
    border-top: 0;
}

/* Utility classes */

.mono {
    font-family: var(--font-mono);
}

.muted {
    color: var(--text-muted);
}

.secondary {
    color: var(--text-secondary);
}

.primary {
    color: var(--text-primary);
}

.accent {
    color: var(--accent);
}

.bg-inset {
    background: var(--surface-inset);
}

.bg-raised {
    background: var(--surface-raised);
}

.bg-island {
    background: var(--surface-island);
}

.border-1 {
    border: 1px solid var(--border);
}

.rounded-md {
    border-radius: var(--radius-md);
}

.rounded-lg {
    border-radius: var(--radius-lg);
}

.rounded-xl {
    border-radius: var(--radius-xl);
}

/* Responsive defaults */

@media (max-width: 640px) {
    .section {
        padding: 40px 0;
    }
}
