/* Shared site styles. Everything is keyed to MudBlazor palette CSS variables
   so both the light and dark palettes work without duplication. */

/* ── App bar ──────────────────────────────────────────────────────────── */

.mallard-appbar {
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--mud-palette-lines-default);
}

.mallard-brand {
    font-weight: 700;
    letter-spacing: -.3px;
}

.nav-tab-active {
    box-shadow: inset 0 -2px 0 var(--mud-palette-primary);
    border-radius: 0;
}

/* ── Main content ─────────────────────────────────────────────────────── */

.mallard-main-content {
    padding: calc(var(--mud-appbar-height, 64px) + 24px) 16px 16px;
}

@media (min-width: 600px) {
    .mallard-main-content {
        padding-left: 24px;
        padding-right: 24px;
        padding-bottom: 24px;
    }
}

/* ── Guild sub-nav ────────────────────────────────────────────────────── */
/* Scrolls horizontally instead of wrapping/compacting on narrow viewports. */

.guild-subnav {
    display: flex;
    align-items: center;
    gap: 2px;
    overflow-x: auto;
    overflow-y: hidden;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    -ms-overflow-style: none;
    margin: -8px -4px 20px;
    padding: 8px 4px 12px;
    border-bottom: 1px solid var(--mud-palette-lines-default);
}

.guild-subnav::-webkit-scrollbar {
    display: none;
}

.guild-subnav .mud-button-root {
    flex-shrink: 0;
}

.guild-subnav-mobile {
    margin: -8px -4px 20px;
    padding: 8px 4px 12px;
    border-bottom: 1px solid var(--mud-palette-lines-default);
}

.mallard-mobile-nav-title {
    font-weight: 600;
}

/* ── Landing hero ─────────────────────────────────────────────────────── */

.hero {
    background: radial-gradient(ellipse 80% 60% at 50% -10%,
        color-mix(in srgb, var(--mud-palette-primary) 22%, transparent),
        transparent);
}

