/* ==========================================================================
   Simply Foods: floating "plate" table of contents on single blog posts.
   Added 2026-11-23. Loaded only on is_singular('post') by
   basilico_child_toc_bubble_assets() in functions.php, with toc-bubble.js.

   - Bottom-left ivory plate (58px) with a gold reading-progress ring that
     fills as you read the article body, and the brand spoon-and-fork mark.
   - Tap / click / Enter opens a contents panel; Esc, outside tap or the
     close button shut it.
   - The bubble is the only table of contents: the old Elementor "Table of
     Contents" widget in the single-post sidebar (template 8674, widget
     b78336b) is hidden at every width (updated 2026-11-24). The rest of the
     sidebar (Categories, contact) moves up into its place. Pure CSS, not
     gated on the script, so the desktop sidebar doesn't jump on load.
   Colours: ivory #FAF6EE, gold #B69A60, palm green #183F35. No salmon.
   ========================================================================== */

/* Old Elementor TOC widget: replaced by the bubble. */
.elementor-location-single .elementor-widget-table-of-contents {
    display: none;
}

/* Headings the panel links to: land below the sticky header. */
.sf-toc-target {
    scroll-margin-top: 96px;
}
.sf-toc-target:focus {
    outline: none;
}
@media (min-width: 1200px) {
    .sf-toc-target {
        scroll-margin-top: 112px;
    }
}

.sf-toc {
    --sf-toc-gold: #B69A60;
    --sf-toc-gold-deep: #8C7140;
    --sf-toc-green: #183F35;
    --sf-toc-ivory: #FAF6EE;
    --sf-toc-paper: #FFFDF9;
    --sf-toc-size: 58px;
    --sf-toc-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
    position: fixed;
    left: 20px;
    /* Centre lines up with the gold back-to-top button (50px, 44px from the
       bottom once it is showing). */
    bottom: 40px;
    /* Above the sticky header (99) and back-to-top (99); below the theme's
       page overlay (603) and slide-out menus (604), so the mobile flyout covers it. */
    z-index: 600;
    width: var(--sf-toc-size);
    height: var(--sf-toc-size);
    font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    -webkit-tap-highlight-color: transparent;
}
@media (max-width: 767px) {
    .sf-toc {
        left: 16px;
    }
}

