/* Control chrome for both aircraft boards (the /flights overhead controls and
   the /aircraft-board mode switch + Boeing guide). The boards themselves are
   styled by board.css; this file only covers the chrome around them. Top
   padding clears the fixed hamburger button (see nav.css). */

/* ---------- Board controls (both boards) ---------- */
.board-controls {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 0.6rem 0.9rem;
    width: 100%;
}

.control-field {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.control-field label,
.control-legend {
    font-size: 0.72rem;
    font-weight: bold;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #5a6b8c;
}

.board-controls input[type="text"],
.board-controls input[type="number"] {
    font-family: inherit;
    font-size: 0.95rem;
    padding: 0.4rem 0.55rem;
    width: 7rem;
    border: 2px solid #003688;
    border-radius: 6px;
    background: #fff;
    color: #003688;
}

.control-field-wide input[type="text"] {
    width: 14rem;
}

.board-controls input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 54, 136, 0.25);
}

.control-or {
    align-self: center;
    color: #5a6b8c;
    font-style: italic;
    padding-bottom: 0.4rem;
}

.control-check {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.85rem;
    color: #003688;
    padding-bottom: 0.4rem;
}

.board-controls button {
    font-family: inherit;
    font-weight: bold;
    font-size: 0.95rem;
    padding: 0.45rem 1.1rem;
    border: none;
    border-radius: 6px;
    background: #003688;
    color: #fff;
    cursor: pointer;
}

