/* SEN visual identity: glass containers, fonts, cards, header.
   Loaded site-wide from default.hbs (replaces the former Ghost Admin header code injection). */

/* =========================================
   1. GLOBAL VARIABLES & THEME
   ========================================= */
/* self-hosted Google font (relative to assets/css/) */
@font-face {
    font-display: swap;
    font-family: 'Jost';
    font-style: normal;
    font-weight: 700;
    src: url('../fonts/jost-v20-latin_latin-ext-700.woff2') format('woff2');
}

:root {
    --font-sans: 'Inter', sans-serif;
    --font-title: 'Jost', sans-serif;
    --sen-bg-dark: #0a0a0a;
    --sen-bg-card: #161616;
    --sen-accent: #00bcd4;
    --sen-tab-blue: #3b88ff;

    /* The "Haiku Glass" Standard */
    --sen-glass-bg: rgba(10, 10, 10, 0.4);
    --sen-glass-blur: blur(8px);
    --sen-glass-border: 1px solid rgba(255, 255, 255, 0.08);
}

h1, h2, h3, .m-hero-title, .m-section-title {
    font-family: var(--font-title) !important;
    font-weight: 700;
    letter-spacing: -0.02em;
}

/* Subtle lift for the Hero text to better set off text from backgrounds */
.m-hero-title,
.m-hero-description {
    text-shadow:
            0 2px 4px rgba(0, 0, 0, 0.2),   /* Soft drop shadow for depth */
            0 0 20px rgba(0, 0, 0, 0.1);    /* Wide glow for general contrast */

    /* Optional: very slight letter-spacing for that premium semantic look */
    letter-spacing: -0.01em;
}

/* Force global centering for any hero with content */
.m-hero .m-hero__content {
    text-align: center !important;
    margin-left: auto !important;
    margin-right: auto !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
}

/* Ensure the shadow we added applies here too */
.m-hero-title.bigger, .m-hero-description.bigger {
    text-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

/* =========================================
   2. BACKGROUND & PARTICLES
   ========================================= */
#particles-js {
    position: fixed !important;
    top: 0; left: 0; width: 100%; height: 100%;
    z-index: -100 !important;
    background-color: var(--sen-bg-dark) !important;
}

/* Make structural wrappers transparent */
.site-wrapper, .main-wrap, .l-content, .l-wrapper {
    background-color: transparent !important;
}

/* =========================================
   3. UNIVERSAL GLASS CONTAINERS
   ========================================= */
/* A. The Main Post Text */
.l-post-content {
    background-color: var(--sen-glass-bg) !important;
    backdrop-filter: var(--sen-glass-blur);
    -webkit-backdrop-filter: var(--sen-glass-blur);
    border: var(--sen-glass-border);
    border-radius: 8px;
    padding: 2rem;
    margin-bottom: 0 !important; /* Removed for tags fusion */
    border-bottom: none !important; /* Removed for tags fusion */
    border-bottom-left-radius: 0 !important;
    border-bottom-right-radius: 0 !important;
    padding-bottom: 2rem !important;
}

/* B. The Related Posts Wrapper */
.m-recommended {
    background-color: transparent !important;
    margin-top: 2rem !important;
    padding: 0 !important;
}

.m-recommended .l-wrapper {
    background-color: var(--sen-glass-bg) !important;
    backdrop-filter: var(--sen-glass-blur);
    -webkit-backdrop-filter: var(--sen-glass-blur);
    border: var(--sen-glass-border);
    border-radius: 8px;
    padding: 0 !important; /* Padding handled by slider */
    overflow: visible !important;
    margin-bottom: 42px;
}

.m-recommended-articles .m-article-card {
    padding-right: 24px;
}

.m-section-title.in-recommended {
    margin-top: 2em;
}

/* C. Subscribe & Footer */
.m-subscribe-section,
.m-footer {
    background-color: var(--sen-glass-bg) !important;
    backdrop-filter: var(--sen-glass-blur);
    -webkit-backdrop-filter: var(--sen-glass-blur);
    border-top: var(--sen-glass-border);
}

/* =========================================
   4. HERO IMAGE (FIXED)
   ========================================= */
.m-hero.in-post, .m-hero.with-picture, .m-hero__picture {
    background-color: transparent !important;
    margin-bottom: 0 !important;
    padding-bottom: 0 !important;
    background-position: center center !important;
    background-size: cover !important;
}

.m-hero.no-picture {
    background-color: var(--sen-glass-bg) !important;
    backdrop-filter: var(--sen-glass-blur);
}

.m-hero__picture img {
    width: auto !important;
    max-width: 100% !important;
    max-height: 500px !important;
    object-fit: contain !important;
    margin: 0 auto;
    display: block;
    box-shadow: none !important;
}

