/* Catalog shared styles — ported from K12's documentation-page theme.
   Neutral-gray background, soft multi-layer shadows, white cards with
   generous rounded corners. Distinct from the lab UI chrome (cream
   surfaces, hard offset shadows) defined in ../css/tokens.css and
   ../css/atoms/ that govern the embedded widgets. */

:root {
    --k12-bg:          #f9f9f9;
    --k12-surface:     #ffffff;
    --k12-text:        #202020;
    --k12-text-sub:    #646464;
    --k12-text-muted:  #8d8d8d;
    --k12-border:      rgba(0, 0, 0, 0.06);
    --k12-border-hair: rgba(0, 0, 0, 0.08);
    --k12-accent:      #1A7A65;
    --k12-accent-hover:#22926F;
    --k12-code-bg:     #f3f3f3;
    --k12-shadow-card:
        0px 0px 0px 1px rgba(0, 0, 0, 0.06),
        0px 1px 2px -1px rgba(0, 0, 0, 0.06),
        0px 2px 4px 0px rgba(0, 0, 0, 0.04);
    --k12-shadow-btn:
        0px 0px 0px 1px rgba(0, 0, 0, 0.06),
        0px 1px 2px rgba(0, 0, 0, 0.04);
    --k12-shadow-btn-hover:
        0px 0px 0px 1px rgba(0, 0, 0, 0.08),
        0px 2px 4px rgba(0, 0, 0, 0.06);
}

html, body {
    margin: 0;
    padding: 0;
    background: var(--k12-bg);
    color: var(--k12-text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; }

.catalog-page {
    max-width: 900px;
    margin: 0 auto;
    padding: 48px 24px 80px;
}

/* ── Breadcrumb / back link ─────────────────────────────────── */

.catalog-breadcrumb {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 32px;
    font-size: 13px;
    font-weight: 600;
    color: var(--k12-text-sub);
    text-decoration: none;
    padding: 8px 16px;
    background: var(--k12-surface);
    border: 1px solid var(--k12-border);
    border-radius: 9999px;
    box-shadow: var(--k12-shadow-btn);
    transition: background 150ms ease, color 150ms ease, box-shadow 150ms ease;
}

.catalog-breadcrumb:hover {
    color: var(--k12-text);
    background: #f5f5f5;
    box-shadow: var(--k12-shadow-btn-hover);
}

/* ── Header & hero ──────────────────────────────────────────── */

.catalog-header {
    margin-bottom: 48px;
}

.catalog-header h1 {
    font-family: inherit;
    font-weight: 700;
    font-size: 2.25rem;
    letter-spacing: -0.02em;
    line-height: 1.15;
    color: var(--k12-text);
    margin: 0 0 8px;
}

.catalog-header h2 {
    font-family: inherit;
    font-weight: 600;
    font-size: 1.3rem;
    letter-spacing: -0.01em;
    color: var(--k12-text);
    margin: 0 0 8px;
}

.catalog-header .subtitle {
    font-size: 1rem;
    color: var(--k12-text-sub);
    line-height: 1.5;
    max-width: 640px;
    margin: 0;
}

.catalog-header .subtitle code {
    font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.85em;
    background: var(--k12-code-bg);
    padding: 1px 6px;
    border-radius: 4px;
    color: var(--k12-text);
}

.catalog-header .subtitle a {
    color: var(--k12-accent);
    text-decoration: none;
    border-bottom: 1px dashed rgba(26, 122, 101, 0.4);
    transition: color 150ms ease, border-color 150ms ease;
}

.catalog-header .subtitle a:hover {
    color: var(--k12-accent-hover);
    border-bottom-color: var(--k12-accent-hover);
}

.catalog-header .stat-pill,
.catalog-header .stat-pill-inline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 16px;
    padding: 5px 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--k12-text-sub);
    background: var(--k12-surface);
    border: 1px solid var(--k12-border);
    border-radius: 9999px;
    box-shadow: var(--k12-shadow-btn);
}

