/* ============================================================================
   impliedtech — blog_detail.css
   Chrome (tokens, top bar, bottom nav, buttons, footer) is identical to index.css.
   Article layout and chart styles follow.
   ============================================================================ */


/* ── DESIGN TOKENS ── */
:root {
    /* Primary — logo magenta #A5216F */
    --md-sys-color-primary:              #A5216F;
    --md-sys-color-on-primary:           #FFFFFF;
    --md-sys-color-primary-container:    #FFD8E9;
    --md-sys-color-on-primary-container: #3D0026;

    /* Secondary — muted plum */
    --md-sys-color-secondary:            #7A4E68;
    --md-sys-color-on-secondary:         #FFFFFF;
    --md-sys-color-secondary-container:  #F6E3EC;
    --md-sys-color-on-secondary-container: #2E1325;

    /* Tertiary — logo indigo */
    --md-sys-color-tertiary:             #3B2F9E;
    --md-sys-color-on-tertiary:          #FFFFFF;
    --md-sys-color-tertiary-container:   #E4E0FF;
    --md-sys-color-on-tertiary-container: #12006B;

    /* Error */
    --md-sys-color-error:                #B3261E;
    --md-sys-color-on-error:             #FFFFFF;
    --md-sys-color-error-container:      #F9DEDC;

    /* Surface */
    --md-sys-color-background:           #FFFBFC;
    --md-sys-color-on-background:        #1F1A1D;
    --md-sys-color-surface:              #FFFBFC;
    --md-sys-color-on-surface:           #1F1A1D;
    --md-sys-color-surface-variant:      #F2E7EC;
    --md-sys-color-on-surface-variant:   #52434B;

    /* Surface containers */
    --md-sys-color-surface-container-lowest:  #FFFFFF;
    --md-sys-color-surface-container-low:     #FDF6F9;
    --md-sys-color-surface-container:         #F8EEF2;
    --md-sys-color-surface-container-high:    #F2E8EC;
    --md-sys-color-surface-container-highest: #ECE2E6;

    /* Outline */
    --md-sys-color-outline:              #9C8791;
    --md-sys-color-outline-variant:      #E6D6DD;

    /* Inverse */
    --md-sys-color-inverse-surface:      #352F32;
    --md-sys-color-inverse-on-surface:   #FAEEF2;

    /* Elevation */
    --md-sys-elevation-1: 0 1px 2px rgba(60,10,40,.05), 0 1px 3px rgba(60,10,40,.04);
    --md-sys-elevation-2: 0 2px 6px rgba(60,10,40,.06), 0 1px 3px rgba(60,10,40,.04);
    --md-sys-elevation-3: 0 8px 20px rgba(60,10,40,.08), 0 2px 6px rgba(60,10,40,.05);
    --md-sys-elevation-4: 0 12px 28px rgba(60,10,40,.10), 0 3px 8px rgba(60,10,40,.06);

    /* Shape */
    --md-sys-shape-corner-extra-small: 4px;
    --md-sys-shape-corner-small:       8px;
    --md-sys-shape-corner-medium:      12px;
    --md-sys-shape-corner-large:       16px;
    --md-sys-shape-corner-extra-large: 20px;
    --md-sys-shape-corner-full:        9999px;

    /* Motion */
    --md-motion-short:    150ms;
    --md-motion-medium:   250ms;
    --md-motion-long:     400ms;
    --md-ease-standard:   cubic-bezier(0.2, 0, 0, 1);
    --md-ease-emphasized: cubic-bezier(0.2, 0, 0, 1);
    --md-ease-decel:      cubic-bezier(0.05, 0.7, 0.1, 1);

    /* Brand — taken straight from the logo gradient */
    --c-brand-indigo: #231A6B;
    --c-brand-purple: #6A1F6E;
    --c-brand:        #A5216F;
    --c-brand-pink:   #EE2070;
    --brand-gradient: linear-gradient(135deg, #231A6B 0%, #6A1F6E 38%, #A5216F 68%, #EE2070 100%);
    --brand-text-gradient: linear-gradient(100deg, #3B2F9E 0%, #A5216F 55%, #E0185F 100%);
}

/* ── DARK / NIGHT MODE ── */
body.dark {
    --md-sys-color-primary:              #FFB0D3;
    --md-sys-color-on-primary:           #5C0039;
    --md-sys-color-primary-container:    #84154F;
    --md-sys-color-on-primary-container: #FFD8E9;
    --md-sys-color-secondary:            #E6BAD0;
    --md-sys-color-on-secondary:         #44263A;
    --md-sys-color-secondary-container:  #5C3C51;
    --md-sys-color-on-secondary-container: #FFD8EA;
    --md-sys-color-tertiary:             #C7BFFF;
    --md-sys-color-on-tertiary:          #2A1B7A;
    --md-sys-color-tertiary-container:   #41339A;
    --md-sys-color-on-tertiary-container: #E4E0FF;
    --md-sys-color-error-container:      #601410;
    --md-sys-color-background:           #161215;
    --md-sys-color-on-background:        #EBE0E4;
    --md-sys-color-surface:              #161215;
    --md-sys-color-on-surface:           #EBE0E4;
    --md-sys-color-surface-variant:      #2A2227;
    --md-sys-color-on-surface-variant:   #D2C2CA;
    --md-sys-color-surface-container-lowest:  #110D10;
    --md-sys-color-surface-container-low:     #1D181B;
    --md-sys-color-surface-container:         #211C1F;
    --md-sys-color-surface-container-high:    #2C262A;
    --md-sys-color-surface-container-highest: #373134;
    --md-sys-color-outline:              #9D8C94;
    --md-sys-color-outline-variant:      #3B3237;
    --md-sys-elevation-1: 0 1px 2px rgba(0,0,0,.4),  0 1px 3px rgba(0,0,0,.3);
    --md-sys-elevation-2: 0 2px 6px rgba(0,0,0,.4),  0 1px 3px rgba(0,0,0,.3);
    --md-sys-elevation-3: 0 8px 20px rgba(0,0,0,.45),0 2px 6px rgba(0,0,0,.32);
    --md-sys-elevation-4: 0 12px 28px rgba(0,0,0,.5),0 3px 8px rgba(0,0,0,.34);
    --brand-text-gradient: linear-gradient(100deg, #B1A6FF 0%, #FF86BC 55%, #FFA3C9 100%);
}

/* One surface system: every card shares the same tonal fill + hairline */
body {
    --sk-card:        color-mix(in srgb, var(--md-sys-color-primary) 3%, var(--md-sys-color-surface-container-low));
    --sk-line:        var(--md-sys-color-outline-variant);
    --sk-line-strong: var(--md-sys-color-outline);
}

/* ============================================================================
   GLOBAL RESETS
   ============================================================================ */

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

html { scroll-behavior: smooth; scroll-padding-top: 64px; }

body {
    background-color: var(--md-sys-color-background);
    color: var(--md-sys-color-on-background);
    min-height: 100vh;
    font-family: 'Google Sans', 'Segoe UI', system-ui, -apple-system, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    transition:
        background-color var(--md-motion-medium) var(--md-ease-standard),
        color            var(--md-motion-medium) var(--md-ease-standard);
}

a { color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
a:hover, a:visited, a:active, a:focus { text-decoration: none; }

::selection      { background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); }
::-moz-selection { background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); }

::-webkit-scrollbar       { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--md-sys-color-outline-variant); border-radius: var(--md-sys-shape-corner-full); }
::-webkit-scrollbar-thumb:hover { background: var(--md-sys-color-outline); }
* { scrollbar-width: thin; scrollbar-color: var(--md-sys-color-outline-variant) transparent; }

a:focus-visible, button:focus-visible, input:focus-visible {
    outline: 2px solid var(--md-sys-color-primary);
    outline-offset: 2px;
    border-radius: var(--md-sys-shape-corner-extra-small);
}
*:focus:not(:focus-visible) { outline: none; }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ============================================================================
   TOP APP BAR
   ============================================================================ */

.md3-top-app-bar {
    position: sticky; top: 0; z-index: 200;
    background: color-mix(in srgb, var(--md-sys-color-surface-container-low) 92%, transparent);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    transition:
        background   var(--md-motion-medium) var(--md-ease-standard),
        box-shadow   var(--md-motion-medium) var(--md-ease-standard),
        border-color var(--md-motion-medium) var(--md-ease-standard);
}
.md3-top-app-bar.scrolled {
    box-shadow: var(--md-sys-elevation-2);
    border-bottom-color: transparent;
    background: color-mix(in srgb, var(--md-sys-color-surface-container) 96%, transparent);
}

.md3-top-app-bar__inner {
    max-width: 1280px; margin: 0 auto;
    padding: 0 16px; height: 64px;
    display: flex; align-items: center; gap: 8px;
}

.md3-top-app-bar__logo {
    display: flex; align-items: center; flex-shrink: 0;
    transition: opacity var(--md-motion-short) var(--md-ease-standard);
}
.md3-top-app-bar__logo:hover { opacity: 0.85; }
.md3-top-app-bar__logo-img { height: 40px; width: auto; object-fit: contain; }

/* Desktop nav */
.md3-nav-tabs { display: none; align-items: center; gap: 2px; flex: 1; justify-content: center; }
@media (min-width: 768px) { .md3-nav-tabs { display: flex; } }

.md3-nav-tab {
    position: relative;
    padding: 8px 16px;
    border-radius: var(--md-sys-shape-corner-full);
    font-size: 14px; font-weight: 500;
    color: var(--md-sys-color-on-surface-variant);
    transition:
        color      var(--md-motion-short) var(--md-ease-standard),
        background var(--md-motion-short) var(--md-ease-standard);
}
.md3-nav-tab::after {
    content: '';
    position: absolute; bottom: 0; left: 50%;
    transform: translateX(-50%);
    width: 0; height: 3px;
    background: var(--md-sys-color-primary);
    border-radius: 3px 3px 0 0;
    transition: width var(--md-motion-medium) var(--md-ease-emphasized);
}
.md3-nav-tab:hover {
    color: var(--md-sys-color-on-surface);
    background: color-mix(in srgb, var(--md-sys-color-primary) 8%, transparent);
}
.md3-nav-tab--active, .md3-nav-tab.active { color: var(--md-sys-color-primary); font-weight: 600; }
.md3-nav-tab--active::after, .md3-nav-tab.active::after { width: calc(100% - 32px); }

.md3-top-app-bar__actions { display: flex; align-items: center; gap: 4px; margin-left: auto; }

/* Scroll progress */
.md3-scroll-progress {
    position: absolute; left: 0; bottom: -1px; height: 3px; width: 0; z-index: 2;
    background: var(--brand-gradient);
    transition: width 80ms linear;
}

/* ============================================================================
   ICON BUTTONS
   ============================================================================ */

.md3-icon-btn {
    position: relative;
    width: 40px; height: 40px;
    border-radius: var(--md-sys-shape-corner-full);
    border: none;
    display: inline-flex; align-items: center; justify-content: center;
    cursor: pointer; overflow: hidden;
    background: transparent;
    color: var(--md-sys-color-on-surface-variant);
    transition:
        background var(--md-motion-short) var(--md-ease-standard),
        transform  var(--md-motion-short) var(--md-ease-emphasized);
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
}
.md3-icon-btn::before {
    content: '';
    position: absolute; inset: 0; border-radius: inherit;
    background: currentColor; opacity: 0;
    transition: opacity var(--md-motion-short) var(--md-ease-standard);
}
.md3-icon-btn:hover::before  { opacity: 0.08; }
.md3-icon-btn:focus::before  { opacity: 0.10; }
.md3-icon-btn:active         { transform: scale(0.94); }
.md3-icon-btn:active::before { opacity: 0.14; }

.md3-icon-btn--outlined {
    border: 1px solid var(--md-sys-color-outline-variant);
    transition:
        border-color var(--md-motion-short) var(--md-ease-standard),
        background   var(--md-motion-short) var(--md-ease-standard);
}
.md3-icon-btn--outlined:hover { border-color: var(--md-sys-color-outline); }
.md3-icon-btn .material-symbols-rounded { font-size: 20px; line-height: 1; position: relative; z-index: 1; }

/* ============================================================================
   BOTTOM NAVIGATION — floating pill, mobile only
   ============================================================================ */

.md3-bottom-nav {
    display: none;
    position: fixed;
    bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    left: 16px; right: 16px;
    height: 68px;
    z-index: 300;
    align-items: center;
    justify-content: space-around;
    border-radius: 999px;
    isolation: isolate;
}
/* Glass lives on ::before so it never intercepts taps */
.md3-bottom-nav::before {
    content: '';
    position: absolute; inset: 0;
    border-radius: inherit;
    background: color-mix(in srgb, var(--md-sys-color-surface-container-lowest) 62%, transparent);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid color-mix(in srgb, var(--md-sys-color-outline-variant) 70%, transparent);
    box-shadow: 0 8px 32px rgba(60,10,40,.14), 0 2px 8px rgba(60,10,40,.07);
    pointer-events: none;
    z-index: -1;
}
body.dark .md3-bottom-nav::before {
    background: rgba(33, 28, 31, 0.78);
    box-shadow: 0 8px 32px rgba(0,0,0,.45), 0 2px 8px rgba(0,0,0,.24);
}
@media (max-width: 767px) { .md3-bottom-nav { display: flex; } }

.md3-bottom-nav__tab {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 3px; padding: 8px 4px;
    border: none; background: transparent;
    cursor: pointer;
    color: var(--md-sys-color-on-surface-variant);
    font-family: inherit; text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    transition: color var(--md-motion-short) var(--md-ease-standard);
    border-radius: 999px;
    position: relative;
}
.md3-bottom-nav__indicator {
    position: relative;
    width: 52px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 999px;
    transition: background var(--md-motion-medium) var(--md-ease-emphasized),
                transform  var(--md-motion-short) var(--md-ease-emphasized);
}
.md3-bottom-nav__indicator::before {
    content: '';
    position: absolute; inset: 0; border-radius: inherit;
    background: var(--md-sys-color-on-surface); opacity: 0;
    transition: opacity var(--md-motion-short) var(--md-ease-standard);
}
.md3-bottom-nav__tab:hover .md3-bottom-nav__indicator::before { opacity: 0.08; }
.md3-bottom-nav__tab:active .md3-bottom-nav__indicator { transform: scale(0.88); }
.md3-bottom-nav__indicator .material-symbols-rounded { font-size: 22px; position: relative; z-index: 1; }

.md3-bottom-nav__label { font-size: 10px; font-weight: 600; line-height: 1; white-space: nowrap; letter-spacing: 0.01em; }

.md3-bottom-nav__tab.active,
.md3-bottom-nav__tab[aria-current="page"],
.md3-bottom-nav__tab--more.open { color: var(--md-sys-color-primary); }
.md3-bottom-nav__tab.active .md3-bottom-nav__indicator,
.md3-bottom-nav__tab[aria-current="page"] .md3-bottom-nav__indicator,
.md3-bottom-nav__tab--more.open .md3-bottom-nav__indicator {
    background: var(--md-sys-color-primary-container);
}
.md3-bottom-nav__tab.active .md3-bottom-nav__label,
.md3-bottom-nav__tab[aria-current="page"] .md3-bottom-nav__label { font-weight: 700; }

/* Scrim */
.md3-bottom-nav__scrim {
    display: none;
    position: fixed; inset: 0; z-index: 398;
    background: rgba(20,5,15,.40);
    opacity: 0; pointer-events: none;
    transition: opacity var(--md-motion-medium) var(--md-ease-standard);
}
@media (max-width: 767px) { .md3-bottom-nav__scrim { display: block; } }
.md3-bottom-nav__scrim.active { opacity: 1; pointer-events: auto; }

/* Drop-up panel */
.md3-bottom-nav__more-panel {
    display: none;
    position: fixed;
    left: 16px; right: 16px;
    bottom: calc(96px + env(safe-area-inset-bottom, 0px));
    z-index: 399;
    transform: translateY(20px);
    background: color-mix(in srgb, var(--md-sys-color-surface-container-lowest) 86%, transparent);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: 28px;
    box-shadow: 0 12px 40px rgba(60,10,40,.16), 0 4px 12px rgba(60,10,40,.07);
    transition: transform var(--md-motion-medium) var(--md-ease-decel),
                opacity  var(--md-motion-medium) var(--md-ease-standard);
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
}
body.dark .md3-bottom-nav__more-panel {
    background: rgba(33, 28, 31, 0.92);
    box-shadow: 0 12px 40px rgba(0,0,0,.55);
}
@media (max-width: 767px) { .md3-bottom-nav__more-panel { display: block; } }
.md3-bottom-nav__more-panel.active { transform: translateY(0); opacity: 1; pointer-events: auto; }

.md3-bottom-nav__more-handle {
    width: 32px; height: 4px;
    background: var(--md-sys-color-outline-variant);
    border-radius: 2px;
    margin: 12px auto 2px;
}
.md3-bottom-nav__more-header { display: flex; align-items: center; justify-content: space-between; padding: 4px 12px 4px 20px; }
.md3-bottom-nav__more-title  { font-size: 15px; font-weight: 700; color: var(--md-sys-color-on-surface); }

.md3-bottom-nav__more-list {
    list-style: none;
    display: grid; grid-template-columns: 1fr 1fr;
    padding: 4px 10px 14px; gap: 2px;
}
.md3-bottom-nav__more-item {
    display: flex; align-items: center; gap: 12px;
    padding: 13px 14px;
    border-radius: 16px;
    font-size: 14px; font-weight: 500;
    color: var(--md-sys-color-on-surface-variant);
    position: relative; overflow: hidden;
    transition: background var(--md-motion-short) var(--md-ease-standard),
                color      var(--md-motion-short) var(--md-ease-standard);
    -webkit-tap-highlight-color: transparent;
}
.md3-bottom-nav__more-item::before {
    content: '';
    position: absolute; inset: 0; border-radius: inherit;
    background: currentColor; opacity: 0;
    transition: opacity var(--md-motion-short) var(--md-ease-standard);
}
.md3-bottom-nav__more-item:hover { background: color-mix(in srgb, var(--md-sys-color-primary) 6%, transparent); }
.md3-bottom-nav__more-item:active::before { opacity: 0.1; }
.md3-bottom-nav__more-item .material-symbols-rounded {
    font-size: 20px; color: var(--md-sys-color-primary);
    position: relative; z-index: 1; flex-shrink: 0;
}
.md3-bottom-nav__more-item span:last-child { position: relative; z-index: 1; }

@media (max-width: 767px) {
    .md3-main   { padding-bottom: 108px; }
    .md3-footer { padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px)); }
}

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

