:root {
    --bg-dark: #0e1015;
    --bg-surface: #161922;
    --bg-card: #1c202b;
    --bg-card-hover: #252a38;
    --accent-red: #c62828;
    --accent-amber: #f59e0b;
    --text-main: #f3f4f6;
    --text-muted: #9ca3af;
    --border: #2b3242;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: var(--bg-dark); color: var(--text-main); font-family: var(--font); line-height: 1.7; }
.container { max-width: 1100px; margin: 0 auto; padding: 0 1.25rem; }

header { background: #12141b; border-bottom: 2px solid var(--accent-red); padding: 1.2rem 0; }
.header-row { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem; }
.brand { font-size: 1.5rem; font-weight: 900; letter-spacing: 1px; color: #fff; text-decoration: none; }
.brand span { color: var(--accent-red); }
nav { display: flex; gap: 1.2rem; flex-wrap: wrap; }
nav a { color: var(--text-muted); text-decoration: none; font-weight: 600; font-size: 0.9rem; text-transform: uppercase; transition: color 0.2s; }
nav a:hover { color: #fff; }

.hero { background: linear-gradient(180deg, #181d28 0%, var(--bg-dark) 100%); padding: 4.5rem 0 3.5rem; border-bottom: 1px solid var(--border); }
.hero h1 { font-size: 2.6rem; font-weight: 800; line-height: 1.2; margin: 0.8rem 0; }
.hero p.lead { font-size: 1.2rem; color: var(--text-muted); max-width: 780px; }
.badge { background: var(--accent-red); color: #fff; font-size: 0.75rem; text-transform: uppercase; font-weight: 800; padding: 4px 10px; border-radius: 3px; display: inline-block; }

.section-title { font-size: 1.6rem; text-transform: uppercase; letter-spacing: 0.5px; margin: 3rem 0 1.5rem; border-left: 4px solid var(--accent-red); padding-left: 12px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 1.5rem; margin-bottom: 3rem; }

.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px; padding: 1.5rem; display: flex; flex-direction: column; justify-content: space-between; transition: 0.2s; }
.card:hover { background: var(--bg-card-hover); transform: translateY(-3px); }
.card-category { font-size: 0.75rem; text-transform: uppercase; font-weight: 700; color: var(--accent-amber); margin-bottom: 0.5rem; }
.card h3 { font-size: 1.25rem; margin-bottom: 0.75rem; line-height: 1.35; color: #fff; }
.card p { color: var(--text-muted); font-size: 0.95rem; margin-bottom: 1.2rem; flex-grow: 1; }
.card a.read-more { color: var(--text-main); font-weight: 700; text-decoration: none; font-size: 0.85rem; text-transform: uppercase; }

.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 1rem; margin: 2rem 0; }
.gallery-card { background: var(--bg-surface); border: 1px solid var(--border); border-radius: 4px; overflow: hidden; aspect-ratio: 4/3; }
.gallery-card img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.2s; }
.gallery-card img:hover { transform: scale(1.04); }

.full-article { max-width: 780px; margin: 3rem auto; }
.full-article h1 { font-size: 2.4rem; line-height: 1.25; margin: 0.5rem 0 1rem; }
.breadcrumb a { color: var(--accent-amber); text-decoration: none; font-size: 0.9rem; font-weight: 600; }
.article-meta { color: var(--text-muted); font-size: 0.85rem; border-bottom: 1px solid var(--border); padding-bottom: 1.2rem; margin-bottom: 2rem; }
.article-body p { margin-bottom: 1.6rem; font-size: 1.12rem; line-height: 1.85; color: #d1d5db; }
.article-body strong { color: #fff; }

footer { border-top: 1px solid var(--border); padding: 3rem 0; text-align: center; color: var(--text-muted); font-size: 0.9rem; margin-top: 4rem; }
footer .tagline { font-size: 0.85rem; color: #6b7280; margin-top: 0.5rem; font-style: italic; }

@media (max-width: 768px) {
    .hero h1 { font-size: 2rem; }
    .grid { grid-template-columns: 1fr; }
}

/* ==========================================================================
   Photo Lightbox Modal
   ========================================================================== */
.rs-lightbox {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 99999;
}
.rs-lightbox.active {
    display: flex;
}
.rs-lightbox-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(10, 12, 16, 0.94);
    backdrop-filter: blur(5px);
}
.rs-lightbox-content {
    position: relative;
    max-width: 90vw;
    max-height: 88vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 10;
}
.rs-lightbox-img {
    max-width: 100%;
    max-height: 80vh;
    object-fit: contain;
    border-radius: 4px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.8);
    user-select: none;
}
.rs-lightbox-bar {
    margin-top: 10px;
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.9rem;
    color: #9ca3af;
    background: rgba(22, 25, 34, 0.85);
    padding: 6px 14px;
    border-radius: 4px;
    border: 1px solid #2b3242;
}
.rs-btn {
    position: absolute;
    background: rgba(28, 32, 44, 0.7);
    border: 1px solid #374151;
    color: #fff;
    cursor: pointer;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: background 0.2s, color 0.2s;
}
.rs-btn:hover {
    background: #c62828;
    color: #fff;
}
.rs-close {
    top: 1.5rem;
    right: 1.5rem;
    width: 44px;
    height: 44px;
    font-size: 2rem;
    line-height: 1;
}
.rs-prev, .rs-next {
    top: 50%;
    transform: translateY(-50%);
    width: 48px;
    height: 60px;
    font-size: 1.5rem;
}
.rs-prev { left: 1.5rem; }
.rs-next { right: 1.5rem; }

@media (max-width: 768px) {
    .rs-prev { left: 0.5rem; width: 40px; height: 50px; }
    .rs-next { right: 0.5rem; width: 40px; height: 50px; }
    .rs-close { top: 0.75rem; right: 0.75rem; }
}

/* ==========================================================================
   High-Contrast Link & Content Typography Fixes
   ========================================================================== */
:root {
    --link-color: #38bdf8;       /* Electric sky blue - clear on black */
    --link-hover: #fbbf24;       /* Motorsport gold/amber on hover */
    --link-visited: #818cf8;     /* Soft indigo (never dark purple) */
}

/* Global base links */
a {
    color: var(--link-color);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-thickness: 1px;
    transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

a:visited {
    color: var(--link-visited);
}

a:hover, a:focus {
    color: var(--link-hover);
    text-decoration-thickness: 2px;
}

/* Header, navigation & buttons remain un-underlined */
header a,
nav a,
.brand,
.btn,
.admin-tab,
.badge,
.gallery-card a,
a.read-more {
    text-decoration: none;
}

/* Standalone & imported article body links */
.article-body a,
.full-article a,
.card p a,
.page-body a {
    color: var(--link-color) !important;
    font-weight: 600;
    text-decoration: underline !important;
    text-underline-offset: 3px;
    text-decoration-color: rgba(56, 189, 248, 0.5) !important;
}

.article-body a:hover,
.full-article a:hover,
.card p a:hover,
.page-body a:hover {
    color: var(--link-hover) !important;
    text-decoration-color: var(--link-hover) !important;
}

/* Defeat legacy Blogger inline styling (e.g. style="color: black" or style="color: #0000ee") *//* ==========================================================================
   Compact Homepage Layout & Dense Cards
   ========================================================================== */
.hero-compact {
    background: linear-gradient(180deg, #151822 0%, var(--bg-dark) 100%);
    padding: 2.25rem 0 1.75rem;
    border-bottom: 1px solid var(--border);
}
.hero-compact h1 {
    font-size: 2rem;
    margin: 0.4rem 0 0.5rem;
    line-height: 1.2;
}
.hero-compact p.lead {
    font-size: 1rem;
    color: var(--text-muted);
    max-width: 820px;
    line-height: 1.5;
}

/* 2-Column Dashboard Grid */
.home-layout {
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 1.75rem;
    align-items: start;
    margin-top: 1.75rem;
}

/* Compact Block Cards */
.card-compact {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 1rem 1.15rem;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: background 0.15s, border-color 0.15s;
}
.card-compact:hover {
    background: var(--bg-card-hover);
    border-color: #3b4254;
}
.card-compact h3 {
    font-size: 1.05rem;
    line-height: 1.3;
    margin-bottom: 0.35rem;
}
.card-compact p {
    font-size: 0.85rem;
    line-height: 1.45;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Compact 2-column subgrid for stories */
.grid-compact-stories {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0.85rem;
    margin-bottom: 1.75rem;
}

/* Single-Box News / Log Feed */
.feed-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 5px;
    overflow: hidden;
}
.feed-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid #1e2330;
    font-size: 0.88rem;
    gap: 0.75rem;
    transition: background 0.15s;
}
.feed-row:last-child {
    border-bottom: none;
}
.feed-row:hover {
    background: var(--bg-card-hover);
}
.feed-left {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}
.feed-date {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-family: monospace;
    flex-shrink: 0;
}
.feed-title {
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
}
.feed-title:hover {
    color: var(--accent-amber);
    text-decoration: none;
}

/* Compact Sidebar Galleries */
.sidebar-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 5px;
    padding: 1.15rem;
    margin-bottom: 1.25rem;
}
.sidebar-box h3 {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--accent-amber);
    margin-bottom: 0.85rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0.4rem;
}
.gallery-mini-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
}
.gallery-mini-item {
    background: #0f121a;
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 0.6rem 0.4rem;
    text-align: center;
    text-decoration: none;
    transition: background 0.15s, border-color 0.15s;
}
.gallery-mini-item:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent-red);
}
.gallery-mini-count {
    font-size: 1.1rem;
    font-weight: 800;
    color: #fff;
    display: block;
}
.gallery-mini-name {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    display: block;
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Category Pill Clouds */
.category-cloud {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.category-pill {
    background: #141722;
    border: 1px solid var(--border);
    color: #cbd5e1;
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 3px;
    text-decoration: none;
    text-transform: uppercase;
    font-weight: 600;
}
.category-pill:hover {
    background: var(--accent-red);
    color: #fff;
    border-color: var(--accent-red);
    text-decoration: none;
}

@media (max-width: 900px) {
    .home-layout {
        grid-template-columns: 1fr;
    }
}
.article-body a[style],
.article-body a span,
.article-body a font,
.full-article a[style],
.full-article a span,
.full-article a font {
    color: inherit !important;
    text-decoration: inherit !important;
}

/* Links inside tables (e.g. race results, tech reports) */
table a {
    color: var(--link-color);
    font-weight: 600;
}

table a:hover {
    color: var(--link-hover);
}

/* Breadcrumb links */
.breadcrumb a {
    color: var(--accent-amber);
    text-decoration: none;
    font-weight: 700;
}

.breadcrumb a:hover {
    color: #fff;
    text-decoration: underline;
}

/* Document & PDF download link highlights */
a[href$=".pdf"]::after {
    content: " (PDF)";
    font-size: 0.75em;
    font-weight: 700;
    vertical-align: super;
    color: var(--accent-amber);
}

