/* Concept Posters — classroom display poster builder */

@import url('/css/styles.css');

/* Bundled site font — required for PDF export (headless Chrome on Linux has no Rockwell). */
@font-face {
    font-family: 'Rockwell';
    src: url('/fonts/Rockwell.ttc') format('truetype');
    font-weight: 400;
    font-style: normal;
    font-display: block;
}

@font-face {
    font-family: 'Rockwell';
    src: url('/fonts/Rockwell.ttc') format('truetype');
    font-weight: 700;
    font-style: normal;
    font-display: block;
}

/* Override global button { color: #fff !important } from styles.css */
body.cp-page .cp-wrap button.cp-preset-btn {
    background: #fff !important;
    color: #c90c0f !important;
    border-color: #c90c0f !important;
}

body.cp-page .cp-wrap button.cp-preset-btn:hover,
body.cp-page .cp-wrap button.cp-preset-btn.active {
    background: #c90c0f !important;
    color: #fff !important;
}

body.cp-page .cp-wrap button.cp-btn-secondary,
body.cp-page .cp-wrap button.cp-point-remove {
    background: #fff !important;
    color: #c90c0f !important;
    border-color: #c90c0f !important;
}

body.cp-page .cp-wrap button.cp-btn-secondary:hover,
body.cp-page .cp-wrap button.cp-point-remove:hover {
    background: #c90c0f !important;
    color: #fff !important;
}

body.cp-page .cp-wrap button.cp-btn-primary {
    background: #c90c0f !important;
    color: #fff !important;
    border-color: #c90c0f !important;
}

body.cp-page .cp-wrap button.cp-btn-primary:hover {
    background: #a00a0c !important;
    border-color: #a00a0c !important;
    color: #fff !important;
}

body.cp-page .cp-wrap button.cp-btn-primary:disabled,
body.cp-page .cp-wrap button.cp-btn-secondary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

body.cp-page .cp-wrap button.cp-saved-item__load {
    background: #fff !important;
    color: #1a1a1a !important;
    border-color: #e0d0d0 !important;
}

body.cp-page .cp-wrap button.cp-saved-item__load:hover,
body.cp-page .cp-wrap .cp-saved-item--active button.cp-saved-item__load {
    background: #fff0f0 !important;
    border-color: #c90c0f !important;
    color: #1a1a1a !important;
}

body.cp-page .cp-wrap button.cp-saved-item__delete {
    background: #fff !important;
    color: #a00a0c !important;
    border-color: #e0d0d0 !important;
}

body.cp-page .cp-wrap button.cp-saved-item__delete:hover {
    background: #fff0f0 !important;
    border-color: #c90c0f !important;
    color: #c90c0f !important;
}

body.cp-page {
    background: #f8f9fa !important;
    display: block !important;
    justify-content: unset !important;
    align-items: unset !important;
    min-height: auto !important;
    text-align: left !important;
}

.cp-wrap {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem 1rem 3rem;
    font-family: "Rockwell", "Rockwell Nova", "Roboto Slab", serif;
    color: #1d1d1b;
    transition: margin-left 0.28s ease;
}

.cp-wrap > h1 {
    color: #c90c0f;
    text-align: center;
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
}

.cp-wrap > h1 i {
    color: #fab719;
    margin-right: 0.35rem;
}

.cp-lead {
    text-align: center;
    color: #444;
    max-width: 760px;
    margin: 0 auto 1.5rem;
    line-height: 1.5;
}

.cp-back {
    display: inline-block;
    margin-bottom: 1rem;
    color: #c90c0f;
    text-decoration: none;
    font-weight: 600;
}

.cp-back:hover {
    text-decoration: underline;
}

/* ---- Toolbar ---- */

.cp-toolbar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.cp-toolbar-meta {
    color: #666;
    font-size: 0.85rem;
}

/* ---- Workspace + slide-out drawer ---- */

.cp-workspace {
    position: relative;
}

.cp-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    border: 0;
    padding: 0;
    margin: 0;
    z-index: 1400;
    cursor: pointer;
}

