/* Layout and page-level styles. Shared components live in tokens.css.
   Layout echoes the FAA DRS browse page: masthead band, accent stripe, tab
   bar, a browse menu on the left and content on the right. */

* { box-sizing: border-box; }
body { display: flex; flex-direction: column; min-height: 100vh; }
h1 { font-size: 24px; line-height: 1.25; margin: 4px 0 6px; font-weight: 600; color: var(--brand); }
h2 { font-size: 17px; margin: 24px 0 10px; font-weight: 600; }
p { margin: 0 0 8px; }
.small { font-size: 13px; }
.lede { font-size: 16px; max-width: 70ch; }
.meta { color: var(--muted); margin-bottom: 16px; }
.note { padding: 8px 12px; border-left: 3px solid var(--line); background: var(--soft); }
.empty { padding: 16px; color: var(--muted); }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: 4px 0; }
.pad { padding: 16px; }
.card { margin-bottom: 16px; }
.card-title { margin: 0; padding: 14px 16px; font-size: 15px; border-bottom: 1px solid var(--line); }
.pad > .card-title { padding: 0 0 10px; margin-bottom: 10px; }
.pad > h2:first-child { margin-top: 0; }
.btn { min-height: 36px; }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--on-brand); }

.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 8px; top: 8px; z-index: 10; background: var(--surface); padding: 8px; }

/* Masthead */
.masthead { background: var(--brand); color: var(--on-brand); }
.masthead-inner { display: flex; align-items: center; gap: 28px; padding: 18px 32px; max-width: 1600px; margin: 0 auto; }
.wordmark { font: 700 32px/1 ui-monospace, monospace; color: var(--on-brand); text-decoration: none;
  letter-spacing: .04em; padding: 6px 12px; border: 2px solid var(--on-brand); border-radius: 4px; }
.masthead-title { flex: 1; text-align: center; }
.site-name { font-size: 30px; font-weight: 400; margin: 0; line-height: 1.2; }
.site-tagline { font-size: 14px; margin: 4px 0 0; color: var(--on-brand-muted); }
.masthead :focus-visible { outline-color: var(--on-brand); }

/* Tab bar, under a rust stripe */
.tabbar { background: var(--brand-2); border-top: 4px solid var(--accent); }
.tabbar-inner { display: flex; gap: 2px; padding: 0 32px; max-width: 1600px; margin: 0 auto; }
.tabbar a { color: var(--on-brand); text-decoration: none; padding: 14px 16px; min-height: 48px; font-size: 16px; }
.tabbar a:hover { background: var(--brand-3); }
.tabbar a[aria-current="page"] { background: var(--brand); box-shadow: inset 0 -4px 0 var(--accent); font-weight: 600; }
.tabbar :focus-visible { outline-color: var(--on-brand); outline-offset: -3px; }

/* Body: browse menu + content */
.layout { flex: 1; display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 28px;
  width: 100%; max-width: 1600px; margin: 0 auto; padding: 24px 32px; align-items: start; }
.content { min-width: 0; }

.browse { background: var(--surface); border: 1px solid var(--line); border-radius: 6px;
  padding: 8px 0; position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; }
.browse-title { margin: 4px 16px 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.browse ul { list-style: none; margin: 0; padding: 0; }
.browse summary { cursor: pointer; padding: 8px 16px; min-height: 40px; list-style: none; display: flex; align-items: center; gap: 6px; }
.browse summary::-webkit-details-marker { display: none; }
.browse summary::before { content: "▸"; font-size: 12px; color: var(--muted); width: 12px; }
.browse details[open] > summary::before { content: "▾"; }
.browse-branch > summary { font-weight: 600; color: var(--brand); border-top: 1px solid var(--line); }
.browse-branch:first-of-type > summary { border-top: 0; }
.browse a { display: block; padding: 6px 16px 6px 34px; color: var(--ink); text-decoration: none; border-left: 4px solid transparent; }
.browse a:hover { background: var(--brand-soft); text-decoration: underline; }
.browse a[aria-current] { background: var(--brand-soft); border-left-color: var(--brand-2); font-weight: 600; color: var(--brand); }
.browse details details summary { padding-left: 34px; font-size: 13px; }
.browse details details a { padding-left: 52px; }
.count { color: var(--muted); font-weight: 400; font-size: 12px; margin-left: auto; }
.browse a .count { margin-left: 4px; }

/* Footer band */
.site-footer { background: var(--brand); color: var(--on-brand-muted); border-top: 4px solid var(--accent); margin-top: 24px; }
.site-footer-inner { max-width: 1600px; margin: 0 auto; padding: 20px 32px; font-size: 13px;
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 8px 32px; }
.footer-hash { margin: 0; text-align: right; }
.site-footer strong { color: var(--on-brand); }

/* About page: build pipeline and data-structure diagram */
.flow { list-style: none; margin: 0 0 16px; padding: 0; display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 28px; }
.flow li { position: relative; padding: 14px 16px; }
.flow li:not(:last-child)::after { content: "→"; content: "→" / ""; position: absolute;
  right: -24px; top: 50%; transform: translateY(-50%); font-size: 20px; color: var(--brand-2); }
.flow h3 { margin: 0 0 6px; font-size: 15px; }
.flow p { margin: 0; font-size: 13px; }
.diagram { display: block; width: 100%; max-width: 800px; height: auto; margin: 0 0 8px; }
.d-box { fill: var(--surface); stroke: var(--brand-2); stroke-width: 1.5; }
.d-box.computed { stroke-dasharray: 6 4; }
.d-name { font: 600 14px ui-monospace, monospace; fill: var(--ink); }
.d-sub, .d-label { font: 13px system-ui, sans-serif; fill: var(--muted); }
.d-colhead { font: 600 12px system-ui, sans-serif; letter-spacing: .06em; fill: var(--muted); }
.d-line { stroke: var(--brand-2); stroke-width: 1.5; fill: none; }
.d-head { fill: var(--brand-2); }
.about dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.about dt { color: var(--muted); }
.about dd { margin: 0; overflow-wrap: anywhere; }

/* Info callout (FAA-style: left accent bar) */
.callout { display: flex; gap: 14px; background: var(--surface); border: 1px solid var(--line);
  border-left: 6px solid var(--brand-2); border-radius: 4px; padding: 16px 20px; margin-bottom: 20px; }
.callout-icon { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--brand);
  color: var(--on-brand); font: 700 16px/28px Georgia, serif; text-align: center; }