.catalog-header .stat-pill strong {
    color: var(--k12-text);
    font-weight: 700;
}

/* ── Section titles ─────────────────────────────────────────── */

.catalog-section {
    margin-top: 48px;
}

.catalog-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--k12-text-muted);
    margin: 0 0 16px;
}

/* ── Three-dot divider ──────────────────────────────────────── */

.dot-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 32px 0;
}

.dot-divider span {
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: #d9d9d9;
}

/* ── Catalog cards (index.html) ─────────────────────────────── */

.catalog-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
}

.catalog-card {
    display: block;
    background: var(--k12-surface);
    border-radius: 16px;
    box-shadow: var(--k12-shadow-card);
    padding: 28px 28px 24px;
    text-decoration: none;
    color: inherit;
    transition: box-shadow 150ms ease, transform 150ms ease;
}

.catalog-card[hidden] { display: none; }

a.catalog-card:hover {
    box-shadow:
        0px 0px 0px 1px rgba(0, 0, 0, 0.08),
        0px 2px 6px -1px rgba(0, 0, 0, 0.08),
        0px 6px 14px 0px rgba(0, 0, 0, 0.06);
    transform: translateY(-1px);
}

.card-diagram {
    background: var(--k12-bg);
    border-radius: 10px;
    aspect-ratio: 220 / 130;
    max-height: 180px;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.card-diagram svg {
    width: 100%;
    height: 100%;
    display: block;
}

.card-body { min-width: 0; }

.card-body .card-role,
.catalog-card .card-role {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--k12-text-muted);
    margin-bottom: 6px;
}

.card-body h2,
.catalog-card h2 {
    font-family: inherit;
    font-weight: 600;
    font-size: 1.3rem;
    letter-spacing: -0.01em;
    line-height: 1.25;
    color: var(--k12-text);
    margin: 0 0 10px;
}

.card-body p,
.catalog-card p {
    font-size: 0.875rem;
    line-height: 1.55;
    color: var(--k12-text-sub);
    margin: 0 0 14px;
}

.card-body p + p { margin-top: -4px; }

.card-body .field-label {
    display: block;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--k12-text-muted);
    margin-top: 14px;
    margin-bottom: 4px;
}

.card-body ul {
    list-style: none;
    padding: 0;
    margin: 0 0 14px;
}

.card-body li {
    position: relative;
    padding-left: 18px;
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--k12-text-sub);
}

.card-body li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 9px;
    width: 6px;
    height: 2px;
    background: var(--k12-text-muted);
    border-radius: 1px;
}

.card-pose {
    display: block;
    margin-top: 16px;
    padding: 10px 14px;
    background: var(--k12-code-bg);
    border-radius: 8px;
    font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.45;
    color: var(--k12-text);
    overflow-x: auto;
    white-space: pre;
}

.card-used {
    margin-top: 14px;
    font-size: 12px;
    color: var(--k12-text-muted);
    line-height: 1.5;
}

.card-used code,
.card-sub code,
.card-desc code,
.card-notes code,
.card-body p code {
    font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.85em;
    background: var(--k12-code-bg);
    padding: 1px 6px;
    border-radius: 4px;
}

.card-sub {
    font-size: 0.875rem;
    color: var(--k12-text-sub);
    margin: 0 0 6px;
}

.card-desc {
    font-size: 0.875rem;
    line-height: 1.55;
    color: var(--k12-text-sub);
    margin: 0 0 16px;
}

.card-notes {
    font-size: 0.8125rem;
    line-height: 1.55;
    color: var(--k12-text-sub);
    margin: 0 0 4px;
}

/* ── Compact role cards (camera-presets.html grid) ──────────── */

.role-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

@media (max-width: 720px) {
    .role-grid { grid-template-columns: minmax(0, 1fr); }
}

.role-card {
    background: var(--k12-surface);
    border-radius: 12px;
    box-shadow: var(--k12-shadow-card);
    padding: 20px 22px;
    display: grid;
    grid-template-columns: 80px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
    min-width: 0;
}

