/*
 * SpaceCamp's skin for the job board's chrome.
 *
 * The board itself — lanes, cards, panels — is Orbit's, byte for byte:
 * board.css (the island's own stylesheet, loaded with the `board` entrypoint)
 * and board-palette.css (the ten colours, washes and swatches). Both draw
 * from Bootstrap's `--bs-*` variables, which SpaceCamp already maps onto its
 * tokens, so most of the board takes this app's look for free. This file is
 * the SEAM (docs/dev/board-port.md): the pieces Orbit keeps in its own
 * interim stylesheet — the sub-bar, the search pill, the faces, the menu, the
 * settings page's `o-*` furniture — restated on `--sc-*` tokens, plus the two
 * things Orbit's layout gives the board that SpaceCamp's does not: the
 * full-height flex chain from <body> down, and a dark theme.
 *
 * Load order: imported from app.js after sc-tokens.css and app.css, BEFORE
 * board.css (which arrives with the island). So every override of something
 * board.css sets is written `body.orb-board-page …`, one class more specific,
 * the same device Orbit's interim file uses.
 */

/* ------------------------------------------------------------- tokens */

:root {
    /* board.css's one font token: counts, labels, the composer's hints. */
    --orb-font-fono: var(--sc-font-mono);
    /* The Saving chip sits below the chrome: the navbar plus the sub-bar. */
    --orb-chrome-h: 105px;
}

/* ------------------------------------------------------------- layout */

/*
 * The chain of definite heights: body → sub-bar (fixed) → main → #board-view
 * → .orb-board → .orb-lanes. board.css starts it at .orb-board-page and
 * expects <body> to be a flex column, which SpaceCamp's base layout is not;
 * stated here for the board page only, so no other page's body changes.
 * Nothing else may sit between <body> and <main> but the navbar and the
 * sub-bar, both `flex: none`.
 */
body.orb-board-page {
    display: flex;
    flex-direction: column;
}

/*
 * Positioned, or a board's fixed backdrop (.orb-board-bg) paints over it — a
 * positioned element paints above every non-positioned sibling whatever the
 * document order. The z-index is Orbit's header's (5): above the sub-bar's 4
 * so the account dropdown can open over it, below the island's panels.
 */
body.orb-board-page .navbar {
    position: relative;
    z-index: 5;
    flex: none;
    margin-bottom: 0 !important;
}

body.orb-board-page main {
    /* The page's .pb-5 would put a scrollable sliver under the lanes. */
    padding-bottom: 0.75rem !important;
}

/* ------------------------------------------------------------ sub-bar */

/*
 * The board's second bar, under the navbar: trail, search, header text, the
 * faces and the "..." menu. Positioned so it paints above a board's fixed
 * backdrop, and given a z-index so its menu panel paints above the lanes,
 * which are positioned too and come later; it holds nothing a card panel has
 * to get out of. flex: none keeps it a fixed-height link in the chain.
 */
.o-subbar {
    position: relative;
    z-index: 4;
    flex: none;
    height: 48px;
    background: var(--sc-bg-sunken);
    color: var(--sc-fg);
    border-bottom: 1px solid var(--sc-border);
}
.o-subbar__inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.o-subbar__trail { display: flex; align-items: baseline; gap: 10px; min-width: 0; flex: 1 1 0; }
.o-subbar__crumb { margin: 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 400 15px/1.3 var(--sc-font-sans); letter-spacing: 0; color: var(--sc-fg-muted); text-decoration: none; }
a.o-subbar__crumb { flex: 0 1 auto; }
a.o-subbar__crumb:hover { color: var(--sc-fg); }
.o-subbar__crumb--current { flex: 0 1 auto; color: var(--sc-fg); font-weight: 600; }
.o-subbar__sep { flex: none; color: var(--sc-fg-subtle); font-size: 15px; }
.o-subbar__right { display: flex; align-items: center; justify-content: flex-end; flex: 1 1 0; min-width: 0; }
/* The board header (Board::$header): Markdown on ONE line, so the bar keeps
   its 48px. Paragraphs run inline and a line break is a space; past the room
   there is, it ends in an ellipsis rather than pushing the faces off. */
