/*
Theme Name: Informator Górski
Theme URI: https://informatorgorski.pl
Author: Riomega / Dorian Rochowski
Author URI: https://riomega.pl
Description: Jasny motyw magazynowy dla portalu turystyczno-górskiego. Forest green accent, warm off-white background, self-hosted Inter. Zero jQuery, zero frameworków.
Version: 1.0.0
Requires at least: 6.4
Tested up to: 6.9
Requires PHP: 8.0
License: GNU General Public License v2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: informatorgorski
Tags: light, magazine, travel, mountain, blog, custom-menu, featured-images, sticky-post, translation-ready
*/

/* ==========================================================================
   FONTS — Inter self-hosted (latin + latin-ext)
   ========================================================================== */

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('assets/fonts/inter-v18-latin-ext-400.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('assets/fonts/inter-v18-latin-ext-600.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 800;
    font-display: swap;
    src: url('assets/fonts/inter-v18-latin-ext-800.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('assets/fonts/inter-latin-400.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('assets/fonts/inter-latin-600.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 800;
    font-display: swap;
    src: url('assets/fonts/inter-latin-800.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ==========================================================================
   TOKENS — Mountain palette (light)
   ========================================================================== */

:root {
    --ig-bg:           #FBFAF7;
    --ig-bg-card:      #FFFFFF;
    --ig-bg-alt:       #F3EFE8;
    --ig-border:       #E5DFD3;
    --ig-border-soft:  #EFEAE0;

    --ig-text:         #1F1F1F;
    --ig-text-soft:    #555555;
    --ig-text-muted:   #8A857A;

    --ig-brand:        #2D6A4F;   /* forest green */
    --ig-brand-dark:   #1B4332;
    --ig-brand-soft:   #D9E4DC;

    --ig-accent:       #C87F47;   /* trail brown */
    --ig-accent-dark:  #A36636;

    --ig-link:         var(--ig-brand);
    --ig-link-hover:   var(--ig-brand-dark);

    --ig-shadow-sm:    0 1px 2px rgba(30, 20, 10, 0.04);
    --ig-shadow-md:    0 6px 20px rgba(30, 20, 10, 0.07);

    --ig-radius:       4px;
    --ig-radius-lg:    8px;

    --ig-container:    1200px;
    --ig-content:      720px;
}

/* ==========================================================================
   RESET + BASE
   ========================================================================== */

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    font-size: 17px;
    line-height: 1.7;
    color: var(--ig-text);
    background: var(--ig-bg);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

img, svg, video { max-width: 100%; height: auto; display: block; }

a {
    color: var(--ig-link);
    text-decoration: underline;
    text-decoration-thickness: 1px;
    text-underline-offset: 3px;
    transition: color 0.15s ease;
}
a:hover, a:focus { color: var(--ig-link-hover); }

h1, h2, h3, h4, h5, h6 {
    font-weight: 800;
    line-height: 1.25;
    margin: 1.8em 0 0.6em;
    letter-spacing: -0.015em;
    color: var(--ig-text);
}
h1 { font-size: clamp(2rem, 4vw, 2.75rem); }
h2 { font-size: clamp(1.5rem, 2.8vw, 1.85rem); }
h3 { font-size: 1.3rem; }
h4 { font-size: 1.1rem; }

p { margin: 0 0 1.2em; }

blockquote {
    border-left: 3px solid var(--ig-brand);
    padding: 0.2em 0 0.2em 1.2em;
    margin: 1.6em 0;
    color: var(--ig-text-soft);
    font-style: italic;
    font-size: 1.08em;
}

code {
    font-family: ui-monospace, 'Cascadia Code', 'Roboto Mono', monospace;
    background: var(--ig-bg-alt);
    padding: 0.15em 0.4em;
    border-radius: 3px;
    font-size: 0.92em;
}

hr { border: 0; border-top: 1px solid var(--ig-border); margin: 2.5em 0; }

::selection { background: var(--ig-brand); color: #fff; }

/* ==========================================================================
   LAYOUT — Container
   ========================================================================== */

.ig-container {
    max-width: var(--ig-container);
    margin: 0 auto;
    padding: 0 clamp(1rem, 3vw, 2rem);
}

.ig-content-narrow {
    max-width: var(--ig-content);
    margin: 0 auto;
}

/* ==========================================================================
   HEADER
   ========================================================================== */

.ig-header {
    background: var(--ig-bg-card);
    border-bottom: 1px solid var(--ig-border);
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: var(--ig-shadow-sm);
}

.ig-header__inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
    padding: 1rem 0;
}

.ig-logo {
    font-weight: 800;
    font-size: 1.35rem;
    color: var(--ig-text);
    text-decoration: none;
    letter-spacing: -0.015em;
    white-space: nowrap;
    flex-shrink: 0;
}
.ig-logo:hover { color: var(--ig-brand); }

/* WP custom logo image (header) */
.custom-logo-link { display: inline-block; flex-shrink: 0; line-height: 0; }
.custom-logo { max-height: 48px; width: auto; height: auto; display: block; }
@media (max-width: 600px) {
    .custom-logo { max-height: 40px; }
}

/* Footer logo */
.ig-footer__logo { display: inline-block; line-height: 0; margin-bottom: 0.8rem; }
.ig-footer__logo img {
    max-height: 42px;
    width: auto;
    height: auto;
    display: block;
    opacity: 0.85;
    transition: opacity 0.15s ease;
}
.ig-footer__logo:hover img { opacity: 1; }

/* ── Primary navigation ── */
.ig-header__nav { flex: 1; display: flex; justify-content: center; }
.ig-header__nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 0.3rem;
    align-items: center;
}
.ig-header__nav > ul > li { position: relative; }

.ig-header__nav a {
    color: var(--ig-text);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.92rem;
    padding: 0.6em 0.9em;
    display: inline-block;
    border-radius: var(--ig-radius);
    transition: color 0.15s ease, background 0.15s ease;
}
.ig-header__nav > ul > li > a:hover,
.ig-header__nav > ul > li.current-menu-item > a,
.ig-header__nav > ul > li.current-menu-parent > a,
.ig-header__nav > ul > li.current-menu-ancestor > a {
    color: var(--ig-brand);
}

/* Chevron indicator for items with submenu */
.ig-header__nav li.menu-item-has-children > a::after {
    content: "";
    display: inline-block;
    width: 0; height: 0;
    border-left: 4px solid transparent;
    border-right: 4px solid transparent;
    border-top: 5px solid currentColor;
    margin-left: 0.5em;
    vertical-align: 0.15em;
    opacity: 0.55;
    transition: transform 0.2s ease;
}
.ig-header__nav li.menu-item-has-children:hover > a::after,
.ig-header__nav li.menu-item-has-children:focus-within > a::after {
    transform: rotate(180deg);
    opacity: 1;
}

/* Level 2 dropdown (desktop) */
.ig-header__nav .sub-menu {
    position: absolute;
    top: 100%;
    left: 0;
    min-width: 230px;
    background: var(--ig-bg-card);
    border: 1px solid var(--ig-border-soft);
    border-radius: var(--ig-radius-lg);
    box-shadow: var(--ig-shadow-md);
    padding: 0.5rem;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: opacity 0.15s ease, transform 0.15s ease, visibility 0s linear 0.15s;
    z-index: 150;
}
.ig-header__nav li:hover > .sub-menu,
.ig-header__nav li:focus-within > .sub-menu {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition-delay: 0s;
}
.ig-header__nav .sub-menu a {
    padding: 0.5em 0.8em;
    font-size: 0.9rem;
    font-weight: 500;
    display: block;
    color: var(--ig-text-soft);
}
.ig-header__nav .sub-menu a:hover,
.ig-header__nav .sub-menu .current-menu-item > a {
    background: var(--ig-bg-alt);
    color: var(--ig-brand);
}

/* Level 3 (flyout to the right) */
.ig-header__nav .sub-menu .sub-menu {
    top: -0.5rem;
    left: 100%;
    margin-left: 0.25rem;
}
.ig-header__nav .sub-menu li.menu-item-has-children > a::after {
    content: "";
    border-left: 5px solid currentColor;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    border-right: 0;
    float: right;
    margin-top: 0.45em;
    margin-left: 0.6em;
    transform: none !important;
}

/* Keep dropdown within viewport (last items align right) */
.ig-header__nav > ul > li:nth-last-child(-n+2) > .sub-menu {
    left: auto;
    right: 0;
}
.ig-header__nav > ul > li:nth-last-child(-n+2) > .sub-menu .sub-menu {
    left: auto;
    right: 100%;
    margin-left: 0;
    margin-right: 0.25rem;
}

.ig-header__search {
    color: var(--ig-text-soft);
    text-decoration: none;
    padding: 0.4em;
    display: inline-flex;
    align-items: center;
    flex-shrink: 0;
}
.ig-header__search:hover { color: var(--ig-brand); }
.ig-header__search svg { width: 20px; height: 20px; }

.ig-menu-toggle {
    display: none;
    background: none;
    border: 0;
    padding: 0.4em;
    cursor: pointer;
    color: var(--ig-text);
}
.ig-menu-toggle svg { width: 26px; height: 26px; }

/* ── Mobile (< 1024px): accordion dropdowns, off-canvas ── */
@media (max-width: 1023px) {
    .ig-header__nav {
        position: fixed;
        top: 64px;
        left: 0; right: 0;
        background: var(--ig-bg-card);
        border-bottom: 1px solid var(--ig-border);
        padding: 1rem 1.25rem 1.5rem;
        transform: translateY(-110%);
        transition: transform 0.25s ease;
        max-height: calc(100vh - 64px);
        overflow-y: auto;
        display: block;
    }
    .ig-header__nav.is-open { transform: translateY(0); }
    .ig-header__nav > ul { flex-direction: column; align-items: stretch; gap: 0.15rem; }
    .ig-header__nav li { width: 100%; position: relative; }
    .ig-header__nav a {
        display: block;
        padding: 0.7em 0.4em;
        border-bottom: 1px solid var(--ig-border-soft);
        font-size: 1rem;
    }
    /* Reset dropdown positioning on mobile */
    .ig-header__nav .sub-menu {
        position: static;
        border: 0;
        box-shadow: none;
        padding: 0 0 0 1rem;
        margin: 0;
        min-width: 0;
        background: transparent;
        opacity: 1;
        visibility: hidden;
        transform: none;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.25s ease, visibility 0s linear 0.25s;
    }
    .ig-header__nav li.is-open > .sub-menu {
        visibility: visible;
        max-height: 2000px;
        transition: max-height 0.35s ease, visibility 0s;
    }
    .ig-header__nav .sub-menu a {
        padding: 0.55em 0.4em;
        font-size: 0.93rem;
    }
    .ig-header__nav li.menu-item-has-children > a::after {
        float: right;
        margin-top: 0.5em;
    }
    .ig-header__nav li.is-open > a::after { transform: rotate(180deg); }
    .ig-header__nav .sub-menu .sub-menu { left: auto; right: auto; }
    .ig-menu-toggle { display: inline-flex; }
}

/* ==========================================================================
   HERO (home/archive)
   ========================================================================== */

.ig-hero {
    padding: clamp(2rem, 5vw, 4rem) 0 clamp(1.5rem, 3vw, 2.5rem);
    border-bottom: 1px solid var(--ig-border-soft);
    margin-bottom: clamp(2rem, 4vw, 3rem);
}
.ig-hero__eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--ig-brand);
    margin-bottom: 0.5rem;
}
.ig-hero__title {
    font-size: clamp(1.8rem, 3.5vw, 2.6rem);
    margin: 0 0 0.4em;
}
.ig-hero__lead {
    color: var(--ig-text-soft);
    font-size: 1.1rem;
    max-width: 720px;
    margin: 0;
}

/* ==========================================================================
   CARDS (post archive)
   ========================================================================== */

.ig-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 2rem;
}