/* Editor is an off-canvas drawer sliding in from the left */
.cp-editor {
    background: #fff;
    border: 3px solid #c90c0f;
    border-left: none;
    border-radius: 0 14px 14px 0;
    padding: 1.25rem;
    box-shadow: 8px 0 30px rgba(0, 0, 0, 0.2);
    position: fixed;
    top: 0;
    left: 0;
    width: 480px;
    max-width: 94vw;
    height: 100vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    z-index: 1500;
    transform: translateX(-105%);
    transition: transform 0.28s ease;
    -webkit-overflow-scrolling: touch;
}

.cp-editor-body {
    display: flex;
    gap: 0.85rem;
    flex: 1;
    min-height: 0;
}

.cp-tabs {
    flex: 0 0 128px;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    overflow-y: auto;
    padding-right: 0.25rem;
    border-right: 2px solid #f0e5e5;
}

.cp-tab {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    padding: 0.6rem 0.6rem;
    border: 2px solid transparent;
    border-radius: 8px;
    background: #f7f2f2;
    color: #1a1a1a;
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 600;
    text-align: left;
    line-height: 1.2;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.cp-tab i {
    flex-shrink: 0;
    width: 1.1rem;
    text-align: center;
    color: #c90c0f;
}

.cp-tab:hover {
    background: #fdeaea;
}

.cp-tab.active {
    background: #c90c0f;
    color: #fff;
    border-color: #c90c0f;
}

.cp-tab.active i {
    color: #fff;
}

.cp-tab-panels {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    padding-right: 0.35rem;
    -webkit-overflow-scrolling: touch;
}

.cp-tab-panel[hidden] {
    display: none;
}

.cp-tab-panel .cp-actions--stacked {
    flex-direction: column;
    border-top: none;
    padding-top: 0;
    margin-top: 0;
}

.cp-tab-panel .cp-actions--stacked .cp-btn {
    width: 100%;
    justify-content: center;
}

.cp-page.cp-drawer-open .cp-editor {
    transform: translateX(0);
}

.cp-editor-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-shrink: 0;
}

.cp-editor-head-right {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.cp-drawer-close {
    background: #fff;
    color: #c90c0f;
    border: 2px solid #c90c0f;
    border-radius: 8px;
    width: 2.2rem;
    height: 2.2rem;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
}

.cp-drawer-close:hover {
    background: #c90c0f;
    color: #fff;
}

/* On wide screens the whole page shifts right so the drawer never covers content */
@media (min-width: 1000px) {
    .cp-page.cp-drawer-open .cp-wrap {
        margin-left: 500px;
    }

    .cp-page.cp-drawer-open .cp-backdrop {
        display: none !important;
    }
}

.cp-editor h2 {
    color: #c90c0f;
    font-size: 1.1rem;
    margin: 0;
}

.cp-editor h2 i {
    color: #fab719;
    margin-right: 0.35rem;
}

.cp-field {
    margin-bottom: 0.9rem;
}

.cp-field label {
    display: block;
    font-weight: 600;
    font-size: 0.88rem;
    margin-bottom: 0.3rem;
    color: #333;
}

.cp-field input[type="text"],
.cp-field input[type="number"],
.cp-field select,
.cp-field textarea {
    width: 100%;
    padding: 0.5rem 0.65rem;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.95rem;
    background: #fff;
    color: #1d1d1b;
}

.cp-field textarea {
    min-height: 4.5rem;
    resize: vertical;
}

.cp-field input:focus,
.cp-field select:focus,
.cp-field textarea:focus {
    outline: none;
    border-color: #c90c0f;
}

.cp-field-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.cp-field-hint {
    font-size: 0.78rem;
    color: #666;
    margin-top: 0.25rem;
    line-height: 1.35;
}

.cp-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.cp-preset-btn {
    background: #fff;
    color: #c90c0f;
    border: 2px solid #c90c0f;
    border-radius: 999px;
    padding: 0.3rem 0.7rem;
    font-family: inherit;
    font-size: 0.78rem;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
}

.cp-preset-btn:hover,
.cp-preset-btn.active {
    background: #c90c0f;
    color: #fff;
}

#presetGrid .cp-preset-btn--customized {
    position: relative;
    padding-right: 1.35rem;
}

#presetGrid .cp-preset-btn--customized::after {
    content: '';
    position: absolute;
    top: 0.35rem;
    right: 0.4rem;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #fab719;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.15);
}

#presetGrid .cp-preset-btn.active.cp-preset-btn--customized::after {
    background: #fff;
    box-shadow: none;
}