.o-subbar__header { min-width: 0; margin-right: 14px; padding-right: 14px; border-right: 1px solid var(--sc-border-strong); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 14px; color: var(--sc-fg-muted); }
.o-subbar__header p,
.o-subbar__header ul,
.o-subbar__header ol,
.o-subbar__header li { display: inline; margin: 0; padding: 0; }
.o-subbar__header p + p::before { content: " "; }
.o-subbar__header br { display: none; }
.o-subbar__header a { color: var(--bs-link-color); text-decoration: none; }
.o-subbar__header a:hover { text-decoration: underline; }
.o-subbar .o-faces { margin: 0; }
.o-subbar .o-face { box-shadow: 0 0 0 2px var(--sc-bg-sunken); }
.o-subbar .o-face--more { box-shadow: 0 0 0 2px var(--sc-bg-sunken), inset 0 0 0 1px var(--sc-border-strong); }
.o-subbar #board-people:not(:empty) { margin-right: 14px; padding-right: 14px; border-right: 1px solid var(--sc-border-strong); }

/* ------------------------------------------------------------- search */

/*
 * The search pill, in the middle of the sub-bar (Orbit keeps it in its dark
 * header; SpaceCamp's navbar stays as it is). The field is the title search
 * and the button at its right-hand end opens the rest of the filter
 * (assets/vue/Board/FilterPopover.js), whose popover is positioned off this.
 */
.o-search-slot { flex: 0 1 420px; min-width: 0; }
.o-search { position: relative; display: flex; align-items: center; gap: 4px; width: 100%; height: 34px; padding: 0 4px 0 12px; border-radius: 17px; background: var(--sc-surface); color: var(--sc-fg); border: 1px solid var(--sc-border); transition: border-color 0.1s, box-shadow 0.1s; }
.o-search:focus-within,
.o-search--open { border-color: var(--sc-border-strong); box-shadow: var(--sc-shadow-2); }
.o-search__icon { display: flex; flex: none; color: var(--sc-fg-subtle); }
.o-search__input { flex: 1 1 auto; min-width: 0; height: 100%; padding: 0 4px; border: 0; background: transparent; color: var(--sc-fg); font: 400 14px/1 var(--sc-font-sans); }
.o-search__input::placeholder { color: var(--sc-fg-subtle); }
.o-search__input:focus { outline: none; }
.o-search__clear,
.o-search__filter { display: inline-flex; align-items: center; justify-content: center; gap: 4px; flex: none; height: 26px; min-width: 26px; padding: 0 6px; border: 0; border-radius: 13px; background: transparent; color: var(--sc-fg-muted); cursor: pointer; }
.o-search__clear:hover,
.o-search__filter:hover { background: var(--sc-surface-hover); color: var(--sc-fg); }
.o-search__filter[aria-expanded="true"] { background: var(--sc-bg-sunken); color: var(--sc-fg); }
/* On while any facet behind it is — the button says the board is filtered. */
.o-search__filter--on,
.o-search__filter--on:hover,
.o-search__filter--on[aria-expanded="true"] { padding: 0 9px 0 7px; background: var(--sc-fg); color: var(--sc-bg); }
.o-search__count { font: 400 11px/1 var(--sc-font-mono); font-variant-numeric: tabular-nums; }

/* -------------------------------------------------------------- faces */

.o-faces { display: flex; align-items: center; align-self: center; flex: none; margin: 0 0 0 auto; padding: 0; list-style: none; }
.o-face { position: relative; display: flex; align-items: center; justify-content: center; flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--sc-fg); color: var(--sc-bg); font-family: var(--sc-font-mono); font-size: 10px; letter-spacing: 0.04em; line-height: 1; overflow: hidden; box-shadow: 0 0 0 2px var(--sc-surface); }
.o-face + .o-face { margin-left: -4px; }
.o-face:hover { z-index: 1; }
.o-face + .o-face--split { margin-left: 10px; }
.o-face__img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.o-face--more { background: var(--sc-surface-hover); color: var(--sc-fg-muted); box-shadow: 0 0 0 2px var(--sc-surface), inset 0 0 0 1px var(--sc-border); }

