/*
Theme Name: Marko Rillo
Theme URI: https://markorillo.com
Author: Marko Rillo, with Gemini 3.1 Pro
Description: Bilingual Full Site Editing framework configured for deep experiential workshop environments and custom analytical instruments.
Version: 1.0.1
Text Domain: rillo
Tags: block-theme, full-site-editing
*/

/* ==========================================================================
   TABLE OF CONTENTS
   0. Root variables - PhPStorm silencer for CSS type errors
   1. Global Utilities (README §4)
   2. Universal Components (README §5)
      2.1 Header & Navigation (Desktop)
      2.2 Header & Navigation (Mobile Overrides)
      2.3 Language Toggle
   3. Container Patterns (README §6)
   4. WordPress FSE Overrides
   ========================================================================== */

/* ==========================================================================
   0. IDE VARIABLE STUB (Silences PhpStorm Errors)
   ========================================================================== */
:root {
    --wp--preset--font-family--mono: "IBM Plex Mono", monospace;
    --wp--preset--font-family--sans: "Inter Variable", sans;
    --wp--preset--font-family--display: "Fraunces Variable", ui-serif, serif;
    --wp--preset--color--border: #E4E1DA;
    --wp--preset--color--lsp: #C4362B;
    --wp--preset--color--strategy: inherit;
    --wp--preset--color--training: inherit;
    --wp--preset--color--card: #FFFFFF;
    --wp--preset--color--muted-foreground: #6E6A63;
    --wp--preset--color--muted: #EFEDE8;
    --wp--preset--color--foreground: #2B2A28;
    --wp--preset--color--background: #FBFAF7;
    --wp--preset--color--change: inherit;
    --wp--preset--shadow--natural: inherit;
}

/* ==========================================================================
   1. GLOBAL UTILITIES
   ========================================================================== */

.container-page {
    max-width: 1200px;
    margin-inline: auto;
    padding-inline: 1.25rem;
}
@media (min-width: 768px) {
    .container-page {
        padding-inline: 2rem;
    }
}

.prose-page {
    max-width: 720px;
}

.scrim-bottom {
    background: linear-gradient(to top, rgba(0,0,0,0.65), rgba(0,0,0,0.15) 55%, transparent 80%);
}

.font-data {
    font-family: var(--wp--preset--font-family--mono), monospace !important;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

/* ==========================================================================
   2. UNIVERSAL COMPONENTS
   ========================================================================== */

/* --------------------------------------------------------------------------
   2.1 Header & Navigation (Desktop & General)
   -------------------------------------------------------------------------- */

/* Glass Header Base */
.site-header-glass {
    position: sticky;
    top: 0;
    z-index: 100;
    border-bottom: 1px solid var(--wp--preset--color--border);
}
.site-header-glass::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background-color: rgba(251, 250, 247, 0.85);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

/* Red LSP Dot */
.brand-title a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--wp--preset--font-family--display), serif;
    font-size: 1.125rem;
    letter-spacing: -0.02em;
    text-decoration: none;
}
.brand-title a::before {
    content: "";
    display: inline-block;
    width: 0.625rem;
    height: 0.625rem;
    border-radius: 2px;
    background-color: var(--wp--preset--color--lsp);
}

/* Desktop Pill Navigation Hover States */
@media (min-width: 1024px) {
    .pill-nav .wp-block-navigation-item__content {
        padding: 0.5rem 0.75rem;
        border-radius: 999px;
        font-size: 0.875rem;
        font-weight: 500;
        color: var(--wp--preset--color--muted-foreground);
        transition: all 0.2s ease;
    }
    .pill-nav .wp-block-navigation-item__content:hover,
    .pill-nav .current-menu-item .wp-block-navigation-item__content {
        background-color: var(--wp--preset--color--muted);
        color: var(--wp--preset--color--foreground);
    }
}

/* --------------------------------------------------------------------------
   2.2 Header & Navigation (Mobile Modal Overrides)
   -------------------------------------------------------------------------- */

