/*
 * The 2027 band designs on screen (#608, #613): the large-print face and the shared colors.
 *
 * The printed sheet is drawn in Python by pinsheets/cart_band.py. Everything here MUST match the
 * constants there, so a sheet looks the same on the phone as on paper; pinsheets/tests/
 * test_cart_band.py (BandCssTests) parses this file and fails if they drift. Change both together.
 *
 * Barlow Semi Condensed, Bold and Medium, converted to woff2 from the TTFs in assets/fonts that
 * the printed sheet uses. SIL Open Font License 1.1: see ../fonts/BarlowSemiCondensed-OFL.txt.
 */
@font-face {
    font-family: 'Barlow Semi Condensed';
    src: url('../fonts/BarlowSemiCondensed-Bold.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'Barlow Semi Condensed';
    src: url('../fonts/BarlowSemiCondensed-Medium.woff2') format('woff2');
    font-weight: 500;
    font-style: normal;
    font-display: swap;
}

:root {
    /* Colors: cart_band ACCENT, INK, GRAY, DIVIDER, LEADER and MUTED_HAZARD */
    --band-accent: #B3261E;
    --band-ink: #111111;
    --band-gray: #666666;
    --band-divider: #C8C8C8;
    --band-leader: #3D3D3D;
    --band-muted-hazard: #9A9A9A;

    /*
     * The pin's leaders and dot, in the printed sheet's pixels at 300 dpi (cart_band LEADER_WIDTH_PX,
     * LEADER_DASH_PX, HALO_PX, DOT_RADIUS_PX and DAY_DOT_RADIUS_PX). Unitless, because a hole's
     * drawing is in its own traced units: multiply by the drawing's units per pixel, as cart_band
     * does, or by 1px / 3.125 for CSS pixels at the mock's scale.
     */
    --band-leader-width: 3;
    --band-leader-dash: 9 7;
    --band-halo: 5;
    --band-dot-radius: 10;
    --band-day-dot-radius: 22;

    --band-font: 'Barlow Semi Condensed', 'Arial Narrow', sans-serif;
}

.psp-band {
    font-family: var(--band-font);
    color: var(--band-ink);
}

/*
 * The 2027 digital sheet (#615): designs/2027/cell.html, the printed cell (cart_band.draw_band_cell)
 * laid out in the browser.
 *
 * The print measures its text with PIL and shrinks it to fit. Here every size is a share of the
 * cell's width (cqi, the cell being a size container) in the printed proportions: the badge, the
 * +/-, the on and side numbers and their captions are cart_band's BADGE_NUMERAL_PX, FIGURE_PX,
 * NUMBER_PX and CAPTION_PX over its REFERENCE_CELL_WIDTH. clamp() keeps them readable in a narrow
 * cell and stops them growing past what a golfer needs in a wide one, each floor and cap in the
 * same proportion, so the cell reads the same at any width.
 *
 * The badge and the +/- take a strip above the drawing, and the drawing the cell's full width
 * under it. Of draw_band_cell's two layouts (cart_band.drawing_box) that is the one that draws it
 * bigger when, as on a screen, the width is fixed and the height is not.
 */
.psp-band-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 12px;
}