.md3-btn {
    position: relative;
    display: inline-flex; align-items: center; justify-content: center;
    gap: 8px; padding: 10px 24px;
    border-radius: var(--md-sys-shape-corner-full);
    border: none;
    font-size: 14px; font-weight: 500;
    cursor: pointer; overflow: hidden; white-space: nowrap;
    -webkit-tap-highlight-color: transparent;
    font-family: inherit;
    transition:
        background var(--md-motion-short) var(--md-ease-standard),
        box-shadow var(--md-motion-medium) var(--md-ease-emphasized),
        transform  var(--md-motion-short) var(--md-ease-emphasized);
}
.md3-btn::before {
    content: '';
    position: absolute; inset: 0; border-radius: inherit;
    background: currentColor; opacity: 0;
    transition: opacity var(--md-motion-short) var(--md-ease-standard);
}
.md3-btn:hover::before  { opacity: 0.08; }
.md3-btn:active         { transform: scale(0.97); }
.md3-btn:active::before { opacity: 0.14; }
.md3-btn:disabled       { opacity: .6; cursor: default; }

.md3-btn--filled       { background: var(--md-sys-color-primary); color: var(--md-sys-color-on-primary); }
.md3-btn--filled:hover { box-shadow: var(--md-sys-elevation-1); }

.md3-btn--tonal-primary       { background: var(--md-sys-color-primary-container); color: var(--md-sys-color-on-primary-container); }
.md3-btn--tonal-primary:hover { box-shadow: var(--md-sys-elevation-1); }

.md3-btn--outlined {
    background: transparent; color: var(--md-sys-color-primary);
    border: 1px solid var(--md-sys-color-outline);
}
.md3-btn--outlined:hover { border-color: var(--md-sys-color-primary); }

.md3-btn--large { padding: 14px 32px; font-size: 15px; }
.md3-btn--large .material-symbols-rounded { font-size: 20px; }

/* ============================================================================
   CHIPS
   ============================================================================ */

.md3-chip {
    display: inline-flex; align-items: center; gap: 8px;
    padding: 6px 16px;
    border-radius: var(--md-sys-shape-corner-small);
    font-size: 13px; font-weight: 500;
    border: 1px solid var(--md-sys-color-outline-variant);
    transition: background var(--md-motion-short) var(--md-ease-standard);
}
.md3-chip--assist { background: transparent; color: var(--md-sys-color-on-surface-variant); }
.md3-chip--assist:hover { background: var(--md-sys-color-surface-container); }
.md3-chip__icon  { font-size: 16px; color: var(--md-sys-color-primary); }

