/* RILHIA BRAND IDENTITY SYSTEM v43.1
   - Fixed: Build Card metadata stacking (forced verticality).
   - Fixed: Summary text layout and truncation alignment.
   - Restored: Global link styles and search bar shaping.
*/

/* --- 1. FONT REGISTRATION --- */
@font-face {
    font-family: "Formula1";
    src: url("../fonts/Formula1 Display-Regular.woff2") format("woff2");
    font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
    font-family: "Formula1";
    src: url("../fonts/Formula1 Display-Bold Bold.woff2") format("woff2");
    font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
    font-family: "Formula1";
    src: url("../fonts/Formula1 Display-Black.woff2") format("woff2");
    font-weight: 900; font-style: normal; font-display: swap;
}
@font-face {
    font-family: "Formula1Wide";
    src: url("../fonts/Formula1 Display-Wide.woff2") format("woff2");
    font-weight: 500; font-style: normal; font-display: swap;
}

/* --- 2. THE DESIGNER PALETTE --- */
:root {
    --rilhia-carbon:       #101010;
    --rilhia-slate-ui:     #efefef;
    --rilhia-border-metal: #d1d1d1;
    --plasma-cyan:         #00EFFF;
    --plasma-purple:       #C740FF;
    --text-body:           #333333;
}

/* --- 3. GLOBAL LAYOUT --- */
body {
    font-family: "Formula1", sans-serif;
    font-weight: 400;
    background-color: #ffffff;
    color: var(--text-body);
    line-height: 1.7;
    margin: 0;
    -webkit-font-smoothing: antialiased;
}

#body { background-color: #ffffff !important; }

/* Global Link Styling */
#body a {
    color: var(--rilhia-carbon);
    text-decoration: none;
    border-bottom: 2px solid var(--plasma-purple);
    transition: border-color 0.2s ease;
}

#body a:hover {
    border-bottom-color: var(--plasma-cyan);
}

@media (min-width: 48rem) {
    #body { margin-left: 300px; }
    #body-inner {
        max-width: 95% !important;
        width: 95% !important;
        padding: 2rem 5% 4rem 5% !important;
    }
}

/* --- 4. BREADCRUMBS & HEADERS --- */
#breadcrumbs {
    display: block !important;
    text-align: left !important;
    margin: 0 0 2rem 0 !important;
    font-size: 0.8rem !important;
    text-transform: uppercase;
    letter-spacing: 2px;
}

#body-inner > h1:first-of-type { display: none !important; }

h1 {
    font-family: "Formula1", sans-serif !important;
    font-weight: 700 !important;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    font-size: 2.8rem;
    color: var(--rilhia-carbon);
    border-bottom: 3px solid var(--rilhia-carbon);
    padding-bottom: 12px;
    margin-bottom: 35px;
    line-height: 1.1;
}

h2 {
    font-family: "Formula1", sans-serif !important;
    font-weight: 400;
    font-size: 1.4rem;
    text-transform: uppercase;
    color: #555;
    margin-top: 0;
    letter-spacing: 1px;
}

p, li { font-family: "Formula1", sans-serif; font-weight: 400; font-size: 1.05rem; }
b, strong { font-weight: 700; }

/* --- 5. SIDEBAR SHELL --- */
#sidebar {
    background-color: var(--rilhia-slate-ui) !important;
    background-image: none !important;
    border-right: 1px solid var(--rilhia-border-metal);
}

#header {
    background: var(--rilhia-carbon);
    color: #fff;
    text-align: center;
    padding: 1rem;
}

#header-wrapper, #sidebar .search-wrapper, #sidebar .search-wrapper form {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

#header-wrapper {
    padding: 3rem 1.5rem;
    border-bottom: 1px solid var(--rilhia-border-metal);
}

#header-wrapper a#logo img {
    border: none !important;
    background: transparent !important;
    filter: drop-shadow(0 5px 15px rgba(0,0,0,0.1));
}

#built-with { display: none !important; }

/* --- 6. RILHIA NAV TREE --- */
#sidebar-tree {
    padding: 1rem 1rem 2rem 1rem;
    overflow-y: auto;
}

