/**
 * Studio-grade printable surface — A4 preview, activity bodies, name hub.
 * Load after cnt-trace-detail.css / cnt-worksheet-variants.css. #cntTracingWorksheet uses .cnt-studio-sheet.
 */

:root {
    --studio-ink: #0f172a;
    --studio-ink-soft: #334155;
    --studio-muted: #64748b;
    --studio-paper: #fcfbfa;
    --studio-paper-warm: #faf8f5;
    --studio-row: #ffffff;
    --studio-rule: rgba(15, 23, 42, 0.22);
    --studio-rule-mid: rgba(15, 23, 42, 0.32);
    --studio-accent: #4c1d95;
    --studio-accent-soft: rgba(76, 29, 149, 0.12);
    --studio-shadow-sheet:
        0 0 0 1px rgba(15, 23, 42, 0.06),
        0 1px 2px rgba(15, 23, 42, 0.04),
        0 28px 64px -24px rgba(15, 23, 42, 0.14);
    --studio-radius-sheet: 16px;
    --studio-radius-row: 12px;
}

/* —— Capture sheet (browser PDF + print) —— */
.cnt-preview-sheet.cnt-studio-sheet {
    --cnt-paper: var(--studio-paper);
    --cnt-guide-mid: rgba(15, 23, 42, 0.34);
    --cnt-guide-soft: rgba(15, 23, 42, 0.2);
    --cnt-hw-dot-strong: rgba(15, 23, 42, 0.4);
    --cnt-hw-dot-soft: rgba(15, 23, 42, 0.23);
    background:
        linear-gradient(180deg, #ffffff 0%, var(--studio-paper-warm) 100%),
        var(--studio-paper);
    border: 1px solid rgba(15, 23, 42, 0.07);
    border-radius: var(--studio-radius-sheet);
    box-shadow: var(--studio-shadow-sheet);
    padding: 1.35rem 1.4rem 1.15rem;
}

.cnt-preview-sheet.cnt-studio-sheet .cnt-preview-header {
    padding-bottom: 0.85rem;
    margin-bottom: 0.65rem;
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
}

.cnt-preview-sheet.cnt-studio-sheet .cnt-name-line {
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--studio-muted);
}

/* Default: modest preview title (most layouts). Big-name overrides below. */
.cnt-preview-sheet.cnt-studio-sheet .cnt-sheet-title {
    font-family: "Nunito", system-ui, sans-serif;
    color: var(--studio-ink);
    -webkit-text-stroke: 0 transparent;
    text-transform: none;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.12;
    font-size: clamp(0.88rem, 1.85vw, 1.15rem);
}

.cnt-preview-sheet.cnt-studio-sheet[data-worksheet-key="big-name"] .cnt-sheet-title {
    font-weight: 900;
    font-size: clamp(1.15rem, 3.8vw, 2.85rem);
    line-height: 1.08;
}

.cnt-preview-sheet.cnt-studio-sheet .cnt-sheet-subtitle {
    color: var(--studio-ink-soft);
    font-size: 0.95rem;
    font-weight: 500;
}

/* Big-name trace bands */
.cnt-preview-sheet.cnt-studio-sheet .cnt-trace-lines {
    gap: 0.7rem;
}

.cnt-preview-sheet.cnt-studio-sheet .cnt-trace-row {
    background: var(--studio-row);
    border-radius: var(--studio-radius-row);
    box-shadow:
        inset 0 0 0 1px rgba(15, 23, 42, 0.05),
        0 1px 0 rgba(255, 255, 255, 0.9);
    min-height: 128px;
}

.cnt-preview-sheet.cnt-studio-sheet .cnt-trace-name {
    color: rgba(15, 23, 42, 0.88);
    font-weight: 500;
    letter-spacing: 0.02em;
    /* Keep absolute inset from cnt-trace-detail (.cnt-trace-name); relative broke vertical alignment in preview. */
    position: absolute;
    z-index: 1;
}

/* Raleway Dots only supports 400 — studio rule above must not win (or letters vanish). */
.cnt-preview-sheet.cnt-studio-sheet .cnt-trace-name.cnt-font-raleway-dots {
    font-family: "Raleway Dots", cursive;
    font-weight: 400;
    color: rgba(26, 32, 58, 0.94);
    letter-spacing: 0.04em;
}

.cnt-preview-sheet.cnt-studio-sheet .cnt-trace-name.cnt-trace-name--model {
    font-family: "Inter", system-ui, sans-serif;
    font-weight: 600;
    color: #0f172a;
    letter-spacing: 0.02em;
    font-size: unset;
}

.cnt-preview-sheet.cnt-studio-sheet .cnt-tracing-footer {
    font-size: 0.72rem;
    letter-spacing: 0.02em;
    color: #94a3b8;
    padding-top: 0.85rem;
    border-top: 1px solid rgba(15, 23, 42, 0.06);
}

/* Activity bodies inside capture sheet */
.cnt-preview-sheet.cnt-studio-sheet .cnt-wv-sheet .cnt-wv-lead {
    color: var(--studio-ink-soft);
    font-weight: 500;
    letter-spacing: 0.01em;
}