.role-card .role-diagram {
    background: var(--k12-bg);
    border-radius: 8px;
    aspect-ratio: 1 / 1;
}

.role-card .role-diagram svg {
    width: 100%;
    height: 100%;
    display: block;
}

.role-card .role-name {
    font-weight: 600;
    font-size: 1.05rem;
    letter-spacing: -0.01em;
    color: var(--k12-text);
    margin: 0 0 4px;
    line-height: 1.25;
}

.role-card .role-tagline {
    font-size: 12px;
    color: var(--k12-text-sub);
    margin: 0 0 10px;
    line-height: 1.4;
}

.role-card .role-shape {
    font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 11px;
    color: var(--k12-accent);
    background: var(--k12-code-bg);
    padding: 3px 8px;
    border-radius: 6px;
    display: inline-block;
}

/* ── Rules list (camera-presets.html) ───────────────────────── */

.rules-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 14px;
    counter-reset: rule;
}

.rules-list > li {
    background: var(--k12-surface);
    border-radius: 12px;
    box-shadow: var(--k12-shadow-card);
    padding: 16px 20px 16px 52px;
    position: relative;
    counter-increment: rule;
}

.rules-list > li::before {
    content: "R" counter(rule);
    position: absolute;
    left: 16px;
    top: 17px;
    font-family: ui-monospace, Menlo, monospace;
    font-size: 12px;
    font-weight: 600;
    color: var(--k12-accent);
    letter-spacing: 0.02em;
}

.rules-list .rule-title {
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: -0.01em;
    line-height: 1.3;
    color: var(--k12-text);
    margin: 0 0 4px;
}

.rules-list .rule-body {
    font-size: 0.875rem;
    line-height: 1.55;
    color: var(--k12-text-sub);
    margin: 0;
}

/* ── Applied-example cards + widget cards ───────────────────── */

.applied-card {
    background: var(--k12-surface);
    border-radius: 16px;
    box-shadow: var(--k12-shadow-card);
    padding: 24px 28px 22px;
    min-width: 0;
    margin-bottom: 20px;
}

/* Direct-child only — modal/completion/widget headings nested deeper keep their own styling. */
.applied-card > h2,
.applied-card > h3 {
    font-family: inherit;
    font-weight: 600;
    font-size: 1.15rem;
    letter-spacing: -0.01em;
    color: var(--k12-text);
    margin: 0 0 4px;
}

.applied-card .applied-meta {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--k12-text-muted);
    margin-bottom: 10px;
}

.applied-card p {
    font-size: 0.875rem;
    line-height: 1.55;
    margin: 0 0 12px;
    color: var(--k12-text-sub);
}

.applied-card .mapping-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
}

.applied-card .mapping-table th,
.applied-card .mapping-table td {
    text-align: left;
    padding: 8px 10px;
    font-size: 12px;
    border-top: 1px solid var(--k12-border);
}

.applied-card .mapping-table th {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--k12-text-muted);
    border-top: none;
    background: transparent;
}

.applied-card .mapping-table code {
    font-family: ui-monospace, Menlo, monospace;
    font-size: 11px;
    background: var(--k12-code-bg);
    padding: 1px 5px;
    border-radius: 4px;
}

.callout-note {
    font-size: 0.8125rem;
    line-height: 1.55;
    color: var(--k12-text-sub);
    padding: 12px 16px;
    background: #fffaea;
    border: 1px solid rgba(0, 0, 0, 0.04);
    border-left: 3px solid #E0B94A;
    border-radius: 8px;
    margin: 12px 0 0;
}

.callout-note strong { color: var(--k12-text); }

/* ── Status pills (ui-actions.html) ─────────────────────────── */

.status-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 72px;
    padding: 2px 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    border-radius: 9999px;
    border: 1px solid var(--k12-border);
    background: var(--k12-surface);
    color: var(--k12-text-sub);
    white-space: nowrap;
}