.rilhia-nav, .rilhia-nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.rilhia-nav .nav-row {
    display: flex;
    align-items: center;
    background: var(--rilhia-border-metal) !important;
    margin-left: -1rem;
    margin-right: -1rem;
    padding-left: 1rem;
    border-style: solid;
    border-width: 1px 1px 1px 5px;
    border-color: #ffffff #999 #999 #ffffff;
    margin-bottom: 2px;
    transition: background 0.2s ease;
}

.rilhia-nav .nav-row:hover { background: rgba(255, 255, 255, 0.55) !important; }

.rilhia-nav .nav-link {
    flex: 1;
    display: block;
    padding: 0.45rem 0.5rem 0.45rem 0.75rem;
    color: #666 !important;
    text-decoration: none !important;
    font-size: 0.88rem;
    letter-spacing: 0.5px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.rilhia-nav .nav-item.has-children > .nav-row .nav-link { font-weight: 700; color: #444 !important; text-transform: uppercase; }
.rilhia-nav .nav-item.is-active > .nav-row { border-left-color: var(--plasma-cyan) !important; }
.rilhia-nav .nav-item.is-active > .nav-row .nav-link { color: var(--rilhia-carbon) !important; font-weight: 700; }

.rilhia-nav .nav-toggle {
    background: none;
    border: 1px solid var(--rilhia-border-metal);
    border-radius: 3px;
    cursor: pointer;
    width: 22px; height: 22px;
    margin-right: 6px;
    color: #888 !important;
}

.rilhia-nav .nav-item > .rilhia-nav {
    padding-left: 0.75rem;
    border-left: 2px solid var(--rilhia-border-metal);
    margin-left: 0.75rem;
}

/* --- 7. SEARCH SYSTEM --- */
.rilhia-search-sidebar { padding: 0.5rem 0rem; border-bottom: 1px solid var(--plasma-cyan); }
.rilhia-search-row { display: flex; width: 100%; align-items: stretch; }
.rilhia-search-input {
    flex: 1;
    min-width: 0;
    background: #fff !important;
    border: 1px solid var(--rilhia-border-metal) !important;
    border-right: none !important;
    font-family: "Formula1", sans-serif;
    font-size: 0.82rem;
    padding: 0 10px;
    border-radius: 4px 0 0 4px;
    color: var(--rilhia-carbon) !important;
    outline: none;
    margin-bottom: 0rem !important;
}
.rilhia-search-btn {
    flex-shrink: 0;
    background: var(--rilhia-carbon);
    color: #fff;
    border: 1px solid var(--plasma-cyan);
    border-radius: 3px;
    padding: 0 12px;
    cursor: pointer;
    font-family: "Formula1", sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-left: 0.25rem;
    display: flex;
    align-items: center;
    transition: background 0.2s ease;
}
.rilhia-search-btn:hover { background: var(--plasma-purple); }

/* --- 8. ARTICLE LANDING & CARDS --- */
.articles-landing { max-width: 1000px; margin: 0 auto; }
.intro-text { font-size: 1.2rem; color: #444; margin-bottom: 3rem; }

.article-preview {
    background: #ffffff;
    border: 1px solid #e0e0e0;
    border-radius: 12px;
    padding: 30px;
    margin-bottom: 40px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    transition: box-shadow 0.3s ease, transform 0.2s ease;
}

.article-preview:hover {
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

.article-content-wrapper { display: flex; gap: 30px; align-items: flex-start; }
.article-image-wrapper { flex: 0 0 280px; }
.article-thumbnail { width: 100%; height: auto; border-radius: 8px; display: block; object-fit: cover; }
.article-text { flex: 1; }

.article-date { 
    display: block; 
    color: #888; 
    font-size: 0.85rem; 
    text-transform: uppercase; 
    letter-spacing: 1.2px; 
    margin-bottom: 12px; 
}

.article-title { margin: 0 0 15px 0; font-size: 1.75rem; line-height: 1.2; }
.article-title a { text-decoration: none; color: var(--rilhia-carbon); border: none !important; }
.article-title a:hover { color: var(--plasma-purple); border-bottom: none !important; }

/* Enhanced Summary Text for Article & Build Cards */
.article-summary { 
    font-size: 0.95rem;
    line-height: 1.6;
    color: #555; 
    margin-bottom: 20px; 
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
}

.read-more-link {
    font-weight: 700;
    text-decoration: none;
    color: var(--rilhia-carbon) !important;
    border-bottom: 2px solid var(--plasma-purple) !important;
}
.read-more-link:hover { border-bottom-color: var(--plasma-cyan) !important; }

/* --- 8b. BUILD CARD METADATA (Vertical Stacking Fix) --- */
.build-meta-stack,
.build-meta-badges,
.build-badges {
    display: flex !important;
    flex-direction: column !important; /* Absolute vertical stacking */
    align-items: flex-start !important;
    gap: 10px !important;
    margin: 15px 0 !important;
    width: 100%;
}

.meta-label,
.build-badge,
.badge {
    display: flex !important; /* Allow bullet alignment */
    width: auto;
    font-family: "Formula1", sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #666;
    align-items: center;
    line-height: 1.2;
    padding: 2px 0;
}

/* F1-style accent bullet for technical notes */
.meta-label::before,
.build-badge::before,
.badge::before {
    content: "";
    display: inline-block;
    width: 6px;
    height: 6px;
    background-color: var(--plasma-cyan);
    margin-right: 12px;
    border-radius: 1px; /* Sharp technical look */
    transform: rotate(45deg);
    flex-shrink: 0;
}

/* Individual Badge Color Accents */
.badge-live::before, .cyan::before { background-color: var(--plasma-cyan); }
.badge-video::before, .purple::before { background-color: var(--plasma-purple); }

/* --- 9. MEDIA & VIDEO SECTION --- */
.media-section { margin-bottom: 4rem; }
.section-title {
    font-size: 2rem;
    margin-bottom: 2.5rem;
    text-transform: uppercase;
    border-bottom: 2px solid var(--rilhia-slate-ui);
    padding-bottom: 10px;
}

.media-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 2.5rem;
}

.media-card a { text-decoration: none; color: inherit; border: none !important; }

.media-card h4 {
    font-size: 1rem;
    margin-bottom: 15px;
    font-weight: 500;
    line-height: 1.4;
    color: #444;
    min-height: 4.2em; 
    display: flex;
    align-items: flex-end;
}

.media-card img {
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    transition: transform 0.2s ease;
}

.media-card a:hover img { transform: translateY(-5px); box-shadow: 0 10px 25px rgba(0,0,0,0.2); }

/* Individual Video Page Layout */
.video-container-large {
    width: 100% !important;
    max-width: 1200px !important;
    margin: 2rem auto !important;
}

.video-border-frame {
    position: relative;
    padding-bottom: 56.25%;
    background: #000;
    border: 5px solid var(--rilhia-carbon);
    border-radius: 8px;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
    overflow: hidden;
}

.video-border-frame iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100% !important; height: 100% !important;
}

/* --- 10. CODE BLOCKS --- */
pre code {
    display: block !important;
    background: transparent !important;
    padding: 0 !important;
    color: inherit;
    white-space: pre;
}

pre {
    background: #2d2d2d !important;
    color: #ccc !important;
    padding: 1.5rem !important;
    border-radius: 6px;
    overflow-x: auto;
    line-height: 1.6 !important;
}

/* --- 11. RESPONSIVENESS --- */
@media (max-width: 768px) {
    #body { margin-left: 0; }
    .article-content-wrapper { flex-direction: column; gap: 20px; }
    .article-image-wrapper { flex: none; width: 100%; }
    .media-card h4 { min-height: auto; }
}

/* Build Action Buttons */
.build-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
}

.btn {
    padding: 12px 24px;
    font-family: "Formula1", sans-serif;
    font-weight: 700;
    text-transform: uppercase;
    text-decoration: none !important;
    border-radius: 4px;
    font-size: 0.9rem;
    letter-spacing: 1px;
    transition: all 0.2s ease;
    border: none !important;
}

.btn-plasma-cyan {
    background: var(--plasma-cyan);
    color: var(--rilhia-carbon) !important;
}

.btn-plasma-cyan:hover {
    background: var(--plasma-purple);
    color: #fff !important;
}

.btn-github {
    background: var(--rilhia-carbon);
    color: #fff !important;
    border: 1px solid var(--rilhia-border-metal) !important;
}

.btn-github:hover {
    background: #333;
}

.build-videos {
    margin-top: 4rem;
}

.build-videos h2 {
    margin-bottom: 2rem;
}