.ig-card {
    background: var(--ig-bg-card);
    border: 1px solid var(--ig-border-soft);
    border-radius: var(--ig-radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}
.ig-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--ig-shadow-md);
    border-color: var(--ig-border);
}
.ig-card__media {
    display: block;
    aspect-ratio: 16 / 10;
    overflow: hidden;
    background: var(--ig-bg-alt);
}
.ig-card__media img {
    width: 100%; height: 100%;
    object-fit: cover;
    transition: transform 0.3s ease;
}
.ig-card:hover .ig-card__media img { transform: scale(1.04); }

.ig-card__body {
    padding: 1.4rem 1.4rem 1.6rem;
    display: flex; flex-direction: column; gap: 0.6rem;
    flex: 1;
}
.ig-card__cat {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ig-brand);
    text-decoration: none;
    margin-bottom: 0.2rem;
}
.ig-card__cat:hover { color: var(--ig-brand-dark); }
.ig-card__title {
    margin: 0;
    font-size: 1.2rem;
    line-height: 1.35;
}
.ig-card__title a { color: var(--ig-text); text-decoration: none; }
.ig-card__title a:hover { color: var(--ig-brand); }
.ig-card__meta {
    margin-top: auto;
    font-size: 0.82rem;
    color: var(--ig-text-muted);
    display: flex; gap: 0.8rem; align-items: center;
    padding-top: 0.5rem;
}
.ig-card__excerpt {
    font-size: 0.95rem;
    color: var(--ig-text-soft);
    margin: 0;
}