/* ---- My posters (local save) ---- */

.cp-saved {
    margin: 1rem 0 1.25rem;
    padding: 0.85rem;
    background: #faf7f7;
    border: 1px solid #e6d6d6;
    border-radius: 10px;
}

.cp-saved-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.35rem;
}

.cp-saved-title {
    margin: 0;
    font-size: 0.95rem;
    color: #1a1a1a;
}

.cp-saved-note {
    margin: 0 0 0.65rem;
    font-size: 0.78rem;
    color: #666;
    line-height: 1.35;
}

.cp-save-status {
    font-size: 0.72rem;
    font-weight: 600;
    color: #2d7a3a;
    white-space: nowrap;
}

.cp-save-status--error {
    color: #a00a0c;
}

.cp-saved-add {
    width: 100%;
    justify-content: center;
    margin-bottom: 0.65rem;
}

.cp-saved-list {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    max-height: 220px;
    overflow-y: auto;
}

.cp-saved-empty {
    margin: 0;
    font-size: 0.78rem;
    color: #888;
    line-height: 1.35;
}

.cp-saved-item {
    display: flex;
    align-items: stretch;
    gap: 0.35rem;
}

.cp-saved-item__load {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.1rem;
    padding: 0.45rem 0.6rem;
    border: 2px solid #e0d0d0;
    border-radius: 8px;
    background: #fff;
    color: #1a1a1a;
    font-family: inherit;
    font-size: 0.82rem;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
}

.cp-saved-item__load:hover {
    border-color: #c90c0f;
    background: #fff8f8;
}

.cp-saved-item--active .cp-saved-item__load {
    border-color: #c90c0f;
    background: #fff0f0;
}

.cp-saved-item__title {
    font-weight: 700;
    color: #1a1a1a;
}

.cp-saved-item__meta {
    font-size: 0.72rem;
    color: #888;
}

.cp-saved-item__delete {
    flex-shrink: 0;
    width: 2.2rem;
    border: 2px solid #e0d0d0;
    border-radius: 8px;
    background: #fff;
    color: #a00a0c;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s;
}

.cp-saved-item__delete:hover {
    background: #fff0f0;
    border-color: #c90c0f;
    color: #c90c0f;
}

.cp-points-list {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.cp-point-row {
    display: flex;
    gap: 0.4rem;
    align-items: center;
}

.cp-point-row input {
    flex: 1;
}

.cp-point-remove {
    background: #fff;
    color: #c90c0f;
    border: 2px solid #c90c0f;
    border-radius: 6px;
    width: 2rem;
    height: 2rem;
    cursor: pointer;
    flex-shrink: 0;
    font-size: 1rem;
    line-height: 1;
}

.cp-point-remove:hover {
    background: #c90c0f;
    color: #fff;
}

.cp-check-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.cp-check-row input {
    width: 1.1rem;
    height: 1.1rem;
    accent-color: #c90c0f;
}

.cp-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 2px solid #eee;
}

.cp-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.55rem 1rem;
    border-radius: 8px;
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    border: 2px solid transparent;
    transition: background 0.15s, color 0.15s;
}

.cp-btn-primary {
    background: #c90c0f;
    color: #fff;
    border-color: #c90c0f;
}

.cp-btn-primary:hover {
    background: #a00a0c;
    border-color: #a00a0c;
    color: #fff;
}

.cp-btn-secondary {
    background: #fff;
    color: #c90c0f;
    border-color: #c90c0f;
}

.cp-btn-secondary:hover {
    background: #c90c0f;
    color: #fff;
}

.cp-btn-sm {
    padding: 0.35rem 0.7rem;
    font-size: 0.8rem;
}

.cp-btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* ---- Bundle download ---- */

.cp-bundle {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 2px solid #eee;
}

.cp-bundle-head {
    margin: 0 0 0.35rem;
    font-size: 1rem;
    color: #1a1a1a;
}

.cp-bundle-note {
    margin: 0 0 0.75rem;
    font-size: 0.78rem;
    color: #666;
    line-height: 1.35;
}

.cp-bundle-all {
    width: 100%;
    justify-content: center;
    margin-bottom: 0.85rem;
}

.cp-bundle-sub {
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #c90c0f;
    margin-bottom: 0.4rem;
}

