/**
 * Links Directory – premium design system
 * Used by the category archive and single link templates.
 *
 * Every rule is scoped under `.ld` so theme styles can't leak in and these
 * styles can't leak out. Tweak the look through the custom properties below.
 */

/* ==========================================================================
   1. Design tokens
   ========================================================================== */
.ld {
    --lx-accent: #4f46e5;
    --lx-accent-hover: #4338ca;
    --lx-accent-soft: #eef2ff;
    --lx-accent-ink: #3730a3;

    --lx-ink: #0f172a;
    --lx-ink-2: #334155;
    --lx-muted: #64748b;
    --lx-line: #e2e8f0;
    --lx-line-strong: #cbd5e1;
    --lx-surface: #ffffff;
    --lx-bg: #f8fafc;

    --lx-r-sm: 10px;
    --lx-r-md: 16px;
    --lx-r-lg: 22px;

    --lx-shadow-sm: 0 1px 2px rgba(15, 23, 42, .04);
    --lx-shadow-md: 0 10px 28px -10px rgba(15, 23, 42, .16);

    --lx-gap: 24px;
    --lx-sticky-top: 24px; /* raise if your theme has a sticky header */

    --lx-font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@supports (color: color-mix(in srgb, red, blue)) {
    .ld {
        --lx-accent-hover: color-mix(in srgb, var(--lx-accent) 84%, #000);
        --lx-accent-soft: color-mix(in srgb, var(--lx-accent) 9%, #fff);
        --lx-accent-ink: color-mix(in srgb, var(--lx-accent) 72%, #000);
    }
}

/* ==========================================================================
   2. Base / theme neutralising
   ========================================================================== */
.ld-primary {
    width: 100% !important;
    max-width: none !important;
    float: none !important;
    flex: 1 1 100%;
}

.ld {
    font-family: var(--lx-font);
    color: var(--lx-ink-2);
    font-size: 16px;
    line-height: 1.6;
    margin: 0;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

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

.ld .ld__container {
    max-width: 1440px;
    margin: 0 auto;
    padding: 32px 24px 72px;
}

.ld h1,
.ld h2,
.ld h3 {
    font-family: inherit;
    color: var(--lx-ink);
    margin: 0;
    text-transform: none;
}

.ld p { margin: 0; }

.ld ul,
.ld ol {
    margin: 0;
    padding: 0;
    list-style: none;
}

.ld li { margin: 0; }

.ld a {
    text-decoration: none;
    box-shadow: none;
    border-bottom: 0;
}

.ld a:focus-visible,
.ld summary:focus-visible,
.ld input:focus-visible {
    outline: 3px solid var(--lx-accent);
    outline: 3px solid color-mix(in srgb, var(--lx-accent) 45%, transparent);
    outline-offset: 2px;
}

.ld .ld-icon { flex: none; display: inline-block; vertical-align: middle; }

.ld .ld-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;
}

/* ==========================================================================
   3. Media (image / logo / initial)
   ========================================================================== */
.ld .ld-media {
    position: relative;
    display: block;
    overflow: hidden;
    background: var(--lx-bg);
}

.ld .ld-media__img {
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
}

.ld .ld-media__ph {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 2.6rem;
    font-weight: 700;
    letter-spacing: -.02em;
    color: hsl(var(--lx-hue) 42% 32%);
    background:
        radial-gradient(circle at 20% 15%, hsl(var(--lx-hue) 90% 97%), transparent 60%),
        linear-gradient(135deg, hsl(var(--lx-hue) 78% 94%), hsl(calc(var(--lx-hue) + 35) 72% 89%));
}

.ld .ld-media__ph--logo img {
    width: 64px;
    height: 64px;
    object-fit: contain;
    border-radius: 14px;
    background: #fff;
    padding: 10px;
    box-shadow: 0 6px 18px -8px rgba(15, 23, 42, .25);
}

/* ==========================================================================
   4. Components
   ========================================================================== */

/* ---- Panel ------------------------------------------------------------- */
.ld .ld-panel {
    background: var(--lx-surface);
    border: 1px solid var(--lx-line);
    border-radius: var(--lx-r-md);
    padding: 20px;
    box-shadow: var(--lx-shadow-sm);
}

.ld .ld-panel-title {
    margin-bottom: 14px;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--lx-muted);
}

/* ---- Chip -------------------------------------------------------------- */
.ld .ld-chip {
    display: inline-block;
    margin-top: 20px;
    padding: 4px 12px;
    font-size: .8125rem;
    font-weight: 600;
    color: var(--lx-accent-ink);
    background: var(--lx-accent-soft);
    border-radius: 999px;
}

/* ---- Rating ------------------------------------------------------------ */
.ld .ld-rating {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 8px;
    font-size: .75rem;
    font-weight: 700;
    line-height: 1.6;
    color: #92400e;
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: 999px;
    white-space: nowrap;
}

.ld .ld-rating .ld-icon { color: #f59e0b; }
.ld .ld-rating__max { font-weight: 500; color: #b45309; opacity: .75; }

.ld .ld-stars-wrap { display: inline-flex; align-items: center; gap: 8px; }

.ld .ld-stars {
    font-size: 1.05rem;
    letter-spacing: 2px;
    line-height: 1;
    background: linear-gradient(90deg, #f59e0b var(--lx-fill), var(--lx-line-strong) var(--lx-fill));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.ld .ld-stars__text { font-weight: 700; color: var(--lx-ink); }
.ld .ld-stars__text span { font-weight: 500; color: var(--lx-muted); }

/* ---- Cards ------------------------------------------------------------- */
.ld .ld-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: var(--lx-gap);
}

.ld .ld-card {
    position: relative;
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--lx-surface);
    border: 1px solid var(--lx-line);
    border-radius: var(--lx-r-md);
    overflow: hidden;
    box-shadow: var(--lx-shadow-sm);
    transition: transform .25s ease, box-shadow .25s ease, border-color .25s ease;
}

.ld .ld-card:hover,
.ld .ld-card:focus-within {
    transform: translateY(-3px);
    border-color: var(--lx-line-strong);
    box-shadow: var(--lx-shadow-md);
}

.ld .ld-card__media { aspect-ratio: 16 / 10; }

.ld .ld-card__media .ld-media__img { transition: transform .6s cubic-bezier(.2, .7, .2, 1); }
.ld .ld-card:hover .ld-media__img { transform: scale(1.045); }

.ld .ld-card__body {
    display: flex;
    flex: 1;
    flex-direction: column;
    padding: 16px 18px 14px;
}

.ld .ld-card__meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    min-height: 24px;
    margin-bottom: 8px;
}

.ld .ld-card__domain,
.ld .ld-card__cat {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    min-width: 0;
    overflow: hidden;
    font-size: .75rem;
    font-weight: 500;
    color: var(--lx-muted);
    white-space: nowrap;
    text-overflow: ellipsis;
}

.ld .ld-card__cat {
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--lx-accent-ink);
}

.ld .ld-card__title {
    font-size: 1.0625rem;
    font-weight: 650;
    line-height: 1.35;
    letter-spacing: -.01em;
}

.ld .ld-card__link {
    color: var(--lx-ink);
    transition: color .2s ease;
}

/* Stretched link: the whole card is clickable */
.ld .ld-card__link::after {
    content: "";
    position: absolute;
    inset: 0;
    z-index: 1;
}

.ld .ld-card__link:hover,
.ld .ld-card:hover .ld-card__link { color: var(--lx-accent); }

.ld .ld-card__link:focus-visible { outline: 0; }
.ld .ld-card__link:focus-visible::after {
    outline: 3px solid var(--lx-accent);
    outline: 3px solid color-mix(in srgb, var(--lx-accent) 55%, transparent);
    outline-offset: -3px;
    border-radius: var(--lx-r-md);
}

.ld .ld-card__excerpt {
    margin-top: 8px;
    font-size: .875rem;
    line-height: 1.55;
    color: var(--lx-muted);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ld .ld-card__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 14px;
}

.ld .ld-card__more {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: .8125rem;
    font-weight: 600;
    color: var(--lx-accent);
}

.ld .ld-card__more .ld-icon { transition: transform .25s ease; }
.ld .ld-card:hover .ld-card__more .ld-icon { transform: translateX(3px); }

.ld .ld-card__visit {
    position: relative;
    z-index: 2; /* above the stretched title link */
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    color: var(--lx-muted);
    background: var(--lx-bg);
    border: 1px solid var(--lx-line);
    border-radius: 10px;
    transition: color .2s ease, background-color .2s ease, border-color .2s ease;
}

.ld .ld-card__visit:hover,
.ld .ld-card__visit:focus-visible {
    color: #fff;
    background: var(--lx-accent);
    border-color: var(--lx-accent);
}

/* ---- Mini list (sidebars) --------------------------------------------- */
.ld .ld-minilist { display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; margin: 0 -8px; }

.ld .ld-mini__link {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: 12px;
    color: inherit;
    transition: background-color .2s ease;
}

.ld .ld-mini__link:hover,
.ld .ld-mini__link:focus-visible { background: var(--lx-bg); }

.ld .ld-mini__media {
    flex: none;
    width: 52px;
    height: 52px;
    border-radius: 12px;
    border: 1px solid var(--lx-line);
}

.ld .ld-mini__media .ld-media__ph { font-size: 1.25rem; }
.ld .ld-mini__media .ld-media__ph--logo img { width: 34px; height: 34px; padding: 5px; border-radius: 8px; }

.ld .ld-mini__text { display: block; min-width: 0; }

.ld .ld-mini__cat {
    display: block;
    font-size: .6875rem;
    font-weight: 700;
    letter-spacing: .05em;
    text-transform: uppercase;
    color: var(--lx-accent-ink);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.ld .ld-mini__title {
    font-size: .9375rem;
    font-weight: 600;
    line-height: 1.3;
    color: var(--lx-ink);
    transition: color .2s ease;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ld .ld-mini__link:hover .ld-mini__title { color: var(--lx-accent); }

.ld .ld-mini__desc {
    display: block;
    margin-top: 2px;
    font-size: .8125rem;
    line-height: 1.4;
    color: var(--lx-muted);
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

/* ---- Button ------------------------------------------------------------ */
.ld .ld-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 50px;
    padding: 0 28px;
    font-size: 1rem;
    font-weight: 650;
    line-height: 1;
    color: #fff;
    background: var(--lx-accent);
    border: 0;
    border-radius: 14px;
    box-shadow: 0 1px 2px rgba(15, 23, 42, .12), 0 10px 22px -10px var(--lx-accent);
    transition: transform .2s ease, background-color .2s ease, box-shadow .2s ease;
}

.ld .ld-btn:hover,
.ld .ld-btn:focus-visible {
    color: #fff;
    background: var(--lx-accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 1px 2px rgba(15, 23, 42, .12), 0 14px 26px -10px var(--lx-accent);
}

.ld .ld-btn:active { transform: translateY(0); }
.ld .ld-btn .ld-icon { transition: transform .2s ease; }
.ld .ld-btn:hover .ld-icon { transform: translate(2px, -2px); }

/* ---- Badges / tags ----------------------------------------------------- */
.ld .ld-badges { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }

.ld .ld-badge {
    display: inline-block;
    padding: 4px 12px;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--lx-accent-ink);
    background: var(--lx-accent-soft);
    border-radius: 999px;
    transition: background-color .2s ease, color .2s ease;
}

.ld .ld-badge:hover,
.ld .ld-badge:focus-visible { color: #fff; background: var(--lx-accent); }

.ld .ld-tags { margin-top: 28px; }
.ld .ld-tags__title {
    margin-bottom: 10px;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--lx-muted);
}
.ld .ld-tags__list { display: flex; flex-wrap: wrap; gap: 8px; }

.ld .ld-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    font-size: .8125rem;
    font-weight: 500;
    color: var(--lx-ink-2);
    background: var(--lx-surface);
    border: 1px solid var(--lx-line);
    border-radius: 999px;
    transition: color .2s ease, border-color .2s ease, background-color .2s ease;
}

.ld .ld-tag:hover,
.ld .ld-tag:focus-visible {
    color: var(--lx-accent-ink);
    background: var(--lx-accent-soft);
    border-color: var(--lx-accent);
}

/* ---- Pagination -------------------------------------------------------- */
.ld .ld-pagination { margin-top: 40px; }
.ld .ld-pagination__list { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }

.ld .ld-pagination .page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    height: 42px;
    padding: 0 12px;
    font-size: .9375rem;
    font-weight: 600;
    color: var(--lx-ink-2);
    background: var(--lx-surface);
    border: 1px solid var(--lx-line);
    border-radius: 12px;
    transition: color .2s ease, border-color .2s ease, background-color .2s ease;
}

.ld .ld-pagination a.page-numbers:hover,
.ld .ld-pagination a.page-numbers:focus-visible {
    color: var(--lx-accent);
    border-color: var(--lx-accent);
    background: var(--lx-accent-soft);
}

.ld .ld-pagination .page-numbers.current {
    color: #fff;
    background: var(--lx-accent);
    border-color: var(--lx-accent);
}

.ld .ld-pagination .page-numbers.dots { border-color: transparent; background: transparent; }

/* ---- Empty state ------------------------------------------------------- */
.ld .ld-empty {
    display: grid;
    justify-items: center;
    gap: 10px;
    padding: 64px 24px;
    text-align: center;
    background: var(--lx-surface);
    border: 1px dashed var(--lx-line-strong);
    border-radius: var(--lx-r-lg);
}

.ld .ld-empty__icon {
    display: grid;
    place-items: center;
    width: 60px;
    height: 60px;
    color: var(--lx-accent);
    background: var(--lx-accent-soft);
    border-radius: 18px;
}

.ld .ld-empty__title { font-size: 1.25rem; font-weight: 650; }
.ld .ld-empty__text { max-width: 40ch; color: var(--lx-muted); }

/* ---- Section heading --------------------------------------------------- */
.ld .ld-section-head { margin-bottom: 24px; }
.ld .ld-section-head__title { font-size: 1.5rem; font-weight: 700; letter-spacing: -.02em; }
.ld .ld-section-head__sub { margin-top: 4px; color: var(--lx-muted); }

/* ==========================================================================
   5. Category page
   ========================================================================== */
.ld .ld-hero {
    position: relative;
    isolation: isolate;
    padding: 52px 24px 44px;
    margin-bottom: 32px;
    text-align: center;
    background:
        radial-gradient(900px 260px at 50% -10%, var(--lx-accent-soft), transparent 70%),
        var(--lx-surface);
    border: 1px solid var(--lx-line);
    border-radius: var(--lx-r-lg);
    overflow: hidden;
}

.ld .ld-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    background-image: radial-gradient(var(--lx-line-strong) 1px, transparent 1.4px);
    background-size: 22px 22px;
    opacity: .55;
    -webkit-mask-image: linear-gradient(#000, transparent 75%);
    mask-image: linear-gradient(#000, transparent 75%);
}

.ld .ld-hero__icon {
    display: inline-grid;
    place-items: center;
    width: 52px;
    height: 52px;
    margin-bottom: 18px;
    color: var(--lx-accent);
    background: var(--lx-surface);
    border: 1px solid var(--lx-line);
    border-radius: 16px;
    box-shadow: var(--lx-shadow-md);
}

.ld .ld-hero__title {
    font-size: clamp(2rem, 1.3rem + 2.4vw, 3.1rem);
    font-weight: 750;
    line-height: 1.1;
    letter-spacing: -.035em;
}

.ld .ld-hero__desc {
    max-width: 62ch;
    margin: 14px auto 0;
    font-size: 1.0625rem;
    line-height: 1.65;
    color: var(--lx-ink-2);
}

.ld .ld-hero__desc p + p { margin-top: .75em; }

/* Layout: nav | main | side */
.ld .ld-layout {
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr) 272px;
    grid-template-areas: "nav main side";
    gap: 32px;
    align-items: start;
}

.ld .ld-layout__nav { grid-area: nav; position: sticky; top: var(--lx-sticky-top); }
.ld .ld-layout__main { grid-area: main; min-width: 0; }
.ld .ld-layout__side { grid-area: side; position: sticky; top: var(--lx-sticky-top); }

/* When a sidebar is missing, the centre takes over its column. */
.ld .ld-layout--no-nav { grid-template-columns: minmax(0, 1fr) 272px; grid-template-areas: "main side"; }
.ld .ld-layout--no-side { grid-template-columns: 248px minmax(0, 1fr); grid-template-areas: "nav main"; }
.ld .ld-layout--no-nav.ld-layout--no-side { grid-template-columns: minmax(0, 1fr); grid-template-areas: "main"; }

/* Category navigation */
.ld .ld-catnav {
    background: var(--lx-surface);
    border: 1px solid var(--lx-line);
    border-radius: var(--lx-r-md);
    box-shadow: var(--lx-shadow-sm);
}

.ld .ld-catnav__toggle { display: none; } /* shown on mobile only */

.ld .ld-catnav__panel {
    padding: 20px 12px 12px;
    max-height: calc(100vh - (var(--lx-sticky-top) * 2) - 8px);
    overflow-y: auto;
    overscroll-behavior: contain;
    scrollbar-width: thin;
}

.ld .ld-catnav__panel .ld-panel-title { padding: 0 8px; }

.ld .ld-catnav__search {
    position: relative;
    margin: 0 4px 12px;
}

.ld .ld-catnav__search .ld-icon {
    position: absolute;
    top: 50%;
    left: 12px;
    transform: translateY(-50%);
    color: var(--lx-muted);
    pointer-events: none;
}

.ld .ld-catnav__input {
    width: 100%;
    height: 40px;
    padding: 0 12px 0 36px;
    font: inherit;
    font-size: .875rem;
    color: var(--lx-ink);
    background: var(--lx-bg);
    border: 1px solid var(--lx-line);
    border-radius: 12px;
    box-shadow: none;
    transition: border-color .2s ease, background-color .2s ease;
}

.ld .ld-catnav__input:focus { border-color: var(--lx-accent); background: var(--lx-surface); }

.ld .ld-catlist { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
.ld .ld-catlist--child { margin: 2px 0 4px 18px; padding-left: 10px; border-left: 1px solid var(--lx-line); }

.ld .ld-catlist__link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    font-size: .9375rem;
    font-weight: 500;
    color: var(--lx-ink-2);
    border-radius: 12px;
    transition: background-color .2s ease, color .2s ease;
}

.ld .ld-catlist__link:hover,
.ld .ld-catlist__link:focus-visible { color: var(--lx-ink); background: var(--lx-bg); }

.ld .ld-catlist__dot {
    flex: none;
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    font-size: .75rem;
    font-weight: 700;
    color: hsl(var(--lx-hue) 45% 32%);
    background: hsl(var(--lx-hue) 80% 94%);
    border-radius: 8px;
}

.ld .ld-catlist__name { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

.ld .ld-catlist__count {
    flex: none;
    min-width: 24px;
    padding: 1px 7px;
    font-size: .75rem;
    font-weight: 600;
    text-align: center;
    color: var(--lx-muted);
    background: var(--lx-bg);
    border-radius: 999px;
}

/* Active state */
.ld .ld-catlist__item.is-current > .ld-catlist__link {
    color: var(--lx-accent-ink);
    font-weight: 650;
    background: var(--lx-accent-soft);
    box-shadow: inset 3px 0 0 var(--lx-accent);
}

.ld .ld-catlist__item.is-current > .ld-catlist__link .ld-catlist__count {
    color: #fff;
    background: var(--lx-accent);
}

.ld .ld-catlist__item.is-ancestor > .ld-catlist__link { color: var(--lx-ink); font-weight: 600; }

.ld .ld-catnav__empty { padding: 12px 8px; font-size: .875rem; color: var(--lx-muted); }

/* ==========================================================================
   6. Single link page
   ========================================================================== */
.ld .ld-breadcrumb { margin-bottom: 24px; }

.ld .ld-breadcrumb__list {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 0;
    font-size: .875rem;
    color: var(--lx-muted);
}

.ld .ld-breadcrumb__item { display: inline-flex; align-items: center; min-width: 0; }

.ld .ld-breadcrumb__item + .ld-breadcrumb__item::before {
    content: "";
    flex: none;
    width: 6px;
    height: 6px;
    margin: 0 12px 0 10px;
    border-top: 1.5px solid var(--lx-line-strong);
    border-right: 1.5px solid var(--lx-line-strong);
    transform: rotate(45deg);
}

.ld .ld-breadcrumb a {
    color: var(--lx-muted);
    border-radius: 6px;
    transition: color .2s ease;
}

.ld .ld-breadcrumb a:hover,
.ld .ld-breadcrumb a:focus-visible { color: var(--lx-accent); }

.ld .ld-breadcrumb__item.is-current { color: var(--lx-ink); font-weight: 600; min-width: 0; }
.ld .ld-breadcrumb__item.is-current span {
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
    max-width: 42ch;
}

.ld .ld-single {
    display: grid;
    grid-template-columns: minmax(0, 5fr) minmax(0, 6fr) 280px;
    grid-template-areas: "media main aside";
    gap: 40px;
    align-items: start;
}

.ld .ld-single__media { grid-area: media; position: sticky; top: var(--lx-sticky-top); }
.ld .ld-single__main { grid-area: main; min-width: 0; }
.ld .ld-single__aside { grid-area: aside; position: sticky; top: var(--lx-sticky-top); }

.ld .ld-single--no-aside {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    grid-template-areas: "media main";
}

.ld .ld-media--hero {
    aspect-ratio: 4 / 3;
    border: 1px solid var(--lx-line);
    border-radius: var(--lx-r-lg);
    box-shadow: var(--lx-shadow-md);
}

.ld .ld-media--hero .ld-media__ph { font-size: 4.5rem; }
.ld .ld-media--hero .ld-media__ph--logo img { width: 112px; height: 112px; padding: 18px; border-radius: 24px; }

.ld .ld-entry__title {
    font-size: clamp(1.75rem, 1.2rem + 1.9vw, 2.6rem);
    font-weight: 750;
    line-height: 1.12;
    letter-spacing: -.03em;
}

.ld .ld-facts {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 20px;
    margin-top: 14px;
    font-size: .9375rem;
    color: var(--lx-muted);
}

.ld .ld-facts__item { display: inline-flex; align-items: center; gap: 7px; }

.ld .ld-entry__content { max-width: 68ch; margin-top: 24px; }

.ld .ld-lede {
    font-size: 1.1875rem;
    line-height: 1.65;
    color: var(--lx-ink);
}

.ld .ld-prose { margin-top: 18px; line-height: 1.75; }
.ld .ld-lede + .ld-prose { padding-top: 18px; border-top: 1px solid var(--lx-line); }
.ld .ld-prose > * + * { margin-top: 1em; }
.ld .ld-prose h2,
.ld .ld-prose h3 { margin-top: 1.5em; font-size: 1.25rem; font-weight: 700; }
.ld .ld-prose ul { list-style: disc; padding-left: 1.25em; }
.ld .ld-prose ol { list-style: decimal; padding-left: 1.25em; }
.ld .ld-prose li + li { margin-top: .35em; }
.ld .ld-prose a { color: var(--lx-accent); text-decoration: underline; text-underline-offset: 3px; }
.ld .ld-prose a:hover { color: var(--lx-accent-hover); }
.ld .ld-prose img { max-width: 100%; height: auto; border-radius: var(--lx-r-sm); }

.ld .ld-cta { margin-top: 32px; }
.ld .ld-cta__note { margin-top: 10px; font-size: .8125rem; color: var(--lx-muted); }

.ld .ld-related { margin-top: 72px; padding-top: 48px; border-top: 1px solid var(--lx-line); }
.ld .ld-grid--four { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* ==========================================================================
   7. Responsive
   ========================================================================== */

/* Tablet landscape: the discovery column drops under the grid. */
@media (max-width: 1199px) {
    .ld .ld-layout,
    .ld .ld-layout--no-nav,
    .ld .ld-layout--no-side {
        grid-template-columns: 232px minmax(0, 1fr);
        grid-template-areas:
            "nav main"
            "nav side";
        gap: 28px 28px;
    }

    .ld .ld-layout--no-nav { grid-template-columns: minmax(0, 1fr); grid-template-areas: "main" "side"; }
    .ld .ld-layout--no-side { grid-template-areas: "nav main"; }
    .ld .ld-layout--no-nav.ld-layout--no-side { grid-template-areas: "main"; }

    .ld .ld-layout__side { position: static; }
    .ld .ld-layout__side .ld-minilist { grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); gap: 4px 16px; }

    .ld .ld-single,
    .ld .ld-single--no-aside {
        grid-template-columns: minmax(0, 5fr) minmax(0, 6fr);
        grid-template-areas:
            "media main"
            "aside aside";
        gap: 32px;
    }

    .ld .ld-single__aside { position: static; }
    .ld .ld-single__aside .ld-minilist { grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); gap: 4px 16px; }

    .ld .ld-grid--four { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Tablet portrait & mobile: single column. */
@media (max-width: 799px) {
    .ld { --lx-gap: 16px; }
    .ld .ld__container { padding: 20px 16px 56px; }

    .ld .ld-hero { padding: 36px 18px 32px; margin-bottom: 20px; border-radius: 18px; }
    .ld .ld-hero__desc { font-size: 1rem; }

    .ld .ld-layout,
    .ld .ld-layout--no-nav,
    .ld .ld-layout--no-side,
    .ld .ld-layout--no-nav.ld-layout--no-side {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas: "nav" "main" "side";
        gap: 20px;
    }

    .ld .ld-layout__nav { position: static; }

    /* Categories become a collapsible disclosure. */
    .ld .ld-catnav__toggle {
        display: flex;
        align-items: center;
        gap: 10px;
        min-height: 52px;
        padding: 0 16px;
        font-weight: 650;
        color: var(--lx-ink);
        cursor: pointer;
        list-style: none;
    }

    .ld .ld-catnav__toggle::-webkit-details-marker { display: none; }
    .ld .ld-catnav__toggle span { flex: 1; }
    .ld .ld-catnav__toggle .ld-icon--chevron { transition: transform .25s ease; }
    .ld .ld-catnav[open] .ld-catnav__toggle .ld-icon--chevron { transform: rotate(180deg); }
    .ld .ld-catnav__panel { max-height: 60vh; padding-top: 4px; border-top: 1px solid var(--lx-line); }
    .ld .ld-catnav__panel > .ld-panel-title { display: none; }
    .ld .ld-catnav__search { margin-top: 12px; }
    .ld .ld-catlist__link { min-height: 44px; } /* touch target */

    .ld .ld-grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }

    .ld .ld-single,
    .ld .ld-single--no-aside {
        grid-template-columns: minmax(0, 1fr);
        grid-template-areas: "media" "main" "aside";
        gap: 24px;
    }

    .ld .ld-single__media { position: static; }
    .ld .ld-media--hero { aspect-ratio: 16 / 10; border-radius: 18px; }
    .ld .ld-media--hero .ld-media__ph { font-size: 3rem; }
    .ld .ld-single__aside .ld-minilist { grid-template-columns: minmax(0, 1fr); }
    .ld .ld-layout__side .ld-minilist { grid-template-columns: minmax(0, 1fr); }

    .ld .ld-cta .ld-btn { display: flex; width: 100%; min-height: 54px; }
    .ld .ld-cta__note { text-align: center; }

    .ld .ld-breadcrumb { margin-bottom: 18px; }
    .ld .ld-breadcrumb__list { flex-wrap: nowrap; overflow: hidden; font-size: .8125rem; }
    .ld .ld-breadcrumb__item { flex: none; }
    .ld .ld-breadcrumb__item.is-current { flex: 1 1 auto; }
    .ld .ld-breadcrumb__item.is-current span { max-width: 100%; display: block; }
    .ld .ld-breadcrumb__item + .ld-breadcrumb__item::before { margin: 0 9px 0 7px; }

    .ld .ld-related { margin-top: 48px; padding-top: 32px; }
    .ld .ld-section-head__title { font-size: 1.3rem; }
    .ld .ld-grid--four { grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr)); }
}

/* Small phones: two compact columns would be cramped, keep one. */
@media (max-width: 480px) {
    .ld .ld-grid,
    .ld .ld-grid--four { grid-template-columns: minmax(0, 1fr); }
    .ld .ld-pagination .page-numbers { min-width: 40px; height: 44px; }
}

/* ==========================================================================
   8. Motion preferences
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
    .ld *,
    .ld *::before,
    .ld *::after {
        transition: none !important;
        animation: none !important;
    }

    .ld .ld-card:hover,
    .ld .ld-card:focus-within,
    .ld .ld-card:hover .ld-media__img,
    .ld .ld-btn:hover { transform: none !important; }
}
