/* Demo app overrides — DRYL design lives in _content/DRYL.Components/dryl.css */

html, body {
    height: 100%;
    background: var(--ground);
    color: var(--fg);
    font-family: var(--font-sans);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ─── Demo page zwei-Spalten-Layout (Content + ToC) ─── */
.demo-page-wrap {
    display: flex;
    align-items: flex-start;
    gap: var(--sp-6);
    width: 100%;
}

.demo-page-content {
    flex: 1;
    min-width: 0;
}

/* ─── Sticky Table of Contents ─── */
.demo-toc {
    display: none;  /* JS zeigt via .has-content wenn Sections vorhanden */
    flex: 0 0 160px;
    position: sticky;
    top: var(--sp-7);
    align-self: flex-start;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
    scrollbar-width: none;
}
.demo-toc::-webkit-scrollbar { display: none; }
.demo-toc.has-content { display: block; }

/* Auf mittelgroßen Bildschirmen ausblenden */
@media (max-width: 1279px) {
    .demo-toc.has-content { display: none; }
}

.demo-toc-label {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--fg-dim);
    margin: 0 0 var(--sp-2) 0;
    padding-left: var(--sp-3);
}

.demo-toc ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    border-left: 1px solid var(--line);
}

.demo-toc-link {
    display: block;
    padding: 3px var(--sp-2);
    margin-left: -1px;
    font-size: 12px;
    color: var(--fg-dim);
    text-decoration: none;
    border-left: 2px solid transparent;
    border-radius: 0 var(--r-xs) var(--r-xs) 0;
    transition: color var(--dur-fast) var(--ease-out),
                border-color var(--dur-fast) var(--ease-out);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.demo-toc-link:hover {
    color: var(--fg-muted);
}

.demo-toc-link.is-active {
    color: var(--fg);
    border-left-color: var(--accent-b);
}


/* ─── Top bar (website chrome) ─── */
.topbar-brand {
    text-decoration: none;
    color: inherit;
    padding-left: 0;
    margin-right: var(--sp-2);
}
.topbar-nav {
    display: flex;
    align-items: center;
    gap: var(--sp-1);
}
.topbar-link {
    padding: 6px 12px;
    border-radius: var(--r-sm);
    color: var(--fg-muted);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    transition: color var(--dur-fast) var(--ease-out),
                background var(--dur-fast) var(--ease-out);
}
.topbar-link:hover { color: var(--fg); background: var(--glass-1); }
.topbar-link.active { color: var(--fg); background: var(--glass-2); }

.topbar-spacer { flex: 1; }

.topbar-search-trigger {
    width: 240px;
    justify-content: space-between;
    gap: var(--sp-2);
    cursor: pointer;
    font-family: var(--font-sans);
    font-feature-settings: "ss01", "cv11";
    white-space: nowrap;
    overflow: hidden;
}
.topbar-search-label {
    flex: 1;
    text-align: left;
    color: var(--fg-dim);
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.topbar-icon-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: var(--r-sm);
    color: var(--fg-muted);
    border: 1px solid var(--line);
    background: var(--glass-1);
    transition: color var(--dur-fast) var(--ease-out),
                border-color var(--dur-fast) var(--ease-out);
}
.topbar-icon-link:hover { color: var(--fg); border-color: var(--line-strong); }

@media (max-width: 720px) {
    .topbar-nav { display: none; }
    .topbar-search-trigger { width: auto; }
    .topbar-search-label { display: none; }
    /* Drop the non-essential version badge so the bar fits a phone. */
    .topbar .badge { display: none; }
}

@media (max-width: 480px) {
    /* On the narrowest screens the GitHub link also steps aside (it lives in
       the footer too) — leaving brand, search and theme switcher, which fit.
       Target the anchor only: the theme switcher shares .topbar-icon-link but
       is a <button> and must stay. */
    a.topbar-icon-link { display: none; }
}

/* ─── Theme switcher (app-bar popover) ─── */
.theme-switcher-trigger { cursor: pointer; }

.theme-pop {
    min-width: 230px;
    gap: var(--sp-4);
    padding: var(--sp-1);
}
.theme-pop-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    font-weight: 600;
    color: var(--fg-dim);
}

.theme-swatches {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--sp-2);
}
.theme-swatch {
    position: relative;
    display: flex;
    align-items: flex-end;
    height: 48px;
    padding: var(--sp-2);
    border-radius: var(--r-md);
    border: 1px solid var(--line);
    background: var(--swatch-grad);
    cursor: pointer;
    overflow: hidden;
    transition: transform var(--dur-fast) var(--ease-spring),
                box-shadow var(--dur-fast) var(--ease-out),
                border-color var(--dur-fast) var(--ease-out);
}
/* Scrim so the name stays legible on any gradient. */
.theme-swatch::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(transparent 40%, color-mix(in srgb, var(--bg-0), transparent 40%));
}
.theme-swatch-name {
    position: relative;
    font-size: 12px;
    font-weight: 600;
    color: var(--fg);
}
.theme-swatch:hover {
    transform: translateY(-2px);
    border-color: var(--line-strong);
}
.theme-swatch.is-active {
    border-color: transparent;
    box-shadow: 0 0 0 2px var(--accent-a), 0 0 14px -2px var(--accent-a);
}

