/* Visual styles and theming for F1 Rookie Insights */

:root {
    --primary: #ff0000;
    --dark: #000000;
    --light: #f5f5f5;
    --accent: #da130d;
}

/* Base typography and colors */
body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #222;
    color: #ffffff;
}

/* Header & navigation theming */
header {
    background: linear-gradient(135deg, #000, #222);
    border-bottom: 2px solid var(--primary);
}
.logo-mark {
    border-radius: 4px;
    border: 2px solid var(--primary);
    border-top-color: transparent;
    border-right-color: transparent;
    transform: skewX(-15deg);
}
.logo-text {
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    font-size: 0.9rem;
}
nav a {
    text-decoration: none;
    color: #ddd;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
nav a::after {
    background: var(--primary);
}
nav a.active {
    color: var(--primary);
    font-weight: 600;
}

/* Language switcher styling */
.lang-btn {
    background: rgba(0,0,0,0.35);
    color: #fff;
    border: 2px solid rgba(255,255,255,0.08);
    border-radius: 8px;
    cursor: pointer;
    font-size: 1.15rem;
    transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}
.lang-btn:hover {
    border-color: var(--primary);
    transform: scale(1.06);
    box-shadow: 0 6px 14px rgba(225,6,0,0.12);
}
.lang-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
    box-shadow: 0 8px 22px rgba(225,6,0,0.28);
    transform: none;
}

/* Hero typography and colors */
.hero-text h1 {
    font-size: 1.9rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}
.hero-text h1 .hero-highlight {
    color: var(--primary);
}
.hero-text p {
    color: #d0d0d0;
    font-size: 0.95rem;
}
.badge {
    border-radius: 999px;
    border: 1px solid #444;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #bbb;
}

/* Button styling */
.btn {
    border-radius: 999px;
    border: 1px solid transparent;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s ease-out, color 0.2s ease-out, transform 0.1s ease-out;
}
.btn-primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 4px 12px rgba(225, 6, 0, 0.3);
}
.btn-primary:hover {
    background: #ff2219;
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(225, 6, 0, 0.5);
}
.btn-ghost {
    background: transparent;
    color: #ddd;
    border-color: #555;
}
.btn-ghost:hover {
    background: #1a1a1a;
    transform: translateY(-1px);
}

/* Hero visual styling */
.hero-visual {
    border-radius: 14px;
    border: 1px solid #333;
    background: radial-gradient(circle at 0 0, var(--primary) 0, #000 45%, #000 100%);
}
.hero-visual img {
    border-radius: 10px;
}
.hero-visual figcaption {
    font-size: 0.75rem;
    color: #b0b0b0;
    background: #050505;
}

/* Card styling */
.card {
    background: #111;
    border-radius: 12px;
    border: 1px solid #222;
}
.card h2 {
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}
.card p {
    color: #c9c9c9;
    font-size: 0.9rem;
}
.card ul {
    list-style: disc;
    color: #bdbdbd;
    font-size: 0.88rem;
}
.feature-item {
    background: rgba(255,255,255,0.02);
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.04);
}
.feature-link {
    text-decoration: none;
    color: inherit;
}
.feature-link .feature-item {
    cursor: pointer;
    transition: transform 0.12s ease-out, box-shadow 0.2s ease-out, border-color 0.2s ease-out;
}
.feature-link:hover .feature-item,
.feature-link:focus .feature-item {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0,0,0,0.35);
    border-color: rgba(255,255,255,0.12);
}
.feature-icon {
    font-size: 1.4rem;
}
.feature-item h2 {
    font-size: 1.05rem;
    font-weight: 700;
    text-transform: none;
    letter-spacing: 0.01em;
    color: #e8e8e8;
}
.card a:not(.btn) {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent);
    text-decoration: none;
}
.card a:not(.btn):hover {
    text-decoration: none;
}

/* Footer styling */
footer {
    border-top: 1px solid #222;
    font-size: 0.78rem;
    color: #777;
}

/* Back-to-top button styling */
.back-to-top {
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    box-shadow: 0 6px 14px rgba(0,0,0,0.35);
    text-decoration: none;
    font-size: 1.25rem;
    transition: transform 0.15s ease, opacity 0.15s ease;
    opacity: 0.98;
}
.back-to-top:hover,
.back-to-top:focus {
    transform: translateY(-4px);
    opacity: 1;
}

