/* ===== Tristonia Design System ===== */
:root {
    --bg-0: #07071a;
    --bg-1: #0d0d24;
    --bg-2: #14143a;
    --bg-3: #1f1f55;
    --surface: rgba(255, 255, 255, 0.04);
    --surface-strong: rgba(255, 255, 255, 0.08);
    --border: rgba(255, 255, 255, 0.10);
    --border-strong: rgba(255, 255, 255, 0.18);

    --text: #f5f5fa;
    --text-mute: rgba(245, 245, 250, 0.66);
    --text-dim: rgba(245, 245, 250, 0.42);

    --accent: #78b4ff;
    --accent-2: #c4b5fd;
    --accent-3: #ffd97d;
    --accent-warm: #ff8da1;
    --accent-mint: #72efdd;

    --grad-aurora: linear-gradient(120deg, #78b4ff 0%, #c4b5fd 35%, #ff8da1 70%, #ffd97d 100%);
    --grad-deep: radial-gradient(ellipse at top, #1f1f55 0%, #0d0d24 45%, #07071a 100%);

    --font-display: 'Fraunces', 'Times New Roman', serif;
    --font-sans: 'Inter Tight', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

    --radius-sm: 10px;
    --radius-md: 18px;
    --radius-lg: 28px;
    --radius-pill: 999px;

    --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
*::selection { background: var(--accent-2); color: var(--bg-0); }

html, body {
    background: var(--bg-0);
    color: var(--text);
    font-family: var(--font-sans);
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
    line-height: 1.55;
    overflow-x: hidden;
}

body {
    min-height: 100vh;
    position: relative;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }
img { display: block; max-width: 100%; }

/* Grain texture overlay */
.grain {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9000;
    opacity: 0.06;
    mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml;utf8,<svg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.6 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
}

/* ===== Custom Cursor ===== */
.cursor-dot, .cursor-ring {
    position: fixed;
    top: 0; left: 0;
    pointer-events: none;
    z-index: 9999;
    transform: translate3d(-50%, -50%, 0);
    mix-blend-mode: difference;
}
.cursor-dot {
    width: 6px; height: 6px;
    background: #fff;
    border-radius: 50%;
}
.cursor-ring {
    width: 38px; height: 38px;
    border: 1px solid rgba(255,255,255,0.9);
    border-radius: 50%;
    transition: width 0.28s var(--ease-out-quart),
                height 0.28s var(--ease-out-quart),
                background 0.28s,
                border-color 0.28s;
}
.cursor-ring.is-hover {
    width: 64px; height: 64px;
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,1);
}
@media (hover: none), (max-width: 768px) {
    .cursor-dot, .cursor-ring { display: none; }
}

/* ===== Loader ===== */
.page-loader {
    position: fixed;
    inset: 0;
    background: var(--bg-0);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    transition: opacity 0.8s var(--ease-out-quart);
}
.page-loader.hidden {
    opacity: 0;
    pointer-events: none;
}
.loader-mark {
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 4vw, 2.2rem);
    letter-spacing: 0.04em;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 14px;
}
.loader-mark .dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--accent);
    box-shadow: 0 0 16px var(--accent);
    animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
    0%, 100% { opacity: 0.3; transform: scale(0.8); }
    50% { opacity: 1; transform: scale(1.2); }
}

/* ===== Nav ===== */
.t-nav {
    position: fixed;
    top: 24px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 500;
    display: flex;
    gap: 4px;
    padding: 6px;
    background: rgba(8, 8, 24, 0.55);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-radius: var(--radius-pill);
    border: 1px solid var(--border);
    box-shadow: 0 20px 60px -20px rgba(0,0,0,0.7), inset 0 1px 0 rgba(255,255,255,0.05);
}
.t-nav__brand {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0.05em;
    color: var(--text);
    padding: 10px 18px 10px 22px;
    border-right: 1px solid var(--border);
    margin-right: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.t-nav__brand .brand-dot {
    width: 6px; height: 6px;
    background: var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 10px var(--accent);
}
.t-nav__link {
    position: relative;
    color: var(--text-mute);
    font-size: 0.78rem;
    font-weight: 500;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 10px 18px;
    border-radius: var(--radius-pill);
    transition: color 0.3s var(--ease-out-quart);
}
.t-nav__link::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: var(--radius-pill);
    background: var(--surface-strong);
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 0.3s var(--ease-out-quart), transform 0.3s var(--ease-out-quart);
}
.t-nav__link span { position: relative; z-index: 2; }
.t-nav__link:hover { color: var(--text); }
.t-nav__link:hover::before, .t-nav__link.is-active::before {
    opacity: 1;
    transform: scale(1);
}
.t-nav__link.is-active { color: var(--text); }

@media (max-width: 760px) {
    .t-nav { top: 14px; gap: 0; padding: 4px; max-width: calc(100% - 28px); overflow-x: auto; }
    .t-nav__brand { padding: 8px 12px; font-size: 0.72rem; }
    .t-nav__link { padding: 8px 12px; font-size: 0.66rem; letter-spacing: 0.05em; }
}

/* ===== Layout helpers ===== */
.container {
    width: 100%;
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 32px;
}
.container--narrow { max-width: 920px; }

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