.status-pill.ok      { background: #E8F5EF; border-color: rgba(26, 122, 101, 0.3); color: #0F5C4A; }
.status-pill.partial { background: #FFF7DA; border-color: rgba(201, 144, 0, 0.3); color: #6B5000; }
.status-pill.missing { background: #FBE9E7; border-color: rgba(184, 80, 64, 0.3); color: #7A2A20; }
.status-pill.new     { background: #E5F0FB; border-color: rgba(38, 139, 210, 0.3); color: #1F4E7A; }

.actions-block {
    margin-top: 16px;
    padding: 0 28px;
    background: var(--k12-surface);
    border-radius: 16px;
    box-shadow: var(--k12-shadow-card);
}

.actions-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
}

.actions-table th,
.actions-table td {
    text-align: left;
    padding: 10px 12px;
    font-size: 13px;
    line-height: 1.45;
    border-top: 1px solid var(--k12-border);
    vertical-align: top;
    color: var(--k12-text-sub);
}

.actions-table thead th {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--k12-text-muted);
    border-top: none;
    background: transparent;
    padding-top: 0;
    padding-bottom: 6px;
}

.actions-table td.col-action {
    font-weight: 600;
    color: var(--k12-text);
    white-space: nowrap;
    width: 1%;
}

.actions-table td.col-status {
    width: 1%;
    white-space: nowrap;
}

.actions-table code {
    font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 11px;
    background: var(--k12-code-bg);
    padding: 1px 5px;
    border-radius: 4px;
    white-space: nowrap;
}

.actions-table tr.row-missing td.col-action { color: var(--k12-text-muted); }

.actions-table td.col-action a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dashed rgba(0, 0, 0, 0.25);
    transition: color 150ms ease, border-color 150ms ease;
}

.actions-table td.col-action a:hover {
    color: var(--k12-accent);
    border-bottom-color: var(--k12-accent);
}

.actions-table td.col-action a:focus-visible {
    outline: 2px solid var(--k12-accent);
    outline-offset: 3px;
    border-radius: 4px;
}

/* ── Tier legend strip (ui-actions.html) ────────────────────── */

.tier-legend {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    margin: 0 0 12px;
    padding: 14px 20px;
    background: var(--k12-surface);
    border-radius: 12px;
    box-shadow: var(--k12-shadow-card);
}

.tier-legend-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--k12-text-muted);
    margin-right: 4px;
}

.tier-legend-step {
    font-size: 12.5px;
    font-weight: 600;
    color: var(--k12-text);
    padding: 5px 12px;
    background: var(--k12-code-bg);
    border-radius: 8px;
    white-space: nowrap;
}

.tier-legend-arrow {
    color: var(--k12-text-muted);
    font-size: 14px;
    user-select: none;
}

/* ── Status legend (ui-actions.html) ────────────────────────── */

.status-legend {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    margin: 0 4px 4px;
    font-size: 12px;
    color: var(--k12-text-sub);
}