.callout p:last-child { margin-bottom: 0; }

.crumbs { color: var(--muted); font-size: 13px; }
.two-up { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 16px; }
.actions code { word-break: break-all; }

/* Reader keeps a right-hand side panel inside the content column */
.split.reader { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }

/* Tables scroll inside their card; first column sticky */
.table-wrap { overflow-x: auto; }
.table-wrap td:first-child, .table-wrap th:first-child { position: sticky; left: 0; background: var(--surface); }
table.compact td, table.compact th { padding: 4px 8px; }
tr.current td { background: var(--brand-soft); }

/* Entries card */
ol.entries { list-style: none; margin: 0; padding: 0; }
.entry { display: grid; grid-template-columns: 110px 1fr; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.entry:last-child { border-bottom: 0; }
.entry.selected { box-shadow: inset 4px 0 0 var(--brand-2); }
.entry.absent { display: block; }
.entry .badge { justify-self: start; align-self: start; }
.raw { white-space: pre-wrap; }

/* Filter toolbar and groups */
.filter { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; background: var(--brand-soft); border-color: var(--line); }
.filter .field { display: flex; flex-direction: column; gap: 4px; flex: 1 1 260px; }
.filter input[type="search"] { padding: 8px; min-height: 40px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); color: var(--ink); font: inherit; }
.check { display: flex; align-items: center; gap: 8px; min-height: 44px; }
label { font-weight: 500; }
.summary { margin-bottom: 10px; }
details.group > summary { list-style: none; }
details.group > summary::-webkit-details-marker { display: none; }
details.group > summary::before { content: "▸"; font-size: 12px; }
details.group[open] > summary::before { content: "▾"; }
.group-name { font-weight: 600; }
.group-header .badge.missing { margin-left: auto; }
details.group { scroll-margin-top: 16px; }

/* Section reader */
.banner { border: 1px solid var(--line); border-left: 6px solid var(--brand-2); background: var(--surface); padding: 12px 16px; margin-bottom: 16px; }
.banner p { margin: 4px 0 0; }
.version-form { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 16px; }
.version-form select { min-height: 36px; padding: 4px 8px; font: inherit; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 4px; }
.in-force { color: var(--muted); }
.prose { white-space: pre-wrap; margin: 16px 0; color: var(--ink); }
.missing-state { padding: 16px; border: 1px solid var(--missing); border-radius: 6px; margin: 16px 0; }
.source { margin-top: 16px; }

/* Sticky "Report an issue" button (bottom right) and its panel */
details.report { position: fixed; right: 16px; bottom: 16px; z-index: 20; }
details.report > summary { list-style: none; min-height: 44px; padding: 10px 16px; font-size: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .3); }
details.report > summary::-webkit-details-marker { display: none; }
details.report[open] > summary { box-shadow: none; }
.report-panel { position: absolute; right: 0; bottom: calc(100% + 8px); width: min(380px, calc(100vw - 32px));
  max-height: calc(100vh - 96px); overflow-y: auto; margin: 0; box-shadow: 0 4px 16px rgba(0, 0, 0, .25); }
.report-form { display: flex; flex-direction: column; gap: 12px; }
.report-form .field { display: flex; flex-direction: column; gap: 4px; }
.report-form textarea { padding: 8px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface);
  color: var(--ink); font: inherit; resize: vertical; }
.report-types { border: 1px solid var(--line); border-radius: 4px; padding: 4px 12px 8px; margin: 0; }
.report-types legend { padding: 0 4px; font-weight: 500; }
.report-form .btn { align-self: flex-start; min-height: 44px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.report-error { border-left-color: var(--missing); }
body.has-report .site-footer-inner { padding-bottom: 72px; }

@media (max-width: 1100px) {
  .split.reader { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; padding: 16px; }
  .browse { position: static; max-height: none; }
  .two-up { grid-template-columns: 1fr; }
  .flow { grid-template-columns: 1fr; }
  .flow li:not(:last-child)::after { content: "↓"; content: "↓" / ""; right: auto; left: 50%;
    top: auto; bottom: -26px; transform: translateX(-50%); }
  .masthead-inner { padding: 14px 16px; }
  .masthead-title { text-align: left; }
  .site-name { font-size: 22px; }
}

@media print {
  .masthead, .tabbar, .browse, .site-footer, .no-print, .skip-link, details.report { display: none !important; }
  body { background: #fff; color: #000; display: block; }
  .layout { display: block; padding: 0; max-width: none; }
  .split.reader { display: block; }
  .prose { max-width: none; }
  a { color: inherit; text-decoration: none; }
}