.cp-bundle-strands {
    margin-bottom: 0.85rem;
}

.cp-bundle-toggle {
    width: 100%;
    justify-content: center;
}

.cp-bundle-chooser {
    margin-top: 0.75rem;
    padding: 0.75rem;
    background: #faf7f7;
    border: 1px solid #e6d6d6;
    border-radius: 10px;
}

.cp-bundle-chooser-actions {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}

.cp-bundle-list {
    max-height: 260px;
    overflow-y: auto;
    margin-bottom: 0.75rem;
    padding-right: 0.25rem;
}

.cp-bundle-group {
    margin-bottom: 0.6rem;
}

.cp-bundle-group__title {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #888;
    margin: 0.4rem 0 0.25rem;
}

.cp-bundle-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0.15rem;
    font-size: 0.85rem;
    color: #1a1a1a;
    cursor: pointer;
}

.cp-bundle-item input {
    width: 16px;
    height: 16px;
    accent-color: #c90c0f;
    flex-shrink: 0;
}

.cp-bundle-chooser #bundleDownloadSelected {
    width: 100%;
    justify-content: center;
}

/* ---- Preview panel ---- */

.cp-preview-panel {
    background: #fff;
    border: 3px solid #c90c0f;
    border-radius: 14px;
    padding: 1.25rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
}

.cp-preview-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.cp-preview-toolbar h2 {
    color: #c90c0f;
    font-size: 1.1rem;
    margin: 0;
}

.cp-preview-toolbar h2 i {
    color: #fab719;
    margin-right: 0.35rem;
}

.cp-zoom-hint {
    font-size: 0.82rem;
    color: #666;
}

.cp-preview-stage {
    background: #e5e7eb;
    border-radius: 10px;
    padding: 1.5rem;
    overflow: auto;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 360px;
    max-height: calc(100vh - 150px);
}

/* Holder reserves the SCALED footprint so the preview never overflows,
   while the poster keeps its true print resolution via a CSS transform. */
.cp-poster-holder {
    position: relative;
    flex-shrink: 0;
}

.cp-poster-holder .cp-poster {
    position: absolute;
    top: 0;
    left: 0;
    transform-origin: top left;
    max-width: none;
}

/* ---- Poster canvas ---- */

.cp-poster {
    --cp-strand: #c90c0f;
    --cp-accent: #fab719;
    --cp-poster-w: 420mm;
    --cp-poster-h: 297mm;
    --cp-title-size: 3.2rem;
    --cp-formula-size: 2.8rem;
    --cp-body-size: 1.8rem;
    --cp-small-size: 1.2rem;

    width: var(--cp-poster-w);
    height: var(--cp-poster-h);
    max-width: 100%;
    background: #fff;
    color: #1d1d1b;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    transform-origin: top center;
    font-family: "Rockwell", "Rockwell Nova", "Roboto Slab", serif;
}

.cp-poster--portrait {
    --cp-poster-w: 297mm;
    --cp-poster-h: 420mm;
}

.cp-poster--a4 {
    --cp-poster-w: 297mm;
    --cp-poster-h: 210mm;
}

.cp-poster--a4.cp-poster--portrait {
    --cp-poster-w: 210mm;
    --cp-poster-h: 297mm;
}

.cp-poster--dark {
    background: #1d1d1b;
    color: #fff;
}

.cp-poster--dark .cp-poster__definition,
.cp-poster--dark .cp-poster__example {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.2);
}

.cp-poster--dark .cp-poster__point {
    background: rgba(255, 255, 255, 0.06);
}

.cp-poster--branded {
    background: linear-gradient(165deg, #c90c0f 0%, #8a080a 55%, #1d1d1b 100%);
    color: #fff;
}

.cp-poster--branded .cp-poster__header {
    background: transparent;
}

.cp-poster--branded .cp-poster__body {
    background: rgba(255, 255, 255, 0.95);
    color: #1d1d1b;
    margin: 0 1.5rem 1.5rem;
    border-radius: 12px;
    flex: 1;
}

.cp-poster__watermark {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-15deg);
    width: 55%;
    opacity: 0.06;
    pointer-events: none;
    z-index: 0;
}

.cp-poster__header {
    background: var(--cp-strand);
    color: #fff;
    padding: 1.75rem 2rem 1.5rem;
    position: relative;
    z-index: 1;
    border-bottom: 6px solid var(--cp-accent);
}