.status-legend .legend-item {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* ── Tier sections (ui-actions.html) ────────────────────────── */

.tier-section {
    margin-top: 56px;
}

.tier-section:first-of-type {
    margin-top: 40px;
}

.tier-title {
    font-family: inherit;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.015em;
    line-height: 1.2;
    color: var(--k12-text);
    margin: 0 0 6px;
}

.tier-tagline {
    font-size: 0.9375rem;
    color: var(--k12-text-sub);
    margin: 0 0 8px;
    line-height: 1.55;
    max-width: 720px;
}

.tier-tagline em { font-style: italic; }
.tier-tagline strong { color: var(--k12-text); font-weight: 600; }

/* ── Action entries (ui-actions.html) ───────────────────────── */

.action-entry {
    padding: 24px 0;
    border-top: 1px solid var(--k12-border);
}

.actions-block > .action-entry:first-child {
    border-top: none;
}

.action-name {
    font-family: inherit;
    font-size: 1.0625rem;
    font-weight: 600;
    letter-spacing: -0.01em;
    line-height: 1.3;
    color: var(--k12-text);
    margin: 0 0 6px;
}

.action-name a {
    color: inherit;
    text-decoration: none;
    border-bottom: 1px dashed rgba(0, 0, 0, 0.25);
    transition: color 150ms ease, border-color 150ms ease;
}

.action-name a:hover {
    color: var(--k12-accent);
    border-bottom-color: var(--k12-accent);
}

.action-name a:focus-visible {
    outline: 2px solid var(--k12-accent);
    outline-offset: 3px;
    border-radius: 4px;
}

.action-desc {
    font-size: 0.875rem;
    line-height: 1.55;
    color: var(--k12-text-sub);
    margin: 0 0 18px;
    max-width: 780px;
}

.action-desc code {
    font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.85em;
    background: var(--k12-code-bg);
    padding: 1px 6px;
    border-radius: 4px;
    color: var(--k12-text);
}

.action-inputs {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px 20px;
}

.input-slot {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    min-width: 0;
}

.input-slot:empty {
    display: block;
}

.input-slot-label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--k12-text-muted);
    margin-bottom: 2px;
}

.input-slot .input-method {
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    color: var(--k12-text);
}

.input-slot code {
    font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.85em;
    background: var(--k12-code-bg);
    padding: 1px 5px;
    border-radius: 4px;
    color: var(--k12-text);
}

@media (max-width: 640px) {
    .action-inputs {
        grid-template-columns: 1fr;
        gap: 14px;
    }
    .input-slot:empty { display: none; }
}

/* ── "Drag-only by design" intent badge ─────────────────────── */

.badge-intent {
    display: inline-block;
    padding: 1px 7px;
    margin-left: 6px;
    font-size: 9.5px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--k12-text-muted);
    background: var(--k12-code-bg);
    border: 1px solid var(--k12-border);
    border-radius: 5px;
    white-space: nowrap;
    vertical-align: 2px;
    line-height: 1.5;
}

/* ── UI Modes entries (ui-modes.html) ───────────────────────── */

.mode-entry .action-name {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    font-family: inherit;
}

.mode-entry .action-name > code {
    font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.95em;
    font-weight: 600;
    letter-spacing: 0;
    padding: 2px 10px;
    border-radius: 6px;
    background: var(--k12-code-bg);
    color: var(--k12-text);
}

.mode-entry .action-desc code {
    font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 0.85em;
    background: var(--k12-code-bg);
    padding: 1px 6px;
    border-radius: 4px;
    color: var(--k12-text);
}

.mode-refs {
    display: grid;
    grid-template-columns: 90px minmax(0, 1fr);
    gap: 8px 20px;
    margin: 0;
    align-items: start;
}

.mode-refs dt {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--k12-text-muted);
    padding-top: 3px;
}

.mode-refs dd {
    margin: 0;
    font-size: 13px;
    line-height: 1.55;
    color: var(--k12-text-sub);
    min-width: 0;
}

.mode-refs dd code {
    font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
    font-size: 12px;
    background: var(--k12-code-bg);
    padding: 1px 6px;
    border-radius: 4px;
    color: var(--k12-text);
    word-break: break-all;
}

.mode-altsels {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.mode-altsels li {
    font-size: 13px;
    line-height: 1.55;
    color: var(--k12-text-sub);
}

.mode-altsels-note {
    color: var(--k12-text-muted);
    font-size: 12px;
}

.altsel-demo-link {
    color: var(--k12-accent);
    text-decoration: none;
    font-size: 12px;
    font-weight: 500;
    margin-left: 6px;
    white-space: nowrap;
    transition: color 150ms ease;
}

.altsel-demo-link:hover {
    color: var(--k12-accent-hover);
    text-decoration: underline;
}

@media (max-width: 640px) {
    .mode-refs {
        grid-template-columns: 1fr;
        gap: 4px 0;
    }
    .mode-refs dt {
        padding-top: 10px;
    }
    .mode-refs dt:first-child {
        padding-top: 0;
    }
}