/* ==========================================================================
   SINGLE POST
   ========================================================================== */

.ig-article {
    padding: clamp(1.5rem, 3vw, 2.5rem) 0 clamp(3rem, 6vw, 5rem);
}

.ig-breadcrumbs {
    font-size: 0.85rem;
    color: var(--ig-text-muted);
    margin-bottom: 1rem;
}
.ig-breadcrumbs a { color: var(--ig-text-soft); text-decoration: none; }
.ig-breadcrumbs a:hover { color: var(--ig-brand); }
.ig-breadcrumbs .separator { margin: 0 0.4em; color: var(--ig-text-muted); }

.ig-article__header {
    max-width: var(--ig-content);
    margin: 0 auto 2rem;
}
.ig-article__eyebrow {
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--ig-brand);
    margin-bottom: 0.8rem;
}
.ig-article__eyebrow a { color: inherit; text-decoration: none; }
.ig-article__title {
    font-size: clamp(1.9rem, 4vw, 2.7rem);
    margin: 0 0 0.7em;
    line-height: 1.2;
}
.ig-article__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    font-size: 0.9rem;
    color: var(--ig-text-soft);
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--ig-border-soft);
}
.ig-article__meta .author {
    display: flex; align-items: center; gap: 0.5rem;
    font-weight: 600; color: var(--ig-text);
}
.ig-article__meta .author img {
    width: 32px; height: 32px; border-radius: 50%;
    object-fit: cover;
}
.ig-article__meta time { color: var(--ig-text-muted); }
.ig-article__meta .reading-time {
    display: inline-flex; align-items: center; gap: 0.3rem;
    color: var(--ig-text-muted);
}