.cp-poster__strand {
    font-size: var(--cp-small-size);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-weight: 700;
    opacity: 0.9;
    margin-bottom: 0.35rem;
}

.cp-poster__title {
    font-size: var(--cp-title-size);
    font-weight: 700;
    line-height: 1.1;
    margin: 0;
    /* White outline behind the coloured title for readability on the coloured block */
    -webkit-text-stroke: 4px #fff;
    text-stroke: 4px #fff;
    paint-order: stroke fill;
}

.cp-poster__subtitle {
    font-size: calc(var(--cp-body-size) * 1.05);
    margin: 0.5rem 0 0;
    opacity: 0.92;
    font-weight: 400;
}

/* Ratio strand uses a bright yellow header; use dark text for contrast. */
.cp-poster--strand-ratio .cp-poster__header {
    color: #1d1d1b;
}

.cp-poster--strand-ratio .cp-poster__title {
    -webkit-text-stroke-width: 0;
    text-stroke-width: 0;
}

/* Yellow-on-white is low contrast, so use dark text for Ratio formulas and
   captions; the yellow is kept for accent borders, bullets and highlights. */
.cp-poster--strand-ratio .cp-poster__formula,
.cp-poster--strand-ratio .cp-poster__dual-label,
.cp-poster--strand-ratio .cp-poster__triple-caption,
.cp-poster--strand-ratio .cp-poster__example-label {
    color: #1d1d1b;
}

.cp-poster__body {
    flex: 1;
    padding: 1.75rem 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    position: relative;
    z-index: 1;
}

.cp-poster__formula-block {
    text-align: center;
    padding: 1rem 0;
}

.cp-poster__formula {
    font-size: var(--cp-formula-size);
    font-weight: 700;
    color: var(--cp-strand);
    line-height: 1.25;
    word-break: break-word;
}

.cp-poster--dark .cp-poster__formula,
.cp-poster--branded .cp-poster__formula {
    color: #c90c0f;
}

.cp-poster__formula-secondary {
    font-size: calc(var(--cp-formula-size) * 0.72);
    margin-top: 0.75rem;
    color: #444;
    font-weight: 600;
}

.cp-poster__definition {
    font-size: var(--cp-body-size);
    line-height: 1.45;
    padding: 1rem 1.25rem;
    background: #f8f9fa;
    border-left: 6px solid var(--cp-strand);
    border-radius: 0 8px 8px 0;
}