.cnt-preview-sheet.cnt-studio-sheet .cnt-wv-sheet .cnt-wv-kicker {
    color: var(--studio-accent);
    letter-spacing: 0.16em;
    font-size: 0.68rem;
}

.cnt-preview-sheet.cnt-studio-sheet .cnt-wv-trace-row {
    background: var(--studio-row);
    border-radius: var(--studio-radius-row);
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.05);
}

.cnt-preview-sheet.cnt-studio-sheet .cnt-wv-dots {
    color: rgba(15, 23, 42, 0.9);
}

.cnt-preview-sheet.cnt-studio-sheet .cnt-wv-heart-band {
    border-color: rgba(76, 29, 149, 0.12);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.95), 0 10px 28px -16px rgba(15, 23, 42, 0.08);
}

.cnt-preview-sheet.cnt-studio-sheet .cnt-wv-sheet > .rounded-3.border.bg-white,
.cnt-preview-sheet.cnt-studio-sheet .cnt-wv-sheet > .rounded-3.border.bg-white.mb-3 {
    border-color: rgba(15, 23, 42, 0.08) !important;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.95), 0 8px 28px -12px rgba(15, 23, 42, 0.08);
}

.cnt-preview-sheet.cnt-studio-sheet .cnt-wv-sheet {
    --wv-guide: rgba(15, 23, 42, 0.28);
    --wv-guide-soft: rgba(15, 23, 42, 0.16);
    --wv-muted: var(--studio-ink-soft);
    --wv-ink: var(--studio-ink);
    --cnt-hw-dot-strong: rgba(15, 23, 42, 0.4);
    --cnt-hw-dot-soft: rgba(15, 23, 42, 0.23);
}

.cnt-preview-sheet.cnt-studio-sheet .cnt-wv-box {
    border-color: rgba(15, 23, 42, 0.12);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
}

.cnt-trace-wrap.alert.border {
    border-radius: 14px !important;
    border-color: rgba(15, 23, 42, 0.08) !important;
    background: linear-gradient(180deg, #ffffff, #fafbfd) !important;
}

/* Controls rail (left column) */
.cnt-trace-shell > .rounded-4.border.bg-white.p-4.shadow-sm:first-child {
    border-radius: 16px !important;
    border: 1px solid rgba(15, 23, 42, 0.07) !important;
    box-shadow: 0 12px 36px -18px rgba(15, 23, 42, 0.12) !important;
}

.cnt-trace-shell > .rounded-4.border.bg-white.shadow-sm:not(:first-child) {
    border-radius: 16px !important;
    border: 1px solid rgba(15, 23, 42, 0.07) !important;
    box-shadow: 0 16px 44px -20px rgba(15, 23, 42, 0.14) !important;
}

.cnt-trace-shell .cnt-trace-label {
    color: var(--studio-muted);
    font-size: 0.72rem;
    letter-spacing: 0.12em;
}

.cnt-trace-shell .cnt-trace-control,
.cnt-trace-shell .form-select.cnt-trace-control {
    border-radius: 12px;
    border-color: rgba(15, 23, 42, 0.1);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9);
}

.cnt-trace-shell .form-select.cnt-trace-control {
    cursor: pointer;
    padding-right: 3.4rem;
    background-image:
        linear-gradient(45deg, transparent 50%, #64748b 50%),
        linear-gradient(135deg, #64748b 50%, transparent 50%);
    background-position:
        calc(100% - 1.35rem) calc(50% - 0.16rem),
        calc(100% - 0.95rem) calc(50% - 0.16rem);
    background-size: 0.5rem 0.5rem, 0.5rem 0.5rem;
    background-repeat: no-repeat;
}

/* —— Name hub (trace/{slug}) —— */
.cnt-name-hub .cnt-worksheet-preview {
    border-radius: 14px !important;
    border: 1px solid rgba(15, 23, 42, 0.08) !important;
    box-shadow: var(--studio-shadow-sheet);
}

.cnt-name-hub-hero-preview {
    max-width: min(100%, 380px);
}

.cnt-name-hub-hero-preview svg.cnt-ws-preview-thumb {
    display: block;
    width: 100%;
    height: auto;
    vertical-align: middle;
}

.cnt-variation-card {
    border-radius: 14px !important;
    border: 1px solid rgba(15, 23, 42, 0.07) !important;
    box-shadow: 0 10px 32px -20px rgba(15, 23, 42, 0.12) !important;
    overflow: hidden;
}

.cnt-variation-thumb {
    background: linear-gradient(165deg, #ffffff 0%, #f8f6fc 55%, #f3f0fa 100%);
    border-bottom: 1px solid rgba(15, 23, 42, 0.06);
    padding: 14px 14px 10px;
}

.cnt-variation-thumb svg.cnt-ws-preview-thumb {
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, 0.07);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

.cnt-variation-card .card-body {
    padding: 1rem 1.1rem 1.1rem !important;
}

.cnt-variation-card .h6 {
    font-family: "Nunito", system-ui, sans-serif;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--studio-ink);
}

.cnt-variation-badge {
    background: rgba(76, 29, 149, 0.1);
    color: var(--studio-accent);
    border: 1px solid rgba(76, 29, 149, 0.2);
    font-weight: 800;
}

.cnt-variation-pack-teaser {
    border-radius: 16px !important;
    border: 1px solid rgba(15, 23, 42, 0.07) !important;
    box-shadow: 0 14px 40px -22px rgba(15, 23, 42, 0.1);
    background: linear-gradient(180deg, #ffffff 0%, #faf9fc 100%) !important;
}

.cnt-ws-img-wrap {
    border-radius: 14px;
    background: linear-gradient(180deg, #ffffff, #f8f7fc);
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.05);
}

.cnt-ws-img-wrap svg.cnt-ws-preview-thumb {
    border-radius: 12px;
    border: 1px solid rgba(15, 23, 42, 0.07);
}

/*
 * mocks/customname6.html — outer capture “paper” beats default studio chrome
 * (#cntTracingWorksheet loads after attributes; id beats .cnt-preview-sheet.cnt-studio-sheet alone)
 */
#cntTracingWorksheet[data-worksheet-key="name-tracing-practice"].cnt-preview-sheet.cnt-studio-sheet {
    background: #ffffff;
    border: none;
    border-radius: 0;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    padding: 0.5in 0.75in;
}

#cntTracingWorksheet[data-worksheet-key="name-tracing-practice"].cnt-preview-sheet.cnt-studio-sheet .cnt-trace-lines {
    gap: 15px;
}

#cntTracingWorksheet[data-worksheet-key="name-tracing-practice"].cnt-preview-sheet.cnt-studio-sheet .cnt-trace-row.cnt-trace-row--ntp-mock {
    min-height: 0;
    background: #ffffff;
    border-radius: 0;
    box-shadow: none;
}

