/* Barbaro Universal State System

   Mount zones:
   - Document viewer: full-page state at page root.
   - Account gate: gate state in a compact account-context wrapper.
   - Editor body: inline state inside the editor body container (.doc-editor-body).
   - Brand 404: full-page state wrapped in brand ribbons.
*/

@keyframes stateShimmer {
    0% { background-position: -260px 0; }
    100% { background-position: 260px 0; }
}

.state {
    box-sizing: border-box;
    color: var(--stone);
    font-family: var(--font-app);
}

.state--full-page {
    max-width: 760px;
    margin: 36px auto;
    padding: 48px 24px;
    text-align: center;
}

.state--inline {
    margin: 0;
    padding: 28px 20px;
    text-align: center;
}

.state--inline.is-compact {
    padding: 20px 16px;
}

.state--banner {
    display: flex;
    align-items: center;
    gap: 14px;
    margin: 0 0 14px;
    padding: 10px 14px;
    text-align: left;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.4;
}

.state--gate {
    max-width: 560px;
    margin: clamp(36px, 9vh, 72px) auto;
    padding: 44px 30px;
    text-align: center;
}

.state-card,
.state--gate {
    background: linear-gradient(135deg, rgba(249, 246, 239, .98), rgba(241, 233, 212, .72));
    border: 1px solid rgba(60, 42, 30, .08);
    border-radius: 12px;
    box-shadow: 0 1px 2px rgba(60,42,30,.04), 0 12px 28px -20px rgba(60,42,30,.22);
}

:is(#lineup-root, #le-body, #state-host) .state-missing.state-card,
:is(#acct-root, #adm-root) .state--gate,
#pizza-root .state-loading.state-card {
    background: var(--cream);
    border: 0;
    box-shadow: 0 1px 2px rgba(60,42,30,.04), 0 18px 36px -28px rgba(60,42,30,.24);
}

.state--gate {
    position: relative;
    overflow: hidden;
}

.state:focus,
.state:focus-visible {
    outline: none;
}

.state--gate::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 5px;
    background: linear-gradient(to bottom, rgba(160,82,45,.34), rgba(160,82,45,.08));
    pointer-events: none;
}

.state-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 86px;
    height: 72px;
    margin: 0 auto 16px;
    color: var(--rust-muted);
    border: 1px solid rgba(160,82,45,.18);
    border-radius: 16px;
    background: rgba(160,82,45,.055);
}

.state-icon svg {
    display: block;
    width: 40px;
    height: 40px;
}
.state-icon img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.state-kicker {
    margin: 0 0 7px;
    color: var(--rust);
    font-family: var(--font-app);
    font-size: 14px;
    font-style: italic;
    line-height: 1.35;
}

.state-title {
    margin: 0 0 8px;
    color: var(--ink);
    font-family: var(--font-app);
    font-size: clamp(28px, 4vw, 36px);
    font-weight: 400;
    line-height: 1.2;
    letter-spacing: 0;
}

.state-code {
    margin: 0 0 10px;
    color: var(--rust);
    font-family: var(--font-app);
    font-size: 56px;
    font-weight: 400;
    line-height: 1;
    letter-spacing: 0;
}

.state--inline .state-title,
.state--gate .state-title,
.state--banner .state-title {
    font-size: clamp(20px, 3vw, 26px);
}

.state--inline.is-compact .state-title {
    font-size: clamp(18px, 2.5vw, 22px);
}

.state-body {
    max-width: 480px;
    margin: 0 auto 20px;
    color: var(--stone);
    font-family: var(--font-app);
    font-size: 14px;
    line-height: 1.5;
}

.state--inline .state-body {
    max-width: 420px;
}

.state-actions {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 10px;
}

.state-cta {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 12px 22px;
    border: 1px solid var(--rust);
    border-radius: 999px;
    background: var(--rust);
    color: #fff;
    font-family: var(--font-app);
    font-size: 13px;
    font-weight: 700;
    line-height: 1.2;
    text-decoration: none;
    cursor: pointer;
    transition: transform var(--transition-state), background var(--transition-state), border-color var(--transition-state), color var(--transition-state), box-shadow var(--transition-state);
}

.state-cta:hover {
    background: #8b4726;
    color: #fff;
    transform: var(--hover-lift);
}

.state-cta.secondary {
    background: transparent;
    color: var(--rust);
    border-color: rgba(160,82,45,.28);
    padding: 10px 18px;
}

.state-cta.secondary:hover {
    background: rgba(249,246,239,.78);
    border-color: var(--rust-muted);
    transform: var(--hover-lift);
}

.state-cta:focus-visible,
.state-banner-action:focus-visible {
    outline: 0;
}

@media (max-width: 480px) {
    .state--gate {
        margin: 28px auto;
        padding: 34px 20px;
    }

    .state--gate .state-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .state--gate .state-cta {
        width: 100%;
    }
}

.state-banner-msg {
    flex: 1 1 auto;
}