/* Mobile navigation styling */
.main-nav {
    background: #000;
    border-bottom: 1px solid #222;
}
.main-nav li {
    border-top: 1px solid #181818;
}
.nav-toggle-label {
    cursor: pointer;
}
.nav-toggle-label span {
    background: #f5f5f5;
    border-radius: 999px;
}

/* Subpage hero styling */
.hero--subpage .hero-text h1 {
    font-size: 2rem;
}
.hero-image {
    border-radius: 14px;
    border: 1px solid #333;
    background: #000;
}
.hero-image figcaption {
    font-size: 0.75rem;
    color: #b0b0b0;
    background: #050505;
}

/* Inline image styling */
.inline-image {
    border-radius: 10px;
    border: 1px solid #262626;
    background: #000;
}
.inline-image figcaption {
    font-size: 0.72rem;
    color: #aaaaaa;
    background: #050505;
}

/* Team card styling */
.team-card h2 {
    color: #ffffff;
}
.team-header {
    border-radius: 12px 12px 0 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.4);
}
.team-header a:hover {
    text-decoration: none;
}
.team-header h2 {
    font-size: 1.05rem;
    text-transform: uppercase;
    letter-spacing: 0.13em;
}
.team-engine {
    font-size: 0.8rem;
    color: #e5e5e5;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.55);
}
.team-engine-haas {
    font-size: 0.8rem;
    color: #e5e5e5;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.55);
}
.team-haas-name {
    font-weight: 600;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.55);
}