.ig-article__hero {
    margin: 0 auto 2.5rem;
    max-width: 1200px;
    border-radius: var(--ig-radius-lg);
    overflow: hidden;
}
.ig-article__hero img {
    width: 100%; height: auto;
    aspect-ratio: 1200 / 630;
    object-fit: cover;
}

/* ── Article layout: content + sticky TOC sidebar (desktop) ── */
.ig-article__layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 2rem;
    max-width: 1000px;
    margin: 0 auto;
}
.ig-article--has-toc .ig-article__layout {
    max-width: 1120px;
}
@media (min-width: 1024px) {
    .ig-article--has-toc .ig-article__layout {
        grid-template-columns: minmax(0, 1fr) 260px;
        gap: 3.5rem;
    }
}

.ig-article__main { min-width: 0; }

.ig-article__content {
    max-width: var(--ig-content);
    margin: 0 auto;
    font-size: 1.07rem;
    line-height: 1.75;
    min-width: 0;
}
.ig-article__content > * { max-width: 100%; }
.ig-article__content p { overflow-wrap: break-word; word-wrap: break-word; }
.ig-article__content img {
    border-radius: var(--ig-radius);
    height: auto;
    max-width: 100%;
}
.ig-article__content > img { margin: 2em 0; box-shadow: var(--ig-shadow-sm); }

.ig-article__content .wp-caption,
.ig-article__content figure { margin: 2em 0; }
.ig-article__content figcaption {
    font-size: 0.85rem; color: var(--ig-text-muted);
    text-align: center;
    margin-top: 0.6em;
}
.ig-article__content ul, .ig-article__content ol {
    margin: 0 0 1.4em; padding-left: 1.4em;
}
.ig-article__content li { margin-bottom: 0.3em; }
.ig-article__content h2 {
    border-top: 1px solid var(--ig-border-soft);
    padding-top: 1.2em;
    margin-top: 2em;
    scroll-margin-top: 90px;
}
.ig-article__content h2:first-child { border-top: 0; padding-top: 0; margin-top: 1em; }
.ig-article__content h3 { margin-top: 1.8em; scroll-margin-top: 90px; }