.hero-title {
    background: linear-gradient(90deg, var(--mud-palette-primary), #00c9a7);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
}

.marketing-hero {
    padding: 48px 0 24px;
    text-align: center;
}

.marketing-section {
    padding-bottom: 96px;
}

.marketing-page {
    padding-top: 24px;
    padding-bottom: 56px;
}

.stat-row {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 24px;
    max-width: 36rem;
    margin-block: 0;
}

@media (min-width: 600px) {
    .stat-row {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

.stat-value {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -.5px;
}

.stat-label {
    margin: 2px 0 0;
    font-size: .75rem;
    color: var(--mud-palette-text-secondary);
}

/* ── Live stats band ──────────────────────────────────────────────────── */
/* Sits under the hero's four static stats and is deliberately quieter than
   them. min-height reserves the row's space: the numbers arrive only after the
   WebAssembly runtime boots, and without it the hero would jump downward on a
   page whose install button is the thing being aimed at. An API failure leaves
   the same reserved gap rather than a layout shift. */

.live-stats {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 4px 14px;
    min-height: 24px;
    margin-top: 20px;
    font-size: .8125rem;
    color: var(--mud-palette-text-secondary);
}

.live-stat b {
    font-weight: 700;
    color: var(--mud-palette-text-primary);
}

/* Separators are drawn per cell rather than between them: the band wraps to two
   or three lines on a phone, and a `+ .live-stat::before` rule would strand a
   dot at the start of each wrapped line. */
.live-stat::before {
    content: "·";
    margin-right: 14px;
    opacity: .5;
}

.live-stats-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--mud-palette-success);
}

.live-stats-dot.is-degraded {
    background: var(--mud-palette-warning);
}

/* ── Product shots ────────────────────────────────────────────────────── */
/* The lightbox is the native popover API: no JS, so it works on the prerendered
   HTML before the WebAssembly runtime has booted. Only the UA's default border,
   padding and background need removing. */

.shot-figure {
    display: flex;
    flex-direction: column;
    height: 100%;
    margin: 0;
    overflow: hidden;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: var(--mud-default-borderradius);
    background: var(--mud-palette-surface);
}

.shot-button {
    position: relative;
    display: block;
    width: 100%;
    padding: 12px;
    border: none;
    border-bottom: 1px solid var(--mud-palette-lines-default);
    /* The screenshots are light-theme, so they sit on a permanently light mat
       rather than the page surface — otherwise they glow against the dark palette. */
    background: #f4f4f9;
    cursor: zoom-in;
}

.shot-image {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: 6px;
    /* Anchored left-top rather than centred: a centred crop sliced the line numbers
       and the first character off every line of code, which reads as broken. */
    object-fit: cover;
    object-position: left top;
}

.shot-hint {
    position: absolute;
    right: 16px;
    bottom: 16px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(26, 26, 39, .8);
    color: #fff;
    font-size: .75rem;
    font-weight: 500;
    opacity: 0;
    transition: opacity .15s ease;
    pointer-events: none;
}

.shot-button:hover .shot-hint,
.shot-button:focus-visible .shot-hint {
    opacity: 1;
}

.shot-caption {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 20px;
}

.shot-viewer,
.shot-viewer:popover-open {
    padding: 0;
    border: none;
    background: transparent;
    overflow: visible;
}

.shot-viewer img {
    max-width: 94vw;
    max-height: 88vh;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 8px;
    box-shadow: 0 24px 48px rgba(0, 0, 0, .45);
}

.shot-viewer::backdrop {
    background: rgba(0, 0, 0, .7);
}

/* ── Marketing / docs sections ────────────────────────────────────────── */

.marketing-card {
    padding: 24px;
    border: 1px solid var(--mud-palette-lines-default);
    background: var(--mud-palette-surface);
}

.code-card-icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    border-radius: 10px;
    background: color-mix(in srgb, var(--mud-palette-primary) 15%, transparent);
    font-size: 1.1rem;
}

.code-card-trigger {
    align-self: flex-start;
    font-family: var(--mallard-mono);
}

.marketing-list {
    margin: 0;
    padding-left: 20px;
    list-style: disc;
}

.marketing-list > li + li {
    margin-top: 8px;
}

.numbered-steps {
    margin: 0;
    padding-left: 20px;
}

.numbered-steps > li + li {
    margin-top: 12px;
}

.numbered-steps::marker {
    color: var(--mud-palette-primary);
}

.template-group {
    margin-bottom: 56px;
    scroll-margin-top: calc(var(--mud-appbar-height, 64px) + 16px);
}

.price-period {
    font-size: .85rem;
    font-weight: 500;
    color: var(--mud-palette-text-secondary);
}

.tier-highlights {
    margin: 0;
    padding: 0;
    list-style: none;
    font-size: .85rem;
}

.tier-highlights > li + li {
    margin-top: 6px;
}

.rival-facts {
    margin: 0;
    font-size: .85rem;
}

.rival-facts dt {
    font-weight: 500;
}

.rival-facts dt + dd {
    margin: 2px 0 0;
    color: var(--mud-palette-text-secondary);
}

.rival-facts dd + dt {
    margin-top: 14px;
}

/* ── Tables ───────────────────────────────────────────────────────────── */
/* Every wide table scrolls inside its own box rather than widening the page. */

.table-scroll {
    overflow-x: auto;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 8px;
}

.marketing-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: .85rem;
}

.marketing-table thead {
    background: var(--mud-palette-background-gray);
    color: var(--mud-palette-text-secondary);
}

.marketing-table th,
.marketing-table td {
    padding: 10px 16px;
    vertical-align: top;
}

.marketing-table tbody tr {
    border-top: 1px solid var(--mud-palette-lines-default);
}

.marketing-table tbody th {
    font-weight: 500;
}

.marketing-table .col-mallard {
    background: color-mix(in srgb, var(--mud-palette-primary) 8%, transparent);
    font-weight: 500;
}

