/* =========================================
   1. VARIABLES & THEME ENGINE
   ========================================= */
:root {
    /* --- Globale Farver --- */
    --blue: #0089c7;
    --orange: #ff7a18;
    --light-orange: #fff2df;
    
    /* Typografi */
    --font-serif: 'Georgia', 'Times New Roman', serif;
    --font-sans: system-ui, -apple-system, sans-serif;
    
    /* Layout */
    --maxWidth: 1600px;
    --gap: 3rem;
    --gradient-border: linear-gradient(90deg, var(--orange), var(--blue), #9c27b0, var(--orange));

    /* --- LIGHT MODE DEFAULTS --- */
    --bg-body: #ffffff;
    --bg-header: rgba(255, 255, 255, 0.95);
    --bg-footer: #f4f4f4;
    
    --text-main: #333333;
    --text-muted: #666666;
    --link-color: #0089c7;
    
    --card-bg: #f8f9fa;
    --card-border: #e1e1e1;
    
    --sidebar-bg: #f0f0f0;
    --sidebar-border: #ddd;
    
    --heading-color: #111111;
    --logo-color: #333333;
    
    --bg-gradient: none;
}

/* --- DARK MODE (System Preference) --- */
@media (prefers-color-scheme: dark) {
    :root {
        --bg-body: #191919;
        --bg-header: rgba(25, 25, 25, 0.95);
        --bg-footer: #0b0b0b;
        
        --text-main: #e0e0e0;
        --text-muted: #999999;
        --link-color: #5bbce6;

        --card-bg: #222222;
        --card-border: rgba(255, 255, 255, 0.08);
        
        --sidebar-bg: #111111;
        --sidebar-border: #333333;

        --heading-color: #ffffff;
        --logo-color: #ffffff;

        --bg-gradient: linear-gradient(180deg, #321a2d 0%, var(--bg-body) 600px);
    }
}

/* --- TVUNGET DARK MODE (Toggle) --- */
[data-theme="dark"] {
    --bg-body: #191919;
    --bg-header: rgba(25, 25, 25, 0.95);
    --bg-footer: #0b0b0b;
    --text-main: #e0e0e0;
    --text-muted: #999999;
    --link-color: #5bbce6;
    --card-bg: #222222;
    --card-border: rgba(255, 255, 255, 0.08);
    --sidebar-bg: #111111;
    --sidebar-border: #333333;
    --heading-color: #ffffff;
    --logo-color: #ffffff;
    --bg-gradient: linear-gradient(180deg, #321a2d 0%, var(--bg-body) 600px);
}

/* --- TVUNGET LIGHT MODE (Toggle) --- */
[data-theme="light"] {
    --bg-body: #ffffff;
    --bg-header: rgba(255, 255, 255, 0.95);
    --bg-footer: #f4f4f4;
    --text-main: #333333;
    --text-muted: #666666;
    --link-color: #0089c7;
    --card-bg: #f8f9fa;
    --card-border: #e1e1e1;
    --sidebar-bg: #f0f0f0;
    --sidebar-border: #ddd;
    --heading-color: #111111;
    --logo-color: #333333;
    --bg-gradient: none;
}

/* =========================================
   2. BASE & RESET
   ========================================= */
* { box-sizing: border-box; }

html {
    scrollbar-color: #666 var(--bg-body);
    color: var(--text-main);
    background-color: var(--bg-body);
    background-image: var(--bg-gradient);
    background-repeat: no-repeat;
    background-attachment: fixed;
    min-height: 100vh;
    transition: background-color 0.3s ease, color 0.3s ease;
    overflow-x: hidden;
}

body { margin: 0; font-family: var(--font-sans); line-height: 1.6; }
a { color: var(--link-color); text-decoration: none; transition: 0.2s; }
a:hover { color: var(--orange); }
h1, h2, h3, h4 { font-family: var(--font-serif); color: var(--heading-color); font-weight: 700; margin-top: 2rem; margin-bottom: 1rem; }

/* CORE WEB VITALS: CLS FIX */
img {
    max-width: 100%;
    height: auto;
    display: block;
}

/* =========================================
   3. HEADER
   ========================================= */
.site-header {
    background-color: var(--bg-header);
    border-bottom: 1px solid var(--card-border);
    height: 80px; display: flex; align-items: center; position: relative; z-index: 100; backdrop-filter: blur(10px);
}
.header-inner { max-width: var(--maxWidth); width: 100%; margin: 0 auto; padding: 0 1.5rem; display: flex; justify-content: space-between; align-items: center; }

.logo-text { font-family: var(--font-serif); font-weight: 900; font-size: 1.5rem; color: var(--logo-color); text-transform: uppercase; letter-spacing: 1px; display: flex; align-items: center; gap: 10px; }
.logo-text .star { color: var(--orange); font-size: 1.2em; }

.main-nav { display: flex; gap: 2rem; }
.main-nav a { color: var(--text-muted); font-weight: 700; font-size: 1.1rem; }
.main-nav a:hover { color: var(--orange); }

/* YouTube Link i Header */
.nav-yt-link { display: flex; align-items: center; gap: 5px; }
.yt-icon { color: #ff0000; font-size: 1.2em; transition: transform 0.2s; }
.nav-yt-link:hover .yt-icon { transform: scale(1.2); }

.header-search button { background: none; border: none; color: var(--text-main); cursor: pointer; }
.mobile-menu-toggle { display: none; color: var(--text-main); font-size: 1.5rem; }

/* Theme Toggle */
.theme-btn { background: none; border: none; cursor: pointer; color: var(--text-main); padding: 0; margin-left: 1rem; display: flex; align-items: center; }
.theme-btn:hover { color: var(--orange); }
[data-theme="dark"] .moon-icon { display: none; } [data-theme="dark"] .sun-icon { display: block; }
[data-theme="light"] .sun-icon { display: none; } [data-theme="light"] .moon-icon { display: block; }

/* =========================================
   4. LAYOUT GRID
   ========================================= */
.articles-and-sidebar {
    max-width: var(--maxWidth); margin: 0 auto; padding: 0 1.5rem;
    display: grid; grid-template-columns: 1fr 320px; gap: var(--gap);
    margin-top: 4rem; margin-bottom: 8rem;
}

/* Intro Section */
.intro { margin-bottom: 3rem; padding-bottom: 1rem; border-bottom: none; }
.intro h2 { font-size: 3rem; margin: 0; line-height: 1; text-transform: uppercase; text-shadow: 0 3px 3px rgba(0, 0, 0, .5); }

/* =========================================
   5. SIDEBAR COMPONENTS
   ========================================= */
.sidebar-title { margin-bottom: 1rem; display: block; height: 45px; }
.sidebar-title svg text { font-family: var(--font-sans); }

.sidebar-module { background: var(--sidebar-bg); border: 1px solid var(--sidebar-border); padding: 1.5rem; margin-bottom: 2rem; border-radius: 8px; }
.sidebar-module h3 { font-size: 1rem; margin-top: 0; color: var(--orange); }
.sidebar-module ul { list-style: none; padding: 0; }
.sidebar-module li { border-bottom: 1px solid var(--sidebar-border); padding: 0.5rem 0; }

/* Mini Cards */
.article-card { background: var(--card-bg); border-radius: 8px; padding: 1.5rem; position: relative; border: 1px solid var(--card-border); margin-bottom: 2rem; display: flex; flex-direction: column; box-shadow: 0 4px 6px rgba(0,0,0,0.1); }
.article-card h2 { font-size: 1.2rem; margin: 0 0 0.5rem 0; }
.article-card p { font-size: 0.95rem; margin: 0 0 1rem 0; color: var(--text-muted); }

/* Sidebar Share Buttons */
.sidebar-share-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sidebar-share-btn { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px; background: var(--card-bg); border: 1px solid var(--card-border); color: var(--text-muted); border-radius: 4px; font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: all 0.2s; font-family: var(--font-sans); line-height: 1; }
.sidebar-share-btn:hover { border-color: var(--orange); color: var(--orange); background: var(--bg-body); }
.yt-btn { width: 100%; margin-top: 10px; text-decoration: none; }
.yt-btn:hover { border-color: #ff0000; color: #ff0000; background: #fff0f0; }
[data-theme="dark"] .yt-btn:hover { background: rgba(255, 0, 0, 0.1); }

/* Buy Me A Coffee Widget */
.bmc-widget { display: flex; align-items: center; background: var(--card-bg); border: 2px solid var(--orange); padding: 1rem; border-radius: 12px; text-decoration: none; transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1); margin-bottom: 2rem; position: relative; overflow: hidden; }
.bmc-icon { font-size: 2rem; color: var(--orange); margin-right: 15px; transition: transform 0.3s; }
.bmc-content h3 { margin: 0; font-size: 1rem; color: var(--heading-color); line-height: 1.2; }
.bmc-content p { margin: 5px 0 0 0; font-size: 0.85rem; color: var(--text-muted); line-height: 1.2; }
.bmc-widget:hover { background: var(--orange); transform: translateY(-5px); box-shadow: 0 10px 20px rgba(255, 122, 24, 0.3); }
.bmc-widget:hover .bmc-icon { color: #fff; transform: rotate(-10deg) scale(1.1); }
.bmc-widget:hover h3, .bmc-widget:hover p { color: #fff; }
.bmc-widget:hover::after { content: "♨"; position: absolute; left: 28px; top: 5px; font-size: 1.5rem; color: rgba(255,255,255,0.6); animation: steam 1s infinite ease-out; }
@keyframes steam { 0% { transform: translateY(0) scale(1); opacity: 0; } 50% { opacity: 1; } 100% { transform: translateY(-10px) scale(1.5); opacity: 0; } }

/* =========================================
   6. LATEST ARTICLES (Layered Card)
   ========================================= */
.latest-articles-list { display: flex; flex-direction: column; gap: 6rem; margin-top: 3rem; }

.layered-card {
    position: relative; width: 100%; max-width: 900px; min-height: 400px; margin: 0 auto; 
    background-color: color-mix(in srgb, var(--card-bg), white 8%);
    border: 1px solid var(--card-border);
    box-shadow: 0 15px 35px rgba(0,0,0,0.2); border-radius: 5px;
    overflow: visible; /* Tillad "flyvende" elementer */
}

/* Thumbnail (Flyvende) */
.layered-card .thumbnail {
    float: left; position: relative; left: -30px; top: -30px; 
    height: 400px; width: 45%; background: #000;
    box-shadow: 5px 5px 20px rgba(0,0,0,0.4);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: block; z-index: 10;
}
.layered-card img.left { position: absolute; left: 50%; top: 50%; height: 100%; width: 100%; object-fit: cover; transform: translate(-50%, -50%); transition: transform 0.5s; }
.layered-card .thumbnail:hover { transform: translateY(-5px); box-shadow: 0 10px 40px var(--orange); outline: 1px solid var(--orange); }
.layered-card .thumbnail:hover img.left { transform: translate(-50%, -50%) scale(1.05); }

/* Card Content */
.layered-card .right { margin-left: 45%; padding: 20px 30px 80px 10px; }
.layered-card h1 { margin-top: 0; padding-top: 10px; font-size: 1.8rem; line-height: 1.2; font-family: var(--font-serif); }
.layered-card .author { background-color: var(--sidebar-bg); height: 30px; width: fit-content; padding-right: 15px; border-radius: 20px; display: flex; align-items: center; margin-top: 10px; border: 1px solid var(--sidebar-border); }
.layered-card .author img { height: 20px; width: 20px; border-radius: 50%; margin-left: 5px; }
.layered-card .author h2 { margin: 0 0 0 10px; padding: 0; font-size: 0.7rem; color: var(--text-muted); font-family: var(--font-sans); text-transform: uppercase; }
.layered-card .separator { margin-top: 15px; border-top: 1px solid var(--sidebar-border); }
.layered-card p { text-align: justify; padding-top: 10px; font-size: 1rem; line-height: 1.6; color: var(--text-main); margin-bottom: 0; }

/* Date */
.layered-card h5 { position: absolute; left: 48%; bottom: -15px; font-size: 6rem; color: var(--text-muted); margin: 0; font-family: var(--font-sans); opacity: 0.1; line-height: 1; pointer-events: none; }
.layered-card h6 { position: absolute; left: 49%; bottom: 25px; font-size: 1.2rem; color: var(--orange); margin: 0; font-family: var(--font-sans); letter-spacing: 2px; font-weight: bold; }

/* Card Actions */
.card-actions { position: absolute; bottom: 20px; right: 140px; display: flex; gap: 10px; }
.card-share-btn { background: var(--bg-body); border: 1px solid var(--card-border); color: var(--text-muted); padding: 8px 12px; border-radius: 20px; cursor: pointer; font-size: 0.85rem; display: flex; align-items: center; gap: 6px; transition: all 0.2s; }
.card-share-btn:hover { border-color: var(--orange); color: var(--orange); background: var(--sidebar-bg); }

/* FAB */
.layered-card .fab { position: absolute; right: 30px; bottom: 20px; background-color: var(--orange); width: 60px; height: 60px; color: white; border-radius: 50%; box-shadow: 0 5px 15px rgba(0,0,0,0.2); display: flex; align-items: center; justify-content: center; transition: transform 0.2s, background 0.2s; }
.layered-card .fab:hover { background-color: var(--blue); transform: scale(1.1); }
.layered-card .fab i { font-size: 1.5em; color: #fff; }

/* =========================================
   7. SINGLE ARTICLE COMPONENTS
   ========================================= */
.article-box { background-color: var(--card-bg); color: var(--text-main); border-radius: 12px; padding: 3rem 4rem; border: 1px solid var(--card-border); margin-bottom: 2rem; }
.article-header h1 { font-size: 3rem; line-height: 1.1; margin-bottom: 0.5rem; }
.article-meta { margin-bottom: 2rem; padding-bottom: 2rem; border-bottom: 1px solid var(--card-border); color: var(--text-muted); }

/* Images */
.article-box figure { margin: 2rem -4rem; width: calc(100% + 8rem); }
.article-box figcaption { text-align: center; font-size: 0.9rem; color: var(--text-muted); padding: 0.5rem 1rem; font-style: italic; background: rgba(0,0,0,0.02); }

/* AI Takeaways */
.ai-takeaways { background-color: var(--sidebar-bg); border: 1px solid var(--orange); border-left-width: 5px; padding: 1.5rem; margin-bottom: 2rem; border-radius: 4px; }
.ai-takeaways h3 { margin-top: 0; color: var(--orange); font-size: 1.2rem; display: flex; align-items: center; gap: 10px; }

/* FAQ Fold-ud (Details/Summary) */
.faq-item { background: var(--bg-body); border: 1px solid var(--card-border); border-radius: 6px; margin-bottom: 1rem; transition: all 0.2s; }
.faq-item[open] { border-color: var(--orange); box-shadow: 0 4px 10px rgba(0,0,0,0.05); }
.faq-item summary { padding: 1.2rem; font-weight: 700; cursor: pointer; list-style: none; position: relative; padding-right: 3rem; font-family: var(--font-sans); color: var(--heading-color); }
.faq-item summary::after { content: '+'; position: absolute; right: 1.2rem; top: 50%; transform: translateY(-50%); font-size: 1.5rem; color: var(--orange); }
.faq-item[open] summary::after { content: '-'; }
.faq-item div[itemprop="text"], .faq-item div[itemprop="acceptedAnswer"] { padding: 0 1.2rem 1.2rem 1.2rem; color: var(--text-main); line-height: 1.6; border-top: 1px solid var(--card-border); }
.faq-item summary::-webkit-details-marker { display: none; }

/* Video 16:9 */
.video-wrapper { position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; border-radius: 8px; margin-bottom: 2rem; box-shadow: 0 10px 30px rgba(0,0,0,0.2); background: #000; aspect-ratio: 16 / 9; }
.video-wrapper iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0; }

/* Share & Toast */
.share-section { margin-top: 3rem; padding-top: 2rem; border-top: 1px solid var(--card-border); }
.share-section h3 { font-size: 1rem; text-transform: uppercase; color: var(--text-muted); margin: 0 0 1rem 0; }
.share-actions { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; }
.action-btn { display: inline-flex; align-items: center; gap: 8px; padding: 10px 16px; background-color: var(--bg-body); border: 1px solid var(--card-border); color: var(--text-main); border-radius: 30px; font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: all 0.2s; font-family: var(--font-sans); }
.action-btn:hover { border-color: var(--orange); color: var(--orange); transform: translateY(-2px); }
.social-icon-link { color: var(--text-muted); font-size: 1.2rem; padding: 10px; transition: color 0.2s; }
.social-icon-link:hover { color: var(--orange); }
#native-share-btn { display: none; background-color: var(--text-main); color: var(--bg-body); border-color: transparent; }
#toast-notification { visibility: hidden; min-width: 250px; background-color: #333; color: #fff; text-align: center; border-radius: 4px; padding: 16px; position: fixed; z-index: 1000; left: 50%; bottom: 30px; transform: translateX(-50%); font-size: 0.9rem; box-shadow: 0 4px 12px rgba(0,0,0,0.3); opacity: 0; transition: opacity 0.3s, bottom 0.3s; }
#toast-notification.show { visibility: visible; opacity: 1; bottom: 50px; }

/* Footer Meta (Byline) */
.article-footer-meta { margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--card-border); font-size: 0.9rem; color: var(--text-muted); display: flex; justify-content: space-between; align-items: center; }

/* Misc Typography */
pre { background: #000; padding: 1.5rem; border-radius: 6px; border-left: 4px solid var(--orange); overflow-x: auto; color: #a5b3ce; margin-bottom: 2rem; }
blockquote { border-left: 4px solid var(--orange); margin: 2rem 0; padding-left: 1.5rem; font-style: italic; font-size: 1.25rem; color: var(--text-muted); }

/* HTML Sitemap List */
.sitemap-list { column-count: 2; gap: 3rem; }
.sitemap-list li { margin-bottom: 0.5rem; break-inside: avoid; }

/* =========================================
   8. ABOUT PAGE STYLES
   ========================================= */
.about-profile { display: flex; gap: 2rem; align-items: center; background: var(--sidebar-bg); padding: 2rem; border-radius: 8px; border: 1px solid var(--sidebar-border); margin: 2rem 0; }
.about-profile img { width: 150px; height: 150px; border-radius: 50%; object-fit: cover; border: 4px solid var(--card-bg); box-shadow: 0 4px 10px rgba(0,0,0,0.1); }
.about-bio h2 { margin-top: 0; font-size: 1.5rem; }
.social-mini-links { display: flex; gap: 10px; margin-top: 10px; }
.social-mini-links a { color: var(--text-main); font-size: 1.2rem; transition: 0.2s; }
.social-mini-links a:hover { color: var(--orange); }
.tech-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.5rem; margin-top: 2rem; }
.tech-item { border: 1px solid var(--card-border); padding: 1.5rem; border-radius: 6px; text-align: center; background: var(--bg-body); }
.tech-item i { font-size: 2rem; color: var(--orange); margin-bottom: 1rem; display:block; }

/* =========================================
   9. FOOTER & RESPONSIVE
   ========================================= */
.site-footer { background-color: var(--bg-footer); color: var(--text-muted); padding-top: 4rem; padding-bottom: 2rem; position: relative; border-top: none; }
.site-footer::before { content: ""; position: absolute; top: 0; left: 0; width: 100%; height: 6px; background: var(--gradient-border); }
.inner { max-width: var(--maxWidth); margin: 0 auto; padding: 0 1.5rem; }
.footer-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3rem; margin-bottom: 3rem; }
.footer-logo { font-family: var(--font-serif); font-weight: 900; font-size: 1.5rem; color: var(--heading-color); margin-bottom: 1rem; }
.footer-col h4 { color: var(--heading-color); font-size: 1.1rem; text-transform: uppercase; margin-bottom: 1.5rem; border-bottom: 2px solid #333; padding-bottom: 0.5rem; display: inline-block; }
[data-theme="light"] .footer-col h4 { border-bottom-color: #ddd; }
.footer-col ul { list-style: none; padding: 0; }
.footer-col a { color: var(--text-muted); }
.footer-bottom { border-top: 1px solid var(--card-border); padding-top: 2rem; text-align: center; font-size: 0.9rem; }
.social-links { display: flex; gap: 1rem; margin-top: 1rem; }

/* --- MOBILE RESPONSIVE OVERRIDES --- */
@media (max-width: 900px) {
    /* Header & Nav */
    .main-nav { display: none; } 
    .mobile-menu-toggle { display: block; }
    
    /* Font Sizes */
    .intro h2, .article-header h1 { font-size: 2rem; line-height: 1.2; word-wrap: break-word; }

    /* Layout & Sidebar */
    .articles-and-sidebar { display: block; padding: 0 1rem; }
    .sidebar { margin-top: 4rem; width: 100%; padding-left: 0; border-left: none; }
    .sidebar-inner { position: static; width: 100%; }

    /* Cards */
    .latest-articles-list { gap: 4rem; }
    .layered-card { display: flex; flex-direction: column; height: auto; padding-bottom: 80px; }
    .layered-card .thumbnail { float: none; width: 100%; height: 250px; left: 0; top: 0; box-shadow: none; }
    .layered-card .right { margin-left: 0; padding: 20px; }
    .layered-card h5 { left: 20px; bottom: 10px; font-size: 4rem; }
    .layered-card h6 { left: 25px; bottom: 25px; font-size: 1rem; }
    .card-actions { right: auto; left: 140px; bottom: 25px; }
    .layered-card .fab { width: 60px; height: 60px; bottom: -30px; right: 20px; }

    /* Single Article */
    .article-box { padding: 2rem; }
    .article-box figure { margin: 2rem -2rem; width: calc(100% + 4rem); border-radius: 0; }
    
    /* Footer */
    .footer-grid { grid-template-columns: 1fr 1fr; }
    
    /* About */
    .about-profile { flex-direction: column; text-align: center; }
    .sitemap-list { column-count: 1; }
}

@media (max-width: 600px) { 
    .footer-grid { grid-template-columns: 1fr; } 
}