/* ── Gutenberg blocks: image, gallery, embed, video ── */
.ig-article__content .wp-block-image {
    margin: 2em 0;
}
.ig-article__content .wp-block-image img {
    display: block;
    margin: 0 auto;
    border-radius: var(--ig-radius);
    box-shadow: var(--ig-shadow-sm);
}
.ig-article__content .wp-block-image figcaption { margin-top: 0.6em; }

/* ── Gallery: hero + horizontal thumbs (carousel-like) ── */
.ig-article__content .wp-block-gallery,
.ig-article__content figure.wp-block-gallery.ig-gal {
    display: block !important;
    margin: 2.5em 0;
    padding: 0;
    width: 100%;
    max-width: 100%;
    background: transparent;
}

/* Reset all child figures to safe defaults */
.ig-article__content .wp-block-gallery > figure.wp-block-image {
    margin: 0;
    padding: 0;
    width: auto;
    max-width: 100%;
}

/* Before JS upgrade (no ig-gal class yet): single-image stacked look */
.ig-article__content .wp-block-gallery:not(.ig-gal) > figure.wp-block-image {
    margin-bottom: 1rem;
}
.ig-article__content .wp-block-gallery:not(.ig-gal) > figure.wp-block-image img {
    width: 100%;
    height: auto;
    display: block;
    border-radius: var(--ig-radius);
}

/* ── HERO image (first in carousel) ── */
.ig-article__content .ig-gal__hero {
    margin: 0 0 1rem 0 !important;
    display: block;
    width: 100%;
}
.ig-article__content .ig-gal__hero a {
    display: block;
    overflow: hidden;
    border-radius: var(--ig-radius-lg);
    box-shadow: var(--ig-shadow-md);
    background: var(--ig-bg-alt);
}
.ig-article__content .ig-gal__hero img {
    display: block;
    width: 100%;
    height: auto;
    max-height: 560px;
    object-fit: cover;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    transition: opacity 0.2s ease;
}
.ig-article__content .ig-gal__hero figcaption,
.ig-article__content .ig-gal__hero .wp-element-caption {
    margin: 0.7rem 0 0;
    font-size: 0.9rem;
    color: var(--ig-text-soft);
    line-height: 1.5;
    text-align: left;
    font-style: italic;
}

/* ── Thumbs strip (horizontal scroll) ── */
.ig-article__content .ig-gal__thumbs {
    display: flex;
    gap: 0.6rem;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
    padding: 0.4rem 0.2rem 0.8rem;
    margin: 0 -0.2rem;
    scrollbar-width: thin;
    scrollbar-color: var(--ig-border) transparent;
    -webkit-overflow-scrolling: touch;
}
.ig-article__content .ig-gal__thumbs::-webkit-scrollbar { height: 6px; }
.ig-article__content .ig-gal__thumbs::-webkit-scrollbar-track { background: transparent; }
.ig-article__content .ig-gal__thumbs::-webkit-scrollbar-thumb {
    background: var(--ig-border);
    border-radius: 3px;
}

.ig-article__content figure.ig-gal__thumb {
    flex: 0 0 auto;
    width: 150px;
    margin: 0 !important;
    scroll-snap-align: start;
    cursor: pointer;
}
.ig-article__content figure.ig-gal__thumb a {
    display: block;
    overflow: hidden;
    border-radius: var(--ig-radius);
    box-shadow: var(--ig-shadow-sm);
    border: 2px solid transparent;
    transition: border-color 0.15s ease, transform 0.15s ease;
}
.ig-article__content figure.ig-gal__thumb a:hover {
    border-color: var(--ig-brand);
    transform: translateY(-1px);
}
.ig-article__content figure.ig-gal__thumb img {
    display: block;
    width: 100%;
    height: 100px;
    object-fit: cover;
    margin: 0;
    border-radius: 0;
    box-shadow: none;
    opacity: 0.85;
    transition: opacity 0.15s ease;
}
.ig-article__content figure.ig-gal__thumb a:hover img { opacity: 1; }

/* Hide per-thumb captions (they show only for hero) */
.ig-article__content figure.ig-gal__thumb figcaption,
.ig-article__content figure.ig-gal__thumb .wp-element-caption {
    display: none;
}