/* ===== Typography ===== */
.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-mute);
}
.eyebrow::before {
    content: "";
    width: 24px; height: 1px;
    background: var(--accent);
}

.display {
    font-family: var(--font-display);
    font-weight: 400;
    line-height: 0.96;
    letter-spacing: -0.025em;
    font-size: clamp(2.6rem, 7vw, 6.5rem);
    color: var(--text);
}
.display em {
    font-style: italic;
    font-weight: 300;
    background: var(--grad-aurora);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.heading {
    font-family: var(--font-display);
    font-weight: 500;
    line-height: 1.05;
    letter-spacing: -0.015em;
    font-size: clamp(1.8rem, 4vw, 3.2rem);
    color: var(--text);
}

.lead {
    font-size: clamp(1.05rem, 1.4vw, 1.25rem);
    line-height: 1.55;
    color: var(--text-mute);
    max-width: 60ch;
    font-weight: 400;
}

/* ===== Buttons ===== */
.btn {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 16px 28px;
    border-radius: var(--radius-pill);
    font-weight: 500;
    font-size: 0.9rem;
    letter-spacing: 0.02em;
    border: 1px solid transparent;
    transition: transform 0.4s var(--ease-out-quart), background 0.3s, border-color 0.3s, color 0.3s;
    overflow: hidden;
    isolation: isolate;
}
.btn::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: var(--grad-aurora);
    opacity: 0;
    z-index: -1;
    transition: opacity 0.4s var(--ease-out-quart);
}
.btn--primary {
    background: var(--text);
    color: var(--bg-0);
}
.btn--primary:hover {
    transform: translateY(-2px);
    background: transparent;
    color: var(--bg-0);
}
.btn--primary:hover::after { opacity: 1; }

.btn--ghost {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border-strong);
    backdrop-filter: blur(12px);
}
.btn--ghost:hover {
    transform: translateY(-2px);
    background: var(--surface-strong);
    border-color: rgba(255,255,255,0.4);
}
.btn .arrow {
    transition: transform 0.4s var(--ease-out-quart);
}
.btn:hover .arrow { transform: translateX(4px); }

/* ===== Cards ===== */
.card {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 32px;
    backdrop-filter: blur(14px);
    transition: transform 0.6s var(--ease-out-quart),
                border-color 0.6s var(--ease-out-quart),
                background 0.6s var(--ease-out-quart);
    overflow: hidden;
}
.card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: radial-gradient(600px circle at var(--mx, 50%) var(--my, 50%), rgba(120, 180, 255, 0.10), transparent 50%);
    opacity: 0;
    transition: opacity 0.4s;
    pointer-events: none;
}
.card:hover::before { opacity: 1; }
.card:hover {
    transform: translateY(-4px);
    border-color: var(--border-strong);
    background: var(--surface-strong);
}

/* ===== Sections ===== */
section { position: relative; padding: clamp(80px, 12vh, 160px) 0; }
.section-head {
    display: flex;
    flex-direction: column;
    gap: 18px;
    margin-bottom: 64px;
    max-width: 760px;
}

/* ===== Footer ===== */
.t-footer {
    position: relative;
    border-top: 1px solid var(--border);
    padding: 60px 0 40px;
    background: rgba(7, 7, 26, 0.6);
}
.t-footer__grid {
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr;
    gap: 40px;
    margin-bottom: 60px;
}
.t-footer__mark {
    font-family: var(--font-display);
    font-size: 1.4rem;
    margin-bottom: 16px;
    letter-spacing: 0.02em;
}
.t-footer__mark em {
    background: var(--grad-aurora);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-style: italic;
}
.t-footer__col h4 {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--text-mute);
    margin-bottom: 18px;
    font-weight: 500;
}
.t-footer__col a {
    display: block;
    padding: 6px 0;
    color: var(--text-mute);
    font-size: 0.92rem;
    transition: color 0.3s, transform 0.3s;
}
.t-footer__col a:hover { color: var(--text); transform: translateX(4px); }
.t-footer__bottom {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 30px;
    border-top: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 0.82rem;
    font-family: var(--font-mono);
    letter-spacing: 0.05em;
}
@media (max-width: 800px) {
    .t-footer__grid { grid-template-columns: 1fr 1fr; }
    .t-footer__brand { grid-column: 1 / -1; }
    .t-footer__bottom { flex-direction: column; gap: 14px; text-align: center; }
}

/* ===== Reveal animations ===== */
.reveal {
    opacity: 0;
    transform: translateY(36px);
    transition: opacity 1s var(--ease-out-quart), transform 1s var(--ease-out-quart);
}
.reveal.is-visible { opacity: 1; transform: translateY(0); }
.reveal[data-delay="1"].is-visible { transition-delay: 0.1s; }
.reveal[data-delay="2"].is-visible { transition-delay: 0.2s; }
.reveal[data-delay="3"].is-visible { transition-delay: 0.3s; }
.reveal[data-delay="4"].is-visible { transition-delay: 0.4s; }
.reveal[data-delay="5"].is-visible { transition-delay: 0.5s; }

/* Split-text wrappers */
.split-line { overflow: hidden; display: block; }
.split-line > span {
    display: inline-block;
    transform: translateY(110%);
    transition: transform 1.1s var(--ease-out-expo);
}
.split-line.is-visible > span { transform: translateY(0); }
