/* The report as a drawing sheet (DESIGN.md, "The sheet"). Screen, phone, print. */

.report { display: none; }
.report.active { display: block; }
.report-toolbar {
    display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
    margin-bottom: var(--s3);
}

.sheet-set { color: var(--ink); }
.sheet {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 272px;
    background: var(--page);
    border: 2px solid var(--ink);
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
}
.sheet + .sheet { margin-top: var(--s5); }
.sheet-main { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
.sheet-main:has(> .sheet-col:only-child) { grid-template-columns: minmax(0, 1fr); }
.sheet-col { min-width: 0; }
.sheet-col + .sheet-col { border-left: 1px solid var(--ink); }
/* Sheet 2 carries the long legal citations: a wider title block and two even columns. */
.sheet-wide { grid-template-columns: minmax(0, 1fr) 400px; }
.sheet-wide .sheet-main { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* ---- Views ---- */
.view { padding: var(--s4) var(--s5) var(--s5); min-width: 0; }
.view + .view { border-top: 1px solid var(--ink); }
.view-title {
    display: flex; align-items: baseline; gap: var(--s2);
    font-family: var(--font-mono); font-size: 0.75rem; font-weight: 600;
    letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink);
    padding-bottom: var(--s2); margin-bottom: var(--s3); border-bottom: 1px solid var(--ink);
}
.view-code {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 28px; padding: 1px 4px; border: 1px solid var(--ink); font-weight: 600;
}

/* ---- A1 roof plan ---- */
.plan { margin: 0; }
.roof-plan { display: block; width: 100%; height: auto; }
.roof-plan .fp-edge { fill: var(--page); stroke: var(--ink); stroke-width: 4; stroke-linejoin: miter; }
.roof-plan .fp-fill { fill: var(--page); stroke: none; }
.roof-plan .plane-edge { fill: none; stroke: var(--ink); stroke-width: 1; }
.roof-plan .ridge { stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 9 5; }
.roof-plan .hip { stroke: var(--ink); stroke-width: 1; }
.roof-plan .slope-arrow line { stroke: var(--red); stroke-width: 2; }
.roof-plan .slope-arrow polygon { fill: var(--red); }
.roof-plan text { font-family: var(--font-mono); }
.roof-plan .plane-label { font-size: 15px; font-weight: 500; fill: var(--ink); }
.roof-plan .plane-tag { font-size: 16px; font-weight: 600; fill: var(--red); display: none; }
.roof-plan .plane:not(.fits) .plane-label { display: none; }
.roof-plan .plane:not(.fits) .plane-tag { display: inline; }
.roof-plan .north-arrow circle { fill: none; stroke: var(--ink); stroke-width: 1; }
.roof-plan .north-arrow polygon { fill: var(--ink); }
.roof-plan .north-arrow text { font-size: 14px; font-weight: 600; fill: var(--ink); }

.plane-legend {
    list-style: none; margin: var(--s2) 0 0; padding: 0;
    display: flex; flex-wrap: wrap; gap: 2px var(--s4);
    font-family: var(--font-mono); font-size: 0.75rem; color: var(--ink);
}
.plane-legend li.fits { display: none; }
.plane-legend:not(:has(li:not(.fits))) { display: none; }
.plane-no { color: var(--red); font-weight: 600; margin-right: 2px; }
.plan-note { margin-top: var(--s2); font-size: 0.75rem; line-height: 1.45; color: var(--muted); }

.plan-unavailable {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--s2);
    min-height: 240px; padding: var(--s5); text-align: center;
    border: 1px dashed var(--ink); font-size: 0.875rem; color: var(--muted);
}
.plan-unavailable p { max-width: 40ch; }
.plan-unavailable .pu-title {
    font-family: var(--font-mono); font-size: 0.8125rem; font-weight: 600;
    letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink);
}

/* ---- Key figures strip ---- */
.key-figures {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: var(--s4) 0 0; border-top: 1px solid var(--ink); border-left: 1px solid var(--ink);
}
.kf { border-right: 1px solid var(--ink); border-bottom: 1px solid var(--ink); padding: var(--s2) var(--s3) var(--s3); min-width: 0; }
.kf-label {
    font-family: var(--font-mono); font-size: 0.6875rem; font-weight: 500;
    letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted);
}
.kf-unit-label { letter-spacing: 0.04em; }
.kf-value {
    margin: var(--s1) 0 0; font-family: var(--font-mono); font-size: 1.5rem; font-weight: 600;
    line-height: 1.1; color: var(--ink); overflow-wrap: anywhere;
}
.kf-value.kf-long { font-size: 1.0625rem; line-height: 1.25; }
.kf-value.kf-long .kf-main { white-space: normal; }
.kf-main { white-space: nowrap; }
.kf-unit { font-size: 0.8125rem; font-weight: 500; color: var(--muted); }
.kf-note { display: block; margin-top: 2px; font-size: 0.6875rem; font-weight: 500; line-height: 1.3; color: var(--muted); }
.kf-none { font-family: var(--font-text); font-size: 0.875rem; font-weight: 500; color: var(--muted); }

