/* ============================================================
   BBT AUTOMOTIVE — shared styles
   Black / white / red brand system derived from the BBT logo.
   ============================================================ */

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

body {
    background-color: #050505;
    color: #C7C7C7;
    overflow-x: hidden;
}

button,
[role="button"],
select,
summary {
    cursor: pointer;
}

::selection {
    background: #E10600;
    color: #fff;
}

::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #0B0B0B;
}

::-webkit-scrollbar-thumb {
    background: #2a2a2a;
    border: 2px solid #0B0B0B;
}

::-webkit-scrollbar-thumb:hover {
    background: #E10600;
}

:focus-visible {
    outline: 2px solid #FF3B30;
    outline-offset: 3px;
}

/* ---------- texture layers ---------- */

/* Film grain over everything — keeps the dark surfaces from looking flat */
.grain::after {
    content: "";
    position: fixed;
    inset: -50%;
    width: 200%;
    height: 200%;
    pointer-events: none;
    z-index: 90;
    opacity: 0.05;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%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");
}

/* Carbon-fibre weave for panels */
.carbon {
    background-color: #0C0C0C;
    background-image:
        linear-gradient(27deg, #151515 5px, transparent 5px),
        linear-gradient(207deg, #151515 5px, transparent 5px),
        linear-gradient(27deg, #0a0a0a 5px, transparent 5px),
        linear-gradient(207deg, #0a0a0a 5px, transparent 5px),
        linear-gradient(90deg, #101010 10px, transparent 10px),
        linear-gradient(#0d0d0d 25%, #0a0a0a 25%, #0a0a0a 50%, transparent 50%, transparent 75%, #111 75%, #111);
    background-size: 20px 20px;
}

/* Hairline used across the site instead of shadows */
.hairline {
    border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Viewfinder corner brackets */
.corner-frame {
    position: relative;
}

.corner-frame::before,
.corner-frame::after {
    content: "";
    position: absolute;
    width: 22px;
    height: 22px;
    border-color: #E10600;
    border-style: solid;
    z-index: 2;
    pointer-events: none;
}

.corner-frame::before {
    top: -1px;
    left: -1px;
    border-width: 2px 0 0 2px;
}

.corner-frame::after {
    bottom: -1px;
    right: -1px;
    border-width: 0 2px 2px 0;
}

/* Outline / ghost display text */
.text-outline {
    -webkit-text-stroke: 1px rgba(255, 255, 255, 0.28);
    color: transparent;
}

.text-outline-red {
    -webkit-text-stroke: 1px rgba(225, 6, 0, 0.6);
    color: transparent;
}

.text-ghost {
    -webkit-text-stroke: 1px rgba(255, 255, 255, 0.07);
    color: transparent;
    user-select: none;
    pointer-events: none;
}

/* Diagonal red hazard tape strip */
.hazard {
    background: repeating-linear-gradient(-45deg,
            #E10600 0 14px,
            #050505 14px 28px);
}

/* ---------- motion ---------- */

/* Scroll reveal — hidden states are gated behind html.js so content
   stays visible if JavaScript never runs */
html.js [data-reveal] {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.9s cubic-bezier(0.16, 1, 0.3, 1), transform 0.9s cubic-bezier(0.16, 1, 0.3, 1);
}

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

html.js [data-reveal="left"] {
    transform: translateX(-36px);
}

html.js [data-reveal="right"] {
    transform: translateX(36px);
}

html.js [data-reveal="scale"] {
    transform: scale(0.94);
}

/* Staggered children — parent carries data-reveal-group */
html.js [data-reveal-group]>* {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 0.8s cubic-bezier(0.16, 1, 0.3, 1), transform 0.8s cubic-bezier(0.16, 1, 0.3, 1);
}

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

html.js [data-reveal-group].is-visible>*:nth-child(1) { transition-delay: 0s; }
html.js [data-reveal-group].is-visible>*:nth-child(2) { transition-delay: 0.08s; }
html.js [data-reveal-group].is-visible>*:nth-child(3) { transition-delay: 0.16s; }
html.js [data-reveal-group].is-visible>*:nth-child(4) { transition-delay: 0.24s; }
html.js [data-reveal-group].is-visible>*:nth-child(5) { transition-delay: 0.32s; }
html.js [data-reveal-group].is-visible>*:nth-child(6) { transition-delay: 0.4s; }

/* Hero headline line mask */
.line-mask {
    display: block;
    overflow: hidden;
    /* tight display line-heights clip glyph bottoms without this compensation */
    padding-bottom: 0.08em;
    margin-bottom: -0.08em;
}

html.js .line-mask>span {
    display: block;
    transform: translateY(110%);
    transition: transform 1s cubic-bezier(0.16, 1, 0.3, 1);
}

html.js.loaded .line-mask>span {
    transform: none;
}

html.js.loaded .line-mask:nth-child(2)>span {
    transition-delay: 0.1s;
}

html.js.loaded .line-mask:nth-child(3)>span {
    transition-delay: 0.2s;
}

/* Marquee */
.marquee {
    overflow: hidden;
    white-space: nowrap;
    display: flex;
}

.marquee-track {
    display: flex;
    align-items: center;
    flex-shrink: 0;
    min-width: 100%;
    animation: marquee 28s linear infinite;
}

.marquee:hover .marquee-track {
    animation-play-state: paused;
}

@keyframes marquee {
    from {
        transform: translateX(0);
    }

    to {
        transform: translateX(-100%);
    }
}

/* Slow spin (decor rings) */
@keyframes spin-slow {
    to {
        transform: rotate(360deg);
    }
}

.spin-slow {
    animation: spin-slow 14s linear infinite;
}

/* Scroll cue */
@keyframes cue {
    0%, 100% {
        transform: translateY(0);
        opacity: 1;
    }

    50% {
        transform: translateY(10px);
        opacity: 0.4;
    }
}

.scroll-cue {
    animation: cue 1.8s ease-in-out infinite;
}

/* Red pulse dot (live telemetry feel) */
@keyframes pulse-dot {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(225, 6, 0, 0.55);
    }

    60% {
        box-shadow: 0 0 0 9px rgba(225, 6, 0, 0);
    }
}

.pulse-dot {
    animation: pulse-dot 1.6s ease-out infinite;
}

/* Underline sweep for links */
.link-sweep {
    position: relative;
}

.link-sweep::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: -4px;
    height: 2px;
    width: 100%;
    background: #E10600;
    transform: scaleX(0);
    transform-origin: right;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.link-sweep:hover::after,
.link-sweep:focus-visible::after {
    transform: scaleX(1);
    transform-origin: left;
}

/* Buttons */
.btn-red {
    position: relative;
    overflow: hidden;
    background: #E10600;
    color: #fff;
    transition: color 0.3s;
    isolation: isolate;
}

.btn-red::before {
    content: "";
    position: absolute;
    inset: 0;
    background: #fff;
    transform: translateX(-101%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: -1;
}

.btn-red:hover,
.btn-red:focus-visible {
    color: #050505;
}

.btn-red:hover::before,
.btn-red:focus-visible::before {
    transform: translateX(0);
}

.btn-ghost {
    position: relative;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    transition: color 0.3s, border-color 0.3s;
    isolation: isolate;
}

.btn-ghost::before {
    content: "";
    position: absolute;
    inset: 0;
    background: #E10600;
    transform: translateY(101%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: -1;
}

.btn-ghost:hover,
.btn-ghost:focus-visible {
    border-color: #E10600;
}

.btn-ghost:hover::before,
.btn-ghost:focus-visible::before {
    transform: translateY(0);
}

/* ---------- header / nav ---------- */

#site-header {
    transition: background-color 0.4s, border-color 0.4s, transform 0.4s;
    background: transparent;
    border-bottom: 1px solid transparent;
}

#site-header.scrolled {
    background: rgba(5, 5, 5, 0.88);
    backdrop-filter: blur(14px);
    border-bottom-color: rgba(255, 255, 255, 0.08);
}

/* Mobile menu overlay */
#mobile-menu {
    transform: translateX(100%);
    transition: transform 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

#mobile-menu.open {
    transform: translateX(0);
}

.menu-open {
    overflow: hidden;
}

/* ---------- forms ---------- */

.field {
    width: 100%;
    background: transparent;
    border: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 14px 0;
    transition: border-color 0.3s;
}

.field::placeholder {
    color: rgba(255, 255, 255, 0.25);
}

.field:focus {
    outline: none;
    box-shadow: none;
    border-bottom-color: #E10600;
}

select.field option {
    background: #101010;
    color: #fff;
}

/* ---------- dyno chart ---------- */

.dyno-grid line {
    stroke: rgba(255, 255, 255, 0.07);
    stroke-width: 1;
}

.dyno-axis text {
    fill: #8F8F8F;
    font-family: "Chakra Petch", monospace;
    font-size: 11px;
    letter-spacing: 0.08em;
}

.dyno-label {
    fill: #fff;
    font-family: "Chakra Petch", monospace;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.08em;
}

#dyno-tooltip {
    position: absolute;
    pointer-events: none;
    background: rgba(10, 10, 10, 0.95);
    border: 1px solid rgba(255, 255, 255, 0.12);
    padding: 10px 14px;
    font-family: "Chakra Petch", monospace;
    font-size: 12px;
    color: #C7C7C7;
    z-index: 20;
    opacity: 0;
    transition: opacity 0.15s;
    min-width: 150px;
}

/* ---------- responsive spec (mobile margins + type) ---------- */

@media (max-width: 767px) {
    .px-margin-edge {
        padding-left: 20px !important;
        padding-right: 20px !important;
    }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }

    [data-reveal],
    [data-reveal-group]>* {
        opacity: 1 !important;
        transform: none !important;
    }

    .line-mask>span {
        transform: none !important;
    }

    .marquee-track {
        animation: none !important;
    }
}