.gradient-text { color: var(--md-sys-color-on-background); }

/* ── Blog-specific tokens (layout + chart palette) ── */
:root {
    --bd-prose-width: 780px;
    --bd-container-width: 1320px;
    --bd-article-width: 860px;
    --bd-sidebar-width: 320px;
    --md-sys-motion-duration-short3: 150ms;
    --md-sys-motion-duration-short4: 200ms;
    --md-sys-motion-duration-medium1: 250ms;
    --md-sys-motion-duration-medium2: 300ms;
    --md-sys-motion-duration-medium3: 350ms;
    --md-sys-motion-duration-medium4: 400ms;
    --md-sys-motion-duration-long1: 450ms;
    --md-sys-motion-duration-long2: 500ms;
    --md-sys-motion-easing-standard: cubic-bezier(0.2, 0, 0, 1);
    --md-sys-motion-easing-emphasized: cubic-bezier(0.2, 0, 0, 1);
    --md-sys-motion-easing-emphasized-decelerate: cubic-bezier(0.05, 0.7, 0.1, 1);
    --md-sys-elevation-0: none;
    --md-sys-elevation-5: 0 16px 36px rgba(60,10,40,.12), 0 4px 10px rgba(60,10,40,.08);
    --md-sys-shape-corner-none: 0px;
    --c-charcoal: #1F1A1D;
    --c-slate:    #52434B;
    --data-viz-grid:       rgba(165, 33, 111, 0.12);
    --data-viz-grid-major: rgba(165, 33, 111, 0.22);
    --data-viz-primary:    #A5216F;
    --data-viz-secondary:  #3B2F9E;
    --data-viz-accent:     #EE2070;
}
body.dark {
    --md-sys-elevation-5: 0 16px 36px rgba(0,0,0,.55), 0 4px 10px rgba(0,0,0,.36);
    --data-viz-grid:       rgba(255, 176, 211, 0.12);
    --data-viz-grid-major: rgba(255, 176, 211, 0.20);
    --data-viz-primary:    #FFB0D3;
    --data-viz-secondary:  #C7BFFF;
    --data-viz-accent:     #FF86BC;
}

/* ============================================================================
   READING PROGRESS BAR
   ============================================================================ */
.bd-reading-progress {
    position: fixed;
    top: 0;
    left: 0;
    width: 0%;
    height: 3px;
    background: var(--brand-gradient);
    z-index: 10001;
    transition: width 0.1s linear;
    border-radius: 0 2px 2px 0;
}


/* ============================================================================
   SECTION HEADER (unified gradient text + accent bar)
   ============================================================================ */
.md3-section-header { margin-bottom: 32px; }

.md3-section-header__label {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.md3-section-header__accent { display: none; }

.md3-section-header__title {
    font-size: clamp(22px, 4vw, 32px);
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.02em;
}

.md3-section-header__sub {
    font-size: 14px;
    color: var(--md-sys-color-on-surface-variant);
    margin: 0;
    padding-left: 16px;
}

.gradient-text { color: var(--md-sys-color-on-background); }

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

.md3-footer { position: relative; margin-top: 72px; padding-top: 48px; background: transparent; }
.md3-footer::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 1px;
    background: var(--sk-line);
}
@media (max-width: 767px) { .md3-footer { margin-top: 48px; padding-top: 32px; } }

/* CTA card — logo gradient */
.md3-footer__cta {
    position: relative; z-index: 2;
    max-width: 1216px; width: calc(100% - 32px); margin: 0 auto;
    padding: 28px 32px; border-radius: 28px;
    display: flex; flex-direction: column; gap: 20px; align-items: flex-start;
    background: var(--brand-gradient);
    color: #fff;
    box-shadow: var(--md-sys-elevation-4);
    overflow: hidden;
}
.md3-footer__cta::after {
    content: 'memory'; font-family: 'Material Symbols Rounded'; font-size: 200px; line-height: 1;
    position: absolute; right: -20px; bottom: -60px; opacity: .14; pointer-events: none;
}
@media (min-width: 768px) {
    .md3-footer__cta { flex-direction: row; align-items: center; justify-content: space-between; padding: 36px 48px; }
}
.md3-footer__cta h3 { font-size: clamp(20px, 2.6vw, 28px); font-weight: 600; letter-spacing: -0.02em; margin-bottom: 4px; }
.md3-footer__cta p  { font-size: 14px; opacity: .9; }
.md3-footer__cta-btn { background: #fff; color: #A5216F; position: relative; z-index: 1; font-weight: 600; }

.md3-footer__inner {
    max-width: 1280px; margin: 0 auto;
    padding: 48px 24px 32px;
    display: grid; grid-template-columns: 1fr; row-gap: 44px;
}
@media (min-width: 768px) { .md3-footer__inner { padding: 48px 32px 40px; } }
@media (max-width: 480px) { .md3-footer__inner { padding: 40px 16px 28px; } }

.md3-footer__top { display: grid; grid-template-columns: 1fr; gap: 32px; align-items: start; }
@media (min-width: 900px) { .md3-footer__top { grid-template-columns: 1fr 1fr; gap: 64px; } }

.md3-footer__brand { display: flex; flex-direction: column; align-items: center; }
@media (min-width: 900px) { .md3-footer__brand { align-items: flex-start; } }
.md3-footer__lockup { display: flex; align-items: center; justify-content: center; }
.md3-footer__logo-wrap { display: flex; align-items: center; justify-content: center; }
.md3-footer__logo-img { height: 56px; width: auto; object-fit: contain; }
.md3-footer__logo-fallback {
    width: 72px; height: 72px;
    background: var(--md-sys-color-primary-container);
    border-radius: var(--md-sys-shape-corner-extra-large);
    display: flex; align-items: center; justify-content: center;
    font-size: 32px; font-weight: 600;
    color: var(--md-sys-color-on-primary-container);
}
.md3-footer__tagline {
    margin: 14px auto 0; font-size: 13px; line-height: 1.6; max-width: 340px;
    color: var(--md-sys-color-on-surface-variant); text-align: center;
}
@media (min-width: 900px) { .md3-footer__tagline { margin-inline: 0; text-align: left; } }

/* Newsletter */
.md3-newsletter {
    padding: 24px; border-radius: 24px;
    background: color-mix(in srgb, var(--md-sys-color-surface-container-high) 70%, transparent);
    border: 1px solid var(--md-sys-color-outline-variant);
    backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.md3-newsletter__title { font-size: 18px; font-weight: 600; letter-spacing: -.01em; margin-bottom: 4px; color: var(--md-sys-color-on-surface); }
.md3-newsletter__lead  { font-size: 13px; line-height: 1.5; margin-bottom: 16px; color: var(--md-sys-color-on-surface-variant); }
.md3-newsletter__form {
    display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 16px;
    border-radius: 999px; background: var(--md-sys-color-surface);
    border: 1.5px solid var(--md-sys-color-outline-variant);
    transition: border-color var(--md-motion-short), box-shadow var(--md-motion-short);
}
.md3-newsletter__form:focus-within {
    border-color: var(--md-sys-color-primary);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--md-sys-color-primary) 16%, transparent);
}
.md3-newsletter__form .material-symbols-rounded { font-size: 20px; color: var(--md-sys-color-on-surface-variant); }
.md3-newsletter__form input {
    flex: 1; min-width: 0; border: none; outline: none; background: transparent;
    font: inherit; font-size: 14px; padding: 10px 0; color: var(--md-sys-color-on-surface);
}
.md3-newsletter__form .md3-btn { padding: 10px 20px; }
.md3-newsletter__note { min-height: 1.2em; margin-top: 10px; font-size: 12px; color: var(--md-sys-color-on-surface-variant); }
.md3-newsletter__note.is-ok    { color: var(--md-sys-color-primary); }
.md3-newsletter__note.is-error { color: var(--md-sys-color-error); }

/* Link columns */
.md3-footer__links { display: grid; grid-template-columns: repeat(2,1fr); gap: 28px 24px; text-align: center; }
@media (min-width: 480px) { .md3-footer__links { grid-template-columns: repeat(4,1fr); } }
@media (min-width: 768px) { .md3-footer__links { text-align: left; } }
.md3-footer__col-title {
    font-size: 12px; letter-spacing: .12em; text-transform: uppercase; font-weight: 700;
    color: var(--md-sys-color-primary); margin: 0 0 16px;
}
.md3-footer__link {
    display: block; width: fit-content; font-size: 14px;
    color: var(--md-sys-color-on-surface-variant); margin-bottom: 10px;
    transition: color var(--md-motion-short), transform var(--md-motion-medium) var(--md-ease-emphasized);
}
.md3-footer__link:hover { color: var(--md-sys-color-primary); transform: translateX(4px); }
@media (max-width: 767px) { .md3-footer__link { margin-inline: auto; } }
@media (max-width: 480px) { .md3-footer__links { gap: 20px 28px; } }

.md3-footer__divider { height: 1px; background: var(--md-sys-color-outline-variant); margin: 0; }

.md3-footer__bottom {
    display: flex; flex-direction: column; align-items: center;
    gap: 14px 20px; text-align: center;
}
@media (min-width: 768px) {
    .md3-footer__bottom { flex-direction: row; flex-wrap: wrap; justify-content: space-between; text-align: left; }
}
.md3-footer__copyright { font-size: 13px; color: var(--md-sys-color-on-surface-variant); margin: 0; }
.md3-footer__meta { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.md3-footer__pill {
    font-size: 11px; font-weight: 600; letter-spacing: .02em;
    padding: 5px 12px; border-radius: 999px;
    border: 1px solid var(--md-sys-color-outline-variant);
    background: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface-variant);
}
.md3-footer__pill--brand { color: var(--md-sys-color-on-primary-container); background: var(--md-sys-color-primary-container); border-color: transparent; }

.md3-footer__social { display: flex; align-items: center; gap: 8px; }
.md3-footer__social .md3-icon-btn {
    background: var(--md-sys-color-surface-container-high);
    border: 1px solid var(--md-sys-color-outline-variant);
}
.social-icon-btn { color: var(--md-sys-color-on-surface-variant); }
.social-icon-btn:hover { color: var(--md-sys-color-primary); }
.md3-footer__social .md3-icon-btn:hover { background: var(--md-sys-color-primary-container); color: var(--md-sys-color-primary); }