/* ---- Reference numbers ---- */
sup.ref { font-family: var(--font-mono); font-size: 0.68em; font-weight: 600; line-height: 0; margin-left: 2px; color: var(--red); }
sup.ref a { color: inherit; text-decoration: none; }
sup.ref a:hover { text-decoration: underline; }

/* ---- A2 property data ---- */
.data-group + .data-group { margin-top: var(--s4); }
.data-group h4 { font-size: 0.9375rem; padding-bottom: var(--s1); border-bottom: 1px solid var(--ink); }
.data-group dl { margin: 0; }
.data-row {
    display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3);
    padding: 6px 0; border-bottom: 1px solid var(--hairline); font-size: 0.875rem;
}
.data-row dt { color: var(--muted); flex: none; max-width: 45%; }
.data-row dd { margin: 0; text-align: right; font-weight: 500; overflow-wrap: anywhere; }
.data-row dd.muted { color: var(--muted); font-weight: 400; }
.data-group-notes .data-row { flex-direction: column; gap: 2px; }
.data-group-notes .data-row dt { max-width: none; font-weight: 600; color: var(--ink); }
.data-group-notes .data-row dd { text-align: left; font-weight: 400; }
.data-row dd .data-note { display: block; margin-top: 2px; font-size: 0.75rem; font-weight: 400; color: var(--muted); line-height: 1.35; }

/* Building areas: a compact two-column list (name over value), so a long list stays short. */
.data-group-compact dl { column-count: 2; column-gap: var(--s4); }
.data-group-compact .data-row { flex-direction: column; align-items: stretch; gap: 0; break-inside: avoid; }
.data-group-compact .data-row dt { max-width: none; font-size: 0.75rem; }
.data-group-compact .data-row dd { text-align: left; }
.data-more { margin-top: var(--s2); font-size: 0.75rem; color: var(--muted); }

/* ---- Title block ---- */
.title-block { display: flex; flex-direction: column; border-left: 2px solid var(--ink); min-width: 0; }
.tb-cell { padding: 10px var(--s3); border-bottom: 1px solid var(--ink); min-width: 0; }
.tb-cell:last-child { border-bottom: 0; }
.tb-logo { padding: var(--s3); }
.tb-label {
    font-family: var(--font-mono); font-size: 0.6875rem; font-weight: 500;
    letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin-bottom: 2px;
}
.tb-address { font-weight: 700; font-size: 1rem; line-height: 1.3; }
.tb-value { font-family: var(--font-mono); font-size: 0.875rem; font-weight: 600; }
.tb-grid { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--ink); }
.tb-grid .tb-cell { border-bottom: 0; }
.tb-grid .tb-cell:nth-child(2) { border-left: 1px solid var(--ink); }
.tb-grid .tb-span { grid-column: 1 / -1; border-top: 1px solid var(--ink); }
.tb-sources { flex: 0 1 auto; border-bottom: 0; }
.tb-sources ol { list-style: none; margin: var(--s1) 0 0; padding: 0; }
.tb-sources li {
    display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 4px;
    font-size: 0.75rem; line-height: 1.4; color: var(--muted); margin-bottom: 6px; overflow-wrap: anywhere;
}
.tb-sources li:last-child { margin-bottom: 0; }
.src-no { font-family: var(--font-mono); font-weight: 600; color: var(--red); }
.tb-sources a { color: var(--ink); }
.tb-sources li:target { outline: 1px solid var(--ink); outline-offset: 2px; }
.tb-notes { margin-top: auto; border-top: 1px solid var(--ink); }
.tb-notes p:not(.tb-label) { font-size: 0.75rem; line-height: 1.4; color: var(--muted); }

