/* Project Car Crash page (/carcrash). Layout components come from css/forge.css;
   this file sets the page's own palette, backdrop and the pieces unique to it. */

/* ---------- Theme: warm safety orange on asphalt ---------- */

body.theme-carcrash {
    --bg:            #0e0e10;
    --accent:        #ff7a3d;
    --accent-rgb:    255, 122, 61;
    --accent-soft:   rgba(255, 122, 61, 0.11);
    --accent-bright: #ff9d6b;
    --surface:       rgba(255, 255, 255, 0.03);
    --surface-hover: rgba(255, 255, 255, 0.05);
    --stroke:        rgba(255, 255, 255, 0.08);
    --stroke-strong: rgba(255, 255, 255, 0.16);
    --muted:         #bcbfc6;
    --faint:         #8d9099;
    background-color: #0e0e10;
}

.theme-carcrash .fx {
    --fx-panel: #18181b;
    --fx-field: #222226;
}

/* Asphalt: a warm glow low on the left, cool steel high on the right, and the faint
   tiled floor of the test track receding from the top. */
.carcrash-backdrop {
    position: fixed;
    inset: 0;
    z-index: -2;
    overflow: hidden;
    background:
        radial-gradient(1100px 760px at -4% 104%, rgba(255, 110, 50, 0.11), transparent 62%),
        radial-gradient(1200px 820px at 104% -6%, rgba(70, 96, 130, 0.30), transparent 64%),
        linear-gradient(180deg, #121214 0%, #0e0e10 55%, #0a0a0b 100%);
}

.carcrash-backdrop::before {
    content: '';
    position: absolute;
    inset: -10% -10% 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
    background-size: 96px 96px;
    transform: perspective(900px) rotateX(58deg);
    transform-origin: 50% 0%;
    -webkit-mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.5) 30%, transparent 62%);
    mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, 0.5) 30%, transparent 62%);
}

.theme-carcrash nav {
    background: rgba(14, 14, 16, 0.72);
}

.theme-carcrash nav a[href="/carcrash"] {
    color: var(--accent);
}

.theme-carcrash .btn--primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #2a0f02;
    box-shadow: 0 12px 34px -14px rgba(255, 122, 61, 0.6);
}

.theme-carcrash .btn--primary:hover {
    background: var(--accent-bright);
    border-color: var(--accent-bright);
}

.theme-carcrash .fx-dot {
    animation: cc-pulse 2.6s ease-out infinite;
}

@keyframes cc-pulse {
    0%   { box-shadow: 0 0 0 0 rgba(255, 122, 61, 0.45); }
    70%  { box-shadow: 0 0 0 9px rgba(255, 122, 61, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 122, 61, 0); }
}

.theme-carcrash .fx-shot {
    border-color: rgba(255, 122, 61, 0.14);
}

.theme-carcrash .fx-shot video {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
}

.theme-carcrash .fx-bar-row:last-of-type .fx-bar i {
    background: linear-gradient(90deg, rgba(255, 122, 61, 0.45), var(--accent));
    box-shadow: 0 0 18px rgba(255, 122, 61, 0.35);
}

.theme-carcrash :is(.fx-perf, .cc-details > div, .cc-note)::after {
    background: radial-gradient(520px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 122, 61, 0.07), transparent 45%);
}

/* ---------- Hero: headline beside a phone playing the game in portrait ---------- */

.cc-hero {
    display: grid;
    grid-template-columns: 1fr 330px;
    gap: 64px;
    align-items: center;
    padding: 88px 0 40px;
}

.cc-hero .fx-display {
    font-size: clamp(2.6rem, 6.2vw, 5.6rem);
}

.cc-phone {
    margin: 0;
    justify-self: end;
    width: 100%;
    max-width: 330px;
}