.cp-poster__points {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.cp-poster__point {
    font-size: var(--cp-body-size);
    line-height: 1.4;
    padding: 0.65rem 1rem 0.65rem 2.5rem;
    position: relative;
    background: #fafafa;
    border-radius: 8px;
    border: 1px solid #eee;
}

.cp-poster__point::before {
    content: '';
    position: absolute;
    left: 0.85rem;
    top: 0.95rem;
    width: 0.65rem;
    height: 0.65rem;
    background: var(--cp-accent);
    border-radius: 50%;
    box-shadow: 0 0 0 3px var(--cp-strand);
}

.cp-poster__steps {
    list-style: none;
    margin: 0;
    padding: 0;
    counter-reset: cp-step;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.cp-poster__step {
    font-size: var(--cp-body-size);
    line-height: 1.4;
    padding: 0.75rem 1rem 0.75rem 3.5rem;
    position: relative;
    background: #fafafa;
    border-radius: 8px;
    border: 1px solid #eee;
    counter-increment: cp-step;
}

.cp-poster__step::before {
    content: counter(cp-step);
    position: absolute;
    left: 0.85rem;
    top: 50%;
    transform: translateY(-50%);
    width: 2rem;
    height: 2rem;
    background: var(--cp-strand);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: var(--cp-small-size);
}

.cp-poster__dual {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.25rem;
}

.cp-poster__dual-label,
.cp-poster__triple-caption {
    font-size: var(--cp-small-size);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 700;
    color: var(--cp-strand);
    margin-bottom: 0.5rem;
}

.cp-poster__triple {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.cp-poster__triple-card {
    text-align: center;
    padding: 1.1rem 0.75rem;
    background: #f8f9fa;
    border-radius: 10px;
    border-top: 5px solid var(--cp-strand);
}

.cp-poster__triple-card .cp-poster__formula {
    font-size: calc(var(--cp-formula-size) * 0.72);
}

.cp-poster__body--with-diagram {
    display: grid;
    grid-template-columns: minmax(0, 38%) minmax(0, 1fr);
    gap: 1.5rem;
    align-items: start;
}

.cp-poster__diagram-col {
    position: sticky;
    top: 0;
}

.cp-poster__content-col {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    min-width: 0;
}

.cp-diagram {
    background: #f8f9fa;
    border-radius: 12px;
    border: 2px solid #e5e7eb;
    padding: 0.75rem;
}

.cp-poster--dark .cp-diagram,
.cp-poster--branded .cp-diagram {
    background: rgba(0, 0, 0, 0.04);
    border-color: rgba(0, 0, 0, 0.1);
}

.cp-diagram__svg {
    width: 100%;
    height: auto;
    display: block;
}

.cp-formula-card-edit {
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #eee;
}

.cp-formula-card-edit label {
    display: block;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 0.2rem;
    color: #555;
}

.cp-formula-card-edit input {
    width: 100%;
    padding: 0.45rem 0.6rem;
    border: 2px solid #ddd;
    border-radius: 6px;
    font-family: inherit;
    margin-bottom: 0.4rem;
}

@media (max-width: 900px) {
    .cp-poster__triple {
        grid-template-columns: 1fr;
    }

    .cp-poster__body--with-diagram {
        grid-template-columns: 1fr;
    }
}

.cp-poster__dual-card {
    text-align: center;
    padding: 1.25rem;
    background: #f8f9fa;
    border-radius: 10px;
    border-top: 5px solid var(--cp-strand);
}

.cp-poster__example {
    font-size: var(--cp-body-size);
    line-height: 1.45;
    padding: 1rem 1.25rem;
    background: #fffbeb;
    border: 2px solid var(--cp-accent);
    border-radius: 8px;
}

.cp-poster__example-label {
    font-size: var(--cp-small-size);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    color: var(--cp-strand);
    margin-bottom: 0.35rem;
}

.cp-poster__footer {
    padding: 0.75rem 2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-top: 2px solid #eee;
    font-size: 0.85rem;
    color: #666;
    position: relative;
    z-index: 1;
}

.cp-poster--dark .cp-poster__footer {
    border-color: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.7);
}

.cp-poster--branded .cp-poster__footer {
    background: rgba(0, 0, 0, 0.25);
    color: #fff;
    border: none;
    margin-top: auto;
}

.cp-poster__footer img {
    height: 1.75rem;
    width: auto;
}

/* Stacked fractions in posters */
.cp-poster .mv-stacked-frac {
    display: inline-block;
    vertical-align: middle;
    text-align: center;
    line-height: 1.1;
    margin: 0 0.15em;
    font-weight: inherit;
}

.cp-poster .mv-stacked-frac-num {
    display: block;
    border-bottom: 2px solid currentColor;
    padding: 0 0.2em 0.08em;
}

.cp-poster .mv-stacked-frac-den {
    display: block;
    padding: 0.08em 0.2em 0;
}

/* Layout: hero centres formula */
.cp-poster--layout-hero .cp-poster__body {
    justify-content: center;
}

.cp-poster--layout-hero .cp-poster__formula-block {
    padding: 1.5rem 0;
}

/* ---- Print ---- */

@media print {
    body.cp-page > *:not(.cp-print-root) {
        display: none !important;
    }

    body.cp-page {
        background: #fff !important;
        margin: 0;
        padding: 0;
    }

    .cp-print-root {
        display: block !important;
        margin: 0;
        padding: 0;
    }

    .cp-print-root .cp-poster {
        box-shadow: none;
        transform: none !important;
        width: 100% !important;
        height: auto !important;
        min-height: 100vh;
        max-width: none;
        page-break-inside: avoid;
    }
}

@page {
    margin: 0;
}

/* Print-only window */
body.cp-print-only {
    margin: 0;
    padding: 0;
    background: #fff;
    font-family: "Rockwell", "Rockwell Nova", "Roboto Slab", serif;
}

body.cp-print-only .cp-poster {
    box-shadow: none;
    margin: 0 auto;
    transform: none !important;
    max-width: none;
}