.board-controls button:hover { background: #0049b8; }

/* ---------- Segmented Type | Tail switch (aircraft board) ----------
   Radios styled as a joined button pair. The third ("Boeing") segment is set
   by the guide, not the user, so it only appears while it is selected. */
.mode-toggle {
    display: flex;
    position: relative; /* contains the visually-hidden radios */
    border: 2px solid #003688;
    border-radius: 6px;
    overflow: hidden;
}

.mode-toggle input[type="radio"] {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    pointer-events: none;
}

.mode-toggle label {
    font-size: 0.9rem;
    font-weight: bold;
    letter-spacing: 0.02em;
    padding: 0 14px;
    min-height: 34px;
    display: flex;
    align-items: center;
    background: #fff;
    color: #003688;
    cursor: pointer;
    border-left: 1px solid #cdd7ea;
    user-select: none;
}

.mode-toggle label:first-of-type {
    border-left: none;
}

.mode-toggle input[type="radio"]:checked + label {
    background: #003688;
    color: #fff;
}

.mode-toggle input[type="radio"]:focus-visible + label {
    box-shadow: inset 0 0 0 3px rgba(0, 54, 136, 0.35);
}

/* Boeing is a guide-driven mode: hide its segment unless it is active. */
.mode-toggle input[value="boeing"]:not(:checked) + label {
    display: none;
}

/* ---------- Dark theme: controls ---------- */
[data-theme="dark"] .control-field label,
[data-theme="dark"] .control-legend,
[data-theme="dark"] .control-or { color: #9fb0d0; }
[data-theme="dark"] .control-check { color: #c7d2e6; }

[data-theme="dark"] .board-controls input[type="text"],
[data-theme="dark"] .board-controls input[type="number"] {
    background: #0e1320;
    border-color: #2b3a5c;
    color: #eaf0fb;
}

[data-theme="dark"] .board-controls button { background: #1b2740; }
[data-theme="dark"] .board-controls button:hover { background: #26365a; }

[data-theme="dark"] .mode-toggle { border-color: #2b3a5c; }

[data-theme="dark"] .mode-toggle label {
    background: #0e1320;
    color: #c7d2e6;
    border-left-color: #24314e;
}

[data-theme="dark"] .mode-toggle input[type="radio"]:checked + label {
    background: #26365a;
    color: #eaf0fb;
}

[data-theme="dark"] .mode-toggle input[type="radio"]:focus-visible + label {
    box-shadow: inset 0 0 0 3px rgba(92, 198, 240, 0.4);
}


main.aircraft-page {
    max-width: 960px;
    padding-top: 4.5rem;
    justify-content: flex-start;
    min-height: 100vh;
    width: 100%;
}

/* board-count sits where the radius normally goes */
#board-count {
    font-variant-numeric: tabular-nums;
}

/* ---------- Boeing guide ---------- */
.aircraft-guide {
    width: 100%;
    text-align: left;
    background: #f4f6fb;
    border: 1px solid #d6deee;
    border-radius: 10px;
    padding: 1.25rem 1.5rem 1.5rem;
}

.aircraft-guide h2 {
    color: #003688;
    font-size: 1.2rem;
    margin-bottom: 0.2rem;
}

.aircraft-guide-hint {
    color: #5a6b8c;
    font-size: 0.9rem;
    margin-bottom: 0.9rem;
}

.aircraft-guide h3 {
    color: #003688;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 1rem 0 0.5rem;
}

.aircraft-guide-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 0.4rem;
}

.aircraft-guide-list button {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 0.5rem;
    width: 100%;
    text-align: left;
    font-family: inherit;
    font-size: 0.92rem;
    padding: 0.45rem 0.7rem;
    border: 1px solid #cdd7ea;
    border-radius: 6px;
    background: #fff;
    color: #003688;
    cursor: pointer;
}

.aircraft-guide-list button:hover {
    border-color: #003688;
    background: #eaf0fb;
}

.aircraft-guide-list .guide-code {
    font-family: inherit;
    font-size: 0.8rem;
    color: #5a6b8c;
    letter-spacing: 0.06em;
    white-space: nowrap;
}

/* Optional helper line under a guide entry (e.g. what the Boeing mode covers) */
.aircraft-guide-list .guide-note {
    display: block;
    font-size: 0.78rem;
    line-height: 1.4;
    color: #5a6b8c;
    padding: 4px 2px 0;
}

/* ---------- Night Tube dark theme ---------- */
[data-theme="dark"] .aircraft-guide {
    background: #131c30;
    border-color: #24314e;
}

[data-theme="dark"] .aircraft-guide h2,
[data-theme="dark"] .aircraft-guide h3 { color: #eaf0fb; }
[data-theme="dark"] .aircraft-guide-hint { color: #9fb0d0; }

[data-theme="dark"] .aircraft-guide-list button {
    background: #0e1320;
    border-color: #24314e;
    color: #c7d2e6;
}

[data-theme="dark"] .aircraft-guide-list button:hover {
    border-color: #5cc6f0;
    background: #18233c;
}

[data-theme="dark"] .aircraft-guide-list .guide-code,
[data-theme="dark"] .aircraft-guide-list .guide-note { color: #8fa2c4; }

/* ---------- Phones ----------
   The controls form carries up to seven fields plus the mode switch, so let
   every field grow to fill the row instead of overflowing it, and give each
   control a 44px touch target. Page gutters shrink so nothing scrolls
   sideways at 360px. */
@media (max-width: 560px) {
    main.flights-page,
    main.aircraft-page {
        padding-left: 16px;
        padding-right: 16px;
        gap: 20px;
    }

    .board-controls {
        gap: 10px;
    }

    .control-field {
        flex: 1 1 140px;
        min-width: 0;
    }

    .control-field-wide {
        flex-basis: 100%;
    }

    .control-mode {
        flex-basis: 100%;
    }

    .board-controls input[type="text"],
    .board-controls input[type="number"] {
        width: 100%;
        min-height: 44px;
        font-size: 16px; /* keeps iOS from zooming the page on focus */
    }

    .mode-toggle label {
        flex: 1 1 0;
        justify-content: center;
        min-height: 44px;
    }

    /* "or" only makes sense when airport and lat/lon sit on one line. */
    .control-or {
        display: none;
    }

    .control-check {
        flex: 1 1 100%;
        min-height: 44px;
        padding-bottom: 0;
    }

    .control-check input[type="checkbox"] {
        width: 20px;
        height: 20px;
    }

    .board-controls button {
        flex: 1 1 100%;
        min-height: 44px;
    }

    .aircraft-guide {
        padding: 16px;
    }

    .aircraft-guide-list {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
        gap: 8px;
    }

    .aircraft-guide-list button {
        min-height: 44px;
    }
}

/* Narrow phones: one guide column, so long names don't wrap to three lines. */
@media (max-width: 400px) {
    .aircraft-guide-list {
        grid-template-columns: 1fr;
    }
}
