/* ============================================================
   GRAND PARK LAW GROUP — Article system · rel. 1.03
   Contents rail, "Indexed under" ledger, kicker labels, topic index.
   Built from the design-system tokens. Markup is written by
   tools/articles/build_article_system.py.
   ============================================================ */
:root {
    --gp-fg: rgba(250, 249, 246, 0.92);
    --gp-mut: rgba(250, 249, 246, 0.52);
    --gp-faint: rgba(250, 249, 246, 0.36);
    --gp-line: rgba(250, 249, 246, 0.09);
    --gp-gold: var(--accent-gold, #c9a962);
    --gp-gold-soft: rgba(201, 169, 98, 0.55);
    --gp-display: var(--font-display, 'Cormorant Garamond', Georgia, serif);
    --gp-body: var(--font-body, 'Outfit', system-ui, sans-serif);
    --gp-ease: cubic-bezier(0.19, 1, 0.22, 1);
}

/* Anchored headings clear the fixed header */
.article-content h2[id], .article-content h3[id],
.pub-article-body h2[id], .pub-article-body h3[id] {
    scroll-margin-top: calc(var(--header-height, 80px) + 1.75rem);
}

/* ---------- Kicker labels: sentence case, no box, no tracking ---------- */
.pub-article-tag,
.article-hero-meta .article-category-badge {
    display: inline-block;
    font-family: var(--gp-body);
    font-size: 0.86rem;
    font-weight: 400;
    letter-spacing: 0.01em;
    text-transform: none;
    color: var(--gp-gold);
    background: none;
    padding: 0;
    border: 0;
}

/* ---------- Practice-guide hero actions: text links, not boxes ---------- */
.prac-article-actions { display: flex; flex-wrap: wrap; gap: 0.5rem 2rem; align-items: center; }
.prac-article-actions .prac-pdf-btn {
    display: inline-flex; align-items: center; gap: 0.5em; min-height: 44px;
    background: none; border: 0; padding: 0; border-radius: 0;
    font-family: var(--gp-display); font-size: 1.1rem; font-weight: 400;
    letter-spacing: 0; text-transform: none; color: var(--gp-fg); text-decoration: none;
    background-image: linear-gradient(var(--gp-gold), var(--gp-gold));
    background-repeat: no-repeat; background-position: left calc(100% - 9px); background-size: 28% 1px;
    transition: background-size 0.7s var(--gp-ease);
}
.prac-article-actions .prac-pdf-btn:hover,
.prac-article-actions .prac-pdf-btn:focus-visible { background-size: 100% 1px; color: var(--gp-fg); }
.prac-article-actions .prac-pdf-btn svg { color: var(--gp-gold); }
.prac-article-actions .prac-pdf-btn + .prac-pdf-btn { color: var(--gp-mut); background-image: linear-gradient(var(--gp-mut), var(--gp-mut)); }

/* ---------- Layout: practice articles (rail beside the column) ---------- */
.gp-shell { display: block; }
@media (min-width: 1100px) {
    .gp-shell {
        display: grid;
        grid-template-columns: 236px minmax(0, 780px);
        justify-content: center;
        column-gap: 3.75rem;
        padding-inline: var(--space-lg, 4rem);
    }
    .gp-shell > .pub-article-body { margin: 0; padding-left: 0; padding-right: 0; min-width: 0; }
    .gp-shell > .gp-rail {
        position: sticky;
        top: calc(var(--header-height, 80px) + 1.5rem);
        align-self: start;
        max-height: calc(100vh - var(--header-height, 80px) - 3rem);
        overflow-y: auto;
        padding-top: 3.5rem;
        scrollbar-width: thin;
    }
}
@media (max-width: 1099.98px) {
    .gp-shell > .gp-rail { max-width: 780px; margin: 2rem auto 0; padding-inline: var(--space-lg, 4rem); }
}
@media (max-width: 640px) {
    .gp-shell > .gp-rail { padding-inline: var(--space-md, 1.5rem); }
}

/* ---------- Layout: Insights articles (rail in the existing sidebar) ---------- */
.article-sidebar .gp-rail { margin-bottom: 2.5rem; }
@media (max-width: 1024px) {
    .article-layout .article-sidebar { display: block; }
    .article-sidebar .sidebar-sticky { position: static; }
    .article-sidebar .sidebar-cta { display: none; }
    .article-sidebar .gp-rail { margin-bottom: 0.5rem; }
}

/* ---------- The rail ---------- */
.gp-rail { font-family: var(--gp-body); color: var(--gp-mut); }
.gp-rail-box { border: 0; margin: 0; }
.gp-rail-summary {
    display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
    list-style: none; cursor: default;
    font-size: 0.8rem; letter-spacing: 0.01em; color: var(--gp-mut);
    padding-bottom: 0.9rem; margin-bottom: 0.6rem;
    border-bottom: 1px solid var(--gp-line);
}
.gp-rail-summary::-webkit-details-marker { display: none; }
.gp-rail-count { font-size: 0.72rem; color: var(--gp-faint); font-variant-numeric: tabular-nums; }

.gp-toc, .gp-toc-sub { list-style: none; margin: 0; padding: 0; }
.gp-toc { padding-left: 1.15rem; }   /* room for the active rule */
.gp-toc-item { margin: 0; }
.gp-toc-link {
    position: relative;
    display: grid; grid-template-columns: 2.1rem minmax(0, 1fr); align-items: baseline;
    padding: 0.42rem 0 0.42rem 0;
    color: var(--gp-mut); text-decoration: none;
    transition: color 0.35s;
}
.gp-toc-link::before {               /* the extending rule: 0 → 0.85rem when active */
    content: ""; position: absolute; left: -1.15rem; top: 1.02em;
    width: 0; height: 1px; background: var(--gp-gold);
    transition: width 0.6s var(--gp-ease);
}
.gp-toc-no {
    font-size: 0.72rem; color: var(--gp-gold-soft);
    font-variant-numeric: tabular-nums; transition: color 0.35s;
}
.gp-toc-label {
    font-family: var(--gp-display); font-size: 1.04rem; line-height: 1.28; font-weight: 400;
    overflow-wrap: anywhere;
}
.gp-toc-label em { font-style: italic; }      /* case names keep their italics */
.gp-toc-link:hover { color: var(--gp-fg); }
.gp-toc-link:hover::before { width: 0.45rem; }
.gp-toc-link:focus-visible { outline: 1px solid var(--gp-gold); outline-offset: 3px; }
.gp-toc-link.is-current, .gp-toc-link.is-active { color: var(--gp-fg); }
.gp-toc-link.is-current .gp-toc-no, .gp-toc-link.is-active .gp-toc-no { color: var(--gp-gold); }
.gp-toc-link.is-current::before, .gp-toc-link.is-active::before { width: 0.85rem; }

.gp-toc-sub { margin: 0.1rem 0 0.35rem 2.1rem; display: none; }
.gp-toc-item.is-open > .gp-toc-sub { display: block; }
.gp-toc-link--sub { grid-template-columns: 1.5rem minmax(0, 1fr); padding: 0.28rem 0; }
.gp-toc-link--sub::before { left: -2.4rem; }
.gp-toc-link--sub .gp-toc-label { font-family: var(--gp-body); font-size: 0.8rem; line-height: 1.4; }

.gp-rail-pos {
    margin: 0.9rem 0 0; padding-top: 0.75rem; border-top: 1px solid var(--gp-line);
    font-size: 0.72rem; color: var(--gp-faint); font-variant-numeric: tabular-nums; min-height: 1.1em;
}

.gp-rail-actions { display: grid; gap: 0.35rem; margin-top: 1.5rem; }
.gp-rail-act {
    display: grid; gap: 0.12rem; min-height: 44px; align-content: center; width: fit-content;
    font-family: var(--gp-display); font-size: 1.08rem; color: var(--gp-fg); text-decoration: none;
}
.gp-rail-act-text { position: relative; width: fit-content; }
.gp-rail-act-text::after {          /* drawn underline (CTA family I) */
    content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 1px;
    background: var(--gp-gold); transform: scaleX(0.28); transform-origin: left center;
    transition: transform 0.7s var(--gp-ease);
}
.gp-rail-act:hover .gp-rail-act-text::after, .gp-rail-act:focus-visible .gp-rail-act-text::after { transform: scaleX(1); }
.gp-rail-act:focus-visible { outline: 1px solid var(--gp-gold); outline-offset: 4px; }
.gp-rail-act-note { font-family: var(--gp-body); font-size: 0.7rem; color: var(--gp-faint); }
.gp-rail-act--quiet { font-size: 0.92rem; color: var(--gp-mut); }
.gp-rail-act--quiet .gp-rail-act-text::after { background: var(--gp-mut); }

/* Collapsed rail on narrow screens: the summary becomes the toggle */
@media (max-width: 1099.98px) {
    .gp-shell .gp-rail-summary, .article-sidebar .gp-rail-summary { cursor: pointer; }
    .gp-rail-box:not([open]) .gp-rail-summary { margin-bottom: 0; }
    .gp-rail-summary::after { content: "+"; font-family: var(--gp-display); font-size: 1.2rem; color: var(--gp-gold); }
    .gp-rail-box[open] .gp-rail-summary::after { content: "–"; }
    .gp-toc-sub { display: block; }
    .gp-rail-actions { grid-auto-flow: column; justify-content: start; column-gap: 1.75rem; margin-top: 1rem; }
}

/* ---------- "Indexed under" ledger ---------- */
.gp-index {
    margin: 3.25rem 0 2.25rem; padding-top: 1.4rem;
    border-top: 1px solid rgba(201, 169, 98, 0.16);
    font-family: var(--gp-body);
}
.gp-index-title {
    margin: 0 0 0.75rem; font-family: var(--gp-display); font-size: 1.3rem; font-weight: 400;
    color: var(--gp-fg); letter-spacing: 0;
}
.gp-index-rows { margin: 0; display: grid; }
.gp-index-row {
    display: grid; grid-template-columns: 7.25rem minmax(0, 1fr); gap: 1rem; align-items: baseline;
    padding: 0.7rem 0; border-top: 1px solid var(--gp-line);
}
.gp-index-row dt { font-size: 0.76rem; color: var(--gp-faint); }
.gp-index-row dd { margin: 0; font-size: 0.92rem; color: var(--gp-mut); min-width: 0; }
.gp-index-practice {
    font-family: var(--gp-display); font-size: 1.12rem; color: var(--gp-fg); text-decoration: none;
    background: linear-gradient(var(--gp-gold), var(--gp-gold)) left bottom / 0 1px no-repeat;
    transition: background-size 0.7s var(--gp-ease);
}
.gp-index-practice:hover, .gp-index-practice:focus-visible { background-size: 100% 1px; }
.gp-index-topics { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.15rem 1.15rem; }
.gp-topic {                         /* bracketed alteration (CTA family IV) */
    display: inline-flex; align-items: center; gap: 0.32em; min-height: 32px;
    font-family: var(--gp-body); font-size: 0.9rem; color: var(--gp-fg); text-decoration: none;
}
.gp-topic::before, .gp-topic::after {
    font-family: var(--gp-display); font-weight: 300; font-size: 1.45em; line-height: 1;
    color: var(--gp-gold-soft); transition: transform 0.6s var(--gp-ease), color 0.3s;
}
.gp-topic::before { content: "["; content: "[" / ""; }
.gp-topic::after { content: "]"; content: "]" / ""; }
a.gp-topic:hover::before, a.gp-topic:focus-visible::before { transform: translateX(-4px); color: var(--gp-gold); }
a.gp-topic:hover::after, a.gp-topic:focus-visible::after { transform: translateX(4px); color: var(--gp-gold); }
a.gp-topic:focus-visible { outline: 1px solid var(--gp-gold); outline-offset: 3px; }
@media (max-width: 520px) {
    .gp-index-row { grid-template-columns: 1fr; gap: 0.25rem; }
}

/* Reset inherited article-body rules inside the ledger */
:is(.pub-article-body, .article-content) .gp-index a { text-decoration: none; border: 0; }
:is(.pub-article-body, .article-content) .gp-index a.gp-topic,
:is(.pub-article-body, .article-content) .gp-index a.gp-index-practice { color: var(--gp-fg); }
:is(.pub-article-body, .article-content) .gp-index ul,
:is(.pub-article-body, .article-content) .gp-index dl { margin: 0; padding: 0; }
:is(.pub-article-body, .article-content) .gp-index li { margin: 0; padding: 0; list-style: none; }
:is(.pub-article-body, .article-content) .gp-index li::before { content: none; display: none; }

/* ---------- Topic index on /insights ---------- */
.gp-topic-panel {
    margin: 0 0 2.5rem; padding: 0 0 1.75rem; border-bottom: 1px solid rgba(201, 169, 98, 0.16);
    font-family: var(--gp-body); color: var(--gp-mut);
}
.gp-topic-panel-k { margin: 0 0 0.35rem; font-size: 0.8rem; color: var(--gp-faint); }
.gp-topic-panel-title { margin: 0; font-family: var(--gp-display); font-weight: 400; font-size: clamp(1.8rem, 3vw, 2.4rem); color: var(--gp-fg); }
.gp-topic-panel-title .gp-topic { font-family: inherit; font-size: inherit; }
.gp-topic-panel-count { margin: 0.4rem 0 1.4rem; font-size: 0.9rem; }
.gp-topic-results { list-style: none; margin: 0; padding: 0; display: grid; }
.gp-topic-results a {
    display: grid; gap: 0.15rem; padding: 0.85rem 0; border-top: 1px solid var(--gp-line);
    text-decoration: none; color: var(--gp-fg);
}
.gp-topic-results a:hover .gp-res-title { color: var(--gp-gold); }
.gp-res-kind { font-size: 0.74rem; color: var(--gp-faint); }
.gp-res-title { font-family: var(--gp-display); font-size: 1.18rem; line-height: 1.3; transition: color 0.3s; }
.gp-topic-clear { display: inline-block; margin-top: 1.1rem; font-family: var(--gp-display); font-size: 1.05rem; color: var(--gp-fg); }

@media (prefers-reduced-motion: reduce) {
    .gp-toc-link, .gp-toc-link::before, .gp-rail-act-text::after, .gp-topic::before, .gp-topic::after,
    .gp-index-practice { transition: none !important; }
}

/* Print: the PDF edition is the printable version; hide navigation chrome */
@media print {
    .gp-rail, .gp-index { display: none !important; }
    .gp-shell { display: block !important; }
}