.state-banner-action {
    flex: 0 0 auto;
    min-height: 32px;
    padding: 6px 14px;
    border-radius: 999px;
    background: transparent;
    color: inherit;
    border: 1px solid currentColor;
    font-family: var(--font-app);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
}

.state-banner-action:hover:not(:disabled) {
    background: currentColor;
}

.state-banner-action:hover:not(:disabled) span {
    color: #fff;
}

.state-banner-action:disabled {
    opacity: .55;
    cursor: progress;
}

.state-banner.is-warning {
    background: rgba(184, 148, 40, .12);
    border: 1px solid rgba(184, 148, 40, .35);
    color: #6e5818;
}

.state-banner.is-error {
    background: rgba(160, 64, 48, .04);
    border: 1px dashed rgba(160, 64, 48, .28);
    color: #a04030;
}

.state-banner.is-info {
    background: rgba(125, 114, 104, .08);
    border: 1px solid var(--divider-light);
    color: var(--stone);
}

.state-loading {
    padding-top: 60px;
}

.state--inline.state-loading {
    padding-top: 28px;
}

.state-skel-thumb,
.state-skel-title,
.state-skel-line,
.state-skel-bubble,
.state-skel-row,
.state-skel-card {
    background: linear-gradient(90deg, var(--sand) 0%, rgba(232,224,204,.6) 50%, var(--sand) 100%);
    background-size: 260px 100%;
    animation: stateShimmer 1.4s linear infinite;
}

.state-skel-thumb {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    margin: 0 auto 18px;
}

.state-skel-title {
    width: min(280px, 78vw);
    height: 34px;
    border-radius: 8px;
    margin: 0 auto 16px;
}

.state-skel-line {
    width: min(520px, 86vw);
    height: 14px;
    border-radius: 7px;
    margin: 0 auto 8px;
}

.state-skel-line.short {
    width: min(360px, 64vw);
}

.state-skel-row {
    width: min(100%, 560px);
    height: 16px;
    border-radius: 8px;
    margin: 0 auto 10px;
}

.state-skel-row.short {
    width: min(72%, 390px);
}

.state-skel-card {
    width: min(100%, 520px);
    height: 96px;
    border-radius: 8px;
    margin: 0 auto 12px;
}

.state-loading-copy {
    display: none;
    margin-top: 16px;
    color: var(--stone);
    font-family: var(--font-app);
    font-size: 13px;
}

.state-loading.is-slow .state-loading-copy {
    display: block;
}

.state-lineup-skel {
    display: grid;
    grid-template-columns: minmax(210px, 260px) minmax(0, 1fr);
    align-items: center;
    gap: 34px;
    max-width: 760px;
    margin: 0 auto;
    text-align: left;
}

.state-lineup-collage {
    position: relative;
    width: 236px;
    height: 210px;
    margin: 0 auto;
}

.state-skel-bubble {
    position: absolute;
    border-radius: 50%;
    opacity: .55;
}

.state-skel-bubble.b1 { width: 120px; height: 120px; top: 8px; left: 8px; z-index: 5; }
.state-skel-bubble.b2 { width: 88px; height: 88px; top: 0; left: 140px; z-index: 5; }
.state-skel-bubble.b3 { width: 96px; height: 96px; top: 96px; left: 120px; z-index: 6; }
.state-skel-bubble.b4 { width: 74px; height: 74px; top: 120px; left: 36px; z-index: 4; }

.state-lineup-copy .state-skel-title,
.state-lineup-copy .state-skel-line {
    margin-left: 0;
    margin-right: 0;
}

.state-lineup-copy .state-skel-eyebrow {
    width: 140px;
    height: 12px;
    border-radius: 6px;
    margin: 0 0 12px;
}

.state-lineup-copy .state-skel-title {
    width: 75%;
    height: 36px;
    margin-bottom: 14px;
}

.state-lineup-copy .state-skel-line {
    width: 92%;
    margin-bottom: 6px;
}

.state-lineup-copy .state-skel-line.short {
    width: 64%;
}

.state-owner-private {
    display: inline-flex;
    align-items: center;
    align-self: center;
    gap: 5px;
    color: var(--stone);
    font-family: var(--font-app);
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
}

.state-owner-private-icon {
    width: 14px;
    height: 14px;
    flex: 0 0 14px;
}

@media (max-width: 700px) {
    .state-lineup-skel {
        grid-template-columns: 1fr;
        text-align: center;
        gap: 18px;
    }

    .state-lineup-copy .state-skel-title,
    .state-lineup-copy .state-skel-line,
    .state-lineup-copy .state-skel-eyebrow {
        margin-left: auto;
        margin-right: auto;
    }
}

@media (max-width: 520px) {
    .state--banner {
        align-items: flex-start;
        flex-direction: column;
    }

    .state-banner-action {
        width: 100%;
    }
}

@media print {
    .state--full-page.state-loading,
    .state--banner.state-error {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .state-skel-thumb,
    .state-skel-title,
    .state-skel-line,
    .state-skel-bubble,
    .state-skel-row,
    .state-skel-card,
    .state-lineup-copy .state-skel-eyebrow {
        animation: none;
        background: var(--sand);
    }
}