/* --------------------------------------------------------------- menu */

/* A dropdown panel off a <details>: the board's "..." menu in its sub-bar. */
.o-menu { position: relative; flex: none; }
.o-menu__button { display: flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: var(--sc-radius-sm); color: var(--sc-fg); list-style: none; cursor: pointer; }
.o-menu__button::-webkit-details-marker { display: none; }
.o-menu__button:hover,
.o-menu[open] > .o-menu__button { background: var(--sc-surface-hover); }
.o-menu__panel { position: absolute; top: calc(100% + 8px); right: 0; min-width: 12rem; padding: 6px; background: var(--sc-surface); color: var(--sc-fg); border: 1px solid var(--sc-border); border-radius: var(--sc-radius); box-shadow: var(--sc-shadow-pop); display: flex; flex-direction: column; }
.o-menu__item { display: block; width: 100%; padding: 9px 12px; border: 0; border-radius: var(--sc-radius-sm); background: transparent; color: var(--sc-fg); font: 400 14px/1.3 var(--sc-font-sans); text-align: left; text-decoration: none; white-space: nowrap; cursor: pointer; }
.o-menu__item:hover { background: var(--sc-surface-hover); color: var(--sc-fg); }

/* ------------------------------------------------- the settings page */

/*
 * The furniture Orbit's settings template is written in, on SpaceCamp's
 * tokens, so the template stays near Orbit's. Above 992px a 7/5 split: the
 * lists and the things people do most on the left, the one-off
 * configuration on the right; below it one column.
 */