/* ---- Narrower screens ---- */
@media screen and (max-width: 1020px) {
    .sheet-main, .sheet-wide .sheet-main { grid-template-columns: minmax(0, 1fr); }
    .sheet-col + .sheet-col { border-left: 0; border-top: 1px solid var(--ink); }
}
@media screen and (max-width: 720px) {
    /* Title block cells join the sheet grid: property/date first, sources last. */
    .sheet, .sheet-wide { grid-template-columns: minmax(0, 1fr); }
    .title-block { display: contents; }
    .tb-logo, .tb-cell:has(.tb-address), .tb-grid { order: -1; }
    .tb-logo { border-bottom: 1px solid var(--ink); }
    .tb-grid { grid-template-columns: 1fr 1fr 1fr; border-bottom: 2px solid var(--ink); }
    .tb-grid .tb-span { grid-column: auto; border-top: 0; border-left: 1px solid var(--ink); }
    .sheet-main { order: 0; }
    .tb-sources { order: 1; border-top: 2px solid var(--ink); border-bottom: 1px solid var(--ink); }
    .tb-notes { order: 2; border-top: 0; }
    .view { padding: var(--s3) var(--s4) var(--s4); }
    .key-figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .kf-value { font-size: 1.375rem; }
    .roof-plan .plane-label { display: none; }
    .roof-plan .plane .plane-tag { display: inline; }
    .roof-plan .plane-tag { font-size: 22px; }
    .roof-plan .north-arrow text { font-size: 18px; }
    .plane-legend li.fits { display: list-item; }
    .plane-legend:not(:has(li:not(.fits))) { display: flex; }
    .plane-legend { flex-direction: column; font-size: 0.8125rem; }
    .data-row { font-size: 0.9375rem; }
    .data-group-compact dl { column-count: 1; }
    .plan-unavailable { min-height: 180px; }
}

/* ---- Print: US Letter landscape, one sheet per page ---- */
@media print {
    @page { size: letter landscape; margin: 0.3in; }
    html, body { background: #fff; }
    body { min-height: 0; display: block; }
    .no-print, .site-header, .site-footer, .page-head, .panel, .notice, .history-section, .report-toolbar { display: none !important; }
    .container { max-width: none; padding: 0; margin: 0; }
    .report { margin: 0; }
    /* One Letter page per sheet. A sheet that is somehow taller grows onto a
       second page rather than cutting anything off (never the notes). */
    .sheet {
        width: 10.4in; min-height: 7.9in;
        grid-template-columns: minmax(0, 1fr) 2.4in;
        break-after: page; break-inside: avoid;
    }
    .sheet-wide { grid-template-columns: minmax(0, 1fr) 4.3in; }
    .sheet-wide .tb-sources li { font-size: 6pt; line-height: 1.3; margin-bottom: 2.5pt; }
    .sheet:last-child { break-after: auto; }
    .sheet + .sheet { margin-top: 0; }
    .view { padding: 9pt 12pt 10pt; }
    .view-title { font-size: 7.5pt; padding-bottom: 4pt; margin-bottom: 8pt; }
    .view-code { min-width: 20pt; }
    .roof-plan { height: 3in; }
    .plan-note, .plane-legend { font-size: 6.5pt; }
    .plan-unavailable { min-height: 2.6in; font-size: 8pt; }
    .plan-unavailable .pu-title { font-size: 8pt; }
    .key-figures { margin-top: 10pt; }
    .kf { padding: 4pt 6pt 6pt; }
    .kf-label { font-size: 6pt; }
    .kf-value { font-size: 15pt; }
    .kf-value.kf-long { font-size: 9.5pt; }
    .kf-note, .kf-unit { font-size: 6.5pt; }
    .kf-none { font-size: 8pt; }
    .data-group + .data-group { margin-top: 8pt; }
    .data-group h4 { font-size: 8.5pt; padding-bottom: 2pt; }
    .data-row { font-size: 7.75pt; padding: 2pt 0; }
    /* Explanation notes stay smaller than the values, as on screen (0.75 / 0.875). */
    .data-row dd .data-note { font-size: 6.6pt; margin-top: 1pt; }
    .data-group-compact .data-row { font-size: 7.25pt; padding: 1.5pt 0; }
    .data-group-compact .data-row dt { font-size: 6.5pt; }
    .data-more { font-size: 6.5pt; margin-top: 3pt; }
    .tb-cell { padding: 6pt 8pt; }
    .tb-logo { padding: 8pt; }
    .tb-label { font-size: 6pt; }
    .tb-address { font-size: 10pt; }
    .tb-value { font-size: 8pt; }
    .tb-sources li { font-size: 6.25pt; line-height: 1.35; margin-bottom: 3pt; grid-template-columns: 9pt minmax(0, 1fr); }
    .tb-notes p:not(.tb-label) { font-size: 6.25pt; }
    .logo-word { font-size: 13pt; }
    a { text-decoration: none; }
}