/* Giant cropped wordmark */
.md3-footer__wordmark {
    display: block; overflow: hidden; text-align: center; white-space: nowrap;
    font-family: 'Montserrat', sans-serif; font-weight: 900; line-height: .8;
    letter-spacing: -0.04em;
    font-size: min(14vw, 220px);
    height: calc(min(14vw, 220px) * .5);
    margin-top: 8px;
    color: transparent; -webkit-text-stroke: 1.5px var(--md-sys-color-outline-variant);
    user-select: none; pointer-events: none;
}

/* ============================================================================
   BLOG DETAIL — LAYOUT
   ============================================================================ */
.md3-main { min-height: 100vh; }

.bd-container {
    max-width: var(--bd-container-width);
    margin: 0 auto;
    padding: 40px 32px 120px;
}

@media (max-width: 1024px) { .bd-container { padding: 32px 24px 100px; } }
@media (max-width: 768px)  { .bd-container { padding: 24px 16px 80px; } }

/* ── Desktop two-column grid ── */
.bd-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 32px;
    align-items: start;
}

@media (min-width: 1100px) {
    .bd-layout {
        grid-template-columns: minmax(0, 1fr) var(--bd-sidebar-width);
        gap: 40px;
    }
}

/* ── Sticky sidebar on desktop ── */
.bd-sidebar {
    display: none;
}

@media (min-width: 1100px) {
    .bd-sidebar {
        display: block;
        position: sticky;
        top: 88px; /* below header */
        max-height: calc(100vh - 108px);
        overflow-y: auto;
        overflow-x: hidden;
        scrollbar-width: thin;
        -ms-overflow-style: none;
    }
    .bd-sidebar::-webkit-scrollbar { width: 4px; }
    .bd-sidebar::-webkit-scrollbar-track { background: transparent; }
    .bd-sidebar::-webkit-scrollbar-thumb { background: var(--md-sys-color-outline-variant); border-radius: 99px; }
}

.bd-sidebar__card {
    background: var(--md-sys-color-surface-container-lowest);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-extra-large);
    overflow: hidden;
    margin-bottom: 20px;
    box-shadow: var(--md-sys-elevation-1);
    transition: border-color var(--md-sys-motion-duration-medium2);
}

body.dark .bd-sidebar__card {
    background: var(--md-sys-color-surface-container-low);
}

.bd-sidebar__card:hover {
    border-color: color-mix(in srgb, var(--md-sys-color-primary) 40%, transparent);
}

.bd-sidebar__card-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 20px 14px;
    font-size: 12px;
    font-weight: 700;
    color: var(--md-sys-color-on-surface-variant);
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
}

.bd-sidebar__card-header .material-symbols-rounded {
    font-size: 16px;
    color: var(--md-sys-color-primary);
}

/* Sidebar TOC */
.bd-sidebar-toc { padding: 10px 12px 14px; }

.bd-sidebar-toc-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 9px 12px;
    margin-bottom: 2px;
    background: none;
    border: none;
    border-left: 2px solid transparent;
    border-radius: 0 var(--md-sys-shape-corner-small) var(--md-sys-shape-corner-small) 0;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    color: var(--md-sys-color-on-surface-variant);
    line-height: 1.4;
    transition:
        border-color var(--md-sys-motion-duration-short4),
        background var(--md-sys-motion-duration-short4),
        color var(--md-sys-motion-duration-short4),
        padding-left var(--md-sys-motion-duration-medium1) var(--md-sys-motion-easing-emphasized);
}

.bd-sidebar-toc-item:hover {
    background: var(--md-sys-color-surface-container);
    color: var(--md-sys-color-on-surface);
    padding-left: 16px;
}

.bd-sidebar-toc-item.active {
    border-left-color: var(--md-sys-color-primary);
    background: color-mix(in srgb, var(--md-sys-color-primary) 8%, transparent);
    color: var(--md-sys-color-primary);
    font-weight: 600;
    padding-left: 16px;
}

.bd-sidebar-toc-item.level-3 {
    padding-left: 24px;
    font-size: 12px;
}

.bd-sidebar-toc-item.level-3:hover,
.bd-sidebar-toc-item.level-3.active { padding-left: 28px; }

/* Sidebar share */
.bd-sidebar-share { padding: 14px; }

.bd-sidebar-share-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.bd-sidebar-share-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 8px;
    background: var(--md-sys-color-surface-container);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-medium);
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    font-family: inherit;
    color: var(--md-sys-color-on-surface-variant);
    transition:
        background var(--md-sys-motion-duration-short4),
        border-color var(--md-sys-motion-duration-short4),
        color var(--md-sys-motion-duration-short4),
        transform var(--md-sys-motion-duration-medium1) var(--md-sys-motion-easing-emphasized);
    -webkit-tap-highlight-color: transparent;
}

.bd-sidebar-share-tile:hover {
    background: var(--md-sys-color-primary-container);
    border-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary-container);
    transform: translateY(-2px);
}

.bd-sidebar-share-tile svg {
    color: var(--md-sys-color-primary);
    transition: color var(--md-sys-motion-duration-short4);
}

.bd-sidebar-share-tile:hover svg {
    color: var(--md-sys-color-on-primary-container);
}

.bd-sidebar-share-tile--full {
    grid-column: 1 / -1;
    flex-direction: row;
    padding: 12px 16px;
    gap: 8px;
    font-size: 12px;
}

/* Sidebar copy feedback */
.bd-sidebar-copy-feedback {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    margin-top: 8px;
    background: color-mix(in srgb, var(--md-sys-color-primary) 10%, transparent);
    border-radius: var(--md-sys-shape-corner-small);
    font-size: 12px;
    font-weight: 600;
    color: var(--md-sys-color-primary);
    opacity: 0;
    transform: translateY(-4px);
    transition:
        opacity var(--md-sys-motion-duration-medium1),
        transform var(--md-sys-motion-duration-medium1) var(--md-sys-motion-easing-emphasized);
}

.bd-sidebar-copy-feedback.show { opacity: 1; transform: translateY(0); }

/* Hide FABs on desktop (sidebar has the actions) */
@media (min-width: 1100px) {
    .bd-fab-group { display: none !important; }
}

/* Breadcrumb */
.bd-breadcrumb {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.bd-breadcrumb__item {
    font-size: 13px;
    color: var(--md-sys-color-on-surface-variant);
    font-weight: 500;
    transition: color var(--md-sys-motion-duration-short4);
}

a.bd-breadcrumb__item:hover { color: var(--md-sys-color-primary); }

.bd-breadcrumb__item--current {
    color: var(--md-sys-color-on-surface);
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 200px;
}

.bd-breadcrumb__sep {
    font-size: 16px;
    color: var(--md-sys-color-outline);
    flex-shrink: 0;
}

/* ============================================================================
   HEADER CARD — Hero + Title + Meta + Actions bar
   ============================================================================ */
.bd-header-card {
    background: var(--md-sys-color-surface-container-lowest);
    border-radius: var(--md-sys-shape-corner-extra-large);
    overflow: hidden;
    box-shadow: var(--md-sys-elevation-2);
    margin-bottom: 20px;
    border: 1px solid var(--md-sys-color-outline-variant);
}

/* ============================================================================
   M3 EXPRESSIVE TYPE LAYER — Google Sans Flex
   ============================================================================
   Reuses the site's own chart palette (--data-viz-primary/accent/secondary,
   the logo's indigo to magenta to pink spectrum) as the expressive accent, instead of
   importing a foreign palette. The same colors that light up a benchmark
   chart now light up the article header. Dark mode falls out for free
   since those tokens already carry dark-mode values above.
   ============================================================================ */
:root {
    --mx-accent-a: #3B2F9E;
    --mx-accent-b: #A5216F;
    --mx-accent-c: #E0185F;
}
body.dark {
    --mx-accent-a: #B1A6FF;
    --mx-accent-b: #FF86BC;
    --mx-accent-c: #FFA3C9;
}

body.dark .bd-header-card {
    background: var(--md-sys-color-surface-container-low);
    box-shadow: var(--md-sys-elevation-3);
}

/* Thin gradient accent on bottom of header card */
.bd-header-card__divider {
    height: 1px;
    background: linear-gradient(90deg,
        transparent 0%,
        var(--md-sys-color-outline-variant) 20%,
        var(--md-sys-color-outline-variant) 80%,
        transparent 100%
    );
    margin: 0 24px;
}

/* ── Actions Bar ── */
.bd-actions-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    gap: 0;
    padding: 20px 32px 24px;
    gap: 20px;
}

@media (max-width: 768px) {
    .bd-actions-bar {
        flex-direction: column;
        padding: 16px 20px 20px;
        gap: 16px;
    }
}

.bd-actions-bar__group {
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 0;
}

.bd-actions-bar__group--util {
    flex: 1;
}

.bd-actions-bar__vdivider {
    width: 1px;
    align-self: stretch;
    background: var(--md-sys-color-outline-variant);
    flex-shrink: 0;
}

@media (max-width: 768px) {
    .bd-actions-bar__vdivider {
        width: auto;
        height: 1px;
        align-self: stretch;
    }
}

.bd-actions-bar__label {
    font-size: 10px;
    font-weight: 700;
    color: var(--md-sys-color-on-surface-variant);
}

.bd-actions-bar__share-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    row-gap: 6px;
}

.bd-actions-bar__util-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
    row-gap: 6px;
}

/* Mobile: tighten share row padding so pills don't clip */
@media (max-width: 480px) {
    .bd-actions-bar__share-row,
    .bd-actions-bar__util-row {
        gap: 5px;
    }
    .bd-share-btn--labeled {
        padding: 6px 10px 6px 9px !important;
        font-size: 11px !important;
    }
    .bd-action-chip {
        padding: 6px 11px;
        font-size: 11px;
    }
    .bd-action-chip--google {
        padding: 6px 12px 6px 10px;
    }
}

/* Labeled share button variant — must override fixed 36×36 from base */
.bd-share-btn--labeled {
    width: auto !important;
    height: auto !important;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 13px 7px 11px;
    border-radius: var(--md-sys-shape-corner-full);
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    white-space: nowrap;
    flex-shrink: 0;
}

.bd-share-btn--labeled svg {
    flex-shrink: 0;
    display: block;
}

.bd-share-btn--labeled span:last-child {
    line-height: 1;
}