.marketing-table .row-note {
    margin-top: 2px;
    font-size: .75rem;
    font-weight: 400;
    color: var(--mud-palette-text-secondary);
}

.nowrap {
    white-space: nowrap;
}

/* ── Docs ─────────────────────────────────────────────────────────────── */

.docs-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--mud-palette-lines-default);
}

.docs-index-card {
    display: flex;
    flex-direction: column;
    height: 100%;
    padding: 16px;
    border: 1px solid var(--mud-palette-lines-default);
    background: var(--mud-palette-surface);
    color: inherit;
    text-decoration: none;
    transition: border-color .15s ease;
}

.docs-index-card:hover {
    border-color: var(--mud-palette-primary);
}

.docs-index-title {
    font-weight: 600;
}

.docs-index-count {
    font-family: var(--mallard-mono);
    font-size: .75rem;
    color: var(--mud-palette-primary);
}

.docs-index-description {
    font-size: .75rem;
    line-height: 1.6;
    color: var(--mud-palette-text-secondary);
}

.disclosure {
    margin-bottom: 10px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 8px;
    background: var(--mud-palette-surface);
    scroll-margin-top: calc(var(--mud-appbar-height, 64px) + 16px);
}

.disclosure > summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 16px;
    font-size: .85rem;
    font-weight: 600;
    cursor: pointer;
    list-style: none;
}

.disclosure > summary::-webkit-details-marker {
    display: none;
}

.disclosure-marker {
    color: var(--mud-palette-text-secondary);
    transition: transform .15s ease;
}

.disclosure[open] .disclosure-marker {
    transform: rotate(90deg);
}

.disclosure-body {
    padding: 16px;
    border-top: 1px solid var(--mud-palette-lines-default);
}

.property-list {
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 8px;
    overflow: hidden;
}

.property {
    padding: 16px;
}

.property + .property {
    border-top: 1px solid var(--mud-palette-lines-default);
}

.property-type {
    font-size: .75rem;
}

.field-list {
    margin: 0;
    padding-left: 12px;
    border-left: 1px solid var(--mud-palette-lines-default);
    list-style: none;
    font-size: .8rem;
}

.field-list > li + li {
    margin-top: 6px;
}

.field-note {
    font-size: .75rem;
    line-height: 1.6;
}

.field-tag {
    display: inline-block;
    padding: 1px 8px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 999px;
    font-family: var(--mallard-mono);
    font-size: .7rem;
    font-weight: 400;
    color: var(--mud-palette-text-secondary);
}

.field-tag.accent-tag {
    margin-left: 8px;
    border-color: color-mix(in srgb, var(--mud-palette-primary) 40%, transparent);
    background: color-mix(in srgb, var(--mud-palette-primary) 10%, transparent);
    font-family: inherit;
    color: var(--mud-palette-primary);
}

.function-entry + .function-entry {
    margin-top: 20px;
}

.function-signature {
    margin: 0;
    font-size: .85rem;
    word-break: break-word;
}

.heading-code {
    font-family: var(--mallard-mono);
    font-size: inherit;
}

/* ── Legal pages ──────────────────────────────────────────────────────── */

.legal-card {
    padding: 32px;
    border: 1px solid var(--mud-palette-lines-default);
    background: var(--mud-palette-surface);
}

.legal-body > section + section {
    margin-top: 28px;
}

.legal-body h2 {
    margin: 0 0 8px;
    font-size: 1.15rem;
    font-weight: 700;
}

.legal-body p {
    margin: 0 0 10px;
    line-height: 1.65;
}

.legal-body ul {
    margin: 0;
    padding-left: 24px;
    list-style: disc;
}

.legal-body li {
    line-height: 1.65;
}

/* ── Footer ───────────────────────────────────────────────────────────── */

.marketing-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    margin: 0 -24px -24px;
    padding: 40px 20px;
    border-top: 1px solid var(--mud-palette-lines-default);
    background: var(--mud-palette-background-gray);
    text-align: center;
}

