/* ==========================================================================
   Demo pages and docs: the same stage in working and reading modes.
   ========================================================================== */

/* --- Demo page frame ------------------------------------------------------ */
.fc-demo {
    --fc-maxw: 1480px;
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: clamp(24px, 3vw, 48px);
    padding-top: 36px;
    align-items: start;
}

.fc-demo__main { min-width: 0; }

.fc-crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; font-size: 14px; color: var(--fc-muted); }
.fc-crumbs ol { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; margin: 0; padding: 0; }
.fc-crumbs li + li::before { content: '/'; margin-right: 10px; color: var(--fc-line-2); }
.fc-shell .fc-crumbs a { color: var(--fc-muted); }
.fc-shell .fc-crumbs a:hover { color: var(--fc-text); }
.fc-crumbs [aria-current] { color: var(--fc-text-2); }
.fc-crumbs__meta { display: inline-flex; gap: 14px; align-items: center; }

.fc-level { display: inline-flex; align-items: center; gap: 8px; }
.fc-level__dots { display: inline-flex; gap: 3px; }
.fc-level__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--fc-line-2); }
.fc-level__dot.is-on { background: var(--fc-mint); }
.fc-level__label { font-size: 13px; color: var(--fc-text-2); }

.fc-demo-head { display: grid; gap: 16px; padding: 18px 0 0; }
.fc-demo-head__title { font-size: clamp(2.1rem, 4.4vw, 3.6rem); max-width: 18ch; }

/* --- Stage: source beside the live form ----------------------------------- */
.fc-stage {
    display: grid;
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
    gap: clamp(20px, 2.4vw, 32px);
    align-items: start;
    margin-top: 36px;
}

.fc-stage__code { min-width: 0; position: sticky; top: 88px; }
.fc-stage__code .fc-editor { max-height: calc(100vh - 104px); }
.fc-stage__code .fc-code { overflow-y: auto; }

.fc-stage__form {
    position: relative;
    min-width: 0;
    background: var(--fc-violet-slab);
    margin-right: calc(var(--fc-gut) * -1);
    border-radius: 28px 0 0 28px;
    padding: 28px var(--fc-gut) 28px 28px;
    display: grid;
    gap: 16px;
}


/* Wide forms (tabs, steppers): the form above, full width, its source below. */
.fc-stage--wide { grid-template-columns: minmax(0, 1fr); }
.fc-stage--wide .fc-stage__form { order: -1; margin-right: 0; border-radius: 28px; padding: 28px; }
.fc-stage--wide .fc-stage__code { position: static; }
.fc-stage--wide .fc-stage__code .fc-editor { max-height: none; }

/* The light panel the form renders on: MudBlazor's own palette, as in a visitor's app. */
.fc-formpanel {
    background: #F7F7FB;
    color: #1B1D2E;
    border-radius: 16px;
    padding: 22px;
    box-shadow: 0 30px 60px -20px rgba(0, 0, 0, .6);
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
}

/* The panel is already the card. A page that wraps its whole form in a MudPaper loses that frame,
   and cards nested deeper become bordered sections instead of floating cards on a card. */
