/* ==========================================================
   StapeTech — Base: fonts, tokens, reset, typography, utilities
   ========================================================== */

/* ---------- Fonts (self-hosted) ---------- */
@font-face {
    font-family: "Plus Jakarta Sans";
    font-style: normal;
    font-weight: 200 800;
    font-display: swap;
    src: url("../fonts/plus-jakarta-sans-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Plus Jakarta Sans";
    font-style: normal;
    font-weight: 200 800;
    font-display: swap;
    src: url("../fonts/plus-jakarta-sans-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../fonts/inter-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Inter";
    font-style: normal;
    font-weight: 100 900;
    font-display: swap;
    src: url("../fonts/inter-latin-ext.woff2") format("woff2");
    unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* Display faces for the two worlds (self-hosted, SIL Open Font License) */
@font-face {
    font-family: "Saira";
    font-style: normal;
    font-weight: 100 900;
    font-stretch: 50% 125%;
    font-display: swap;
    src: url("../fonts/saira-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Noto Serif Display";
    font-style: normal;
    font-weight: 100 900;
    font-stretch: 62.5% 100%;
    font-display: swap;
    src: url("../fonts/noto-serif-display-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: "Pinyon Script";
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url("../fonts/pinyon-script-latin.woff2") format("woff2");
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Design tokens ---------- */
:root {
    /* Brand (from original StapeTech palette) */
    --c-brand: #428bca;
    --c-brand-600: #3273a8;
    --c-brand-700: #285d89;
    --c-brand-50: #eef5fb;
    --c-brand-100: #d9e8f5;
    --c-cyan: #22c4ef;
    --c-ink: #263746;
    --c-ink-900: #172430;
    --c-ink-950: #0e1822;
    --c-light: #f5f9fc;

    /* Neutrals */
    --c-white: #ffffff;
    --c-text: #1b2833;
    --c-muted: #5a6b7b;
    --c-subtle: #5f7080;
    --c-border: #e2eaf1;
    --c-border-strong: #cad7e3;

    /* Status */
    --c-success: #15803d;
    --c-success-bg: #e8f6ee;
    --c-warning: #b45309;
    --c-warning-bg: #fdf3e2;
    --c-error: #c62828;
    --c-error-bg: #fdecec;

    /* Gradients */
    --g-brand: linear-gradient(135deg, var(--c-brand) 0%, var(--c-cyan) 100%);
    --g-dark: radial-gradient(120% 90% at 85% 10%, #22405b 0%, var(--c-ink-900) 45%, var(--c-ink-950) 100%);

    /* Type */
    --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --font-display: "Plus Jakarta Sans", var(--font-sans);
    --fs-xs: 0.8125rem;
    --fs-sm: 0.9375rem;
    --fs-base: 1.0625rem;
    --fs-lg: clamp(1.125rem, 1.05rem + 0.35vw, 1.3125rem);
    --fs-xl: clamp(1.35rem, 1.2rem + 0.6vw, 1.65rem);
    --fs-2xl: clamp(1.75rem, 1.45rem + 1.3vw, 2.5rem);
    --fs-3xl: clamp(2.25rem, 1.7rem + 2.4vw, 3.5rem);
    --fs-hero: clamp(2.6rem, 1.8rem + 3.6vw, 4.6rem);

    /* Space & shape */
    --space-section: clamp(4.5rem, 3rem + 6vw, 8rem);
    --gutter: clamp(1rem, 0.6rem + 1.8vw, 2rem);
    --container: 1200px;
    --radius-sm: 8px;
    --radius: 14px;
    --radius-lg: 22px;
    --radius-xl: 30px;
    --shadow-sm: 0 1px 2px rgba(23, 36, 48, 0.06), 0 1px 3px rgba(23, 36, 48, 0.08);
    --shadow: 0 10px 30px -12px rgba(23, 36, 48, 0.18);
    --shadow-lg: 0 30px 60px -20px rgba(23, 36, 48, 0.28);
    --shadow-brand: 0 12px 30px -10px rgba(66, 139, 202, 0.55);

    /* Motion */
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --dur: 0.35s;

    --header-h: 76px;

    /* Semantic surfaces (light by default, dark on the public site) */
    --surface: var(--c-white);
    --surface-alt: var(--c-light);
    --c-heading: var(--c-ink-900);
    --page-bg: var(--c-white);
}

/* ---------- Theme-driven tokens ----------
   Registered as colours so a theme switch interpolates them (one .8s fade
   recolours the sky, scrim and type together) instead of snapping. */
@property --scrim { syntax: "<color>"; inherits: true; initial-value: #070d13; }
@property --accent { syntax: "<color>"; inherits: true; initial-value: #22c4ef; }
@property --text { syntax: "<color>"; inherits: true; initial-value: #ffffff; }
@property --heading { syntax: "<color>"; inherits: true; initial-value: #ffffff; }

/* ---------- Dark theme (public site default) ---------- */
.theme-dark {
    --c-ink-975: #070d13;
    --page-bg: #070d13;
    --surface: rgba(255, 255, 255, 0.035);
    --surface-alt: rgba(255, 255, 255, 0.055);
    --c-heading: #ffffff;
    --c-text: rgba(234, 244, 255, 0.8);
    --c-muted: rgba(234, 244, 255, 0.58);
    --c-subtle: rgba(234, 244, 255, 0.42);
    --c-border: rgba(255, 255, 255, 0.09);
    --c-border-strong: rgba(255, 255, 255, 0.2);
    --c-brand-50: rgba(66, 139, 202, 0.14);
    --c-brand-100: rgba(66, 139, 202, 0.32);
    --c-brand-600: #6fb2ea;
    --c-brand-700: #9ccdf3;
    --c-light: rgba(255, 255, 255, 0.05);
    --c-success-bg: rgba(21, 128, 61, 0.18);
    --c-warning-bg: rgba(180, 83, 9, 0.2);
    --c-error-bg: rgba(198, 40, 40, 0.18);
    --c-success: #4ade80;
    --c-warning: #fbbf24;
    --c-error: #f87171;
    --shadow: 0 20px 50px -24px rgba(0, 0, 0, 0.7);
    --shadow-lg: 0 30px 70px -24px rgba(0, 0, 0, 0.85);
    --scrim: #070d13;
    --accent: #22c4ef;
    --text: rgba(234, 244, 255, 0.8);
    --heading: #ffffff;
    color-scheme: dark;
}

/* ---------- Light theme (public site, user choice) ---------- */
.theme-light {
    --page-bg: #f7fafc;
    --surface: rgba(255, 255, 255, 0.78);
    --surface-alt: #eef4f9;
    --c-heading: #0f1c27;
    --c-text: #34475a;
    --c-muted: #5d6f80;
    --c-subtle: #5f7080;
    --c-border: rgba(38, 55, 70, 0.1);
    --c-border-strong: rgba(38, 55, 70, 0.2);
    --c-light: #eef4f9;
    --scrim: #f7fafc;
    --accent: #3273a8;
    --text: #34475a;
    --heading: #0f1c27;
    color-scheme: light;
}

/* Colour fades between themes (JS adds .theme-anim for the switch only) */
.theme-dark,
.theme-light {
    transition: --scrim 0.8s ease, --accent 0.8s ease, --text 0.8s ease, --heading 0.8s ease;
}

.theme-anim *:not(.hero__photo) {
    transition: background-color 0.8s ease, color 0.8s ease, border-color 0.8s ease,
        fill 0.8s ease, stroke 0.8s ease, box-shadow 0.8s ease !important;
}

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

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
    margin: 0;
    font-family: var(--font-sans);
    font-size: var(--fs-base);
    line-height: 1.65;
    color: var(--c-text);
    background: var(--page-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    overflow-x: hidden;
}

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

img {
    height: auto;
}

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

button {
    cursor: pointer;
}

a {
    color: var(--c-brand-600);
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
}

a:hover {
    color: var(--c-brand-700);
}

:focus-visible {
    outline: 3px solid var(--c-cyan);
    outline-offset: 3px;
    border-radius: 4px;
}

::selection {
    background: var(--c-brand);
    color: var(--c-white);
}

[hidden] {
    display: none !important;
}

/* ---------- Typography ---------- */
h1,
h2,
h3,
h4 {
    margin: 0 0 0.6em;
    font-family: var(--font-display);
    font-weight: 750;
    line-height: 1.15;
    letter-spacing: -0.02em;
    color: var(--c-heading);
    text-wrap: balance;
}

h1 { font-size: var(--fs-3xl); }
h2 { font-size: var(--fs-2xl); }
h3 { font-size: var(--fs-lg); letter-spacing: -0.01em; }

p {
    margin: 0 0 1em;
    text-wrap: pretty;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.9rem;
    font-family: var(--font-display);
    font-size: var(--fs-xs);
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--c-brand);
}

.eyebrow--light {
    color: var(--c-cyan);
}

.text-gradient {
    background: var(--g-brand);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

/* ---------- Icons ---------- */
.icon {
    width: 1.25em;
    height: 1.25em;
    flex-shrink: 0;
    display: inline-block;
    vertical-align: middle;
}

.icon--xs { width: 0.85em; height: 0.85em; }
.icon--sm { width: 1em; height: 1em; }
.icon--lg { width: 1.75rem; height: 1.75rem; }

/* ---------- Utilities ---------- */
.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;
}

.skip-link {
    position: absolute;
    left: 1rem;
    top: -100px;
    z-index: 1000;
    padding: 0.75rem 1rem;
    background: var(--c-ink-900);
    color: var(--c-white);
    border-radius: var(--radius-sm);
}

.skip-link:focus {
    top: 1rem;
}

.hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.stretched-link::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
}

.link-button {
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    text-decoration: underline;
    text-underline-offset: 3px;
}

.empty-state {
    padding: 3rem 1rem;
    text-align: center;
    color: var(--c-muted);
}

/* ---------- Reveal on scroll (JS adds .is-visible) ---------- */
.js [data-reveal] {
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.8s var(--ease), transform 0.8s var(--ease);
}

.js [data-reveal].is-visible {
    opacity: 1;
    transform: none;
}

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

    .js [data-reveal] {
        opacity: 1;
        transform: none;
    }
}