/* Group figcaption (rare, at bottom of gallery) */
.ig-article__content .wp-block-gallery > figcaption {
    margin-top: 0.8rem;
    font-size: 0.88rem;
    font-style: italic;
    color: var(--ig-text-muted);
    text-align: center;
    padding-top: 0.8rem;
    border-top: 1px solid var(--ig-border-soft);
}

/* Mobile tweaks */
@media (max-width: 600px) {
    .ig-article__content .ig-gal__hero img { max-height: 380px; }
    .ig-article__content figure.ig-gal__thumb { width: 120px; }
    .ig-article__content figure.ig-gal__thumb img { height: 80px; }
}

/* Break out of content narrow column on wide viewports for more impact */
@media (min-width: 900px) {
    .ig-article__content .wp-block-gallery {
        margin-left: -30px;
        margin-right: -30px;
    }
    /* But constrain when in TOC layout (aside present) */
    .ig-article--has-toc .ig-article__content .wp-block-gallery {
        margin-left: 0;
        margin-right: 0;
    }
}

/* Embed / video / iframe */
.ig-article__content .wp-block-embed,
.ig-article__content .wp-block-video {
    margin: 2em 0;
}
.ig-article__content .wp-block-embed iframe,
.ig-article__content iframe,
.ig-article__content video,
.ig-article__content embed,
.ig-article__content object {
    max-width: 100%;
    width: 100%;
    height: auto;
    display: block;
    border: 0;
}
.ig-article__content .wp-block-embed__wrapper,
.ig-article__content .wp-embed-aspect-16-9 .wp-block-embed__wrapper,
.ig-article__content .wp-embed-aspect-4-3 .wp-block-embed__wrapper,
.ig-article__content .wp-embed-aspect-1-1 .wp-block-embed__wrapper {
    position: relative;
    width: 100%;
    border-radius: var(--ig-radius);
    overflow: hidden;
    box-shadow: var(--ig-shadow-sm);
}
.ig-article__content .wp-embed-aspect-16-9 .wp-block-embed__wrapper { aspect-ratio: 16 / 9; }
.ig-article__content .wp-embed-aspect-4-3 .wp-block-embed__wrapper { aspect-ratio: 4 / 3; }
.ig-article__content .wp-embed-aspect-1-1 .wp-block-embed__wrapper { aspect-ratio: 1 / 1; }
.ig-article__content .wp-block-embed iframe {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
}
/* Fallback for embeds without aspect class */
.ig-article__content .wp-block-embed:not([class*="wp-embed-aspect"]) iframe {
    aspect-ratio: 16 / 9;
    position: static;
    height: auto;
}

/* ── Table of Contents ── */
.ig-toc__label {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--ig-brand);
    margin: 0 0 0.6rem;
}
.ig-toc__list {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: ig-toc;
}
.ig-toc__item {
    line-height: 1.4;
    margin: 0;
    counter-increment: ig-toc;
}
.ig-toc__item a {
    display: block;
    padding: 0.4em 0;
    color: var(--ig-text-soft);
    text-decoration: none;
    font-size: 0.9rem;
    border-left: 2px solid transparent;
    padding-left: 0.8em;
    margin-left: -0.8em;
    transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.ig-toc__item a:hover,
.ig-toc__item a.is-active {
    color: var(--ig-brand);
    border-left-color: var(--ig-brand);
    background: var(--ig-brand-soft);
}
.ig-toc__item--h3 a {
    padding-left: 1.6em;
    margin-left: -1.6em;
    font-size: 0.85rem;
    color: var(--ig-text-muted);
}

/* Desktop — sticky sidebar */
.ig-article__aside {
    display: none;
}
@media (min-width: 1024px) {
    .ig-article__aside {
        display: block;
    }
    .ig-toc--desktop {
        position: sticky;
        top: 90px;
        max-height: calc(100vh - 110px);
        overflow-y: auto;
        padding: 1.5rem;
        background: var(--ig-bg-card);
        border: 1px solid var(--ig-border-soft);
        border-radius: var(--ig-radius-lg);
        font-size: 0.9rem;
    }
    .ig-toc--mobile { display: none; }
}

/* Mobile — details on top */
.ig-toc--mobile {
    display: block;
    max-width: var(--ig-content);
    margin: 0 auto 2rem;
    background: var(--ig-bg-card);
    border: 1px solid var(--ig-border-soft);
    border-radius: var(--ig-radius-lg);
    overflow: hidden;
}
.ig-toc--mobile summary {
    padding: 1rem 1.2rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    list-style: none;
    color: var(--ig-text);
}
.ig-toc--mobile summary::-webkit-details-marker { display: none; }
.ig-toc--mobile summary .ig-toc__label { margin: 0; color: var(--ig-brand); }
.ig-toc--mobile .ig-toc__chevron {
    width: 18px; height: 18px;
    color: var(--ig-text-muted);
    transition: transform 0.2s ease;
}
.ig-toc--mobile[open] .ig-toc__chevron { transform: rotate(180deg); }
.ig-toc--mobile .ig-toc__list {
    padding: 0 1.2rem 1.2rem;
    border-top: 1px solid var(--ig-border-soft);
    padding-top: 0.8rem;
}
@media (min-width: 1024px) {
    .ig-toc--mobile { display: none; }
}

/* ==========================================================================
   SHARE BUTTONS
   ========================================================================== */

.ig-share {
    max-width: var(--ig-content);
    margin: 3rem auto 0;
    padding: 1.6rem;
    background: var(--ig-bg-alt);
    border-radius: var(--ig-radius-lg);
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}
.ig-share__label {
    font-weight: 600;
    font-size: 0.95rem;
    margin: 0;
}
.ig-share__list {
    display: flex; gap: 0.5rem; margin: 0; padding: 0; list-style: none;
    flex-wrap: wrap;
}
.ig-share__btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
    border-radius: 50%;
    background: var(--ig-bg-card);
    color: var(--ig-text-soft);
    text-decoration: none;
    border: 1px solid var(--ig-border);
    transition: all 0.15s ease;
    cursor: pointer;
}
.ig-share__btn:hover {
    background: var(--ig-brand);
    color: #fff;
    border-color: var(--ig-brand);
    transform: translateY(-1px);
}
.ig-share__btn svg { width: 18px; height: 18px; }