.theme-custom {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    flex-wrap: wrap;
}
.theme-color {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-1);
    font-size: 12px;
    color: var(--fg-muted);
}
.theme-color input[type="color"] {
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    background: transparent;
    cursor: pointer;
}
.theme-custom-preview {
    width: 28px;
    height: 28px;
    margin-left: auto;
    border-radius: var(--r-sm);
    border: 1px solid var(--line);
}

@media (prefers-reduced-motion: reduce) {
    .theme-swatch { transition: none; }
    .theme-swatch:hover { transform: none; }
}

/* Static preset swatches on the Theming docs page. */
.theme-doc-swatches {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: var(--sp-3);
}
.theme-doc-swatch {
    position: relative;
    display: flex;
    align-items: flex-end;
    height: 72px;
    padding: var(--sp-3);
    border-radius: var(--r-md);
    border: 1px solid var(--line);
    background: var(--swatch-grad);
    overflow: hidden;
}
.theme-doc-swatch::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(transparent 40%, color-mix(in srgb, var(--bg-0), transparent 40%));
}
.theme-doc-swatch-name {
    position: relative;
    font-size: 13px;
    font-weight: 600;
    color: var(--fg);
}

/* Blazor Enhanced Navigation setzt tabindex="-1" auf h1 und fokussiert es programmatisch.
   :focus:not(:focus-visible) unterdrückt den Ring bei programmatischem Fokus,
   lässt ihn aber bei echter Tastaturnavigation bestehen. */
:focus:not(:focus-visible) { outline: none; }

/* ─── Landing shell ─── */
.landing-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}
.landing-main {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: var(--sp-8) var(--sp-7) 96px;
}

.hero {
    display: flex;
    flex-direction: column;
    gap: var(--sp-5);
    align-items: flex-start;
    padding: var(--sp-8) 0 var(--sp-7);
    max-width: 860px;
}
.hero h1 {
    font-size: 56px;
    line-height: 1.04;
    letter-spacing: -0.035em;
    font-weight: 700;
    margin: 0;
}
.hero .lead { font-size: 19px; max-width: 60ch; }
.hero-cta { display: flex; gap: var(--sp-3); flex-wrap: wrap; }

.section-head {
    display: flex;
    flex-direction: column;
    gap: var(--sp-2);
    margin-bottom: var(--sp-5);
}

/* ─── Component doc header ─── */
.doc-source-link {
    display: inline-flex;
    align-items: center;
    gap: var(--sp-1);
    font-size: 13px;
    color: var(--fg-muted);
    text-decoration: none;
    padding: 4px 10px;
    border-radius: var(--r-sm);
    border: 1px solid var(--line);
    background: var(--glass-1);
    transition: color var(--dur-fast) var(--ease-out),
                border-color var(--dur-fast) var(--ease-out);
}
.doc-source-link:hover { color: var(--fg); border-color: var(--line-strong); }

/* ─── DemoExample (live preview + source) ─── */
.demo-example-card {
    border: 1px solid var(--line);
    border-radius: var(--r-lg);
    background: var(--glass-1);
    overflow: hidden;
}
.demo-example-card .tabs { padding: 0 var(--sp-4); }
.demo-example-card .tab-panel { padding: 0; }
.demo-example-preview {
    display: flex;
    flex-direction: column;
    gap: var(--sp-4);
    padding: clamp(var(--sp-4), 4vw, var(--sp-6));
    min-width: 0;
    overflow-x: auto;
}
.demo-example-code { padding: var(--sp-4); }

/* ─── App Shell demo — frame the nested chrome inside a fixed-height box so the
   live DrylLayout (which is normally 100vh) sits cleanly inside a doc preview. ─── */
.demo-shell {
    height: 320px;
    width: 100%;
    border: 1px solid var(--line-strong);
    border-radius: var(--r-md);
    overflow: hidden;
    background: var(--bg-2);
}
.demo-shell .app-shell { min-height: 0; height: 100%; }
.demo-shell .sidebar  { height: 100%; position: relative; z-index: 1; }
.demo-shell .topbar   { position: relative; }
.demo-shell .main       { overflow: auto; }
.demo-shell .main-inner { padding: var(--sp-5); max-width: none; }

/* Sidebar brand text wrapper — stacks name over sub via a class (not inline
   style) so the collapsed icon rail's .sidebar-collapse-hide can hide it. */
