/* Car of the Day — Main Zone.
 *
 * Paper is 90% × 80% of the slide, divided into two columns:
 *   LEFT  — decorative yellow car SVG, vertically centered, height
 *           = 80% of the paper height (= 64% of the zone height).
 *   RIGHT — a single cell that fills the rest of the 90% width and
 *           the full 80% height, holding the photo + headline + fact. */

/* Slide is a horizontal scene: thin asphalt band centered vertically,
 * with yellow + dark-gray "scenery blocks" passing above and below it
 * to suggest motion. Dashes inside the band scroll left→right. */
.cars-main-wrap {
    width: 100cqw;
    height: 100cqh;
    container-type: size;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    overflow: hidden;
    position: relative;
    color: var(--text);
    font-family: 'Geist Mono', 'Roboto Mono', monospace;
    background: #2a2a2a;
}

/* Scenery strips above and below the road — alternating yellow + dark
 * gray blocks that scroll past, sold via background-position animation. */
.cars-main-scenery {
    position: absolute;
    left: 0;
    right: 0;
    height: 5%;
    background:
        repeating-linear-gradient(
            to right,
            #d9b300 0,
            #d9b300 14cqw,
            #2e2e2e 14cqw,
            #2e2e2e 28cqw,
            #f5c400 28cqw,
            #f5c400 42cqw,
            #1a1a1a 42cqw,
            #1a1a1a 56cqw
        );
    background-size: 56cqw 100%;
    animation: cars-scenery-scroll 3s linear infinite;
    pointer-events: none;
    z-index: 0;
}

.cars-main-scenery-top    { top: 0; }
.cars-main-scenery-bottom { bottom: 0; }

@keyframes cars-scenery-scroll {
    from { background-position: 0 0; }
    to   { background-position: 56cqw 0; }
}

/* The road — thinner asphalt band centered vertically, with solid
 * white edge lines as borders. */
