:root {
    --bg: #1a2127;
    --bg-deep: #141a1f;
    --bg-soft: #20282f;
    --bg-raise: #252e36;
    --text: #dacdb8;
    --text-hi: #f1e7d6;
    --accent: #7d3737;
    --accent-soft: #b05454;
    --muted: rgba(218, 205, 184, 0.62);
    --faint: rgba(218, 205, 184, 0.38);
    --line: rgba(218, 205, 184, 0.1);
    --line-hi: rgba(218, 205, 184, 0.22);
    --ok: #8fb08a;
    --bad: #d06a5a;
    --ease: cubic-bezier(0.22, 1, 0.36, 1);
    --maxw: 1180px;
    --gutter: clamp(16px, 5vw, 56px);
    --serif: "Fraunces", Georgia, serif;
    --sans: "Inter", system-ui, sans-serif;
    --mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; scroll-padding-top: 80px; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 16px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}
body.locked { overflow: hidden; }

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
em { font-style: italic; color: var(--accent-soft); }
::selection { background: var(--accent); color: var(--text-hi); }
:focus-visible { outline: 2px solid var(--accent-soft); outline-offset: 3px; border-radius: 6px; }

.grain {
    position: fixed;
    inset: 0;
    z-index: 50;
    pointer-events: none;
    opacity: 0.035;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.pulse {
    position: relative;
    display: inline-block;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ok);
    flex: none;
}
.pulse.bad { background: var(--bad); }
.pulse::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: inherit;
    animation: ping 2.4s var(--ease) infinite;
}
@keyframes ping { 0% { transform: scale(1); opacity: 0.7; } 100% { transform: scale(3); opacity: 0; } }

.nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 20px var(--gutter);
    border-bottom: 1px solid transparent;
    transition: padding 0.4s var(--ease), background 0.4s, border-color 0.4s;
}
.nav.scrolled {
    padding-top: 13px;
    padding-bottom: 13px;
    background: rgba(26, 33, 39, 0.72);
    backdrop-filter: blur(14px) saturate(1.2);
    -webkit-backdrop-filter: blur(14px) saturate(1.2);
    border-bottom-color: var(--line);
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    font-family: var(--serif);
    font-weight: 600;
    font-size: 21px;
    letter-spacing: -0.01em;
    color: var(--text-hi);
}
.brand-mark {
    position: relative;
    width: 20px;
    height: 20px;
    perspective: 120px;
    flex: none;
}
.brand-mark .cube { --s: 13px; position: absolute; left: 3.5px; top: 3.5px; animation: cube-spin 9s linear infinite; }
.brand:hover .brand-mark .cube { animation-duration: 2.4s; }
.brand-tag {
    font-family: var(--sans);
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 3px 9px;
    border: 1px solid var(--line-hi);
    border-radius: 999px;
    margin-left: 2px;
}

.nav-links { display: flex; gap: 6px; margin-left: auto; font-size: 14px; }
.nav-links a {
    padding: 7px 14px;
    border-radius: 999px;
    color: var(--muted);
    transition: color 0.3s, background 0.3s;
}
.nav-links a:hover { color: var(--text-hi); background: rgba(218, 205, 184, 0.06); }

.nav-cta {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    border: 1px solid var(--line-hi);
    border-radius: 999px;
    font-size: 13px;
    color: var(--text);
    background: rgba(26, 33, 39, 0.4);
    transition: border-color 0.3s, background 0.3s;
}
.nav-cta.push { margin-left: auto; }
.nav-cta:hover { border-color: var(--text); background: rgba(218, 205, 184, 0.05); }

.nav-toggle { display: none; width: 40px; height: 40px; margin-left: auto; position: relative; }
.nav-toggle span {
    position: absolute;
    left: 10px;
    right: 10px;
    height: 1.5px;
    background: var(--text-hi);
    transition: transform 0.4s var(--ease), top 0.4s var(--ease);
}
.nav-toggle span:first-child { top: 15px; }
.nav-toggle span:last-child { top: 23px; }
.nav.open .nav-toggle span:first-child { top: 19px; transform: rotate(45deg); }
.nav.open .nav-toggle span:last-child { top: 19px; transform: rotate(-45deg); }

.btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 24px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid transparent;
    transition: transform 0.35s var(--ease), background 0.3s, color 0.3s, border-color 0.3s, box-shadow 0.3s;
}
.btn:hover { transform: translateY(-2px); }
.btn .arrow { transition: transform 0.35s var(--ease); }
.btn:hover .arrow { transform: translateX(4px); }
.btn.primary { background: var(--accent); color: var(--text-hi); box-shadow: 0 10px 30px -10px rgba(125, 55, 55, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.12), inset 0 -3px 0 rgba(0, 0, 0, 0.18); }
.btn.primary:hover { background: #8e4040; box-shadow: 0 16px 40px -12px rgba(176, 84, 84, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.16), inset 0 -3px 0 rgba(0, 0, 0, 0.18); }
.btn.ghost { border-color: var(--line-hi); color: var(--text); background: rgba(26, 33, 39, 0.45); }
.btn.ghost:hover { border-color: var(--text); }

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    padding: 7px 14px 7px 12px;
    border: 1px solid var(--line-hi);
    border-radius: 999px;
    background: rgba(26, 33, 39, 0.55);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    font-size: 12px;
    letter-spacing: 0.2em;
    text-transform: uppercase;
    color: var(--text);
}