.brand-text { display: flex; flex-direction: column; }

/* Blazor reconnect / error UI — keep visible but unobtrusive */
#blazor-error-ui {
    color-scheme: dark;
    background: var(--bg-2);
    color: var(--fg);
    border-top: 1px solid var(--line-strong);
    bottom: 0;
    box-shadow: var(--shadow-lg);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 12px 20px;
    position: fixed;
    width: 100%;
    z-index: 1000;
    font-size: 13px;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 12px;
    top: 8px;
    color: var(--fg-muted);
}

#blazor-error-ui .reload {
    color: var(--accent-b);
    margin-left: 8px;
}

/* ─── Legal pages (Impressum / Datenschutz) ─── */
.legal {
    max-width: 760px;
    margin: 0 auto;
    padding: var(--sp-7) 0 var(--sp-8);
    display: flex;
    flex-direction: column;
    gap: var(--sp-5);
}

.legal-back {
    align-self: flex-start;
}

.legal h1 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--fg);
}

.legal h2 {
    margin: var(--sp-5) 0 0;
    font-size: 1.0625rem;
    font-weight: 600;
    color: var(--fg);
}

.legal p,
.legal li {
    margin: var(--sp-2) 0 0;
    color: var(--fg-muted);
    line-height: 1.65;
}

.legal ul {
    margin: 0;
    padding-left: var(--sp-5);
}

.legal a {
    color: var(--fg);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color var(--dur-fast) var(--ease-out);
}

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

.legal address {
    font-style: normal;
    color: var(--fg-muted);
    line-height: 1.7;
}

/* ─── Site footer (Impressum / Datenschutz / Cookie-Einstellungen) ─── */
.site-footer {
    margin-top: var(--sp-8);
    padding: var(--sp-5) var(--sp-6);
    border-top: 1px solid var(--line);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-3);
    background: color-mix(in srgb, var(--ground) 60%, transparent);
}

.site-footer-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--sp-4);
}

.site-footer-nav a,
.site-footer-nav button {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font: inherit;
    color: var(--fg-muted);
    text-decoration: none;
    transition: color var(--dur-fast) var(--ease-out);
}

.site-footer-nav a:hover,
.site-footer-nav a:focus-visible,
.site-footer-nav button:hover,
.site-footer-nav button:focus-visible {
    color: var(--fg);
}

.site-footer-copy {
    margin: 0;
    font-size: 0.8125rem;
    color: var(--fg-dim);
}
/* ─── Cookie consent banner (app chrome) ───
   Global, not scoped: `.consent-fixed` styles the DrylPresence wrapper, which is
   child-component output the page scope can't reach (::deep). Positioning lives on
   that transformed wrapper itself — a self-transform (the slide-up animation) keeps
   `fixed` anchored to the viewport, whereas a transform on an *ancestor* would pin it
   to the wrapper (which sits at the end of the document flow → banner stuck at page
   bottom). That was the "have to scroll down" bug. */
.consent-fixed {
    position: fixed;
    left: 0;
    right: 0;
    bottom: var(--sp-4);
    margin-inline: auto;
    z-index: var(--z-toast);
    width: min(720px, calc(100vw - var(--sp-6)));
}

.consent {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--sp-4);
    padding: var(--sp-4) var(--sp-5);
    border-radius: var(--r-lg);
    border: 1px solid var(--line-strong);
    background: color-mix(in srgb, var(--ground) 82%, transparent);
    backdrop-filter: blur(var(--glass-blur)) saturate(140%);
    -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(140%);
    box-shadow: var(--shadow-lg), 0 0 0 1px var(--accent-line);
}

/* hairline accent glow along the top edge */
.consent::before {
    content: "";
    position: absolute;
    top: -1px;
    left: var(--sp-5);
    right: var(--sp-5);
    height: 1px;
    background: var(--accent-grad);
    opacity: 0.5;
}

.consent-body {
    flex: 1 1 320px;
    min-width: 0;
}

.consent-title {
    margin: 0 0 var(--sp-1);
    font-size: 0.9375rem;
    font-weight: 600;
    color: var(--fg);
}

.consent-desc {
    margin: 0;
    font-size: 0.8125rem;
    line-height: 1.5;
    color: var(--fg-muted);
}

.consent-desc a {
    color: var(--fg);
    text-decoration: underline;
    text-underline-offset: 2px;
    transition: color var(--dur-fast) var(--ease-out);
}

.consent-desc a:hover,
.consent-desc a:focus-visible {
    color: var(--accent-a);
}

.consent-actions {
    display: flex;
    align-items: center;
    gap: var(--sp-2);
    flex-shrink: 0;
}

@media (max-width: 560px) {
    .consent {
        flex-direction: column;
        align-items: stretch;
    }

    .consent-actions {
        justify-content: flex-end;
    }
}