.cc-phone-screen {
    position: relative;
    aspect-ratio: 9 / 16;
    border-radius: 42px;
    padding: 10px;
    background: linear-gradient(160deg, #2a2a2e, #121214 40%, #1c1c20);
    box-shadow:
        0 0 0 1px rgba(255, 255, 255, 0.10),
        inset 0 0 0 1px rgba(255, 255, 255, 0.05),
        0 60px 120px -40px rgba(0, 0, 0, 0.95),
        0 30px 80px -30px rgba(255, 122, 61, 0.28);
}

.cc-phone-screen::before {
    content: '';
    position: absolute;
    top: 20px;
    left: 50%;
    width: 84px;
    height: 24px;
    transform: translateX(-50%);
    border-radius: 999px;
    background: #050506;
    z-index: 2;
}

.cc-phone-screen video {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 32px;
    background: #0b0b0d;
}

.cc-phone figcaption {
    margin-top: 16px;
    text-align: center;
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--faint);
}

/* ---------- Details grid ---------- */

.cc-details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1px;
    background: var(--stroke);
    border: 1px solid var(--stroke);
    border-radius: var(--r-lg);
    overflow: hidden;
}

.cc-details > div {
    position: relative;
    background: #111113;
    padding: 28px 28px 26px;
}

.cc-details h3 {
    font-size: 1.05rem;
    font-weight: 500;
    color: var(--text);
    margin: 0 0 8px;
}

.cc-details h3::before {
    content: '';
    display: inline-block;
    width: 7px;
    height: 7px;
    margin-right: 10px;
    vertical-align: 0.12em;
    transform: rotate(45deg);
    border: 1px solid var(--accent);
}

.cc-details p {
    font-size: 0.94rem;
    color: var(--muted);
    line-height: 1.65;
    margin: 0;
}

/* ---------- Garage list ---------- */

.cc-cars {
    margin-top: 26px;
}

.cc-cars > div {
    grid-template-columns: 170px 1fr;
}

.cc-cars dt {
    letter-spacing: 0.08em;
    color: var(--text);
}

/* ---------- Engineering notes ---------- */

.cc-notes {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.cc-note {
    position: relative;
    display: flex;
    flex-direction: column;
    background: var(--surface);
    border: 1px solid var(--stroke);
    border-radius: var(--r-lg);
    overflow: hidden;
    text-decoration: none;
    color: var(--text);
    transition: transform 0.5s var(--ease), border-color 0.5s var(--ease);
}

.cc-note:hover {
    transform: translateY(-4px);
    border-color: var(--stroke-strong);
}

.cc-note-media {
    aspect-ratio: 16 / 9;
    overflow: hidden;
    border-bottom: 1px solid var(--stroke);
}

.cc-note-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.8s var(--ease);
}

.cc-note:hover .cc-note-media img {
    transform: scale(1.04);
}

.cc-note span {
    margin: 22px 24px 8px;
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--accent);
}

.cc-note h3 {
    margin: 0 24px 24px;
    font-size: 1.12rem;
    font-weight: 500;
    line-height: 1.35;
}

/* ---------- Responsive ---------- */

@media (max-width: 1000px) {
    .cc-hero {
        grid-template-columns: 1fr;
        gap: 48px;
    }

    .cc-phone {
        justify-self: center;
        max-width: 300px;
    }

    .cc-details,
    .cc-notes {
        grid-template-columns: 1fr 1fr;
    }
}

@media (max-width: 640px) {
    .cc-hero {
        padding-top: 56px;
    }

    .cc-details,
    .cc-notes {
        grid-template-columns: 1fr;
    }

    .cc-cars > div {
        grid-template-columns: 1fr;
    }

    .cc-phone {
        max-width: 260px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .theme-carcrash .fx-dot {
        animation: none;
    }
}

/* Impact chart: wider labels, one orange ramp from the gentlest hit to the hardest. */
.cc-impact .fx-bar-row {
    grid-template-columns: 110px 1fr 64px;
}

.cc-impact .fx-bar i {
    background: rgba(255, 122, 61, 0.55);
}

.cc-impact .fx-bar-row:first-of-type .fx-bar i {
    background: rgba(255, 122, 61, 0.35);
}