.fc-formpanel > .mud-paper:first-child { background: transparent; box-shadow: none; padding: 0 !important; }
.fc-formpanel .mud-paper:not(.mud-alert):not(.fc-formpanel > .mud-paper:first-child),
.fc-formpanel .mud-card { box-shadow: none !important; border: 1px solid #E3E4EF; }

/* Bounded, so wide content (MudTabs' tab bar) scrolls inside itself instead of widening the page. */
.fc-formpanel .mud-tabs, .fc-formpanel .mud-tabs-tabbar { max-width: 100%; }

/* MudTabs is its own shadowed card, and its tab panel renders `display: contents`, so the panel's
   `pa-4` never applies and the fields sat flush against that card's edges. Flatten it into the
   form panel, whose own padding then frames the fields. */
.fc-formpanel .mud-tabs { box-shadow: none; background: transparent; }
.fc-formpanel .mud-tabs-tabbar { background: transparent; border-bottom: 1px solid #E3E4EF; }
.fc-formpanel .mud-tabs-panels { padding-top: 20px; }

.fc-formpanel__head { display: flex; flex-wrap: wrap; gap: 10px; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.fc-formpanel__head b { font-family: var(--fc-display); font-weight: 600; font-size: 16px; letter-spacing: -.02em; }
.fc-chip-rendered { font-family: var(--fc-mono); font-size: 11px; padding: 3px 8px; border-radius: 999px; background: #ECE9FF; color: #4B34D6; }
.fc-stage__aside:empty { display: none; }
.fc-stage__aside { display: grid; gap: 16px; }

.fc-aside-card { color: #fff; }
.fc-aside-card__title { font-family: var(--fc-display); font-weight: 600; font-size: 15px; letter-spacing: -.02em; margin: 0 0 10px; }
.fc-aside-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 14.5px; color: var(--fc-on-violet-2); }
.fc-aside-list li { display: flex; gap: 10px; align-items: flex-start; }
.fc-aside-list svg { color: var(--fc-mint); margin-top: 3px; }

/* --- Notes under the stage ------------------------------------------------ */
.fc-notes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); gap: 18px; margin-top: 56px; }
.fc-notes:empty { display: none; }
.fc-note { border: 1px solid var(--fc-line); background: var(--fc-panel); border-radius: 18px; padding: 22px; min-width: 0; }
.fc-note--when { grid-column: 1 / -1; background: none; border: 0; padding: 0; }
.fc-note__title { font-family: var(--fc-display); font-weight: 600; font-size: 17px; letter-spacing: -.02em; margin: 0 0 14px; display: flex; gap: 10px; align-items: center; color: var(--fc-text); }
.fc-note--pitfalls .fc-note__title svg { color: var(--fc-coral); }
.fc-note--when .fc-note__title { font-size: clamp(1.6rem, 3vw, 2.4rem); font-weight: 700; letter-spacing: var(--fc-track); }
.fc-pull { font-size: clamp(1.05rem, 1.4vw, 1.25rem); line-height: 1.65; color: var(--fc-text); max-width: 68ch; margin: 0; }
.fc-pitfalls { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.fc-pitfalls li { color: var(--fc-text-2); font-size: 15px; padding-left: 16px; position: relative; }
.fc-pitfalls li::before { content: ''; position: absolute; left: 0; top: .7em; width: 6px; height: 6px; border-radius: 50%; background: var(--fc-coral); }
.fc-related { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.fc-shell .fc-related a { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--fc-text-2); text-decoration: none; }
.fc-shell .fc-related a:hover { background: var(--fc-bg-3); color: var(--fc-text); }

/* --- The API in this demo ------------------------------------------------- */
.fc-dsec { padding-top: clamp(64px, 8vw, 104px); }
.fc-apis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); gap: 16px; margin-top: 32px; }
.fc-api { border: 1px solid var(--fc-line); background: var(--fc-panel); border-radius: 16px; padding: 20px; display: grid; gap: 10px; align-content: start; min-width: 0; }
.fc-api b { font-family: var(--fc-mono); font-weight: 600; color: var(--fc-tk-fn); font-size: 14.5px; overflow-wrap: anywhere; }
.fc-api > span { color: var(--fc-text-2); font-size: 14.5px; }
.fc-api__ex.fc-code { padding: 12px 0; background: var(--fc-bg-2); border-radius: 10px; font-size: 13px; }
.fc-api__ex.fc-code .cl { padding-right: 14px; padding-left: calc(14px + (var(--ind, 0) + 4) * 1ch); }
.fc-api__note { color: var(--fc-muted); font-size: 14px; }

/* --- Previous / next ------------------------------------------------------ */
.fc-prevnext, .fc-pn { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 88px; }

.fc-shell .fc-prevnext__link, .fc-shell .fc-pn a {
    border: 1px solid var(--fc-line);
    border-radius: 18px;
    padding: 20px 22px;
    text-decoration: none;
    color: var(--fc-text);
    display: grid;
    gap: 4px;
    transition: border-color .2s, background .2s;
}

.fc-shell .fc-prevnext__link:not(span):hover, .fc-shell .fc-pn a:hover { border-color: var(--fc-violet-2); background: var(--fc-bg-2); }
span.fc-prevnext__link { border: 0; }
.fc-prevnext__link--next, .fc-pn a:last-child:not(:first-child) { text-align: right; }
.fc-prevnext__dir, .fc-pn small { color: var(--fc-muted); font-size: 13px; }
.fc-prevnext__title, .fc-pn b { font-family: var(--fc-display); font-weight: 600; font-size: 19px; letter-spacing: -.02em; }

/* --- Docs ---------------------------------------------------------------- */
.fc-docs { display: grid; grid-template-columns: 232px minmax(0, 1fr) 208px; gap: clamp(28px, 4vw, 56px); padding-top: 40px; align-items: start; }
.fc-docs--api { grid-template-columns: 272px minmax(0, 1fr); }
.fc-docs__main { min-width: 0; }

.fc-article { min-width: 0; max-width: 74ch; font-size: 16.5px; line-height: 1.75; color: var(--fc-text-2); }
.fc-docs--api .fc-article { max-width: none; }
.fc-article > :first-child { margin-top: 0; }
.fc-article h1 { font-family: var(--fc-display); font-weight: 700; font-size: clamp(2.2rem, 4vw, 3.2rem); line-height: 1.05; letter-spacing: var(--fc-track); color: var(--fc-text); margin: 0 0 18px; }
.fc-article h1 + p { font-size: 1.15rem; }
.fc-article h2 { font-family: var(--fc-display); font-weight: 700; font-size: 1.65rem; letter-spacing: -.035em; color: var(--fc-text); margin: 64px 0 14px; line-height: 1.15; scroll-margin-top: 92px; }
.fc-article h3 { font-weight: 650; font-size: 1.2rem; color: var(--fc-text); margin: 40px 0 10px; scroll-margin-top: 92px; }
.fc-article h4 { font-weight: 650; font-size: 1.05rem; color: var(--fc-text); margin: 28px 0 8px; scroll-margin-top: 92px; }
.fc-article p { margin: 0 0 16px; }
.fc-article ul, .fc-article ol { padding-left: 1.3em; margin: 0 0 18px; }
.fc-article li { margin: 6px 0; }
.fc-article li::marker { color: var(--fc-violet-2); }
.fc-article strong { color: var(--fc-text); font-weight: 600; }
.fc-article :not(pre) > code { font-size: .86em; color: var(--fc-tk-ty); background: var(--fc-bg-3); border: 1px solid var(--fc-line); padding: 1px 6px; border-radius: 6px; }
.fc-article blockquote { margin: 24px 0; padding: 16px 18px 2px 48px; background: var(--fc-bg-2); border: 1px solid var(--fc-line); border-radius: 14px; position: relative; }
.fc-article blockquote::before { content: ''; position: absolute; left: 18px; top: 20px; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--fc-yellow); box-sizing: border-box; }
.fc-article table { width: 100%; border-collapse: collapse; margin: 0 0 20px; font-size: 14.5px; display: block; overflow-x: auto; }
.fc-article th, .fc-article td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--fc-line); }
.fc-article th { color: var(--fc-text); font-weight: 600; background: var(--fc-bg-2); }
.fc-article hr { border: 0; border-top: 1px solid var(--fc-line); margin: 48px 0; }