/* ==========================================================================
   AUTHOR BOX (fallback if riomega-author-box active, hidden)
   ========================================================================== */

.ig-author {
    max-width: var(--ig-content);
    margin: 3rem auto 0;
    padding: 1.8rem;
    background: var(--ig-bg-card);
    border: 1px solid var(--ig-border-soft);
    border-radius: var(--ig-radius-lg);
    display: flex;
    gap: 1.5rem;
    align-items: flex-start;
}
.ig-author__avatar img {
    width: 80px; height: 80px;
    border-radius: 50%;
    object-fit: cover;
}
.ig-author__body h3 { margin: 0 0 0.2em; font-size: 1.15rem; }
.ig-author__role { font-size: 0.85rem; color: var(--ig-brand); font-weight: 600; margin-bottom: 0.5em; }
.ig-author__bio { margin: 0; color: var(--ig-text-soft); font-size: 0.95rem; }

/* Hide native author box if riomega-author-box plugin is active */
body.has-riomega-author-box .ig-author { display: none; }

/* ==========================================================================
   RELATED POSTS
   ========================================================================== */

.ig-related {
    border-top: 1px solid var(--ig-border-soft);
    padding-top: 2.5rem;
    margin-top: 3rem;
}
.ig-related h2 {
    font-size: 1.3rem;
    margin: 0 0 1.5rem;
}

/* ==========================================================================
   CATEGORIES STRIP
   ========================================================================== */

.ig-cat-strip {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 1rem 0;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--ig-border-soft);
    overflow-x: auto;
}
.ig-cat-strip a {
    padding: 0.35em 0.9em;
    border-radius: 999px;
    background: var(--ig-bg-card);
    border: 1px solid var(--ig-border);
    color: var(--ig-text-soft);
    font-size: 0.85rem;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
    transition: all 0.15s ease;
}
.ig-cat-strip a:hover,
.ig-cat-strip a.current {
    background: var(--ig-brand);
    color: #fff;
    border-color: var(--ig-brand);
}

/* ==========================================================================
   FAQ BLOCK (RankMath native but styled to match)
   ========================================================================== */