/* Team livery colors */
.team-mclaren {
    background: linear-gradient(135deg, #ff8000, #ffb347);
}
.team-mercedes {
    background: linear-gradient(135deg, #00b0b9, #004b4f);
}
.team-redbull {
    background: linear-gradient(135deg, #1e004f, #e10600);
}
.team-ferrari {
    background: linear-gradient(135deg, #e10600, #ff4b4b);
}
.team-williams {
    background: linear-gradient(135deg, #005aff, #00b0ff);
}
.team-rb {
    background: linear-gradient(135deg, #002b5c, #0077ff);
}
.team-haas {
    background: linear-gradient(135deg, #878282, #ffffff);
    color: #111;
}
.team-aston {
    background: linear-gradient(135deg, #00594f, #00b489);
}
.team-sauber {
    background: linear-gradient(135deg, #00ff9d, #00835a);
    color: #111;
}
.team-alpine {
    background: linear-gradient(135deg, #002bff, #ff005c);
}
.team-drivers {
    font-size: 0.9rem;
}
.team-drivers .number {
    font-weight: 600;
    color: var(--accent);
}
.team-note {
    font-size: 0.88rem;
    color: #c5c5c5;
}

/* Race calendar styling */
.race-list li {
    border-top: 1px solid #222;
}
.race-list li:last-child {
    border-bottom: 1px solid #222;
}
.race-round {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--accent);
}
.race-name {
    font-weight: 600;
}
.race-meta {
    font-size: 0.85rem;
    color: #c0c0c0;
}
.race-date::before {
    content: "📅 ";
}
.race-track::before {
    content: "📍 ";
}

/* Global: remove underlines from all links site-wide */
a,
a:visited {
    text-decoration: none !important;
    color: inherit;
}
a:hover,
a:focus,
a:active {
    text-decoration: none !important;
}

/* Podium display styling */
.podium-pos {
    background: #0a0a0a;
    border-radius: 6px;
    border: 1px solid #1a1a1a;
    font-size: 0.75rem;
    font-weight: 600;
}
.pos-label {
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #888;
    font-size: 0.7rem;
}
.pos-label sup {
    font-size: 0.6rem;
}
.driver-code {
    color: #e8e8e8;
    font-weight: 700;
    letter-spacing: 0.02em;
}
.podium-1st {
    border-color: #d4af37;
    background: linear-gradient(135deg, rgba(212, 175, 55, 0.08), rgba(0,0,0,0.1));
}
.podium-1st .pos-label {
    color: #d4af37;
}
.podium-2nd {
    border-color: #aaa;
    background: linear-gradient(135deg, rgba(170, 170, 170, 0.08), rgba(0,0,0,0.1));
}
.podium-2nd .pos-label {
    color: #aaa;
}
.podium-3rd {
    border-color: #cd7f32;
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.08), rgba(0,0,0,0.1));
}
.podium-3rd .pos-label {
    color: #cd7f32;
}

/* Glossary styling */
.glossary-item {
    border-top: 1px solid #222;
}
.glossary-item:last-child {
    border-bottom: 1px solid #222;
}
.glossary-item dt {
    font-weight: 600;
    font-size: 0.95rem;
}
.glossary-item dd {
    font-size: 0.9rem;
    color: #c7c7c7;
}

/* Shift glossary descriptions left within glossary card */
.card.glossary-section .glossary-item dd {
    margin-left: 50px;
}
.glossary-flags dt::before {
    content: "🏁 ";
    opacity: 0.7;
}
.faq-item {
    border-top: 1px solid #222;
}
.faq-item:last-of-type {
    border-bottom: 1px solid #222;
}
.faq-item summary {
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
}
.faq-item summary::after {
    font-weight: 600;
    color: #aaa;
}
.faq-item p {
    font-size: 0.9rem;
    color: #c8c8c8;
}
.glossary-more p {
    font-size: 0.9rem;
    color: #c8c8c8;
}

/* Multimedia styling */
.multimedia-intro p {
    font-size: 0.9rem;
    color: #c8c8c8;
}
.carousel-track::-webkit-scrollbar {
    height: 6px;
}
.carousel-track::-webkit-scrollbar-track {
    background: #050505;
}
.carousel-track::-webkit-scrollbar-thumb {
    background: #333;
    border-radius: 999px;
}
.carousel-item {
    background: #101010;
    border-radius: 12px;
    border: 1px solid #222;
}

/* Carousel arrow buttons */
.multimedia-carousel { position: relative; }
.carousel-wrapper {
    position: relative;
}
.carousel-arrow {
    appearance: none;
    border: none;
    background: var(--primary);
    color: #fff;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    line-height: 46px;
    font-weight: 700;
    text-align: center;
    cursor: pointer;
    box-shadow: 0 6px 14px rgba(0,0,0,0.35);
    transition: transform 0.15s ease, opacity 0.15s ease, background 0.15s ease;
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 3;
    opacity: 0.75;
}
.carousel-arrow:hover, .carousel-arrow:focus {
    outline: none;
    transform: translateY(calc(-50% - 4px));
    opacity: 1;
}
.carousel-prev { left: 8px; }
.carousel-next { right: 8px; }

/* Ensure track has room under header and is focusable */
.multimedia-carousel .carousel-track {
    outline: none;
}
.video-wrapper {
    border-radius: 10px;
    background: #000;
}
.video-wrapper a { display: block; }
.video-wrapper img {
    display: block;
    width: 100%;
    height: auto;
    border-radius: 10px;
}
.video-title {
    font-size: 0.95rem;
    font-weight: 600;
}
.video-meta {
    font-size: 0.8rem;
    color: #aaaaaa;
}

/* -------------------------------------------------- */
/* Multimedia comments section */
.multimedia-comments {
    margin-top: 2.5rem;
}
.multimedia-comments h2 {
    margin-bottom: 1rem;
}
.comment-form .form-row {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    margin-bottom: 0.9rem;
}
.comment-form label {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 600;
    color: #ddd;
}
.comment-form input,
.comment-form textarea {
    background: #111;
    border: 1px solid #333;
    padding: 0.6rem 0.7rem;
    border-radius: 6px;
    color: #fff;
    font: inherit;
    resize: vertical;
}
.comment-form input:focus,
.comment-form textarea:focus {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
.comment-form input.invalid,
.comment-form textarea.invalid,
.comment-form select.invalid {
    border-color: #ff6b6b;
    outline: 2px solid #ff6b6b;
    outline-offset: 2px;
}
.comment-form button[type=submit] {
    margin-top: 0.4rem;
}
.form-error {
    color: #ff6b6b;
    font-size: 0.8rem;
    margin-top: 0.6rem;
}
.comment-list {
    list-style: none;
    margin: 1.2rem 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.comment-item {
    background: #101010;
    border: 1px solid #222;
    padding: 0.9rem 1rem 0.75rem;
    border-radius: 10px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.25);
}
.comment-item .comment-meta {
    font-size: 0.7rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: #ccc;
    margin-bottom: 0.35rem;
}
.comment-item .comment-meta strong {
    color: var(--primary);
    font-weight: 700;
}
.comment-item .comment-text {
    font-size: 0.9rem;
    line-height: 1.4;
    color: #e8e8e8;
    word-wrap: break-word;
}
.comment-list .no-comments {
    font-size: 0.8rem;
    color: #aaa;
    font-style: italic;
}
@media (min-width: 700px) {
    .comment-form .form-row-inline {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
        gap: 1rem;
    }
}

/* Flag legend styling */
.flag-legend .legend-intro {
    color: #cfcfcf;
    font-size: 0.9rem;
}
.flag-item {
    background: transparent;
}

/* Flag descriptions: make the bubble stand out */
.flag-desc {
    margin-top: 0.5rem;
    padding: 0.6rem 0.75rem;
    background: #0d0d0d;
    color: #e8e8e8;
    border: 1px solid rgba(255,255,255,0.08);
    border-left: 3px solid var(--accent);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.4);
    font-size: 0.9rem;
    line-height: 1.4;
}

/* Optional caret for the bubble */
.flag-item { position: relative; }
.flag-desc::before {
    content: "";
    position: absolute;
    top: -6px;
    left: 18px;
    width: 10px;
    height: 10px;
    background: #0d0d0d;
    border-left: 1px solid rgba(255,255,255,0.08);
    border-top: 1px solid rgba(255,255,255,0.08);
    transform: rotate(45deg);
}
.flag-btn {
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.04);
    background: linear-gradient(180deg, rgba(255,255,255,0.01), rgba(0,0,0,0.02));
    color: #e6e6e6;
    cursor: pointer;
}
.flag-btn:focus,
.flag-btn:hover {
    outline: none;
    box-shadow: 0 6px 18px rgba(0,0,0,0.45);
    border-color: rgba(255,255,255,0.08);
    transform: translateY(-2px);
}
.flag-swatch {
    border-radius: 4px;
    border: 1px solid rgba(0,0,0,0.5);
}
.swatch-green {
    background: #28a745;
}
.swatch-yellow {
    background: #ffd400;
}
.swatch-red {
    background: #e10600;
}
.swatch-white {
    background: #f6f4f1;
    border: 1px solid #ddd;
}
.swatch-yellow-red {
    background: linear-gradient(90deg, #ffd400 0 50%, #e10600 50% 100%);
}
.swatch-blue {
    background: #0077cc;
}
.swatch-black {
    background: #000;
    border: 1px solid #222;
}
.swatch-black-white {
    background: linear-gradient(90deg, #000 0 50%, #fff 50% 100%);
}
.swatch-chequered {
    background-image: repeating-linear-gradient(45deg,#000 0 6px,#fff 0 12px);
}
.flag-label {
    font-weight: 600;
    font-size: 0.95rem;
}
.flag-tooltip {
    background: #0b0b0b;
    color: #e6e6e6;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.04);
    box-shadow: 0 8px 30px rgba(0,0,0,0.6);
    font-size: 0.9rem;
}
.flag-item.pinned .flag-btn {
    border-color: rgba(225,6,0,0.16);
    box-shadow: 0 6px 20px rgba(225,6,0,0.08);
}

/* Responsive typography adjustments */
@media (max-width: 360px) {
    .logo-text {
        font-size: 0.8rem;
    }
    .hero-text h1 {
        font-size: 1.6rem;
    }
}

@media (min-width: 480px) {
    .hero-text h1 {
        font-size: 2rem;
    }
    .back-to-top {
        font-size: 1rem;
    }
}

@media (max-width: 480px) {
    .hero--subpage .hero-text h1 {
        font-size: 1.7rem;
    }
    .page-teams .hero--subpage .hero-text h1,
    .page-races .hero--subpage .hero-text h1,
    .page-glossary .hero--subpage .hero-text h1,
    .page-multimedia .hero--subpage .hero-text h1 {
        font-size: 1.7rem;
    }
    .flag-legend .flag-label {
        font-size: 0.9rem;
    }
}

@media (min-width: 768px) {
    nav a {
        font-size: 0.9rem;
    }
    .hero-text h1 {
        font-size: 2.2rem;
    }
    .hero-text p {
        font-size: 1rem;
    }
    .hero--subpage .hero-text h1 {
        font-size: 2.2rem;
    }
    .page-teams .hero--subpage .hero-text h1,
    .page-races .hero--subpage .hero-text h1,
    .page-glossary .hero--subpage .hero-text h1,
    .page-multimedia .hero--subpage .hero-text h1 {
        font-size: 2.2rem;
    }
    .main-nav a {
        font-size: 0.9rem;
    }
}

@media (min-width: 992px) {
    .hero-text h1 {
        font-size: 2.4rem;
    }
    .hero--subpage .hero-text h1 {
        font-size: 2.4rem;
    }
    .page-teams .hero--subpage .hero-text h1,
    .page-races .hero--subpage .hero-text h1,
    .page-glossary .hero--subpage .hero-text h1,
    .page-multimedia .hero--subpage .hero-text h1 {
        font-size: 2.4rem;
    }
}