.index { display: block; font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--accent-soft); margin-bottom: 16px; }

.deck {
    position: relative;
    width: 100%;
    max-width: 500px;
    aspect-ratio: 1 / 1;
    margin-inline: auto;
    perspective: 1500px;
    container-type: inline-size;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}
.deck-shadow {
    position: absolute;
    left: 16%;
    right: 12%;
    bottom: 3%;
    height: 9%;
    border-radius: 50%;
    background: radial-gradient(closest-side, rgba(0, 0, 0, 0.55), transparent);
    filter: blur(8px);
    animation: deck-shadow 9s ease-in-out infinite;
}
.deck-float {
    position: absolute;
    inset: 0;
    transform-style: preserve-3d;
    animation: deck-float 9s ease-in-out infinite;
}
.deck-rig {
    position: absolute;
    inset: 0;
    transform-style: preserve-3d;
    transform: rotateX(var(--tilt-x, 9deg)) rotateY(var(--tilt-y, -16deg));
}
@keyframes deck-float {
    0%, 100% { transform: translateY(0) rotateZ(0deg); }
    50% { transform: translateY(-2.4cqw) rotateZ(-0.8deg); }
}
@keyframes deck-shadow {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(0.92); opacity: 0.75; }
}

.card3 {
    --tx: 0%;
    --ty: 0%;
    --tz: 0px;
    --rz: 0deg;
    --ry: 0deg;
    --lift: 0px;
    position: absolute;
    left: 50%;
    top: 50%;
    display: flex;
    flex-direction: column;
    width: 56%;
    aspect-ratio: 3 / 4;
    padding: 5.4cqw;
    border: 1px solid var(--line-hi);
    border-radius: 5cqw;
    background: linear-gradient(160deg, var(--bg-raise), #161c21 75%);
    box-shadow: 0 1px 0 rgba(241, 231, 214, 0.08) inset, 0 5cqw 9cqw -3cqw rgba(0, 0, 0, 0.7);
    color: var(--text);
    transform-style: preserve-3d;
    transform: translate(-62%, -46%) translate3d(var(--tx), var(--ty), calc(var(--tz) + var(--lift))) rotateY(var(--ry)) rotateZ(var(--rz));
    transition: transform 0.9s var(--ease), opacity 0.6s var(--ease);
}
.card3::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: radial-gradient(circle at var(--gx, 30%) var(--gy, 20%), rgba(241, 231, 214, 0.16), transparent 58%);
}
.card3 .z1 { transform: translateZ(5px); }
.card3 .z2 { transform: translateZ(10px); }
.card3 .z3 { transform: translateZ(18px); }

.card3[data-pos="0"] { --tz: 100px; --rz: -3deg; }
.card3[data-pos="1"] { --tx: 15%; --ty: -7%; --tz: 20px; --rz: 4deg; --ry: -5deg; }
.card3[data-pos="2"] { --tx: 29%; --ty: -14%; --tz: -60px; --rz: 10deg; --ry: -10deg; }
.card3[data-pos="3"] { --tx: 42%; --ty: -20%; --tz: -140px; --rz: 16deg; --ry: -15deg; }
.card3[data-pos="0"]:hover { --lift: 26px; }

.deck.stack .card3 { --tx: 0%; --ty: 22%; --tz: -140px; --rz: 0deg; --ry: 0deg; opacity: 0; transition: none; }
.deck.entering .card3 { transition-duration: 1.2s; transition-delay: calc(0.2s + var(--i, 0) * 0.12s); }
.card3.lift { --tx: -46%; --ty: -34%; --tz: 180px; --rz: -16deg; opacity: 0; transition-duration: 0.42s; }
.card3.snap { opacity: 0; transition: none; }