@media (max-width: 1023px) {
    .wp-block-navigation__responsive-container.is-menu-open {
        background-color: var(--wp--preset--color--background) !important;
    }
    .wp-block-navigation__responsive-container-content {
        align-items: flex-start !important;
        padding: 3rem 1.5rem !important;
    }
    .wp-block-navigation__responsive-container-content .wp-block-navigation__container {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 0.25rem;
    }
    .wp-block-navigation__responsive-container-content .wp-block-navigation-item {
        width: 100%;
    }
    .wp-block-navigation__responsive-container-content .wp-block-navigation-item__content {
        display: block;
        width: 100%;
        padding: 0.75rem 0.75rem;
        border-radius: 0.375rem;
        font-size: 1rem;
        font-weight: 500;
        color: var(--wp--preset--color--muted-foreground);
        text-align: left;
        transition: all 0.2s ease;
    }
    .wp-block-navigation__responsive-container-content .wp-block-navigation-item__content:hover,
    .wp-block-navigation__responsive-container-content .current-menu-item > .wp-block-navigation-item__content {
        background-color: var(--wp--preset--color--muted);
        color: var(--wp--preset--color--foreground);
    }
}

/* --------------------------------------------------------------------------
   2.3 Language Toggle
   -------------------------------------------------------------------------- */

.lang-toggle {
    display: flex;
    align-items: center;
    gap: 2px;
    border-radius: 999px;
    border: 1px solid var(--wp--preset--color--border);
    padding: 2px;
    font-size: 0.75rem;
    font-weight: 500;
}
.lang-toggle span {
    padding: 2px 8px;
    border-radius: 999px;
    cursor: pointer;
}
.lang-toggle .active {
    background-color: var(--wp--preset--color--foreground);
    color: var(--wp--preset--color--background);
}
.lang-toggle .inactive {
    color: var(--wp--preset--color--muted-foreground);
    transition: color 0.2s ease;
}
.lang-toggle .inactive:hover {
    color: var(--wp--preset--color--foreground);
}

/* ==========================================================================
   3. CONTAINER PATTERNS
   ========================================================================== */
/* (Reserved for future layout specific classes) */

/* ==========================================================================
   4. WORDPRESS FSE OVERRIDES
   ========================================================================== */
/* (Reserved for native block resets) */

/* ==========================================================================
   5. POST CARDS & BADGES (Archive & Blog UI)
   ========================================================================== */

/* The Post Card Wrapper */
.post-card {
    background-color: var(--wp--preset--color--card, #FFFFFF);
    border-radius: 1rem;
    border: 1px solid var(--wp--preset--color--border);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 100%;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    position: relative; /* REQUIRED FOR CLICKABLE CARD */
}
.post-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--wp--preset--shadow--natural);
}

/* Post Card Inner Spacing */
.post-card-content {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    gap: 1rem;
}

/* Make the title link stretch over the entire card */
.post-card-content .wp-block-post-title a::after {
    content: "";
    position: absolute;
    inset: 0; /* Stretches to the boundaries of .post-card */
    z-index: 1;
}

/* Ensure links hover colors still work */
.post-card-content .wp-block-post-title a {
    text-decoration: none;
    color: var(--wp--preset--color--foreground);
}
.post-card-content .wp-block-post-title a:hover {
    color: var(--wp--preset--color--lsp);
}

/* Force Featured Images to fill the top of the card */
.post-card .wp-block-post-featured-image {
    margin: 0;
    width: 100%;
}
.post-card .wp-block-post-featured-image img {
    width: 100%;
    aspect-ratio: 16/9;
    object-fit: cover;
}

/* Fallback Featured Image in Case Image is Missing */
.fallback-image-wrapper {
    aspect-ratio: 16/9;
    width: 100%;
    background-color: #E3F2FD; /* Soft strategy-tint */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem; /* Tighter padding */
    text-align: center;
    box-sizing: border-box; /* PREVENTS OVERFLOW */
    border-bottom: 1px solid var(--wp--preset--color--border);
}
.fallback-title {
    font-family: var(--wp--preset--font-family--sans), sans-serif;
    font-size: 0.75rem; /* Smaller, like Lovable */
    font-weight: 600; /* Less bold */
    text-transform: uppercase;
    color: var(--wp--preset--color--strategy);
    letter-spacing: 0.05em;
    line-height: 1.5;
    overflow-wrap: break-word; /* Forces long words to break gracefully */
    word-wrap: break-word;
}