/* Per-platform brand accent on hover */
.bd-share-btn--labeled[aria-label*="Twitter"]:hover,
.bd-share-btn--labeled[aria-label*="X ("]:hover {
    background: color-mix(in srgb, #000 10%, transparent);
    border-color: #000;
    color: #000;
}
body.dark .bd-share-btn--labeled[aria-label*="Twitter"]:hover,
body.dark .bd-share-btn--labeled[aria-label*="X ("]:hover {
    background: color-mix(in srgb, #fff 12%, transparent);
    border-color: #ddd;
    color: #fff;
}
.bd-share-btn--labeled[aria-label*="Facebook"]:hover {
    background: color-mix(in srgb, #1877F2 12%, transparent);
    border-color: #1877F2;
    color: #1877F2;
}
.bd-share-btn--labeled[aria-label*="LinkedIn"]:hover {
    background: color-mix(in srgb, #0A66C2 12%, transparent);
    border-color: #0A66C2;
    color: #0A66C2;
}
.bd-share-btn--labeled[aria-label*="Reddit"]:hover {
    background: color-mix(in srgb, #FF4500 12%, transparent);
    border-color: #FF4500;
    color: #FF4500;
}

/* Action chip — utility buttons */
.bd-action-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    background: var(--md-sys-color-surface-container);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-full);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    color: var(--md-sys-color-on-surface-variant);
    white-space: nowrap;
    transition:
        background var(--md-sys-motion-duration-short4),
        border-color var(--md-sys-motion-duration-short4),
        color var(--md-sys-motion-duration-short4),
        transform var(--md-sys-motion-duration-short3) var(--md-sys-motion-easing-emphasized);
    -webkit-tap-highlight-color: transparent;
}

.bd-action-chip .material-symbols-rounded {
    font-size: 16px;
}

.bd-action-chip:hover {
    background: var(--md-sys-color-primary-container);
    border-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary-container);
    transform: translateY(-1px);
}

.bd-action-chip--muted:hover {
    background: color-mix(in srgb, var(--md-sys-color-error) 10%, transparent);
    border-color: var(--md-sys-color-error);
    color: var(--md-sys-color-error);
}

/* Google "preferred source" chip — special treatment */
.bd-action-chip--google {
    background: var(--md-sys-color-surface-container-lowest);
    border-color: #DADCE0;
    color: #3C4043;
    font-size: 12px;
    font-weight: 600;
    gap: 8px;
    padding: 7px 16px 7px 12px;
}

body.dark .bd-action-chip--google {
    background: var(--md-sys-color-surface-container);
    border-color: var(--md-sys-color-outline-variant);
    color: var(--md-sys-color-on-surface);
}

.bd-action-chip--google:hover {
    background: #F8F9FA;
    border-color: #4285F4;
    color: #1A73E8;
    box-shadow: 0 1px 3px rgba(66,133,244,.25);
}

body.dark .bd-action-chip--google:hover {
    background: color-mix(in srgb, #4285F4 12%, transparent);
    border-color: #4285F4;
    color: #8AB4F8;
}

/* Bookmarked active state */
.bd-action-chip.bookmarked {
    background: var(--md-sys-color-primary-container);
    border-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary-container);
}

/* Listening active state */
.bd-action-chip.listening {
    background: color-mix(in srgb, var(--md-sys-color-tertiary) 15%, transparent);
    border-color: var(--md-sys-color-tertiary);
    color: var(--md-sys-color-tertiary);
    animation: listeningPulse 2s ease-in-out infinite;
}

@keyframes listeningPulse {
    0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--md-sys-color-tertiary) 30%, transparent); }
    50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--md-sys-color-tertiary) 0%, transparent); }
}

/* ============================================================================
   ARTICLE CARD — Content body (prose only)
   ============================================================================ */
.bd-content-card {
    padding: 0;
}

.bd-article {
    background: var(--md-sys-color-surface-container-lowest);
    border-radius: var(--md-sys-shape-corner-extra-large);
    overflow: hidden;
    box-shadow: var(--md-sys-elevation-2);
    margin-bottom: 56px;
    border: 1px solid var(--md-sys-color-outline-variant);
}

body.dark .bd-article {
    background: var(--md-sys-color-surface-container-low);
    box-shadow: var(--md-sys-elevation-3);
}

/* ── Hero Image — proper 16:9 ── */
.bd-hero {
    width: 100%;
    /* 16:9 aspect ratio */
    aspect-ratio: 16 / 9;
    overflow: hidden;
    position: relative;
    background: var(--md-sys-color-surface-container-high);
}

.bd-hero--fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg,
        var(--md-sys-color-surface-container-high) 0%,
        var(--md-sys-color-surface-container-highest) 100%
    );
}

.bd-hero__fallback-icon {
    font-size: 80px;
    color: var(--md-sys-color-outline);
    opacity: 0.4;
}

.bd-hero__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    /* Subtle zoom on load */
    transform: scale(1.03);
    transition: transform 0.8s var(--md-sys-motion-easing-emphasized);
}

.bd-article:hover .bd-hero__img { transform: scale(1); }

.bd-hero__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to bottom,
        transparent 50%,
        rgba(0,0,0,0.15) 100%
    );
    pointer-events: none;
}

/* ── Article Header ── */
.bd-header {
    padding: 48px 56px 40px;
    position: relative;
    overflow: hidden;
    isolation: isolate;
}

/* Layered color-wash blob — the signature element. Sits behind the title
   and badge, always visible whether or not the post has a hero image,
   since .bd-header renders after the hero and carries its own stacking
   context (isolation: isolate). */
/* Rainbow header blob removed — flat header, matches the rest of the site */
.bd-header::before { display: none; }

@media (max-width: 768px) { .bd-header { padding: 36px 28px 32px; } }
@media (max-width: 480px) { .bd-header { padding: 24px 20px 24px; } }

/* Category badge — expressive gradient pill in Google Sans Flex,
   using the same indigo→magenta→pink spectrum as the site's charts */
.bd-category-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 18px;
    background: var(--brand-gradient);
    color: #fff;
    border-radius: var(--md-sys-shape-corner-full);
    font-family: 'Google Sans Flex', 'Google Sans', sans-serif;
    font-variation-settings: 'wght' 650, 'ROND' 60, 'wdth' 100;
    font-size: 13px;
    margin-bottom: 20px;
    position: relative;
}

.bd-category-badge .material-symbols-rounded { font-size: 14px; color: #fff; }

.bd-title {
    font-family: 'Google Sans Flex', 'Google Sans Display', 'Google Sans', sans-serif;
    font-variation-settings: 'wght' 700, 'ROND' 20, 'wdth' 100;
    font-size: clamp(26px, 4.5vw, 48px);
    line-height: 1.12;
    letter-spacing: -0.02em;
    color: var(--md-sys-color-on-surface);
    margin: 0 0 28px;
    position: relative;
    padding-bottom: 24px;
}

/* First word rendered in the chart spectrum — the expressive accent,
   the same visual move as Google's own "Oh, hi!" Sans Flex showcase,
   adapted to the impliedtech logo spectrum (indigo to magenta to pink). */
.bd-title__accent {
    background: linear-gradient(120deg, var(--mx-accent-a), var(--mx-accent-b), var(--mx-accent-c));
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    font-variation-settings: 'wght' 820, 'ROND' 65, 'wdth' 104;
}

@supports not (background-clip: text) {
    .bd-title__accent { color: var(--mx-accent-a); }
}

/* Spectrum underline — same three hues, full accent bar under the title */
.bd-title::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 0;
    height: 6px;
    width: 96px;
    border-radius: var(--md-sys-shape-corner-full);
    background: linear-gradient(90deg, var(--mx-accent-a), var(--mx-accent-b), var(--mx-accent-c));
}

@media (prefers-reduced-motion: no-preference) {
    .bd-title__accent {
        display: inline-block;
        animation: mxTitleFlex 900ms var(--md-sys-motion-easing-emphasized-decelerate) both;
    }
    .bd-title::after {
        animation: mxUnderlineGrow 700ms var(--md-sys-motion-easing-emphasized-decelerate) 250ms both;
    }
}

@keyframes mxTitleFlex {
    0%   { font-variation-settings: 'wght' 320, 'ROND' 0,  'wdth' 108; opacity: 0; transform: translateY(6px); }
    60%  { font-variation-settings: 'wght' 860, 'ROND' 70, 'wdth' 102; opacity: 1; transform: translateY(0); }
    100% { font-variation-settings: 'wght' 820, 'ROND' 65, 'wdth' 104; opacity: 1; transform: translateY(0); }
}

@keyframes mxUnderlineGrow {
    from { width: 0; opacity: 0; }
    to   { width: 96px; opacity: 1; }
}

/* Meta row */
.bd-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin-bottom: 24px;
}

.bd-meta__chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 14px;
    background: var(--md-sys-color-surface-container-high);
    border-radius: var(--md-sys-shape-corner-full);
    font-size: 13px;
    color: var(--md-sys-color-on-surface);
    border: 1px solid var(--md-sys-color-outline-variant);
    transition:
        background var(--md-sys-motion-duration-short4),
        border-color var(--md-sys-motion-duration-short4);
}

.bd-meta__chip:hover {
    border-color: var(--mx-accent-b);
}
.bd-meta__chip:hover .material-symbols-rounded {
    color: var(--mx-accent-b);
}

/* Author chip gets a visible spectrum-tinted container, not just on hover —
   it's the most important chip in the row */
.bd-meta__chip--author {
    gap: 10px;
    padding: 6px 14px 6px 6px;
    background: linear-gradient(120deg,
        color-mix(in srgb, var(--mx-accent-a) 12%, var(--md-sys-color-surface-container-high)),
        color-mix(in srgb, var(--mx-accent-c) 12%, var(--md-sys-color-surface-container-high)));
    border-color: color-mix(in srgb, var(--mx-accent-a) 30%, var(--md-sys-color-outline-variant));
}

.bd-meta__chip .material-symbols-rounded {
    font-size: 16px;
    color: var(--md-sys-color-primary);
}