/* =========================================
     5. RELATED POSTS (FINAL - SYMMETRICAL ARROWS)
     ========================================= */

/* 1. The Container */
.m-recommended-slider {
    position: relative !important;
    width: 100%;
    padding: 15px 0 25px 0 !important;
    box-sizing: border-box !important;
    overflow: visible !important; /* Allows arrows to hang outside */
}

/* 2. The Slider Wrapper */
.swiper-wrapper {
    height: auto !important;
    margin: 0 !important;
}

/* 3. The Cards (Taller) */
.m-recommended-articles .m-article-card__picture {
    height: 260px !important;
    min-height: 260px !important;
    width: 100% !important;
}

.m-recommended-articles .m-article-card__picture img {
    height: 100% !important;
    width: 100% !important;
    object-fit: cover !important;
    object-position: center top !important;
}

/* 4. The Arrows (Hanging Ears) */
.m-recommended-slider .swiper-button-prev,
.m-recommended-slider .swiper-button-next {
    position: absolute !important;
    top: 50% !important;
    transform: translateY(-50%) !important;
    z-index: 900 !important;

    width: 40px !important;
    height: 40px !important;
    background: rgba(0, 0, 0, 0.6) !important;
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 50%;
    color: #fff !important;

    display: flex !important;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.m-recommended-slider .swiper-button-prev:hover,
.m-recommended-slider .swiper-button-next:hover {
    background: var(--sen-accent) !important;
    border-color: var(--sen-accent) !important;
    transform: translateY(-50%) scale(1.1) !important;
}

/* SYMMETRY FIX: pull them OUTSIDE the box */
.m-recommended-slider .swiper-button-prev {
    left: 0px !important;
}

.m-recommended-slider .swiper-button-next {
    right: -60px !important;
}

/* =========================================
   6. HAIKU CARDS (UI REFINEMENTS)
   ========================================= */

/* 1. Center the caption/info text */
.m-article-card__info {
    text-align: center !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    /* Ensure the background here is transparent to show the card's grey */
    background-color: transparent !important;
}

/* 2. Kill the opaque background on the title and metadata */
.m-article-card__title,
.m-article-card__info-wrapper,
.m-article-card__excerpt {
    background-color: transparent !important;
    background: none !important;
    margin-left: auto !important;
    margin-right: auto !important;
    width: 100% !important;
}

/* 3. Typography fix for the title */
.m-article-card__title {
    font-family: var(--font-mono) !important;
    font-weight: 700 !important;
    line-height: 1.3 !important;
    margin-bottom: 10px !important;
}

/* 4. Ensure the card itself has that solid grey feel */
.m-article-card {
    background-color: var(--sen-bg-card) !important; /* This is your grey */
}

/* move author image to the bottom right */
.m-article-card__author {
    /* Kill the top-left inheritance */
    top: auto !important;
    left: auto !important;

    /* Set the bottom-right anchor */
    bottom: 12px !important;
    right: 10px !important;

    /* Ensure it sits above the image but below any popups */
    position: absolute !important;
    z-index: 5;
}

/* Tabs */
.sen-tab {
    position: absolute; top: -27px; left: 10px; height: 27px; padding: 0 15px;
    background: linear-gradient(to bottom, #4a90e2, #005bb5);
    border: 1px solid #003f7f; border-bottom: 1px solid var(--sen-bg-card) !important;
    border-radius: 4px 4px 0 0; z-index: 10; cursor: grab;
    display: flex; align-items: center;
    font-family: var(--font-mono); font-size: 11px; font-weight: 700; color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.sen-tab::after {
    content: ""; position: absolute; right: 6px; width: 10px; height: 8px;
    background-image: radial-gradient(circle, rgba(255,255,255,0.3) 1px, transparent 1px);
    background-size: 3px 3px; opacity: 0.6;
}

/* Scale tabs for Related slider */
.m-recommended-articles .m-article-card { margin-top: 25px !important; }
.m-recommended-articles .sen-tab { transform: scale(0.9); transform-origin: bottom left; top: -24px; }

/* =============================================
   7. NEWSLETTER (STABLE ROW & GOLDEN ALIGNMENT)
   ============================================= */
@media only screen and (min-width: 768px) {
    .m-subscribe-section .l-wrapper {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 30px;
        text-align: left !important;
    }
    .m-subscribe-section__content { flex: 1 1 auto !important; min-width: 0; margin: 0 !important; }
    .m-subscribe-section__form { flex: 0 0 380px !important; margin: 0 !important; }
}

/* Title Alignment (Golden Spot) */
.m-subscribe-section__content h3,
.m-subscribe-section__title {
    margin: 0 !important;
    line-height: 1.1 !important;
    white-space: nowrap;
    position: relative;
    top: -28px !important;
}

@media only screen and (min-width: 48rem) {
    .m-subscribe-section__content h3,
    .m-subscribe-section__title { font-size: 1.7rem !important; }
}

.m-subscribe-section__content p {
    margin: 0 !important; margin-top: 6px !important;
    opacity: 0.7; font-size: 0.95rem !important; line-height: 1.2 !important;
}

/* Mobile Fallback */
@media (max-width: 767px) {
    .m-subscribe-section .l-wrapper { flex-direction: column !important; align-items: center !important; gap: 20px; }
    .m-subscribe-section__form { width: 100% !important; }
    .m-subscribe-section__content h3 { top: 0 !important; white-space: normal; }
}

/* =========================================
   8. TAGS (CENTERED FLOATING TAB - REFINED)
   ========================================= */

.l-post-content {
    margin-bottom: 2rem !important;
    border-bottom: var(--sen-glass-border) !important;
    border-bottom-left-radius: 8px !important;
    border-bottom-right-radius: 8px !important;
    padding-bottom: 1.5rem !important;
}

.m-tags {
    width: fit-content !important;
    min-width: 100px;
    margin: -2.4rem auto 1rem auto !important;
    display: flex !important;
    align-items: baseline !important;
    justify-content: center;
    gap: 12px;
    z-index: 20;
    position: relative;
    background-color: var(--sen-bg-card) !important;
    backdrop-filter: var(--sen-glass-blur);
    border: var(--sen-glass-border);
    border-radius: 20px;
    padding: 4px 24px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.m-tags::before {
    content: "TAGS";
    font-family: var(--font-mono);
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    color: var(--sen-accent);
    opacity: 0.9;
}

.m-tags a {
    color: var(--sen-text-main) !important;
    opacity: 0.8;
    font-size: 0.85rem;
    font-family: var(--font-mono);
    text-decoration: none;
    transition: all 0.2s ease;
}

.m-tags a:hover {
    color: var(--sen-accent) !important;
    opacity: 1;
}

.m-tags a:not(:last-child)::after {
    content: "/";
    margin-left: 10px;
    opacity: 0.2;
    color: #fff;
}

/* =========================================
   9. COMMENTS (YOUR SPACING FIX)
   ========================================= */
/* Target the Tailwind class inside comments only */
.m-comments .mb-\[8px\] {
    margin-bottom: 18px !important;
}

/* Utilities */
.m-share { position: fixed; }
.m-share__content.js-sticky { position: sticky !important; top: 100px !important; z-index: 100; }
.tag-hash-feature .m-hero__picture { background-color: #000; height: 55vh; display: flex; align-items: center; justify-content: center; }
.tag-hash-feature .m-hero__picture img { max-width: 85%; height: 100% !important; }

/* =========================================
     10. SUBMENU / POPUP CLEANUP
     ========================================= */

/* Kill the hardcoded "Tags" label in popups/submenus */
.m-submenu-title,
.m-recent-articles__title {
    display: none !important;
}

/* leave enough space for the tags strip below */
.m-recent-articles {
    margin: 0 0 70px;
}

/* Sync the popup tags to look like the rest of the site */
.m-recent-articles__item-tags {
    display: flex !important;
    gap: 8px;
    align-items: baseline;
    font-family: var(--font-mono);
    margin-top: 4px !important;
}

/* Optional: Add the slash between tags in the popup too */
.m-recent-articles__item-tags a:not(:last-child)::after {
    content: "/";
    margin-left: 8px;
    opacity: 0.3;
}

/* =========================================
     11. GRAPH VIEW (INTEGRATION)
   ========================================= */

/* Ensure the Header is the absolute King of the Z-axis */
.m-header,
header.site-header,
.js-header {
    position: fixed !important;
    top: 0 !important;
    width: 100% !important;
    z-index: 999999 !important; /* Higher than the 3D canvas */
    background-color: rgba(10, 10, 10, 0.8) !important;
    backdrop-filter: blur(10px) !important;
}

/* Force the graph container to behave like our other glass blocks */
.graph-container {
    background-color: var(--sen-glass-bg) !important;
    backdrop-filter: var(--sen-glass-blur);
    -webkit-backdrop-filter: var(--sen-glass-blur);
    border: var(--sen-glass-border);
    border-radius: 8px;
    margin: 2rem auto !important;
    margin-top: 80px !important; /* Height of your header */
    position: relative !important;
    width: 95% !important; /* Give it a little margin from screen edges */
    max-width: 1400px;
    z-index: 1 !important;
    overflow: hidden !important; /* Prevents any layout bleeding */
    display: flex;
    flex-direction: column;
}

/* The 3D Canvas itself */
[id="3d-graph"] {
    background: transparent !important;
}

/* Style the loading text to match your terminal look */
#graph-loading {
    font-family: var(--font-mono) !important;
    color: var(--sen-accent) !important;
    text-transform: uppercase;
    letter-spacing: 0.2em;
    text-shadow: 0 0 10px var(--sen-accent);
}

/* The Preview Tooltip (Match the card look) */
#graph-preview {
    background-color: var(--sen-bg-card) !important;
    border: 1px solid var(--sen-tab-blue) !important;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.8) !important;
    color: #fff !important;
}

/* =========================================
   12. CARD CLEANUP (PREVENT TAG GHOSTING)
   ========================================= */

/* 1. Fully collapse the tag container so it occupies ZERO space */
.m-article-card__tags,
.m-article-card__header {
    display: none !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    position: absolute !important; /* Move it out of the layout flow entirely */
    visibility: hidden !important;
}

/* 2. Fix the Title's vertical position */
/* This ensures the title stays in the same spot regardless of tag presence */
.m-article-card__info {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important; /* Forces title to stay centered */
    min-height: 120px; /* Adjust this to match your desired card info height */
}

/* 2. Ensure the Title has a clean stacking context */
.m-article-card__title {
    position: relative;
    z-index: 5;
    margin-top: 0 !important;
    margin-bottom: 8px !important;
    background: transparent !important;
    backdrop-filter: none !important; /* Titles don't need blur, the card does */
    -webkit-backdrop-filter: none !important;
}

/* 3. Standardize H3 globally (The "Backend" Fix) */
/* If your H3 global change was too aggressive, let's reset it for card internal parts */
.m-article-card h3 {
    margin: 0;
    padding: 0;
    background: transparent !important;
}

/* Kill any pseudo-elements that might be rendering tag text */
.m-article-card__title::before,
.m-article-card__title::after,
.m-article-card__info::before,
.m-article-card__info::after {
    content: none !important;
    display: none !important;
}

/* Force the title to have a solid (opaque) background relative to its own layer */
/* This 'blanks out' anything sitting directly behind the text pixels */
.m-article-card__title {
    background-color: var(--sen-bg-card) !important;
    box-shadow: 0 0 10px 10px var(--sen-bg-card); /* Bloats the background to cover artifacts */
    z-index: 10 !important;
}

/* =========================================
   13. THE GLASS HEADER (FINAL SYNC)
   ========================================= */

.m-header,
header.site-header {
    /* Kill theme default solid colors */
    background-color: var(--sen-glass-bg) !important;
    background: var(--sen-glass-bg) !important;

    /* Apply our Glass standard */
    backdrop-filter: var(--sen-glass-blur) !important;
    -webkit-backdrop-filter: var(--sen-glass-blur) !important;
    border-bottom: var(--sen-glass-border) !important;

    /* Ensure it spans full width and sits on top */
    position: fixed !important;
    top: 0;
    width: 100%;
    z-index: 1000 !important;
    transition: background-color 0.3s ease;
}

/* Handle the "Scroll" state */
/* If your theme adds a class like .successive or .is-sticky when scrolling */
.m-header.successive,
.m-header.is-sticky {
    background-color: rgba(10, 10, 10, 0.8) !important; /* Slightly darker when scrolling for readability */
}

/* Ensure the navigation links remain readable */
.m-header a,
.m-menu li a {
    color: var(--sen-text-main) !important;
    text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* =========================================
   14. ONSEN DISCUSSION BLOCK (partials/onsen-discussion.hbs)
   ========================================= */
.onsen-section {
    padding: 40px 0;
    text-align: center;
    background-color: var(--sen-glass-bg) !important;
    backdrop-filter: var(--sen-glass-blur);
    -webkit-backdrop-filter: var(--sen-glass-blur);
    border-top: var(--sen-glass-border);
}

.onsen-card {
    max-width: 600px;
    margin: 0 auto;
    padding: 32px;
    border-radius: 12px;
    border: 1px solid #e0f2f2;
}

.onsen-icon {
    font-size: 2.5rem;
    display: block;
    margin-bottom: 10px;
}

.onsen-card h3 {
    margin: 0 0 10px 0;
    font-size: 1.5rem;
}

.onsen-card p {
    margin-bottom: 24px;
    opacity: 0.8;
}

.onsen-button {
    display: inline-block;
    padding: 14px 28px;
    background-color: #2c3e50; /* SEN navy */
    color: #ffffff !important;
    border-radius: 50px;
    text-decoration: none !important;
    font-weight: 600;
    transition: transform 0.2s ease, background-color 0.2s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.onsen-button:hover {
    transform: translateY(-2px);
    background-color: #b2d8d8; /* Onsen accent color */
    color: #2c3e50 !important;
}