/* The "BLOGI" Pill Badge */
.badge-pill {
    display: inline-flex;
    align-items: center;
    background-color: #E6E8FF; /* Light indigo background */
    color: var(--wp--preset--color--change); /* Indigo text */
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.badge-pill::before {
    content: "•";
    color: var(--wp--preset--color--change);
    margin-right: 0.35rem;
    font-size: 1.2rem;
    line-height: 1;
}

/* Override default WordPress link colors inside titles */
.post-card-content .wp-block-post-title a {
    text-decoration: none;
    color: var(--wp--preset--color--foreground);
}
.post-card-content .wp-block-post-title a:hover {
    color: var(--wp--preset--color--lsp);
}

/* Blog Post Archive Page Pagination UI (Lovable Muted Hover Style) */
.wp-block-query-pagination {
    font-family: var(--wp--preset--font-family--sans), sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    margin-top: 3rem;
}
.wp-block-query-pagination a {
    text-decoration: none;
    color: var(--wp--preset--color--muted-foreground);
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    transition: all 0.2s ease;
}
.wp-block-query-pagination a:hover {
    background-color: var(--wp--preset--color--muted);
    color: var(--wp--preset--color--foreground);
}
.wp-block-query-pagination .current {
    padding: 0.5rem 0.75rem;
    color: var(--wp--preset--color--foreground);
    font-weight: 700;
}

/* ==========================================================================
   6. UNIVERSAL FILTERS & PILLS
   ========================================================================== */

/* Filter Bar UI */
.universal-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 3rem;
    padding-top: 2rem;
    border-top: 1px solid var(--wp--preset--color--border);
}
.filter-btn {
    text-decoration: none;
    font-family: var(--wp--preset--font-family--sans), sans-serif;
    font-size: 0.875rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 999px;
    border: 1px solid var(--wp--preset--color--border);
    color: var(--wp--preset--color--muted-foreground);
    background-color: transparent;
    transition: all 0.2s ease;
    cursor: pointer;
}
.filter-btn:hover {
    border-color: var(--wp--preset--color--muted-foreground);
}
.filter-btn.active {
    background-color: var(--wp--preset--color--foreground);
    color: var(--wp--preset--color--background);
    border-color: var(--wp--preset--color--foreground);
}

/* Card Term Pill Overlay */
.card-term-pill {
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 10; /* Ensures it sits above the image and link overlay */
    background-color: var(--wp--preset--color--card);
    padding: 0.25rem 0.75rem;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
    pointer-events: none; /* Lets clicks pass through to the card link */
}
.pill-dot {
    margin-right: 0.25rem;
    font-size: 1.2em;
    line-height: 1;
}

/* Dynamic Pill Colors (Matches Lovable Specs) */
.term-strategy { color: var(--wp--preset--color--strategy); }
.term-training { color: var(--wp--preset--color--training); }
.term-lego-serious-play { color: var(--wp--preset--color--lsp); }
.term-product { color: var(--wp--preset--color--change); } /* Assumed Indigo */

/* Loading State for Real-Time Filter */
.wp-block-query.is-loading {
    opacity: 0.4;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

/* ==========================================================================
   7. SINGLE POST LAYOUT & TOC
   ========================================================================== */

/* The FSE Grid Layout for Single Posts */
.single-post-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 3rem;
    align-items: start; /* Crucial for sticky sidebar */
}
@media (min-width: 1024px) {
    .single-post-grid {
        grid-template-columns: minmax(0, 720px) 250px;
        justify-content: space-between;
    }
}

/* Sticky TOC Sidebar */
.toc-sidebar {
    position: sticky;
    top: 6rem; /* Clears your glass header */
    display: none; /* Hidden on mobile */
}
@media (min-width: 1024px) {
    .toc-sidebar {
        display: block;
    }
}
.toc-sidebar h4 {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--wp--preset--color--muted-foreground);
    margin-bottom: 1rem;
}
.toc-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    border-left: 1px solid var(--wp--preset--color--border);
}
.toc-list a {
    text-decoration: none;
    color: var(--wp--preset--color--muted-foreground);
    font-size: 0.875rem;
    padding-left: 1rem;
    display: block;
    line-height: 1.4;
    transition: all 0.2s ease;
    border-left: 2px solid transparent;
    margin-left: -1px;
}
.toc-list a:hover {
    color: var(--wp--preset--color--foreground);
}
.toc-list a.is-active {
    color: var(--wp--preset--color--strategy);
    border-left-color: var(--wp--preset--color--strategy);
    font-weight: 500;
}
.toc-level-3 {
    padding-left: 1.5rem !important;
    font-size: 0.8rem !important;
}