.cars-main-road {
    position: absolute;
    left: 0;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    height: 90%;
    background:
        linear-gradient(to bottom, #5a5a5a, #4a4a4a 50%, #5a5a5a);
    border-top: 0.5cqh solid #f5f5f5;
    border-bottom: 0.5cqh solid #f5f5f5;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

/* Dashed white center line — animated left→right. */
.cars-main-dashes {
    position: absolute;
    left: -10%;
    top: 50%;
    height: 4cqh;
    width: 200%;
    transform: translateY(-50%);
    background: repeating-linear-gradient(
        to right,
        #f5f5f5 0,
        #f5f5f5 8cqw,
        transparent 8cqw,
        transparent 14cqw
    );
    animation: cars-road-scroll 1.5s linear infinite;
}

@keyframes cars-road-scroll {
    from { transform: translateY(-50%) translateX(-14cqw); }
    to   { transform: translateY(-50%) translateX(0); }
}

.cars-main-paper {
    position: relative;
    width: 90%;
    height: 80%;
    box-sizing: border-box;
    /* Left side is transparent so the slide bg shows through behind the
     * yellow car; the right cell sets its own white background. */
    background: transparent;
    border: none;
    display: flex;
    align-items: stretch;
    overflow: hidden;
}

/* LEFT — yellow car icon column, sized to whatever width its SVG needs
 * at the requested height. */
/* Left side is transparent so the slide-wide road shows through behind
 * the yellow car. */
.cars-main-left {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-sizing: border-box;
    position: relative;
    z-index: 1;
}

/* Yellow car renders ABOVE the road pseudo-elements. */
.cars-main-wrap .cars-main-yallowcar {
    position: relative;
    z-index: 1;
}

/* Override the global .slide-text img rule (max-height: 60cqh, height: auto)
 * with a higher-specificity selector. SVG renders in its natural
 * portrait orientation. */
.cars-main-wrap .cars-main-yallowcar {
    height: 64cqh;
    width: auto;
    max-width: none;
    max-height: none;
    display: block;
    animation: cars-truck-shake 1s ease-in-out infinite;
    transform-origin: center;
}

/* Subtle vibration to suggest the truck is running. Small vertical
 * jitter + tiny rotation tilt back and forth. */
@keyframes cars-truck-shake {
    0%, 100% { transform: translate(0, 0) rotate(0); }
    20%      { transform: translate(0, -2px) rotate(-0.3deg); }
    40%      { transform: translate(0, 1.5px) rotate(0.3deg); }
    60%      { transform: translate(0, -1.5px) rotate(-0.2deg); }
    80%      { transform: translate(0, 1.5px) rotate(0.2deg); }
}

.cars-main-wrap .cars-main-photo img {
    max-width: none;
    max-height: none;
}

/* RIGHT — fills everything else; one cell of content. */
.cars-main-right {
    flex: 1 1 auto;
    display: flex;
    align-items: stretch;
    justify-content: stretch;
    min-width: 0;
    background: #FFF center / cover no-repeat;
    border: 2cqmin inset var(--text);
    border-radius: 4cqmin;
    /* Inner border using the lightest theme color (--bg). Implemented as
     * an inset box-shadow so it draws inside the existing border and
     * follows the rounded corners. */
    box-shadow: inset 0 0 0 0.8cqmin var(--bg);
    position: relative;
    z-index: 1;
}

.cars-main-cell {
    width: 100%;
    height: 100%;
    padding: 1cqmin 2.5cqw;
    box-sizing: border-box;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    color: var(--text);
    overflow: hidden;
}

.cars-main-photo {
    width: 100%;
    height: 100%;
    overflow: hidden;
    border: 0.2cqmin solid var(--text);
    background: #f4f4f4;
}

.cars-main-photo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.cars-main-wrap .cars-main-body {
    font-size: inherit;
    line-height: 1.35;
    font-family: 'Georgia', serif;
    text-align: start;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
}

/* Line-by-line dark highlight: display:inline so each wrapped line gets
 * its own pill of background. box-decoration-break:clone ensures the
 * background+padding repeats on every line, not just the first/last. */
.cars-main-wrap .cars-main-header,
.cars-main-wrap .cars-main-headline,
.cars-main-wrap .cars-main-text {
    display: inline;
    box-decoration-break: clone;
    -webkit-box-decoration-break: clone;
    background-color: color-mix(in srgb, var(--text) 75%, transparent);
    padding: 0.1em 0.4em;
}

/* Wrap each block in its own visual line so they sit on separate rows. */
.cars-main-wrap .cars-main-body > * {
    margin-bottom: 0.25em;
}

.cars-main-wrap .cars-main-header {
    font-family: 'Geist Mono', 'Roboto Mono', monospace;
    font-size: 0.7em;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.25em;
    color: #fff;
    opacity: 0.85;
    line-height: 1.6;
    text-shadow: 0 0.2cqmin 0.5cqmin rgba(0, 0, 0, 0.7);
}

.cars-main-wrap .cars-main-headline {
    font-family: 'Cormorant Garamond', 'Georgia', serif;
    font-size: 1.9em;
    font-weight: 700;
    line-height: 1.5;
    color: #fff;
    letter-spacing: -0.005em;
    text-shadow: 0 0.2cqmin 0.5cqmin rgba(0, 0, 0, 0.6);
}

.cars-main-wrap .cars-main-headline-icon {
    color: var(--accent);
    font-size: 0.85em;
    margin-right: 0.4em;
    vertical-align: baseline;
}

.cars-main-wrap .cars-main-text {
    font-family: 'Georgia', serif;
    font-size: 1.15em;
    line-height: 1.7;
    color: #fff;
    text-shadow: 0 0.2cqmin 0.5cqmin rgba(0, 0, 0, 0.7);
    white-space: nowrap;
}

.cars-main-wrap .cars-main-disclaimer {
    font-family: 'Geist Mono', 'Roboto Mono', monospace;
    font-size: 0.45em;
    text-transform: uppercase;
    letter-spacing: 0.22em;
    color: var(--accent);
    opacity: 0.85;
    line-height: 1;
    margin-top: 0.7em;
}
