/* Browse foundation layout. */

.browse-page {
    min-height: 100vh;
    max-width: 1180px;
    margin: 0 auto;
    padding: clamp(0.75rem, 2vw, 1.75rem) clamp(1rem, 3vw, 2.5rem);
}

.product-shell {
    display: flex;
    flex-direction: column;
    gap: 0.9rem;
}

.product-header {
    display: grid;
    align-content: start;
    gap: 0.6rem;
    padding-block: 0.25rem 0;
}

.product-kicker,
.eyebrow {
    color: var(--color-primary);
}

.product-header-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
}

.product-header h1,
.foundation-hero h2,
.state-card h2 {
    margin: 0;
    color: var(--color-emphasis);
    letter-spacing: -0.03em;
}

.product-header h1 {
    font-size: clamp(2rem, 5vw, 3.75rem);
    line-height: 0.95;
}

.product-lede {
    max-width: 44rem;
    margin: 0.7rem 0 0;
    color: var(--color-subtle);
    font-size: clamp(1rem, 2vw, 1.18rem);
}

.product-nav {
    justify-content: flex-end;
    align-items: center;
}

.product-nav a:not(.button) {
    color: var(--color-subtle);
    font-weight: 600;
    padding: 0.45rem 0;
}
.session-control {
    display: inline-flex;
    align-items: stretch;
    gap: 0;
    flex-wrap: nowrap;
}
.session-control input {
    width: min(9.5rem, 42vw);
    min-height: 2rem;
    padding: 0.45rem 0.65rem;
    border: 1px solid var(--color-border);
    border-right: 0;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
    background: var(--color-surface);
    color: var(--color-text);
    font-family: var(--font-ui);
    font-size: 0.9rem;
}
.session-control input:focus {
    outline: 2px solid color-mix(in srgb, var(--color-primary) 25%, transparent);
    outline-offset: 1px;
    border-color: var(--color-primary);
}
.session-control .button {
    min-height: 2rem;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}
.session-control-authenticated {
    justify-content: flex-end;
    gap: 0.5rem;
}
.foundation-hero {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(18rem, 0.95fr);
    gap: clamp(1rem, 3vw, 2rem);
    padding: clamp(1rem, 3vw, 1.5rem);
    scroll-margin-top: 1rem;
}

.foundation-hero-copy {
    display: grid;
    align-content: center;
    gap: 0.9rem;
}

.foundation-hero-copy p {
    margin: 0;
    color: var(--color-subtle);
    max-width: 42rem;
}

.blueprint-preview {
    min-height: 18rem;
    border: 1px solid var(--color-border);
}

.blueprint-preview::before,
.blueprint-preview::after {
    content: "";
    position: absolute;
    inset: 18% 16%;
    border: 1px solid var(--color-primary);
}

.blueprint-preview::after {
    inset: 32% 26%;
    border-color: var(--color-action);
}

.blueprint-axis,
.blueprint-dimension {
    position: absolute;
    font-family: var(--font-mono);
    font-size: 0.72rem;
    color: var(--color-primary);
}

.blueprint-axis-x {
    right: 0.75rem;
    bottom: 0.75rem;
}
.blueprint-axis-y {
    left: 0.75rem;
    top: 0.75rem;
}
.blueprint-dimension {
    left: 0.75rem;
    bottom: 0.75rem;
}

.browse-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 1rem;
    align-items: end;
    padding: 1rem;
}

.browse-results-grid,
.foundation-grid,
.state-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
    scroll-margin-top: 1rem;
}

.foundation-card {
    display: grid;
    grid-template-rows: auto 1fr;
    min-width: 0;
    overflow: hidden;
}

.state-card {
    display: grid;
    align-content: start;
    gap: 0.75rem;
    min-height: 11rem;
    padding: 1rem;
}

.state-card p {
    margin: 0;
    color: var(--color-subtle);
}

.error-state {
    border-color: color-mix(in srgb, var(--color-error) 55%, var(--color-border));
}

.thing-detail-page {
    min-height: 100vh;
    max-width: 1180px;
    margin: 0 auto;
    padding: clamp(0.75rem, 2vw, 1.75rem) clamp(1rem, 3vw, 2.5rem);
}

.detail-nav {
    display: flex;
}

.detail-nav a {
    color: var(--color-subtle);
    font-weight: 600;
}

.thing-detail-header,
.thing-detail-summary,
.thing-detail-copy,
.detail-panel,
.selected-model-panel,
.parts-list,
.part-row-body {
    display: flex;
    flex-direction: column;
}

.thing-detail-header {
    gap: 0.5rem;
}

.thing-detail-title-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 1rem;
}