.bd-avatar {
    width: 32px; height: 32px;
    background: var(--brand-gradient);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.bd-avatar .material-symbols-rounded { font-size: 18px; color: #fff; }

.bd-meta__text { display: flex; flex-direction: column; gap: 1px; }
.bd-meta__name { font-size: 13px; font-weight: 700; color: var(--md-sys-color-on-surface); line-height: 1.2; }
.bd-meta__label { font-size: 10px; font-weight: 600; color: var(--md-sys-color-on-surface-variant); line-height: 1.2; }

/* Inline share */
.bd-share-inline {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.bd-share-inline__label {
    font-size: 12px;
    font-weight: 600;
    color: var(--md-sys-color-on-surface-variant);
}

.bd-share-btn {
    width: 36px; height: 36px;
    border-radius: var(--md-sys-shape-corner-full);
    border: 1px solid var(--md-sys-color-outline-variant);
    background: var(--md-sys-color-surface-container);
    color: var(--md-sys-color-on-surface-variant);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition:
        background var(--md-sys-motion-duration-short4),
        border-color var(--md-sys-motion-duration-short4),
        transform var(--md-sys-motion-duration-short3) var(--md-sys-motion-easing-emphasized);
    -webkit-tap-highlight-color: transparent;
}

.bd-share-btn:hover {
    background: var(--md-sys-color-primary-container);
    border-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary-container);
    transform: translateY(-2px);
}

/* ── Prose Content ── */
.bd-prose {
    padding: 0 56px 48px;
    font-size: 18px;
    line-height: 1.78;
    color: var(--md-sys-color-on-surface);
}

@media (max-width: 768px) { .bd-prose { padding: 0 28px 40px; font-size: 17px; } }
@media (max-width: 480px) { .bd-prose { padding: 0 20px 32px; font-size: 16px; } }

/* Prose typography */
.bd-prose h2 {
    font-family: 'Google Sans Display', sans-serif;
    font-size: clamp(22px, 3.5vw, 30px);
    font-weight: 700;
    margin: 52px 0 20px;
    color: var(--md-sys-color-on-surface);
    letter-spacing: -0.015em;
    line-height: 1.2;
    /* Accent bar matching index section headers */
    padding-left: 16px;
    border-left: 3px solid var(--md-sys-color-primary);
}

.bd-prose h3 {
    font-family: 'Google Sans Display', sans-serif;
    font-size: clamp(18px, 3vw, 24px);
    font-weight: 600;
    margin: 40px 0 16px;
    color: var(--md-sys-color-on-surface);
    line-height: 1.25;
}

.bd-prose h4 {
    font-size: 19px;
    font-weight: 600;
    margin: 32px 0 12px;
    color: var(--md-sys-color-on-surface);
}

.bd-prose p { margin: 0 0 16px; }

/* Links — primary green instead of Google blue */
.bd-prose a {
    color: var(--md-sys-color-primary);
    text-decoration: none;
    border-bottom: 1.5px solid color-mix(in srgb, var(--md-sys-color-primary) 35%, transparent);
    transition:
        border-color var(--md-sys-motion-duration-short4),
        color var(--md-sys-motion-duration-short4);
}

.bd-prose a:hover {
    color: color-mix(in srgb, var(--md-sys-color-primary) 80%, black);
    border-bottom-color: var(--md-sys-color-primary);
}

/* Images in prose — 16:9 enforced */
.bd-prose img {
    width: 100%;
    height: auto;
    aspect-ratio: 16 / 9;
    object-fit: cover;
    border-radius: var(--md-sys-shape-corner-large);
    margin: 36px 0;
    display: block;
    box-shadow: var(--md-sys-elevation-2);
}

.bd-prose ul, .bd-prose ol {
    margin: 0 0 16px;
    padding-left: 28px;
}

.bd-prose li { margin-bottom: 8px; }
.bd-prose li::marker { color: var(--md-sys-color-primary); }

.bd-prose strong { font-weight: 700; color: var(--md-sys-color-on-surface); }
.bd-prose em { font-style: italic; }

.bd-prose blockquote {
    border-left: 4px solid var(--md-sys-color-primary);
    background: color-mix(in srgb, var(--md-sys-color-primary) 6%, transparent);
    padding: 20px 24px;
    margin: 32px 0;
    border-radius: 0 var(--md-sys-shape-corner-medium) var(--md-sys-shape-corner-medium) 0;
    font-style: italic;
    color: var(--md-sys-color-on-surface-variant);
    font-size: 1.05em;
}

.bd-prose code {
    background: var(--md-sys-color-surface-container-highest);
    padding: 3px 8px;
    border-radius: var(--md-sys-shape-corner-extra-small);
    font-family: 'Roboto Mono', 'Courier New', monospace;
    font-size: 0.88em;
    color: var(--md-sys-color-primary);
    border: 1px solid var(--md-sys-color-outline-variant);
}

body.dark .bd-prose code { color: var(--md-sys-color-primary); }

.bd-prose pre {
    background: var(--md-sys-color-surface-container-high);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-large);
    padding: 24px;
    overflow-x: auto;
    margin: 32px 0;
    position: relative;
    box-shadow: var(--md-sys-elevation-1);
}

.bd-prose pre code {
    background: none;
    padding: 0;
    color: var(--md-sys-color-on-surface);
    border: none;
    font-size: 0.9em;
}

.bd-prose hr {
    border: none;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--md-sys-color-outline-variant) 20%, var(--md-sys-color-outline-variant) 80%, transparent);
    margin: 48px 0;
}

.bd-prose table {
    width: 100%;
    border-collapse: collapse;
    margin: 32px 0;
    font-size: 15px;
}

.bd-prose th, .bd-prose td {
    padding: 12px 16px;
    border: 1px solid var(--md-sys-color-outline-variant);
    text-align: left;
}

.bd-prose th {
    background: var(--md-sys-color-surface-container-high);
    font-weight: 700;
    color: var(--md-sys-color-on-surface);
}

/* Code copy button */
.bd-code-copy-btn {
    position: absolute;
    top: 10px; right: 10px;
    width: 34px; height: 34px;
    background: var(--md-sys-color-surface-container-highest);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-small);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    opacity: 0;
    transition:
        opacity var(--md-sys-motion-duration-short4),
        background var(--md-sys-motion-duration-short4),
        transform var(--md-sys-motion-duration-short3) var(--md-sys-motion-easing-emphasized);
}

.bd-prose pre:hover .bd-code-copy-btn { opacity: 1; }

.bd-code-copy-btn:hover {
    background: var(--md-sys-color-primary-container);
    transform: scale(1.08);
}

.bd-code-copy-btn .material-symbols-rounded { font-size: 16px; color: var(--md-sys-color-on-surface-variant); }

/* ── Tags ── */
.bd-tags {
    padding: 0 56px 48px;
}

@media (max-width: 768px) { .bd-tags { padding: 0 28px 40px; } }
@media (max-width: 480px) { .bd-tags { padding: 0 20px 32px; } }

.bd-tags__label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 700;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 16px;
}

.bd-tags__label .material-symbols-rounded { font-size: 16px; color: var(--md-sys-color-primary); }

.bd-tags__list { display: flex; flex-wrap: wrap; gap: 10px; }

.bd-tag {
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    background: var(--md-sys-color-tertiary-container);
    color: var(--md-sys-color-on-tertiary-container);
    border-radius: var(--md-sys-shape-corner-full);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition:
        background var(--md-sys-motion-duration-short4),
        transform var(--md-sys-motion-duration-medium1) var(--md-sys-motion-easing-emphasized),
        box-shadow var(--md-sys-motion-duration-medium1);
}

.bd-tag:hover {
    background: var(--md-sys-color-tertiary);
    color: var(--md-sys-color-on-tertiary);
    transform: translateY(-2px);
    box-shadow: var(--md-sys-elevation-1);
}

/* ── Author Card ── */
.bd-author-card {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    margin: 0 56px 40px;
    padding: 20px 24px;
    background: var(--md-sys-color-surface-container-lowest);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-large);
}

body.dark .bd-author-card {
    background: var(--md-sys-color-surface-container-low);
}

@media (max-width: 768px) { .bd-author-card { margin: 0 28px 32px; padding: 18px 20px; } }
@media (max-width: 480px) { .bd-author-card { margin: 0 20px 24px; padding: 16px; gap: 12px; } }

.bd-author-card__avatar {
    width: 48px; height: 48px;
    background: var(--brand-gradient);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.bd-author-card__avatar .material-symbols-rounded { font-size: 26px; color: #fff; }

.bd-author-card__body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.bd-author-card__label {
    font-size: 11px;
    font-weight: 700;
    color: var(--md-sys-color-on-surface-variant);
}

.bd-author-card__name {
    font-size: 16px;
    font-weight: 700;
    color: var(--md-sys-color-on-surface);
    margin-bottom: 4px;
}

.bd-author-card__bio {
    font-size: 14px;
    line-height: 1.55;
    color: var(--md-sys-color-on-surface-variant);
    margin: 0;
}

/* ── Article Footer ── */
.bd-article-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 20px 56px 40px;
    border-top: 1px solid var(--md-sys-color-outline-variant);
}

@media (max-width: 768px) { .bd-article-footer { padding: 20px 28px 32px; } }
@media (max-width: 480px) {
    .bd-article-footer {
        padding: 16px 20px 24px;
        flex-direction: column;
    }
}

.bd-back-btn .material-symbols-rounded {
    transition: transform var(--md-sys-motion-duration-short4);
}

.bd-back-btn:hover .material-symbols-rounded { transform: translateX(-4px); }

/* ============================================================================
   RELATED ARTICLES
   ============================================================================ */
.bd-related { margin-top: 64px; }

.bd-related-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

@media (max-width: 600px) { .bd-related-grid { grid-template-columns: 1fr; } }

.bd-related-card {
    background: var(--md-sys-color-surface-container-low);
    border-radius: var(--md-sys-shape-corner-large);
    overflow: hidden;
    text-decoration: none;
    border: 1px solid var(--md-sys-color-outline-variant);
    box-shadow: var(--md-sys-elevation-1);
    transition:
        transform var(--md-sys-motion-duration-medium3) var(--md-sys-motion-easing-emphasized),
        box-shadow var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-emphasized),
        border-color var(--md-sys-motion-duration-short4),
        border-radius var(--md-sys-motion-duration-medium1) var(--md-sys-motion-easing-emphasized);
    opacity: 0;
    transform: translateY(24px);
}

.bd-related-card.bd-animate-in {
    animation: bdSlideUp 0.5s var(--md-sys-motion-easing-emphasized-decelerate) forwards;
}

.bd-related-card:nth-child(2) { animation-delay: 0.08s; }
.bd-related-card:nth-child(3) { animation-delay: 0.16s; }

@keyframes bdSlideUp {
    to { opacity: 1; transform: translateY(0); }
}

.bd-related-card:hover {
    transform: translateY(-6px) scale(1.01);
    box-shadow: var(--md-sys-elevation-3);
    border-color: var(--md-sys-color-primary);
    border-radius: var(--md-sys-shape-corner-medium);
}

/* 16:9 related image */
.bd-related-img-wrap {
    width: 100%;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    position: relative;
    background: var(--md-sys-color-surface-container-high);
}

.bd-related-img-wrap--fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg,
        var(--md-sys-color-surface-container-high),
        var(--md-sys-color-surface-container-highest)
    );
}

.bd-related-img-wrap--fallback .material-symbols-rounded {
    font-size: 48px;
    color: var(--md-sys-color-outline);
    opacity: 0.5;
}

