/* Reusable card, button, input, chip, and state primitives. */

.card-surface,
.blueprint-panel,
.state-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    box-shadow: 0 1px 0 color-mix(in srgb, var(--color-text) 8%, transparent);
}

.card-title {
    font-family: var(--font-heading);
    font-weight: 600;
    color: var(--color-text);
    margin: 0;
    font-size: 1rem;
    line-height: 1.3;
}

.card-body {
    padding: 1rem;
    display: grid;
    gap: 0.65rem;
}

.card-body p {
    margin: 0;
    color: var(--color-subtle);
    font-size: 0.92rem;
}

.card-meta {
    color: var(--color-muted);
    font-family: var(--font-mono);
    font-size: 0.74rem;
}

.card-media,
.blueprint-media,
.blueprint-preview {
    position: relative;
    overflow: hidden;
    background:
        linear-gradient(var(--color-grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--color-grid-line) 1px, transparent 1px),
        var(--color-overlay);
    background-size: 20px 20px;
}

.blueprint-media {
    min-height: 8rem;
    padding: 0.75rem;
}

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

.thing-card-media {
    aspect-ratio: 4 / 3;
    min-height: 10rem;
}

.thing-card-media img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thing-card-placeholder {
    display: grid;
    min-height: 100%;
    align-content: start;
}

.thing-card-placeholder::before,
.thing-card-placeholder::after {
    content: "";
    position: absolute;
    inset: 20% 17%;
    border: 1px solid var(--color-primary);
}

.thing-card-placeholder::after {
    inset: 34% 28%;
    border-color: var(--color-action);
}

.thing-card-body {
    align-content: start;
    grid-template-rows: auto auto auto minmax(0, 1fr) auto;
}

.thing-card-heading {
    display: grid;
    gap: 0.25rem;
    min-width: 0;
}

.thing-card-title {
    font-size: clamp(1rem, 1.8vw, 1.18rem);
}

.thing-card-creator {
    color: var(--color-subtle);
    font-size: 0.88rem;
}

.thing-card-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

.thing-card-actions {
    grid-row: 5;
    align-self: end;
    display: flex;
    justify-content: space-between;
    gap: 0.65rem;
    margin-top: auto;
}

.thing-card-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.7rem;
    margin: 0;
    color: var(--color-muted);
    font-family: var(--font-mono);
    font-size: 0.72rem;
}

.thing-card-stats div {
    display: contents;
}

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

.thing-card-stats dd {
    margin: 0;
}

.thing-card-action {
    cursor: default;
    color: var(--color-muted);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.button,
.viewer-route-nav a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    width: fit-content;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    padding: 0.55rem 0.8rem;
    color: var(--color-text);
    background: var(--color-surface);
    font-family: var(--font-ui);
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
}

.button:hover,
.viewer-route-nav a:hover {
    border-color: var(--color-primary);
    color: var(--color-tertiary);
    text-decoration: none;
}

.button-primary {
    border-color: var(--color-action);
    background: var(--color-action);
    color: var(--color-base);
}

.button-primary:hover {
    filter: brightness(1.04);
    color: var(--color-base);
}

.button-secondary {
    border-color: var(--color-primary);
    color: var(--color-tertiary);
}

.button-ghost {
    background: transparent;
}

.button-row,
.tab-row,
.product-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.search-field {
    display: grid;
    gap: 0.35rem;
    color: var(--color-subtle);
    font-size: 0.85rem;
}

.search-field span,
.eyebrow,
.product-kicker {
    font-family: var(--font-mono);
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.search-field input {
    width: 100%;
    padding: 0.75rem 0.85rem;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    background: var(--color-base);
    color: var(--color-text);
    font-family: var(--font-ui);
}

.search-field input:focus {
    outline: 2px solid color-mix(in srgb, var(--color-primary) 25%, transparent);
    border-color: var(--color-primary);
}

.tab,
.status-pill {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-panel);
    background: transparent;
    color: var(--color-subtle);
    font-family: var(--font-mono);
    font-size: 0.72rem;
    line-height: 1;
    padding: 0.35rem 0.5rem;
}

.tab.is-active,
.status-pill {
    border-color: var(--color-primary);
    color: var(--color-tertiary);
    background: color-mix(in srgb, var(--color-primary) 8%, transparent);
}

.status-muted {
    border-color: var(--color-muted);
    color: var(--color-muted);
    background: transparent;
}

.status-error {
    border-color: var(--color-error);
    color: var(--color-error);
    background: color-mix(in srgb, var(--color-error) 8%, transparent);
}

.skeleton-line,
.skeleton-box {
    background: linear-gradient(90deg, var(--color-overlay), var(--color-highlight), var(--color-overlay));
    background-size: 200% 100%;
    animation: blueprint-skeleton 1.8s linear infinite;
}

.skeleton-line {
    height: 0.7rem;
    width: 65%;
}

.skeleton-wide {
    width: 90%;
}

.skeleton-box {
    min-height: 5rem;
}

@keyframes blueprint-skeleton {
    from { background-position: 200% 0; }
    to { background-position: -200% 0; }
}