.marketing-footer-links {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 4px 8px;
    color: var(--mud-palette-lines-default);
}

/* ── Code samples ─────────────────────────────────────────────────────── */
/* Prism (wwwroot/lib/prism) tokenises in the browser; these rules theme it off
   the MudBlazor palette so light and dark both work. Before the runtime boots —
   or for a reader with no JS at all — the same block renders as plain text. */

.code-block {
    margin: 0;
    padding: 14px 16px;
    overflow-x: auto;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 8px;
    background: var(--mud-palette-background-gray);
    font-family: var(--mallard-mono);
    font-size: .78rem;
    line-height: 1.6;
    tab-size: 4;
}

.code-block code {
    background: none;
    padding: 0;
    font: inherit;
    color: var(--mud-palette-text-primary);
    white-space: pre;
}

.token.comment {
    color: var(--mud-palette-text-secondary);
    font-style: italic;
}

.token.string,
.token.regex {
    color: var(--mud-palette-secondary);
}

.token.number,
.token.boolean {
    color: var(--mud-palette-tertiary);
}

.token.keyword,
.token.control-flow {
    color: var(--mud-palette-primary);
    font-weight: 600;
}

.token.function,
.token.class-name {
    color: var(--mud-palette-info);
}

.token.property,
.token.constant {
    color: var(--mud-palette-info);
}

.token.operator,
.token.punctuation {
    color: var(--mud-palette-text-secondary);
}

/* ── Inline code and monospace ────────────────────────────────────────── */

:root {
    --mallard-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

.mono,
code {
    font-family: var(--mallard-mono);
}

/* Inline <code> in prose only — .code-block resets its own descendants above. */
p code,
li code,
dd code,
.mud-typography code {
    padding: 1px 5px;
    border-radius: 4px;
    background: var(--mud-palette-background-gray);
    font-size: .82em;
}

.accent {
    color: var(--mud-palette-primary);
}

/* ── Cards ────────────────────────────────────────────────────────────── */

.guild-card {
    height: 100%;
    border: 1px solid var(--mud-palette-lines-default);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}

.guild-card:hover {
    transform: translateY(-3px);
    border-color: var(--mud-palette-primary);
    box-shadow: 0 8px 24px rgba(0, 0, 0, .25);
}

.feature-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--mud-palette-primary) 14%, transparent);
    color: var(--mud-palette-primary);
    flex-shrink: 0;
}

/* ── Page scaffolding ─────────────────────────────────────────────────── */

.page-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.empty-state {
    border: 1px dashed var(--mud-palette-lines-default);
    border-radius: var(--mud-default-borderradius);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 48px 24px;
}

/* ── Accessibility ────────────────────────────────────────────────────── */

a:focus-visible {
    outline: 2px solid var(--mud-palette-primary);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .guild-card {
        transition: none;
    }

    .guild-card:hover {
        transform: none;
    }
}

/* ── Pre-boot loading shell ───────────────────────────────────────────────
   Shown by index.html until the WebAssembly runtime starts. On a prerendered
   route BlazorWasmPreRendering.Build keeps this as an overlay above the real
   content rather than replacing it, so a crawler still reads the page. */

.loading-shell {
    position: fixed;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 16px;
    background: var(--mud-palette-background, #1a1a27);
    z-index: 9999;
}

.loading-mark {
    font-family: Inter, Roboto, Helvetica, Arial, sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: -.3px;
    color: #7e6fff;
}

.loading-progress {
    width: 160px;
    height: 4px;
    border: none;
    background: rgba(126, 111, 255, .2);
}

html[data-theme="light"] .loading-shell {
    background: #f4f4f9;
}

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    padding: 12px 16px;
    background: #ffb545;
    color: #1a1a27;
    box-shadow: 0 -1px 4px rgba(0, 0, 0, .3);
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    float: right;
}