.thing-detail-title-row h1,
.detail-panel h2,
.selected-model-panel h2,
.part-row h3 {
    margin: 0;
    color: var(--color-emphasis);
    letter-spacing: -0.03em;
}

.thing-detail-title-row h1 {
    font-size: clamp(2.1rem, 5vw, 4rem);
    line-height: 0.95;
}

.thing-detail-creator,
.detail-muted,
.model-row-summary,
.part-notes,
.viewer-unavailable p {
    margin: 0;
    color: var(--color-subtle);
}

.thing-detail-stats,
.part-row-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.8rem;
    margin: 0;
    color: var(--color-muted);
    font-family: var(--font-mono);
    font-size: 0.76rem;
}

.thing-detail-stats div,
.part-row-meta div {
    display: contents;
}

.thing-detail-stats dt,
.part-row-meta dt {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.thing-detail-stats dd,
.part-row-meta dd {
    margin: 0;
}

.thing-detail-shell {
    display: grid;
    grid-template-columns: minmax(0, 1.05fr) minmax(18rem, 0.95fr);
    align-items: start;
    gap: clamp(1rem, 3vw, 1.5rem);
    padding: clamp(1rem, 3vw, 1.5rem);
}

.thing-detail-viewer {
    aspect-ratio: 4 / 3;
    min-height: 20rem;
    max-height: 34rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    overflow: hidden;
}

.detail-asset-viewer,
.detail-asset-viewer .model-viewer-boundary,
.detail-asset-viewer .model-viewer-stage {
    height: 100%;
    min-height: 0;
}

.detail-asset-viewer .model-viewer-boundary {
    border: 0;
    background: transparent;
}

.detail-asset-viewer .model-viewer-stage {
    grid-template-rows: 1fr;
}

.model-viewer-preview-image {
    grid-row: 1;
    grid-column: 1;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thing-detail-summary {
    justify-content: space-between;
    gap: 1rem;
}

.thing-detail-copy {
    gap: 0.85rem;
}

.thing-detail-chips,
.thing-detail-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.thing-detail-actions {
    align-items: center;
}

.thing-detail-actions .button-primary {
    min-width: 9.5rem;
}

.button:disabled,
.button[disabled],
.model-row:disabled,
.model-row[disabled] {
    cursor: not-allowed;
    opacity: 0.52;
    filter: saturate(0.7);
}

.button:disabled:hover,
.button[disabled]:hover {
    border-color: var(--color-border);
    color: var(--color-text);
    filter: saturate(0.7);
}

.thing-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

.detail-panel {
    gap: 0.85rem;
    padding: 1rem;
}

.thing-detail-grid > .detail-panel:nth-child(-n + 2) {
    align-self: stretch;
    height: 100%;
}

.detail-panel-heading {
    display: flex;
    align-items: baseline;
}

.detail-panel-heading h2,
.selected-model-heading h2 {
    font-size: clamp(1.25rem, 2vw, 1.6rem);
    line-height: 1.1;
}

.selected-model-heading {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.instruction-list,
.print-settings {
    margin: 0;
    padding-left: 1.25rem;
    color: var(--color-text);
}

.instruction-list li + li,
.print-settings li + li {
    margin-top: 0.35rem;
}

.model-list {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
}

.model-row {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    background: var(--color-base);
    color: var(--color-text);
    text-align: left;
}

.model-row:hover,
.model-row.is-selected {
    border-color: var(--color-primary);
}

.model-row.is-selected {
    background: color-mix(in srgb, var(--color-primary) 8%, transparent);
}

.model-row-title {
    font-weight: 700;
}

.model-row-meta {
    color: var(--color-muted);
    font-family: var(--font-mono);
    font-size: 0.75rem;
}

.selected-model-panel,
.part-row-body {
    gap: 0.65rem;
}

.parts-list {
    gap: 0.75rem;
}

.part-row {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    background: var(--color-base);
}

.part-row-index {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 2rem;
    width: 2rem;
    height: 2rem;
    border: 1px solid var(--color-primary);
    border-radius: 999px;
    color: var(--color-primary);
    font-family: var(--font-mono);
    font-size: 0.78rem;
}

.viewer-unavailable {
    min-height: 12rem;
    padding: 1rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 1rem;
}


@media (max-width: 820px) {
    .foundation-hero,
    .browse-controls,
    .thing-detail-shell,
    .thing-detail-grid {
        grid-template-columns: 1fr;
    }

    .product-header-row,
    .thing-detail-title-row {
        display: grid;
        align-items: start;
    }

    .product-nav {
        justify-content: flex-start;
    }

    .browse-results-grid,
    .foundation-grid,
    .state-grid {
        grid-template-columns: 1fr;
    }
}