/* ==========================================================================
   8. RICH TEXT FORMATTING (Gutenberg Blocks)
   ========================================================================== */

.prose-page {
    font-family: var(--wp--preset--font-family--sans), sans-serif;
    color: var(--wp--preset--color--foreground);
    line-height: 1.7;
    font-size: 1.125rem;
}

/* Headings */
.prose-page h1, .prose-page h2, .prose-page h3, .prose-page h4, .prose-page h5, .prose-page h6 {
    font-family: var(--wp--preset--font-family--display), serif;
    color: var(--wp--preset--color--foreground);
    margin-top: 3rem;
    margin-bottom: 1rem;
    font-weight: 600;
    line-height: 1.2;
}

/* Links */
.prose-page p a, .prose-page li a {
    color: var(--wp--preset--color--strategy);
    text-decoration: underline;
    text-underline-offset: 3px;
}

/* Tables (Native block) */
.prose-page .wp-block-table {
    width: 100%;
    margin: 2rem 0;
    overflow-x: auto;
}
.prose-page table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: 0.875rem;
}
.prose-page th, .prose-page td {
    padding: 1rem;
    border-bottom: 1px solid var(--wp--preset--color--border);
}
.prose-page th {
    background-color: var(--wp--preset--color--muted);
    font-weight: 600;
}

/* Code Blocks & Inline Code */
.prose-page code {
    font-family: var(--wp--preset--font-family--mono), monospace;
    background-color: var(--wp--preset--color--muted);
    padding: 0.2em 0.4em;
    border-radius: 0.25rem;
    font-size: 0.85em;
}
.prose-page pre {
    background-color: var(--wp--preset--color--foreground);
    color: var(--wp--preset--color--background);
    padding: 1.5rem;
    border-radius: 0.5rem;
    overflow-x: auto;
    margin: 2rem 0;
}
.prose-page pre code {
    background-color: transparent;
    color: inherit;
    padding: 0;
}

/* Accordions (Native Details block) */
.prose-page .wp-block-details {
    background-color: var(--wp--preset--color--card);
    border: 1px solid var(--wp--preset--color--border);
    border-radius: 0.5rem;
    padding: 1rem 1.5rem;
    margin: 1.5rem 0;
}
.prose-page .wp-block-details summary {
    font-weight: 600;
    cursor: pointer;
    font-family: var(--wp--preset--font-family--sans), sans-serif;
}

/* Quotes */
.prose-page .wp-block-quote {
    border-left: 4px solid var(--wp--preset--color--lsp);
    padding-left: 1.5rem;
    margin: 2rem 0;
    font-style: italic;
    color: var(--wp--preset--color--muted-foreground);
}

/* ==========================================================================
   9. CASE STUDY SPECIFICS
   ========================================================================== */

/* The Sidebar Cards */
.case-card {
    background-color: var(--wp--preset--color--card);
    border: 1px solid var(--wp--preset--color--border);
    border-radius: 1rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.02);
}

.case-card .font-data {
    margin-bottom: 0.5rem;
}

/* The Next Case Highlight Card */
.case-card-next {
    background-color: #E6E8FF; /* Light indigo background */
    border-color: transparent;
}
.case-card-next a {
    color: var(--wp--preset--color--change);
    font-weight: 600;
    text-decoration: none;
    font-size: 1.125rem;
    line-height: 1.4;
    display: inline-block;
    transition: color 0.2s ease;
}
.case-card-next a:hover {
    color: var(--wp--preset--color--foreground);
}

/* Override margins for the h4 stats so they stack nicely */
.case-card h4.wp-block-heading {
    margin-top: 0.5rem;
    margin-bottom: 0.25rem;
    line-height: 1;
}