#cntTracingWorksheet[data-worksheet-key="name-tracing-practice"].cnt-preview-sheet.cnt-studio-sheet .cnt-trace-name.cnt-font-raleway-dots {
    color: #334155;
    letter-spacing: 2px;
}

#cntTracingWorksheet[data-worksheet-key="name-tracing-practice"].cnt-preview-sheet.cnt-studio-sheet .cnt-trace-name.cnt-trace-name--model {
    color: #000000;
    letter-spacing: 2px;
}

/* DOM mock rows: reset studio absolute insets; keep mock line-height (studio .cnt-trace-name sets lh:1 later in load order) */
#cntTracingWorksheet[data-worksheet-key="name-tracing-practice"].cnt-preview-sheet.cnt-studio-sheet .cnt-trace-row--ntp-mock > .cnt-ntp-mock-type.cnt-trace-name {
    position: relative !important;
    top: auto !important;
    right: auto !important;
    bottom: auto !important;
    left: auto !important;
    overflow: visible;
    display: inline-block !important;
    width: auto !important;
    max-width: 100% !important;
    line-height: 0.97 !important;
    letter-spacing: 2px !important;
}

#cntTracingWorksheet[data-worksheet-key="name-tracing-practice"].cnt-preview-sheet.cnt-studio-sheet .cnt-tracing-footer {
    margin-top: auto;
    padding-top: 20px;
    border-top: none;
    text-align: center;
    font-size: 10px;
    line-height: 1.4;
    color: #cbd5e1;
}

#cntTracingWorksheet[data-worksheet-key="name-tracing-practice"] .cnt-ntp-mock-title {
    font-size: 20px;
    font-weight: 700;
    color: #000000;
}

#cntTracingWorksheet[data-worksheet-key="name-tracing-practice"] .cnt-ntp-mock-name-field {
    font-size: 14px;
    font-weight: 400;
}

@media print {
    .cnt-preview-sheet.cnt-studio-sheet {
        box-shadow: none;
        border-radius: 0;
    }

    #cntTracingWorksheet[data-worksheet-key="name-tracing-practice"].cnt-preview-sheet.cnt-studio-sheet {
        box-shadow: none;
        padding: 0.35in 0.5in;
    }
}

/* Sidebar: last 10 worksheets (localStorage) */
.cnt-recent-worksheets {
    max-height: 280px;
    overflow-y: auto;
}

a.cnt-recent-ws-link {
    color: var(--studio-ink-soft);
    padding: 0.35rem 0.4rem;
    border-radius: 8px;
    line-height: 1.25;
    border: 1px solid transparent;
}

a.cnt-recent-ws-link:hover {
    background: var(--studio-accent-soft);
    color: var(--studio-ink);
    border-color: rgba(76, 29, 149, 0.15);
}

a.cnt-recent-ws-link.is-current {
    background: rgba(76, 29, 149, 0.1);
    border-color: rgba(76, 29, 149, 0.22);
    color: var(--studio-accent);
    font-weight: 600;
}

a.cnt-recent-ws-link .cnt-recent-ws-name {
    font-weight: 600;
    font-size: 0.82rem;
}

a.cnt-recent-ws-link .cnt-recent-ws-meta {
    font-size: 0.72rem;
}