/* One cell per row on a phone; three across from a tablet up, as a printed nine is read */
@media (min-width: 768px) {
    .psp-band-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

/* A grid item wrapped round a cell to make it a link: the cell fills it, so a row's cells line up */
/* An <a>, so the cell's own colors and no underline, and a focus ring for the keyboard */
.psp-band-grid > .psp-band-link {
    display: flex;
    min-width: 0;
    cursor: pointer;
    color: inherit;
    text-decoration: none;
}

.psp-band-grid > .psp-band-link:focus-visible {
    outline: 3px solid var(--psp-green, #198754);
    outline-offset: 2px;
}

.psp-band-grid > .psp-band-link > .psp-band-cell {
    flex: 1 1 auto;
}

/* The per-hole page's one cell: no wider than a phone's, so the band stays close to the drawing */
.psp-band-single {
    max-width: 32rem;
    margin: 0 auto;
}

.psp-band-cell {
    container-type: inline-size;
    display: flex;
    flex-direction: column;
    min-width: 0;
    padding: 10px;
    background: #fff;
    /* cart_band CELL_RULE: the black rule round each cell */
    border: 2px solid var(--band-ink);
    text-align: left;
}

.psp-band-strip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

/* The hole number in a badge, so it can't be read as a distance. BADGE_BOX_PX and BADGE_RADIUS over BADGE_NUMERAL_PX. */
.psp-band-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    min-width: 1.43em;
    height: 1.43em;
    padding: 0 0.15em;
    border-radius: 0.24em;
    background: var(--band-ink);
    color: #fff;
    font-weight: 700;
    font-size: clamp(0.98rem, 10.7cqi, 1.96rem);
    line-height: 1;
}

/* The +/- from the middle, level with the badge, in the accent color. Here and nowhere on the drawing. */
.psp-band-figure {
    color: var(--band-accent);
    font-weight: 700;
    font-size: clamp(1.07rem, 11.8cqi, 2.15rem);
    line-height: 1;
    white-space: nowrap;
}

.psp-band-drawing .psp-band-svg {
    display: block;
    width: 100%;
    height: auto;
}

/* The data band, under a thin rule, at the foot of the cell however tall its row is */
.psp-band-data {
    display: flex;
    flex-wrap: wrap;
    row-gap: 0.2em;
    align-items: flex-end;
    margin-top: auto;
    padding-top: 0.35rem;
    border-top: 1px solid var(--band-divider);
    /* --band-text-scale: the course's Number size (courses.typography.NUMBER_SIZES, #625), set on the band by cell-data.html; 1 when unset */
    font-size: calc(clamp(1.75rem, 19.2cqi, 3.5rem) * var(--band-text-scale, 1));
    line-height: 1;
}

/*
 * The on number takes LEFT_SLOT_SHARE of the band and the side the rest, as printed. When the on
 * number and its caption need more, min-width moves the divider over, as band_layout moves it.
 * Print then shrinks the text if the two still don't fit; on screen the side goes to a line of
 * its own instead (the band wraps), so "100 on / 120 deep" in a narrow cell never runs out of it.
 */
.psp-band-slot {
    display: flex;
    align-items: flex-end;
    align-items: last baseline;
    gap: 0.11em;
    min-width: max-content;
    white-space: nowrap;
}

.psp-band-on {
    flex: 0 0 56%;
}

.psp-band-side {
    flex: 1 0 auto;
    padding-left: 0.21em;
    border-left: 1px solid var(--band-divider);
}

.psp-band-number {
    font-weight: 700;
    color: var(--band-ink);
}

/* "on" over "34 deep", "from" over "right": two lines, the lower on the number's baseline */
.psp-band-caption {
    display: inline-flex;
    flex-direction: column;
    font-size: 0.507em;
    line-height: 1;
}

.psp-band-caption-strong {
    font-weight: 700;
    color: var(--band-ink);
}

.psp-band-caption-muted {
    font-weight: 500;
    color: var(--band-gray);
}

/* Only on screen: the printed band is left empty, but a golfer on a phone can refresh */
.psp-band-unset {
    font-size: 0.507em;
    font-weight: 500;
    color: var(--band-gray);
}

.psp-band-errata {
    text-align: right;
}

/* The per-hole page's thumbnails: the badge and the drawing, small, inside the thumbnail's own box */
.psp-band-cell-compact {
    padding: 0;
    border: 0;
    background: transparent;
}

.psp-band-cell-compact .psp-band-strip {
    justify-content: center;
}

.psp-band-cell-compact .psp-band-badge {
    font-size: 0.75rem;
}

/*
 * The pin placement editor on a 2027 sheet (#625): the hole edited inside its cell, the editor's
 * own drawing (pin-placement-svg.js) where the cell's drawing goes. As wide as the per-hole page's
 * cell, so the numbers under it read at the size a golfer sees them. The script caps its drawing
 * at 40% of the screen's height, sized for a column beside 2025's number and depth; in the cell
 * the drawing is the whole editor, so it may take more.
 */
.psp-band-editor {
    max-width: 32rem;
    margin: 0 auto;
}

.psp-band-editor .psp-band-drawing svg {
    max-height: 60vh !important;
}