.c-top { display: flex; align-items: center; justify-content: space-between; gap: 2cqw; }
.c-tag {
    font-size: 2.3cqw;
    font-weight: 500;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--muted);
    padding: 0.8cqw 2cqw;
    border: 1px solid var(--line-hi);
    border-radius: 999px;
}
.c-top .pulse { width: 1.6cqw; height: 1.6cqw; }
.c-art { flex: 1; display: grid; place-items: center; perspective: 400px; }
.c-art .cube { --s: 11cqw; animation: cube-spin 14s linear infinite; }
.c-stat { font-family: var(--serif); font-weight: 300; font-size: 15cqw; line-height: 1; letter-spacing: -0.04em; color: var(--text-hi); }
.c-stat small { font-family: var(--sans); font-size: 3cqw; letter-spacing: 0; color: var(--muted); margin-left: 1cqw; }
.c-title { font-family: var(--serif); font-weight: 400; font-size: 5.6cqw; line-height: 1.05; letter-spacing: -0.02em; color: var(--text-hi); }
.c-text { margin-top: 1.4cqw; font-size: 2.7cqw; line-height: 1.45; color: var(--muted); }
.c-foot {
    display: flex;
    justify-content: space-between;
    gap: 2cqw;
    margin-top: 3.6cqw;
    padding-top: 2.6cqw;
    border-top: 1px solid var(--line);
    font-family: var(--mono);
    font-size: 2.2cqw;
    color: var(--faint);
}

.card3.accent { background: linear-gradient(150deg, #8e4040, var(--accent) 50%, #4a2428); border-color: rgba(255, 255, 255, 0.14); }
.card3.accent .c-tag { color: var(--text-hi); border-color: rgba(241, 231, 214, 0.35); }
.card3.accent .c-text, .card3.accent .c-foot { color: rgba(241, 231, 214, 0.75); }
.card3.accent .c-foot { border-color: rgba(241, 231, 214, 0.2); }
.card3.light { background: linear-gradient(160deg, #f1e7d6, #cdbfa7); border-color: rgba(255, 255, 255, 0.5); color: var(--bg); }
.card3.light .c-tag { color: var(--accent); border-color: rgba(125, 55, 55, 0.35); }
.card3.light .c-title, .card3.light .c-stat { color: var(--bg); }
.card3.light .c-text, .card3.light .c-foot { color: rgba(26, 33, 39, 0.66); }
.card3.light .c-foot { border-color: rgba(26, 33, 39, 0.14); }
.card3.light::after { background: radial-gradient(circle at var(--gx, 30%) var(--gy, 20%), rgba(255, 255, 255, 0.4), transparent 58%); }
.card3.bad { border-color: rgba(208, 106, 90, 0.5); }
.card3.bad .c-stat { color: var(--bad); }

.tilt { transform-style: preserve-3d; will-change: transform; }
.tilt .z1 { transform: translateZ(24px); }
.tilt .z2 { transform: translateZ(48px); }
.tilt .z3 { transform: translateZ(72px); }
.tilt .glare {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: radial-gradient(420px circle at var(--gx, 50%) var(--gy, 0%), rgba(241, 231, 214, 0.1), transparent 55%);
    opacity: 0;
    transition: opacity 0.4s;
}
.tilt:hover .glare { opacity: 1; }

.cube {
    --s: 40px;
    display: block;
    position: relative;
    width: var(--s);
    height: var(--s);
    transform-style: preserve-3d;
    transform: rotateX(-24deg) rotateY(38deg);
}
.cube i {
    position: absolute;
    inset: 0;
    border: 1px solid rgba(241, 231, 214, 0.45);
    background: rgba(176, 84, 84, 0.22);
}
.cube i:nth-child(1) { transform: translateZ(calc(var(--s) / 2)); background: rgba(176, 84, 84, 0.55); }
.cube i:nth-child(2) { transform: rotateY(180deg) translateZ(calc(var(--s) / 2)); }
.cube i:nth-child(3) { transform: rotateY(90deg) translateZ(calc(var(--s) / 2)); background: rgba(125, 55, 55, 0.6); }
.cube i:nth-child(4) { transform: rotateY(-90deg) translateZ(calc(var(--s) / 2)); }
.cube i:nth-child(5) { transform: rotateX(90deg) translateZ(calc(var(--s) / 2)); background: rgba(218, 205, 184, 0.35); }
.cube i:nth-child(6) { transform: rotateX(-90deg) translateZ(calc(var(--s) / 2)); }
.cube.light i { background: rgba(218, 205, 184, 0.1); border-color: rgba(241, 231, 214, 0.5); }
.cube.light i:nth-child(1) { background: rgba(218, 205, 184, 0.22); }
.cube.light i:nth-child(5) { background: rgba(241, 231, 214, 0.4); }
.cube.spin { animation: cube-spin 14s linear infinite; }
@keyframes cube-spin {
    from { transform: rotateX(-24deg) rotateY(0deg); }
    to { transform: rotateX(-24deg) rotateY(360deg); }
}

.muted { color: var(--muted); font-size: 14px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

[data-reveal] { opacity: 0; transform: translateY(24px); transition: opacity 0.9s var(--ease), transform 0.9s var(--ease); }
[data-reveal].in { opacity: 1; transform: none; }

@media (max-width: 820px) {
    .nav-cta.hide-sm { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
    [data-reveal] { opacity: 1; transform: none; }
    html { scroll-behavior: auto; }
}