.sf-toc__sr {
    position: absolute !important;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

/* ---- The plate ---------------------------------------------------------- */
.sf-toc .sf-toc__bubble {
    -webkit-appearance: none;
    appearance: none;
    position: relative;
    display: block;
    box-sizing: border-box;
    width: var(--sf-toc-size);
    height: var(--sf-toc-size);
    min-width: 0;
    min-height: 0;
    max-width: none;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    overflow: visible;
    background: radial-gradient(circle at 34% 28%, #FFFFFF 0%, var(--sf-toc-ivory) 52%, #EFE7D6 100%);
    color: var(--sf-toc-gold-deep);
    font: inherit;
    line-height: 1;
    letter-spacing: 0;
    text-transform: none;
    cursor: pointer;
    box-shadow:
        0 12px 26px -8px rgba(24, 63, 53, 0.42),
        0 3px 8px rgba(24, 63, 53, 0.12),
        inset 0 0 0 1px rgba(182, 154, 96, 0.30);
    opacity: 0;
    transform: translateY(16px) scale(0.86);
    pointer-events: none;
    transition:
        opacity 0.28s ease,
        transform 0.32s var(--sf-toc-ease),
        box-shadow 0.2s ease;
}
/* Shown while reading the article, while the panel is open, and whenever it
   has keyboard focus (so Tab can always reach it, like a skip link). */
.sf-toc.is-shown .sf-toc__bubble,
.sf-toc.is-open .sf-toc__bubble,
.sf-toc .sf-toc__bubble:focus-visible {
    opacity: 1;
    transform: none;
    pointer-events: auto;
}
@media (hover: hover) {
    .sf-toc.is-shown .sf-toc__bubble:hover {
        transform: translateY(-2px);
        box-shadow:
            0 16px 32px -8px rgba(24, 63, 53, 0.48),
            0 4px 10px rgba(24, 63, 53, 0.14),
            inset 0 0 0 1px rgba(182, 154, 96, 0.45);
    }
}
.sf-toc.is-shown .sf-toc__bubble:active {
    transform: scale(0.95);
}
.sf-toc .sf-toc__bubble:focus {
    outline: none;
}
.sf-toc .sf-toc__bubble:focus-visible {
    outline: 2px solid var(--sf-toc-green);
    outline-offset: 3px;
}

.sf-toc__plate {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
}
.sf-toc__track {
    fill: none;
    stroke: rgba(182, 154, 96, 0.22);
    stroke-width: 3.25;
}
.sf-toc__ring {
    fill: none;
    stroke: var(--sf-toc-gold);
    stroke-width: 3.25;
    stroke-linecap: round;
    stroke-dasharray: 100 100;
    stroke-dashoffset: 100;
    transition: stroke-dashoffset 0.15s linear, opacity 0.2s ease;
}
.sf-toc[data-progress="0"] .sf-toc__ring {
    opacity: 0;
}
.sf-toc__well {
    stroke: rgba(182, 154, 96, 0.42);
    stroke-width: 1;
}

/* Spoon-and-fork mark, swaps to an X while the panel is open. */
.sf-toc__icon {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 24px;
    height: 24px;
    margin: -12px 0 0 -12px;
    pointer-events: none;
    transition: opacity 0.2s ease, transform 0.3s var(--sf-toc-ease);
}
.sf-toc__icon--close {
    color: var(--sf-toc-green);
    opacity: 0;
    transform: rotate(-45deg) scale(0.6);
}
.sf-toc.is-open .sf-toc__icon--mark {
    opacity: 0;
    transform: rotate(45deg) scale(0.6);
}
.sf-toc.is-open .sf-toc__icon--close {
    opacity: 1;
    transform: none;
}

/* ---- The panel ---------------------------------------------------------- */
.sf-toc__panel {
    position: absolute;
    left: 0;
    bottom: calc(100% + 12px);
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    width: min(360px, calc(100vw - 32px));
    /* Stays below the sticky header (73px phone / 85px desktop). */
    max-height: min(640px, calc(100vh - 210px));
    max-height: min(640px, calc(100dvh - 210px));
    background: var(--sf-toc-paper);
    color: var(--sf-toc-green);
    border: 1px solid rgba(182, 154, 96, 0.30);
    border-radius: 18px;
    box-shadow:
        0 28px 60px -20px rgba(24, 63, 53, 0.50),
        0 6px 16px rgba(24, 63, 53, 0.10);
    text-align: left;
    opacity: 0;
    transform: translateY(10px) scale(0.94);
    transform-origin: 29px calc(100% + 41px);
    transition: opacity 0.2s ease, transform 0.28s var(--sf-toc-ease);
}
.sf-toc__panel[hidden] {
    display: none;
}
.sf-toc__panel.is-in {
    opacity: 1;
    transform: none;
}

.sf-toc__head {
    position: relative;
    flex: none;
    padding: 18px 64px 16px 22px;
}
.sf-toc__eyebrow {
    margin: 0 0 4px;
    padding: 0;
    color: var(--sf-toc-gold-deep);
    font-size: 11px;
    font-weight: 600;
    line-height: 1.4;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}
.sf-toc__title {
    margin: 0;
    padding: 0;
    color: var(--sf-toc-green);
    font-family: "Cormorant Garamond", Georgia, "Times New Roman", serif;
    font-size: 27px;
    font-weight: 600;
    line-height: 1.1;
    letter-spacing: 0;
}
/* Hairline under the header doubles as a slim progress bar. */
.sf-toc__bar {
    position: absolute;
    left: 22px;
    right: 22px;
    bottom: 0;
    height: 2px;
    border-radius: 2px;
    background: rgba(182, 154, 96, 0.20);
    overflow: hidden;
}
.sf-toc__bar span {
    display: block;
    height: 100%;
    background: var(--sf-toc-gold);
    transform-origin: 0 50%;
    transform: scaleX(0);
    transition: transform 0.15s linear;
}

.sf-toc .sf-toc__close {
    -webkit-appearance: none;
    appearance: none;
    position: absolute;
    top: 14px;
    right: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    width: 38px;
    height: 38px;
    min-width: 0;
    min-height: 0;
    margin: 0;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: rgba(24, 63, 53, 0.06);
    color: var(--sf-toc-green);
    line-height: 1;
    letter-spacing: 0;
    text-transform: none;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease;
}
.sf-toc .sf-toc__close svg {
    width: 18px;
    height: 18px;
}
.sf-toc .sf-toc__close:hover {
    background: rgba(182, 154, 96, 0.22);
}
.sf-toc .sf-toc__close:focus {
    outline: none;
}
.sf-toc .sf-toc__close:focus-visible {
    outline: 2px solid var(--sf-toc-green);
    outline-offset: 2px;
}

.sf-toc__nav {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: rgba(182, 154, 96, 0.5) transparent;
    padding: 10px 10px 16px;
    /* Soft fade at the bottom edge when the list scrolls. */
    -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 18px), transparent);
    mask-image: linear-gradient(to bottom, #000 calc(100% - 18px), transparent);
}
.sf-toc .sf-toc__list,
.sf-toc .sf-toc__sub {
    list-style: none;
    margin: 0;
    padding: 0;
}
.sf-toc .sf-toc__item {
    margin: 0;
    padding: 0;
    list-style: none;
}
.sf-toc .sf-toc__item::before,
.sf-toc .sf-toc__item::marker {
    content: none;
}
.sf-toc .sf-toc__sub {
    margin: 0 0 4px 34px;
    border-left: 1px solid rgba(182, 154, 96, 0.35);
}

.sf-toc .sf-toc__link {
    position: relative;
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 12px;
    color: var(--sf-toc-green);
    font-size: 15px;
    font-weight: 500;
    line-height: 1.38;
    text-decoration: none;
    transition: background-color 0.18s ease, color 0.18s ease;
}
.sf-toc .sf-toc__sub .sf-toc__link {
    padding: 7px 12px 7px 14px;
    border-radius: 0 10px 10px 0;
    color: rgba(24, 63, 53, 0.80);
    font-size: 14px;
    font-weight: 400;
}
.sf-toc .sf-toc__num {
    flex: none;
    min-width: 18px;
    color: var(--sf-toc-gold-deep);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.04em;
    font-variant-numeric: tabular-nums;
}
.sf-toc .sf-toc__link:hover {
    background: rgba(182, 154, 96, 0.10);
    color: var(--sf-toc-green);
}
.sf-toc .sf-toc__link:focus {
    outline: none;
}
.sf-toc .sf-toc__link:focus-visible {
    outline: 2px solid var(--sf-toc-green);
    outline-offset: -2px;
}
/* Current section */
.sf-toc .sf-toc__link[aria-current] {
    background: rgba(182, 154, 96, 0.16);
    color: var(--sf-toc-green);
    font-weight: 600;
}
.sf-toc .sf-toc__link[aria-current]::before {
    content: "";
    position: absolute;
    left: 0;
    top: 9px;
    bottom: 9px;
    width: 3px;
    border-radius: 3px;
    background: var(--sf-toc-gold);
}
.sf-toc .sf-toc__sub .sf-toc__link[aria-current]::before {
    left: -2px;
    top: 6px;
    bottom: 6px;
}

/* ---- Motion, contrast, print -------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    .sf-toc .sf-toc__bubble,
    .sf-toc.is-shown .sf-toc__bubble:hover,
    .sf-toc.is-shown .sf-toc__bubble:active,
    .sf-toc__panel,
    .sf-toc__icon,
    .sf-toc__icon--close,
    .sf-toc.is-open .sf-toc__icon--mark {
        transform: none;
    }
    .sf-toc .sf-toc__bubble,
    .sf-toc__panel,
    .sf-toc__icon {
        transition: opacity 0.12s linear;
    }
    .sf-toc__ring,
    .sf-toc__bar span {
        transition: none;
    }
}
@media (forced-colors: active) {
    .sf-toc .sf-toc__bubble,
    .sf-toc__panel {
        border: 2px solid CanvasText;
    }
    .sf-toc__ring {
        stroke: Highlight;
    }
}
@media print {
    .sf-toc {
        display: none !important;
    }
}