.bd-related-img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    transition: transform var(--md-sys-motion-duration-long1) var(--md-sys-motion-easing-emphasized);
}

.bd-related-card:hover .bd-related-img { transform: scale(1.06); }

.bd-related-body { padding: 20px; }

.bd-related-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 700;
    color: var(--md-sys-color-primary);
    background: color-mix(in srgb, var(--md-sys-color-primary) 10%, transparent);
    padding: 3px 8px;
    border-radius: var(--md-sys-shape-corner-extra-small);
    margin-bottom: 10px;
}

.bd-related-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--md-sys-color-on-surface);
    margin: 0 0 12px;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color var(--md-sys-motion-duration-short4);
}

.bd-related-card:hover .bd-related-title { color: var(--md-sys-color-primary); }

.bd-related-meta {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--md-sys-color-on-surface-variant);
}

.bd-related-meta .material-symbols-rounded { font-size: 14px; }

/* ============================================================================
   FLOATING ACTION BUTTONS
   ============================================================================ */
.bd-fab-group {
    position: fixed;
    bottom: 32px;
    right: 32px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    z-index: 100;
}

@media (max-width: 768px) { .bd-fab-group { bottom: 24px; right: 20px; gap: 10px; } }

.bd-fab {
    width: 52px; height: 52px;
    border-radius: var(--md-sys-shape-corner-large);
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: var(--md-sys-elevation-3);
    opacity: 0;
    transform: scale(0.8) translateY(8px);
    pointer-events: none;
    transition:
        opacity var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-emphasized),
        transform var(--md-sys-motion-duration-medium2) var(--md-sys-motion-easing-emphasized),
        box-shadow var(--md-sys-motion-duration-medium1);
    -webkit-tap-highlight-color: transparent;
}

.bd-fab.bd-fab--visible {
    opacity: 1;
    transform: scale(1) translateY(0);
    pointer-events: auto;
}

/* Stagger fab entries */
.bd-fab-group .bd-fab:nth-child(1) { transition-delay: 0.04s; }
.bd-fab-group .bd-fab:nth-child(2) { transition-delay: 0.08s; }
.bd-fab-group .bd-fab:nth-child(3) { transition-delay: 0.12s; }

.bd-fab--primary {
    background: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
}

.bd-fab--secondary {
    background: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface);
    border: 1px solid var(--md-sys-color-outline-variant);
}

.bd-fab:hover {
    transform: scale(1.06) translateY(-3px);
    box-shadow: var(--md-sys-elevation-4);
}

.bd-fab .material-symbols-rounded { font-size: 22px; }

@media (max-width: 768px) {
    .bd-fab { width: 46px; height: 46px; border-radius: 14px; }
    .bd-fab .material-symbols-rounded { font-size: 20px; }
}

/* ============================================================================
   PANELS (TOC + Share)
   ============================================================================ */
.bd-panel {
    position: fixed;
    top: 80px;
    right: -420px;
    width: 360px;
    max-height: calc(100vh - 110px);
    background: var(--md-sys-color-surface-container-lowest);
    border-radius: var(--md-sys-shape-corner-extra-large);
    border: 1px solid var(--md-sys-color-outline-variant);
    box-shadow: var(--md-sys-elevation-4);
    overflow: hidden;
    z-index: 201;
    transition: right 0.4s var(--md-sys-motion-easing-emphasized-decelerate);
}

body.dark .bd-panel { background: var(--md-sys-color-surface-container); }

.bd-panel.active { right: 28px; }

@media (max-width: 768px) {
    .bd-panel {
        right: -110%;
        width: calc(100% - 32px);
        max-width: 380px;
        top: 68px;
    }
    .bd-panel.active { right: 16px; }
}

.bd-panel__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    position: sticky;
    top: 0;
    background: inherit;
    z-index: 1;
}

.bd-panel__title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 15px;
    font-weight: 700;
    color: var(--md-sys-color-on-surface);
    margin: 0;
}

.bd-panel__title .material-symbols-rounded {
    font-size: 20px;
    color: var(--md-sys-color-primary);
}

.bd-panel__content {
    padding: 12px 16px 20px;
    overflow-y: auto;
    max-height: calc(100vh - 200px);
}

/* TOC items */
.bd-toc-item {
    display: block;
    width: 100%;
    text-align: left;
    padding: 10px 14px;
    margin-bottom: 4px;
    background: none;
    border: none;
    border-left: 3px solid transparent;
    border-radius: 0 var(--md-sys-shape-corner-medium) var(--md-sys-shape-corner-medium) 0;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    color: var(--md-sys-color-on-surface-variant);
    transition:
        border-color var(--md-sys-motion-duration-short4),
        background var(--md-sys-motion-duration-short4),
        padding-left var(--md-sys-motion-duration-medium1) var(--md-sys-motion-easing-emphasized),
        color var(--md-sys-motion-duration-short4);
    line-height: 1.4;
}

.bd-toc-item:hover {
    background: var(--md-sys-color-surface-container-high);
    padding-left: 18px;
    color: var(--md-sys-color-on-surface);
}

.bd-toc-item.active {
    border-left-color: var(--md-sys-color-primary);
    background: color-mix(in srgb, var(--md-sys-color-primary) 8%, transparent);
    color: var(--md-sys-color-primary);
    font-weight: 600;
    padding-left: 18px;
}

.bd-toc-item.level-3 { padding-left: 28px; font-size: 12px; }
.bd-toc-item.level-3:hover, .bd-toc-item.level-3.active { padding-left: 32px; }

/* Share grid */
.bd-share-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 16px;
}

.bd-share-tile {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 18px 12px;
    background: var(--md-sys-color-surface-container-high);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-large);
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    color: var(--md-sys-color-on-surface);
    transition:
        background var(--md-sys-motion-duration-short4),
        border-color var(--md-sys-motion-duration-short4),
        transform var(--md-sys-motion-duration-medium1) var(--md-sys-motion-easing-emphasized);
}

.bd-share-tile:hover {
    background: var(--md-sys-color-primary-container);
    border-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary-container);
    transform: translateY(-3px);
}

.bd-share-tile svg { color: var(--md-sys-color-primary); }

.bd-share-tile--full {
    grid-column: 1 / -1;
    flex-direction: row;
    padding: 14px 20px;
    gap: 10px;
}

.bd-copy-feedback {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: color-mix(in srgb, var(--md-sys-color-primary) 10%, transparent);
    border-radius: var(--md-sys-shape-corner-medium);
    font-size: 13px;
    font-weight: 600;
    color: var(--md-sys-color-primary);
    opacity: 0;
    transform: translateY(-8px);
    transition:
        opacity var(--md-sys-motion-duration-medium1),
        transform var(--md-sys-motion-duration-medium1) var(--md-sys-motion-easing-emphasized);
}

.bd-copy-feedback.show { opacity: 1; transform: translateY(0); }
.bd-copy-feedback .material-symbols-rounded { font-size: 18px; }

/* ============================================================================
   UTILITY
   ============================================================================ */
.hidden { display: none !important; }

.social-icon-btn { color: var(--md-sys-color-on-surface-variant); }
.social-icon-btn:hover { color: var(--md-sys-color-primary); }

/* ============================================================================
   SOKYO CHART ENGINE — blog_detail.css
   Premium chart block styles. Inherits M3 design tokens from :root.
   ============================================================================ */

/* ── Chart Block Wrapper ─────────────────────────────────────────────────── */
.sokyo-chart-block {
    margin: 2.5rem 0;
    background: var(--md-sys-color-surface-container-lowest);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-extra-large);
    padding: 28px 28px 24px;
    overflow: hidden;
    position: relative;
    /* Subtle entrance animation */
    opacity: 0;
    transform: translateY(16px);
    transition:
        opacity 0.6s var(--md-sys-motion-easing-emphasized-decelerate),
        transform 0.6s var(--md-sys-motion-easing-emphasized-decelerate),
        border-color var(--md-sys-motion-duration-medium2),
        box-shadow var(--md-sys-motion-duration-medium2);
    box-shadow: var(--md-sys-elevation-1);
}

/* Accent gradient top-border glow */
.sokyo-chart-block::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--md-sys-color-primary);
    opacity: 0;
    transition: opacity var(--md-sys-motion-duration-medium2);
}

.sokyo-chart-block.sokyo-chart--visible {
    opacity: 1;
    transform: translateY(0);
}

.sokyo-chart-block:hover {
    border-color: color-mix(in srgb, var(--md-sys-color-primary) 45%, transparent);
    box-shadow: var(--md-sys-elevation-2), 0 0 0 1px color-mix(in srgb, var(--md-sys-color-primary) 10%, transparent);
}

.sokyo-chart-block:hover::before {
    opacity: 1;
}

body.dark .sokyo-chart-block {
    background: var(--md-sys-color-surface-container-low);
}

.sokyo-chart-block--error {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--md-sys-color-error);
    font-size: 13px;
    padding: 16px 20px;
    background: color-mix(in srgb, var(--md-sys-color-error-container) 60%, transparent);
    border-color: var(--md-sys-color-error);
}

.sokyo-chart-block--error .material-symbols-rounded { font-size: 20px; flex-shrink: 0; }

/* ── Chart Header ────────────────────────────────────────────────────────── */
.sokyo-chart-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    gap: 12px;
}

.sokyo-chart-title-wrap {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

/* ── Chart Title ─────────────────────────────────────────────────────────── */
.sokyo-chart-title {
    font-family: 'Google Sans Display', 'Google Sans', sans-serif;
    font-size: 15px;
    font-weight: 700;
    letter-spacing: 0.1px;
    color: var(--md-sys-color-on-surface);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.sokyo-chart-title::before {
    content: '';
    display: inline-block;
    width: 3px;
    height: 16px;
    background: var(--md-sys-color-primary);
    border-radius: 99px;
    flex-shrink: 0;
}

.sokyo-chart-subtitle {
    font-size: 12px;
    color: var(--md-sys-color-on-surface-variant);
    font-weight: 400;
    padding-left: 11px; /* align with title text after the bar */
}

/* Chart type badge */
.sokyo-chart-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 10px;
    background: color-mix(in srgb, var(--md-sys-color-primary) 10%, transparent);
    border: 1px solid color-mix(in srgb, var(--md-sys-color-primary) 20%, transparent);
    border-radius: var(--md-sys-shape-corner-full);
    font-size: 10px;
    font-weight: 700;
    color: var(--md-sys-color-primary);
    flex-shrink: 0;
    margin-top: 2px;
}

.sokyo-chart-badge .material-symbols-rounded {
    font-size: 12px;
}

/* ── Canvas charts (bar, line, radar) ────────────────────────────────────── */
/* The wrapper owns the chart size (fixed height) and Chart.js fills it.
   Never put max-height / !important sizing on the canvas itself: that fights
   Chart.js's own sizing and causes constant resize "wobble". */
.sokyo-chart-canvas-wrap {
    position: relative;
    width: 100%;
    height: 340px;
}

.sokyo-chart-canvas-wrap--radar { height: 420px; }

.sokyo-chart-canvas {
    display: block;
    /* Let the page scroll vertically when a finger is on a chart */
    touch-action: pan-y;
}

.sokyo-donut-wrap {
    position: relative;
    display: flex;
    justify-content: center;
    width: 100%;
    max-width: 400px;
    height: 340px;
    margin: 0 auto;
}

@media (max-width: 600px) {
    .sokyo-chart-canvas-wrap { height: 280px; }
    .sokyo-chart-canvas-wrap--radar { height: 340px; }
    .sokyo-donut-wrap { height: 300px; }
}

/* ── KPI Cards ───────────────────────────────────────────────────────────── */
.sokyo-kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
}

