/*
  02-shell.css — v37 app shell: helm bar (compact sticky header), 5-tab
  bottom nav, bottom-sheet modals, restyled gates.
*/

.app { padding-bottom: 88px; }
main { padding: var(--gap); }

/* ---------- Helm bar ---------- */
.topbar {
  background: var(--hull);
  border-bottom: 2px solid var(--brass);
  padding: 8px 12px 8px;
  color: #f3e6c8;
  backdrop-filter: none;
}
.title-row { gap: 8px; }
h1#shipTitle {
  font-family: var(--font-display); font-weight: 400;
  font-size: var(--t4); letter-spacing: .05em;
  color: var(--brass-bright); text-shadow: none; line-height: 1.05;
}
.subtitle { color: #b9a784; font-size: var(--t0); margin-top: 1px; }
.sync-pill {
  border-color: rgba(232,192,105,.28); background: rgba(255,255,255,.04);
  color: #cdbb96; font-size: var(--t0); padding: 6px 10px;
}

/* One horizontal rail replaces the 2x2 time grid + summary line (~100px saved). */
.time-actions.helm-rail {
  display: flex; grid-template-columns: none;
  gap: 8px; margin-top: 8px; align-items: center;
  overflow-x: auto; -webkit-overflow-scrolling: touch;
  padding-bottom: 2px;
  /* No scroll-snap: on mobile `proximity` snapping re-aligned to the first
     button after a scroll gesture, dragging the rail back to the left and
     hiding the anchor toggle at the far end. Free scrolling holds position. */
  overscroll-behavior-x: contain;
}
.rail-btn {
  flex: 0 0 auto; min-height: 38px; padding: 6px 13px;
  border-radius: 999px; border: 1px solid rgba(232,192,105,.32);
  background: rgba(255,255,255,.05); color: #f3e6c8;
  font: inherit; font-weight: 650; font-size: var(--t1);
  display: inline-flex; align-items: center; gap: 5px; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.rail-btn .faint { color: #a08c67; font-weight: 500; font-size: var(--t0); }
.rail-btn:active { transform: translateY(1px); }
.rail-btn.primary { background: var(--brass); border-color: transparent; color: #1b1105; }
.rail-btn.primary .faint { color: rgba(27,17,5,.6); }

.summary-line { margin-top: 0 !important; flex: 0 0 auto; display: inline-flex; flex-wrap: nowrap; gap: 8px; align-items: center; }
.summary-line .tag, .summary-line .summary-pill {
  flex: 0 0 auto; white-space: nowrap; font-size: var(--t0);
  border-color: rgba(232,192,105,.24); color: #cdbb96; background: rgba(255,255,255,.04);
}
.summary-line .time-pill { color: var(--brass-bright); border-color: rgba(232,192,105,.42); font-weight: 700; }
.summary-line .time-toggle { flex: 0 0 auto; }

/* ---------- Bottom nav: 7 tabs, horizontally scrollable ---------- */
.bottom-nav {
  background: var(--hull);
  border-top: 1px solid rgba(232,192,105,.26);
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
}
/* A horizontal rail rather than a fixed 7-up grid: on a narrow phone seven
   equal columns squeezed the last tab ("More") off-screen. As a scroller the
   tabs keep a comfortable tap size and the user can swipe left/right to reach
   any of them. On wider screens all seven still fit with room to spare, so
   the rail simply doesn't scroll. */
.bottom-nav-inner {
  display: flex;
  gap: 2px;
  padding: 0 8px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-width: none;              /* quiet: no visible scrollbar */
  justify-content: safe center;        /* centre when everything fits */
}
.bottom-nav-inner::-webkit-scrollbar { display: none; }
.navbtn {
  flex: 0 0 auto;
  min-width: 60px;                     /* comfortable tap target + label room */
}
@media (max-width: 460px) {
  .navbtn { font-size: .64rem; letter-spacing: -.01em; min-width: 58px; }
  .navbtn .nav-icon svg { width: 20px; height: 20px; }
}
.navbtn { padding-inline: 4px; }
.navbtn {
  min-height: 54px; font-size: .72rem; color: #a5906b;
  border-radius: var(--r-s); gap: 3px; position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.navbtn > span:last-child { white-space: nowrap; }
.navbtn .nav-icon svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.navbtn.active {
  color: var(--brass-bright); background: rgba(232,192,105,.10); outline: 0;
}
.navbtn.active::after {
  content: ""; position: absolute; top: 0; left: 26%; right: 26%;
  height: 3px; border-radius: 0 0 3px 3px; background: var(--brass);
}

/* ---------- Bottom sheets (the modal system, reskinned) ---------- */
.modal-backdrop { padding: 0; background: rgba(10, 6, 2, .58); }
.modal {
  max-width: 100%; width: 100%;
  border: 0; border-top: 2px solid var(--brass);
  border-radius: var(--r-l) var(--r-l) 0 0;
  max-height: 92dvh;
  background: var(--chart);
  box-shadow: var(--e3);
  /* v37.7: no top padding — the sticky .modal-head must pin flush against
     the sheet's top edge, otherwise scrolled rows peek through the gap
     above the title (the padding strip is part of the scrollport). */
  padding: 0 14px 10px;
  overscroll-behavior: contain;
}
.modal::before {
  content: ""; display: block; width: 44px; height: 4px; border-radius: 999px;
  background: rgba(29,23,17,.26); margin: 10px auto;
}
/* Full-bleed sticky header: negative margins cancel the sheet's side padding
   so pinned rows can never peek out at its edges; the sheet's own rounded
   overflow clipping shapes the corners when it pins at the top. */
.modal-head { margin: 0 -14px 10px; display: grid; grid-template-columns: minmax(64px, auto) minmax(0, 1fr) 42px; align-items: center; gap: 8px; }
.modal-head h2 { text-align: center; min-width: 0; }
.modal-back, .modal-back-spacer {
  justify-self: start; min-width: 64px; min-height: 38px;
}
.modal-back {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  padding: 7px 10px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--chart-2); color: var(--ink-soft); font: inherit;
  font-size: .82rem; font-weight: 800; cursor: pointer;
}
.modal-back:active { transform: translateY(1px); background: var(--chart); }
.modal-head .x { justify-self: end; }
@media (max-width: 390px) {
  .modal-head { grid-template-columns: 48px minmax(0, 1fr) 42px; }
  .modal-back, .modal-back-spacer { min-width: 48px; }
  .modal-back { width: 42px; padding: 0; font-size: 1.1rem; }
  .modal-back span:last-child { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}
.modal h2 { color: var(--ink); font-family: var(--font-display); font-weight: 400; font-size: var(--t3); }
.modal .x { background: var(--chart-2); color: var(--ink-soft); border-color: var(--line); }

/* Sticky action bar: Save/Cancel never scroll away in long forms. */
.modal .form-actions {
  position: sticky; bottom: -10px; z-index: 2;
  background: var(--chart);
  box-shadow: 0 -10px 12px -8px rgba(29,23,17,.22);
  padding: 10px 0 calc(10px + env(safe-area-inset-bottom));
  margin: 10px 0 -10px;
}

/* Board HTML reused inside sheets: strip the accordion chrome. */
.modal details[data-board-key] { border: 0; background: transparent; box-shadow: none; margin: 0; padding: 0; }
.modal details[data-board-key] > summary { display: none; }
.modal details[data-board-key] > .board-body { padding: 0; border: 0; background: transparent; }
/* Detail sheets show full text: no clamping, no More toggles. */
.modal .line-clamp-2 { display: block; -webkit-line-clamp: unset; max-height: none; overflow: visible; }
.modal .notes-toggle { display: none; }

/* Wide screens: sheets become centered panels. */
@media (min-width: 700px) {
  .modal-backdrop { padding: 24px; align-items: center; }
  .modal { max-width: 640px; border-radius: var(--r-l); border: 1px solid var(--line-strong); }
  .modal::before { display: none; }
  .modal .form-actions { bottom: -10px; }
}

/* ---------- Toast ---------- */
.toast {
  background: var(--hull); color: #f3e6c8;
  border: 1px solid rgba(232,192,105,.32); box-shadow: var(--e2);
}
.toast .toast-action { color: var(--brass-bright); }

/* ---------- Gates ---------- */
.player-panel, .access-panel {
  background: var(--chart); border: 1px solid var(--line-strong);
  border-top: 3px solid var(--brass); box-shadow: var(--e3);
}
.gate-crest h2 { font-family: var(--font-display); font-weight: 400; letter-spacing: .05em; }
.gate-crest svg { stroke: var(--brass); }

/* ---------- Screen & section headings on the deck ---------- */
.screen-title h2, .section-title h2 {
  font-family: var(--font-display); font-weight: 400;
  color: var(--brass-bright); letter-spacing: .05em;
  text-shadow: none; font-size: var(--t3);
}
.section-title { margin: var(--s4) 2px var(--s2); }
.section-title .hint { color: #b9a784; font-size: var(--t0); }
.screen-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 2px 2px var(--s2); }

/* Skip link stays visible-on-focus over the new chrome. */
.skip-link:focus { background: var(--brass); color: #1b1105; }