.wp-block-rank-math-faq-block {
    max-width: var(--ig-content);
    margin: 2.5rem auto;
    background: var(--ig-bg-alt);
    padding: 1.8rem;
    border-radius: var(--ig-radius-lg);
    border-left: 3px solid var(--ig-brand);
}
.wp-block-rank-math-faq-block h2,
.wp-block-rank-math-faq-block h3.rank-math-question {
    font-size: 1.08rem;
    margin: 1.3em 0 0.4em;
    color: var(--ig-text);
    padding-top: 1.1em;
    border-top: 1px dashed var(--ig-border);
}
.wp-block-rank-math-faq-block h2:first-child,
.wp-block-rank-math-faq-block > h3:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
    font-size: 1.2rem;
}
.wp-block-rank-math-faq-block .rank-math-answer p {
    color: var(--ig-text-soft);
    margin: 0 0 0.6em;
}

/* ==========================================================================
   PAGINATION
   ========================================================================== */

.ig-pagination {
    display: flex;
    justify-content: center;
    gap: 0.4rem;
    margin: 3rem 0;
    flex-wrap: wrap;
}
.ig-pagination a,
.ig-pagination span {
    padding: 0.5em 0.9em;
    background: var(--ig-bg-card);
    border: 1px solid var(--ig-border);
    border-radius: var(--ig-radius);
    text-decoration: none;
    color: var(--ig-text-soft);
    font-weight: 500;
}
.ig-pagination a:hover,
.ig-pagination .current {
    background: var(--ig-brand);
    color: #fff;
    border-color: var(--ig-brand);
}

/* ==========================================================================
   SEARCH FORM
   ========================================================================== */

.ig-search-form {
    display: flex;
    max-width: 500px;
    gap: 0.4rem;
}
.ig-search-form input[type="search"] {
    flex: 1;
    padding: 0.7em 1em;
    border: 1px solid var(--ig-border);
    border-radius: var(--ig-radius);
    font-family: inherit;
    font-size: 1rem;
    background: var(--ig-bg-card);
    color: var(--ig-text);
}
.ig-search-form input[type="search"]:focus {
    outline: 0;
    border-color: var(--ig-brand);
    box-shadow: 0 0 0 3px rgba(45, 106, 79, 0.15);
}
.ig-search-form button {
    padding: 0.7em 1.4em;
    background: var(--ig-brand);
    color: #fff;
    border: 0;
    border-radius: var(--ig-radius);
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
}
.ig-search-form button:hover { background: var(--ig-brand-dark); }

/* ==========================================================================
   FOOTER
   ========================================================================== */

.ig-footer {
    background: var(--ig-bg-alt);
    border-top: 1px solid var(--ig-border);
    padding: 3rem 0 1.5rem;
    margin-top: 5rem;
    color: var(--ig-text-soft);
    font-size: 0.92rem;
}
.ig-footer__grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr;
    gap: 2rem;
    margin-bottom: 2rem;
}
@media (max-width: 700px) {
    .ig-footer__grid { grid-template-columns: 1fr; gap: 1.5rem; }
}
.ig-footer__brand p { margin: 0.5em 0 0; }
.ig-footer h4 {
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--ig-text);
    margin: 0 0 0.8rem;
}
.ig-footer ul {
    list-style: none; margin: 0; padding: 0;
}
.ig-footer li { margin-bottom: 0.4em; }
.ig-footer a { color: var(--ig-text-soft); text-decoration: none; }
.ig-footer a:hover { color: var(--ig-brand); }

.ig-footer__bottom {
    border-top: 1px solid var(--ig-border);
    padding-top: 1.2rem;
    display: flex;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.85rem;
}

/* ==========================================================================
   MISC — RankMath & Riomega Author Box integration
   ========================================================================== */

.rank-math-breadcrumb {
    font-size: 0.85rem;
    color: var(--ig-text-muted);
    margin-bottom: 1rem;
}
.rank-math-breadcrumb a {
    color: var(--ig-text-soft);
    text-decoration: none;
}
.rank-math-breadcrumb a:hover { color: var(--ig-brand); }
.rank-math-breadcrumb .separator { margin: 0 0.4em; }

/* riomega-author-box override for jasny variant */
.riomega-author-box {
    --rab-accent: var(--ig-brand);
}

/* ==========================================================================
   RESPONSIVE TWEAKS
   ========================================================================== */

@media (max-width: 600px) {
    body { font-size: 16px; }
    .ig-article__content { font-size: 1rem; }
}

/* ==========================================================================
   PRINT
   ========================================================================== */

@media print {
    .ig-header, .ig-footer, .ig-share, .ig-related, .ig-cat-strip { display: none; }
    .ig-article__content { max-width: 100%; }
    body { background: #fff; color: #000; }
}