.fc-docfoot { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--fc-line); font-size: 14px; }
.fc-shell .fc-docfoot a { color: var(--fc-muted); }
.fc-shell .fc-docfoot a:hover { color: var(--fc-text); }

.fc-toc { position: sticky; top: 92px; font-size: 13.5px; }
.fc-toc b { display: block; color: var(--fc-text); font-weight: 600; margin-bottom: 10px; }
.fc-shell .fc-toc a { display: block; padding: 5px 0 5px 12px; color: var(--fc-muted); text-decoration: none; line-height: 1.35; border-left: 1px solid var(--fc-line); }
.fc-toc a.lv3 { padding-left: 24px; font-size: 13px; }
.fc-shell .fc-toc a:hover { color: var(--fc-text-2); }
.fc-shell .fc-toc a.is-on { color: var(--fc-text); border-left-color: var(--fc-violet-2); }

/* --- API reference -------------------------------------------------------- */
.fc-apiref__head { display: grid; gap: 14px; margin-bottom: 8px; }
.fc-filter { position: relative; margin-bottom: 18px; }
.fc-filter input { width: 100%; height: 42px; border-radius: 10px; border: 1px solid var(--fc-line-2); background: var(--fc-bg-2); color: var(--fc-text); font: inherit; font-size: 14.5px; padding: 0 12px 0 38px; }
.fc-filter input::placeholder { color: var(--fc-muted); }
.fc-filter input:focus { outline: none; border-color: var(--fc-violet-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--fc-violet-2) 30%, transparent); }
.fc-filter svg { position: absolute; left: 12px; top: 12px; color: var(--fc-muted); }
.fc-shell .fc-side--api a { font-family: var(--fc-mono); font-size: 13px; padding: 5px 12px 5px 24px; color: var(--fc-muted); }
.fc-shell .fc-side--api a.fc-side__sub { font-family: var(--fc-body); font-size: 13.5px; color: var(--fc-text-2); padding-left: 12px; margin-top: 6px; }
.fc-side--api .fc-side__label { margin-top: 16px; }
.fc-apigroup > h2 { font-family: var(--fc-display); font-weight: 700; font-size: 1.5rem; letter-spacing: -.035em; margin: 64px 0 4px; }
.fc-apigroup > h3 { font-size: 1rem; font-weight: 600; color: var(--fc-muted); margin: 28px 0 0; }
.fc-apigroup > p, .fc-apigroup > ul, .fc-apigroup > .fc-block { max-width: 78ch; }
.fc-entry { display: grid; grid-template-columns: minmax(180px, 240px) minmax(0, 1fr); gap: 8px 32px; padding: 22px 0; border-top: 1px solid var(--fc-line); scroll-margin-top: 92px; }
.fc-entry h4 { margin: 2px 0 0; font-family: var(--fc-mono); font-weight: 600; font-size: 15px; color: var(--fc-tk-fn); overflow-wrap: anywhere; }
.fc-entry__body { min-width: 0; font-size: 15.5px; }
.fc-entry__body p { margin: 0 0 12px; }
.fc-entry__body .fc-block { margin-bottom: 0; }
.fc-empty { padding: 48px 0; color: var(--fc-muted); }
.fc-empty b { color: var(--fc-text); }
.fc-docs [hidden] { display: none !important; }

/* --- Responsive ----------------------------------------------------------- */
@media (max-width: 1280px) {
    .fc-demo { grid-template-columns: minmax(0, 1fr); }
    .fc-demo__side { position: static; max-height: none; padding: 0; }
    .fc-demo__side .fc-side__nav { display: none; }
    .fc-demo__side .fc-side__select { display: block; max-width: 420px; }
}

@media (max-width: 1180px) {
    .fc-docs { grid-template-columns: 220px minmax(0, 1fr); }
    .fc-toc { display: none; }
}

@media (max-width: 1000px) {
    .fc-stage { grid-template-columns: minmax(0, 1fr); }
    .fc-stage__code { position: static; }
    .fc-stage__code .fc-editor { max-height: none; }
    .fc-stage__form { margin: 0 calc(var(--fc-gut) * -1); border-radius: 0; padding: 24px var(--fc-gut); }
}

@media (max-width: 860px) {
    .fc-docs, .fc-docs--api { grid-template-columns: minmax(0, 1fr); padding-top: 24px; }
    .fc-entry { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 680px) {
    .fc-prevnext, .fc-pn { grid-template-columns: minmax(0, 1fr); }
    .fc-prevnext__link--next, .fc-pn a:last-child { text-align: left; }
}
