*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    background: #c8c0b0;
}

body {
    margin: 0;
    padding: 24px 16px 88px;
    font-family: "IBM Plex Mono", "Courier New", monospace;
    color: black;
    line-height: 1.45;
}

.stage-plot {
    width: min(210mm, calc(100vw - 32px));
    aspect-ratio: 210 / 296;
    height: auto;
    max-height: 296mm;
    margin: 0 auto;
    background: white;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.25);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.stage-plot-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: center;
    gap: 12px 20px;
    padding: 10px 16px;
    background: white;
    flex-shrink: 0;
}

.stage-plot-header-col {
    min-width: 0;
}

.stage-plot-header-col--meta {
    text-align: right;
}

.stage-plot-context {
    margin: 0 0 2px;
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.6rem;
    font-weight: 600;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: black;
}

.stage-plot-header h1 {
    margin: 0;
    font-family: "Oswald", "Arial Narrow", sans-serif;
    font-size: clamp(1.2rem, 3vw, 1.65rem);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    line-height: 1;
}

.stage-plot-doc-type {
    margin: 0 0 4px;
    font-family: "Oswald", "Arial Narrow", sans-serif;
    font-size: 0.72rem;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: black;
}

.stage-plot-revision {
    margin: 0;
}

.stage-plot-revision time {
    display: inline-block;
    padding: 1px 7px;
    border: 1px solid black;
    border-radius: 2px;
    background: white;
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.55rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: black;
}

.stage-plot-visual {
    margin: 0;
    line-height: 0;
    background: lightgrey;
    flex: 1 1 auto;
    min-height: 0;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stage-plot-visual img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    display: block;
}

.specs-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    border-top: 1px solid lightgrey;
    flex-shrink: 0;
}

.spec-panel {
    padding: 10px 14px 8px;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

.spec-panel.right-border {
    border-right: 1px solid lightgrey;
}

.spec-panel.bottom-border {
    border-bottom: 1px solid lightgrey;
}

.spec-panel.full-line {
    grid-column: span 2;
}

.spec-panel h2 {
    margin: 0 0 2px;
    font-family: "Oswald", "Arial Narrow", sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.spec-subtitle {
    margin: 0 0 8px;
    font-size: 0.62rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: grey;
    min-height: 0.9em;
}

.spec-list {
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
}

.spec-list li {
    display: flex;
    align-items: baseline;
    gap: 4px;
    margin-bottom: 3px;
    font-size: 0.62rem;
    letter-spacing: 0.02em;
}

.spec-label {
    white-space: nowrap;
}

.spec-dots {
    flex: 1;
    border-bottom: 1px dotted grey;
    min-width: 12px;
    margin-bottom: 3px;
}

.spec-value {
    white-space: nowrap;
    text-align: right;
}

.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px 20px;
    flex: 1;
}

.two-col ul {
    list-style: none;
    margin: 0;
    padding: 0;
}

.two-col li {
    font-size: 0.62rem;
    margin-bottom: 3px;
    letter-spacing: 0.02em;
}

.requests-list {
    list-style: none;
    margin: 0;
    padding: 0;
    flex: 1;
}

.requests-list li {
    position: relative;
    padding-left: 14px;
    margin-bottom: 4px;
    font-size: 0.62rem;
    letter-spacing: 0.02em;
}

.requests-list li::before {
    content: "•";
    position: absolute;
    left: 0;
    color: #1a1a1a;
}

.spec-alert {
    margin-top: 8px;
    padding: 6px 8px;
    background: black;
    color: white;
    font-size: 0.55rem;
    font-weight: bolder;
    letter-spacing: 0.04em;
    line-height: 1.3;
    text-transform: uppercase;
}

.spec-notice {
    margin-top: 8px;
    padding: 5px 8px;
    border: 1px solid lightgrey;
    background: lightgrey;
    color: black;
    font-size: 0.55rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    line-height: 1.3;
    text-transform: uppercase;
}

.page-nav {
    width: min(210mm, calc(100vw - 32px));
    margin: 0 auto 16px;
    text-align: center;
}

.page-nav a {
    color: #2a2418;
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.75rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-decoration: none;
}

.page-nav a:hover {
    text-decoration: underline;
}

@media (max-width: 640px) {
    body {
        padding: 12px 8px 88px;
    }

    .page-nav {
        width: min(210mm, calc(100vw - 16px));
    }

    .stage-plot {
        width: calc(100vw - 16px);
        aspect-ratio: auto;
        max-height: none;
        overflow: visible;
    }

    .stage-plot-header {
        grid-template-columns: 1fr;
        text-align: center;
    }

    .stage-plot-header-col--meta {
        text-align: center;
    }

    .stage-plot-visual {
        flex: none;
        min-height: 0;
    }

    .stage-plot-visual img {
        width: 100%;
        max-height: none;
    }

    .specs-grid {
        grid-template-columns: 1fr;
    }

    .spec-panel.right-border {
        border-right: 0;
    }

    .spec-panel.full-line {
        grid-column: auto;
    }
}

.is-pdf-render {
    background: #fff;
}

.is-pdf-render body {
    margin: 0;
    padding: 0;
    background: #fff;
    width: 190mm;
    min-width: 190mm;
}

.is-pdf-render .page-nav,
.is-pdf-render .pdf-download-btn {
    display: none;
}

.is-pdf-render .stage-plot {
    position: fixed;
    inset: 0 auto auto 0;
    width: 190mm;
    height: 275.5mm;
    max-width: none;
    max-height: 275.5mm;
    margin: 0;
    aspect-ratio: auto;
    overflow: hidden;
    box-shadow: none;
}

.is-pdf-render .stage-plot-header {
    grid-template-columns: 1fr 1fr;
    text-align: initial;
}

.is-pdf-render .stage-plot-header-col--meta {
    text-align: right;
}

.is-pdf-render .stage-plot-visual {
    flex: 1 1 auto;
    min-height: 0;
}

.is-pdf-render .stage-plot-visual img {
    width: auto;
    max-height: 100%;
}

.is-pdf-render .specs-grid {
    grid-template-columns: 1fr 1fr;
}

.is-pdf-render .spec-panel.right-border {
    border-right: 1px solid lightgrey;
}

.is-pdf-render .spec-panel.full-line {
    grid-column: span 2;
}

@media print {
    @page {
        size: A4 portrait;
        margin: 10mm;
    }

    html {
        background: #fff;
    }

    body {
        padding: 0;
    }

    .page-nav,
    .pdf-download-btn {
        display: none;
    }

    .stage-plot {
        width: 190mm;
        height: 275.5mm;
        max-height: 275.5mm;
        max-width: none;
        box-shadow: none;
        overflow: hidden;
    }
}

.pdf-download-btn {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border: none;
    border-radius: 999px;
    background: #1a1a1a;
    color: #fff;
    font-family: "IBM Plex Mono", monospace;
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
    transition: background-color 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}

.pdf-download-btn:hover:not(:disabled) {
    background: #e60000;
    transform: translateY(-2px);
}

.pdf-download-btn:disabled {
    opacity: 0.7;
    cursor: wait;
}

.pdf-download-btn svg {
    flex-shrink: 0;
    fill: currentColor;
}

.pdf-download-btn.is-loading svg {
    animation: pdf-btn-spin 0.8s linear infinite;
}

@keyframes pdf-btn-spin {
    to {
        transform: rotate(360deg);
    }
}