.sokyo-kpi-card {
    background: var(--md-sys-color-surface-container);
    border: 1px solid var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-large);
    padding: 18px 16px;
    position: relative;
    overflow: hidden;
    transition:
        background var(--md-sys-motion-duration-short4),
        border-color var(--md-sys-motion-duration-short4),
        transform var(--md-sys-motion-duration-short4) var(--md-sys-motion-easing-emphasized),
        box-shadow var(--md-sys-motion-duration-short4);
}

/* Bottom gradient stripe per card */
.sokyo-kpi-card::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 3px;
    background: var(--md-sys-color-primary);
    opacity: 0;
    transition: opacity var(--md-sys-motion-duration-short4);
}

.sokyo-kpi-card:hover {
    border-color: color-mix(in srgb, var(--md-sys-color-primary) 50%, transparent);
    transform: translateY(-3px);
    box-shadow: var(--md-sys-elevation-2);
}

.sokyo-kpi-card:hover::after { opacity: 1; }

.sokyo-kpi__label {
    font-size: 11px;
    font-weight: 600;
    color: var(--md-sys-color-on-surface-variant);
    margin-bottom: 10px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sokyo-kpi__value {
    font-family: 'Google Sans Display', 'Montserrat', sans-serif;
    font-size: 30px;
    font-weight: 700;
    color: var(--md-sys-color-on-surface);
    line-height: 1.05;
    letter-spacing: -0.5px;
}

.sokyo-kpi__unit {
    font-size: 13px;
    font-weight: 500;
    color: var(--md-sys-color-on-surface-variant);
    margin-left: 3px;
    vertical-align: baseline;
    letter-spacing: 0;
}

.sokyo-kpi__trend {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 700;
    margin-top: 10px;
    padding: 3px 8px;
    border-radius: var(--md-sys-shape-corner-full);
    color: var(--md-sys-color-on-surface-variant);
    background: var(--md-sys-color-surface-container-high);
}

.sokyo-kpi__trend .material-symbols-rounded { font-size: 14px; }

.sokyo-kpi__trend--up {
    color: #16A34A;
    background: color-mix(in srgb, #16A34A 12%, transparent);
}

.sokyo-kpi__trend--down {
    color: var(--md-sys-color-error);
    background: color-mix(in srgb, var(--md-sys-color-error) 10%, transparent);
}

.sokyo-kpi__desc {
    font-size: 11px;
    color: var(--md-sys-color-on-surface-variant);
    margin-top: 6px;
    line-height: 1.45;
}

/* ── Comparison Table ────────────────────────────────────────────────────── */
.sokyo-compare-table {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--md-sys-shape-corner-medium);
    border: 1px solid var(--md-sys-color-outline-variant);
    overflow: hidden;
}

.sokyo-compare-row {
    display: flex;
    border-bottom: 1px solid var(--md-sys-color-outline-variant);
    transition: background var(--md-sys-motion-duration-short3);
}

.sokyo-compare-row:last-child { border-bottom: none; }

.sokyo-compare-row--header {
    border-bottom: 2px solid var(--md-sys-color-outline);
    position: sticky;
    top: 0;
    z-index: 2;
}

.sokyo-compare-cell {
    flex: 1;
    min-width: 120px;
    padding: 12px 16px;
    font-size: 13px;
    color: var(--md-sys-color-on-surface);
    vertical-align: middle;
    transition: background var(--md-sys-motion-duration-short3);
}

.sokyo-compare-cell--metric {
    flex: 0 0 160px;
    min-width: 160px;
    font-weight: 600;
    font-size: 12px;
    letter-spacing: 0.2px;
    color: var(--md-sys-color-on-surface-variant);
    background: var(--md-sys-color-surface-container);
    border-right: 1px solid var(--md-sys-color-outline-variant);
    position: sticky;
    left: 0;
    z-index: 1;
}

.sokyo-compare-row--header .sokyo-compare-cell--metric {
    font-size: 10px;
    background: var(--md-sys-color-surface-container-high);
}

.sokyo-compare-row--header .sokyo-compare-cell {
    font-weight: 700;
    font-size: 13px;
    background: var(--md-sys-color-surface-container-high);
    color: var(--md-sys-color-on-surface);
}

.sokyo-compare-cell--highlight {
    background: color-mix(in srgb, var(--md-sys-color-primary-container) 40%, transparent) !important;
}

.sokyo-compare-row--header .sokyo-compare-cell--highlight {
    color: var(--md-sys-color-primary);
    background: color-mix(in srgb, var(--md-sys-color-primary-container) 70%, transparent) !important;
}

.sokyo-compare-row:not(.sokyo-compare-row--header):hover .sokyo-compare-cell:not(.sokyo-compare-cell--metric) {
    background: color-mix(in srgb, var(--md-sys-color-surface-container-high) 70%, transparent);
}

.sokyo-compare-score {
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 6px;
}

.sokyo-compare-score--best {
    color: var(--md-sys-color-primary);
}

.sokyo-compare-score--best::after {
    content: ' ★';
    font-size: 10px;
    opacity: 0.8;
}

.sokyo-compare-bar-wrap {
    height: 5px;
    background: var(--md-sys-color-outline-variant);
    border-radius: 99px;
    overflow: hidden;
}

.sokyo-compare-bar {
    height: 100%;
    border-radius: 99px;
    opacity: 0.9;
    transition: width 1s var(--md-sys-motion-easing-emphasized-decelerate);
}

/* ── Mobile adjustments ──────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .sokyo-chart-block {
        padding: 18px 16px 16px;
        margin: 1.75rem -4px;
        border-radius: var(--md-sys-shape-corner-large);
    }

    .sokyo-kpi-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }

    .sokyo-kpi__value { font-size: 24px; }

    .sokyo-compare-cell--metric {
        flex: 0 0 120px;
        min-width: 120px;
        font-size: 11px;
        padding: 10px 10px;
    }

    .sokyo-compare-cell {
        min-width: 96px;
        padding: 10px 10px;
        font-size: 12px;
    }
}

/* ============================================================================
   AD SLOTS — AdSense containers
   ============================================================================ */
.bd-ad-slot {
    width: 100%;
    min-height: 100px;
    margin: 32px 0;
    padding: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--md-sys-color-surface-container-lowest);
    border: 1px dashed var(--md-sys-color-outline-variant);
    border-radius: var(--md-sys-shape-corner-large);
    overflow: hidden;
}

body.dark .bd-ad-slot {
    background: var(--md-sys-color-surface-container-low);
}

.bd-ad-slot .adsbygoogle {
    width: 100%;
}

.bd-ad-slot__label {
    font-size: 10px;
    font-weight: 700;
    color: var(--md-sys-color-on-surface-variant);
    opacity: 0.7;
}

/* In-article slot sits inside the padded prose card, so match bd-prose's horizontal padding */
.bd-ad-slot--in-article {
    margin: 8px 56px 32px;
    width: auto;
}

@media (max-width: 768px) {
    .bd-ad-slot--in-article {
        margin: 8px 28px 24px;
    }
}

@media (max-width: 480px) {
    .bd-ad-slot--in-article {
        margin: 8px 20px 20px;
    }
}

/* Sidebar slot: no border/label chrome of its own — the .bd-sidebar__card wrapper provides it */
.bd-ad-slot--sidebar {
    margin: 0;
    padding: 14px;
    border: none;
    border-radius: 0;
    min-height: 250px;
}
/* Force AdSense containers to respect parent width on all breakpoints */
ins.adsbygoogle {
    display: block !important;
    width: 100% !important;
    max-width: 100% !important;
    overflow: hidden;
}

.bd-ad-slot {
    max-width: 100%;
    box-sizing: border-box;
}

/* Prevent any residual horizontal scroll from ad iframes */
html, body {
    overflow-x: hidden;
}

@media (max-width: 480px) {
    .bd-ad-slot {
        min-height: 80px;
        padding: 8px;
        margin: 20px 0;
    }
    .bd-ad-slot--in-article {
        margin: 8px 12px 16px;
    }
    .bd-ad-slot--sidebar {
        min-height: 200px;
    }
}


/* ── Mobile: remove the bottom Share buttons (footer button + floating FAB) ── */
@media (max-width: 768px) {
    #shareToggleBtn,
    .bd-fab[aria-label="Share article"] { display: none !important; }
}


/* ============================================================================
   UNIFIED SURFACES — same card system as the homepage
   ============================================================================ */
.bd-header-card, .bd-content-card, .bd-article.bd-content-card,
.bd-sidebar__card, .bd-related-card, .sokyo-chart-block {
    background: var(--sk-card);
    border: 1px solid var(--sk-line);
    border-radius: var(--md-sys-shape-corner-extra-large);
}
body.dark .bd-header-card, body.dark .sokyo-chart-block { background: var(--sk-card); }
.bd-related-card {
    overflow: hidden;
    transition: transform var(--md-motion-medium) var(--md-ease-emphasized),
                box-shadow var(--md-motion-medium) var(--md-ease-emphasized),
                border-color var(--md-motion-short) var(--md-ease-standard);
}
.bd-related-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--md-sys-elevation-3);
    border-color: transparent;
}
.bd-author-card { background: var(--md-sys-color-surface-container); border: 1px solid var(--sk-line); }

@media print {
    .md3-top-app-bar, .md3-bottom-nav, .md3-footer, .bd-fab-group, .bd-ad-slot, button, nav { display: none !important; }
    body { background: #fff !important; color: #000 !important; }
}