.o-titleblock { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 20px; margin: 0 0 20px; }
.o-title { margin: 0 0 4px; font-size: 22px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.15; overflow-wrap: anywhere; }
.o-lede { margin: 0; font-size: 13px; line-height: 1.55; color: var(--sc-fg-muted); max-width: 62ch; text-wrap: pretty; }
.o-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.o-cols { display: grid; gap: 0 24px; align-items: start; }
.o-cols > * { min-width: 0; }
@media (min-width: 992px) {
    .o-cols--split { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
}
.o-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 8px; }
.o-eyebrow { margin: 0; font: 500 11.5px/1.4 var(--sc-font-sans); letter-spacing: 0.05em; text-transform: uppercase; color: var(--sc-fg-subtle); }
.o-stat { flex: none; font-family: var(--sc-font-mono); font-size: 11px; color: var(--sc-fg-subtle); white-space: nowrap; font-variant-numeric: tabular-nums; }
.o-card { display: flex; flex-direction: column; background: var(--sc-surface); border: 1px solid var(--sc-border); border-radius: var(--sc-radius); margin-bottom: 20px; }
.o-card--pad { padding: 18px 20px; }
.o-help { margin: 0 0 14px; font-size: 13px; line-height: 1.5; color: var(--sc-fg-muted); max-width: 62ch; text-wrap: pretty; }
.o-help--after { margin: 14px 0 0; }
.o-help code { font-size: 12px; color: var(--sc-fg); }
.o-field { margin-bottom: 16px; }
.o-field-row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.o-field-row > :first-child { flex: 1 1 200px; }
.o-label { display: block; margin-bottom: 6px; font-size: 12px; color: var(--sc-fg-muted); }
.o-input { display: block; width: 100%; padding: 9px 12px; border: 1px solid var(--sc-border-strong); border-radius: var(--sc-radius-sm); background: var(--sc-surface); color: var(--sc-fg); font: inherit; font-size: 14px; line-height: 1.3; }
.o-input:focus { outline: 2px solid var(--sc-accent-line); outline-offset: 1px; }
.o-input--md { padding: 8px 12px; font-size: 14px; }
.o-input--sm { padding: 7px 10px; font-size: 13px; width: 240px; max-width: 46vw; }
.o-form-actions { display: flex; justify-content: flex-end; margin-top: 16px; }
.o-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 34px; padding: 7px 14px; border: 1px solid var(--sc-fg); border-radius: var(--sc-radius-sm); background: var(--sc-fg); color: var(--sc-bg); font: 500 13px/1 var(--sc-font-sans); text-decoration: none; white-space: nowrap; cursor: pointer; transition: background-color 0.1s, color 0.1s, border-color 0.1s; }
.o-btn:hover { background: var(--sc-fg-muted); border-color: var(--sc-fg-muted); color: var(--sc-bg); }
.o-btn--outline { background: var(--sc-surface); border-color: var(--sc-border-strong); color: var(--sc-fg); }
.o-btn--outline:hover { background: var(--sc-surface-hover); border-color: var(--sc-fg); color: var(--sc-fg); }
.o-btn--danger { background: transparent; border-color: var(--sc-danger); color: var(--sc-danger); }
.o-btn--danger:hover { background: var(--sc-danger); border-color: var(--sc-danger); color: #ffffff; }
.o-btn--xs { min-height: 28px; padding: 4px 10px; font-size: 12px; }
.orb-label-row .o-input { flex: 1 1 8rem; width: auto; max-width: none; }
.o-danger-strip { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 14px; margin-top: 18px; padding: 16px 20px; background: var(--sc-surface); border: 1px solid var(--sc-border); border-left: 3px solid var(--sc-danger); border-radius: var(--sc-radius); }
.o-danger-strip h2 { margin: 0 0 3px; font-size: 14px; font-weight: 600; letter-spacing: 0; }
.o-danger-strip p { margin: 0; font-size: 13px; color: var(--sc-fg-muted); }

/* ------------------------------------------------------- /boards index */

.sc-board-index__group { margin-top: 20px; }
.sc-board-index__client { display: flex; align-items: center; gap: 6px; margin: 0 0 6px; list-style: none; cursor: pointer; }
.sc-board-index__client::-webkit-details-marker { display: none; }
.sc-board-index__client h2 { margin: 0; font-size: 12px; font-weight: 500; letter-spacing: 0.05em; text-transform: uppercase; color: var(--sc-fg-subtle); }
/* The disclosure caret is Phosphor's caret-right, as a mask so it takes the
   text colour, turned down while the group is open — Orbit's archived-boards
   device (assets/icons/phosphor/). */
.sc-board-index__client::before { content: ''; width: 12px; height: 12px; flex: none; background: currentColor; color: var(--sc-fg-subtle); -webkit-mask: url("../icons/phosphor/caret-right-qypISww.svg") center / contain no-repeat; mask: url("../icons/phosphor/caret-right-qypISww.svg") center / contain no-repeat; transition: transform 0.1s; }
.sc-board-index__group[open] > .sc-board-index__client::before { transform: rotate(90deg); }
.sc-board-index__list { margin: 0; border: 1px solid var(--sc-border); border-radius: var(--sc-radius); background: var(--sc-surface); }
.sc-board-index__row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 14px; border-top: 1px solid var(--sc-divider); }
.sc-board-index__row:first-child { border-top: 0; }
.sc-board-index__job { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 14px; }
.sc-board-index__job .text-muted { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sc-board-index__board { display: inline-flex; align-items: center; gap: 6px; flex: none; font-size: 14px; font-weight: 500; color: var(--sc-fg); text-decoration: none; }
.sc-board-index__board:hover { text-decoration: underline; }

/* --------------------------------------------------- the board itself */

/*
 * The lane strip's gutter: board.css lines lane one up with Bootstrap's
 * .container through --orb-container; SpaceCamp's <main> IS a .container,
 * so nothing to re-aim. What follows restates Orbit's interim board look on
 * the tokens — lanes a shade off the page, cards as bordered surfaces.
 */
body.orb-board-page .orb-lane { background: var(--sc-bg-sunken); border-radius: var(--sc-radius); }
body.orb-board-page .orb-lane-tinted { background: var(--orb-lane-tint); }
body.orb-board-page .orb-lane-add { background: transparent; }
body.orb-board-page .orb-lane-title,
body.orb-board-page .orb-lane-title-input,
body.orb-board-page .orb-lane-collapsed-name { font-size: 14px; font-weight: 600; }
body.orb-board-page .orb-lane-count,
body.orb-board-page .orb-lane-header .btn-link { font-family: var(--sc-font-mono); font-size: 11px; color: var(--sc-fg-subtle); text-decoration: none; }
body.orb-board-page .orb-lane-collapsed-count { color: var(--sc-fg); }
body.orb-board-page .orb-lane-add-card { font-family: var(--sc-font-mono); font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--sc-fg-subtle); }
body.orb-board-page .orb-lane-add-card:hover { color: var(--sc-fg); }
body.orb-board-page .orb-card { background: var(--sc-surface); border: 1px solid var(--sc-border); border-radius: var(--sc-radius); box-shadow: none; }
body.orb-board-page .orb-card:hover { background: var(--sc-surface-hover); }

/*
 * A `- [ ]` in a card description: SpaceCamp's MarkdownRenderer draws
 * checkboxes clickable for the ToDo board's checklists, and the job board has
 * no endpoint behind a tick yet. Inert until it has, rather than a box that
 * looks live and does nothing.
 */
body.orb-board-page .orb-markdown input.task-list-item-checkbox,
body.orb-board-page .orb-markdown .task-list-item input[type="checkbox"] { pointer-events: none; }

/* --------------------------------------------------------- dark theme */

/*
 * Orbit has no dark theme; SpaceCamp does. board.css draws from --bs-*
 * variables, so lanes, cards and panels follow the theme already. What does
 * not are the palette's TINTS — the near-white `--orb-{c}-tint` a coloured
 * lane is painted with, which on a dark board is a bright block. Re-derived
 * from each colour's solid shade over the dark surface; the solids, which
 * carry --orb-ink, read as they are.
 */
[data-bs-theme="dark"] {
    --orb-red-tint:    color-mix(in srgb, var(--orb-red) 18%, var(--sc-surface));
    --orb-orange-tint: color-mix(in srgb, var(--orb-orange) 18%, var(--sc-surface));
    --orb-yellow-tint: color-mix(in srgb, var(--orb-yellow) 18%, var(--sc-surface));
    --orb-lime-tint:   color-mix(in srgb, var(--orb-lime) 18%, var(--sc-surface));
    --orb-green-tint:  color-mix(in srgb, var(--orb-green) 18%, var(--sc-surface));
    --orb-teal-tint:   color-mix(in srgb, var(--orb-teal) 18%, var(--sc-surface));
    --orb-blue-tint:   color-mix(in srgb, var(--orb-blue) 18%, var(--sc-surface));
    --orb-purple-tint: color-mix(in srgb, var(--orb-purple) 18%, var(--sc-surface));
    --orb-pink-tint:   color-mix(in srgb, var(--orb-pink) 18%, var(--sc-surface));
    --orb-grey-tint:   color-mix(in srgb, var(--orb-grey) 18%, var(--sc-surface));
}

/* -------------------------------------------------------------- phones */

@media (max-width: 767.98px) {
    /* The sub-bar keeps the board's name and the menu; the trail's first
       crumb, the faces and the header text go — the menu is what the bar is
       for on a phone. The search pill takes the room left. */
    .o-subbar__trail a.o-subbar__crumb,
    .o-subbar__trail span.o-subbar__crumb,
    .o-subbar__sep,
    .o-subbar #board-people,
    .o-subbar__header { display: none; }
    .o-subbar__inner { gap: 8px; }
    .o-search-slot { flex: 1 1 auto; }
}

/*
 * iOS Safari zooms the page to any focused field whose text is under 16px, and
 * on the board — a page that is overflow:hidden and never scrolls itself —
 * that zoom leaves the lanes offset and does not fully come back on blur. So
 * on a coarse pointer every text field on the board is 16px.
 */
@media (pointer: coarse) {
    body.orb-board-page .form-control,
    body.orb-board-page .form-control-sm,
    body.orb-board-page .form-select,
    body.orb-board-page .form-select-sm,
    body.orb-board-page .o-input,
    body.orb-board-page .o-search__input,
    body.orb-board-page .orb-lane-title-input { font-size: 16px; }
}
