/* RLN Centerline Engineering - Geodetic Suite
   Ribbon interface. Loaded after geodetic.css. It only restyles the chrome at the top of each page;
   the tools themselves are not changed. Colours come from the variables in geodetic.css. */

:root {
  --rb-bar: #0a2f5c;
  --rb-bar-h: 34px;
  --rb-panel-top: #f8fbfe;
  --rb-panel-bot: #e4ecf7;
  --rb-sep: #c3d2e6;
  --rb-hover: #d7e6f8;
  --rb-hover-line: #8fb0dc;
  --rb-on: #c4dbf5;
  --rb-ink: #0f4c9a;
}

/* the old two-row header is replaced */
body.rb .topbar, body.rb .subbar { display: none !important; }
body.rb #geo-top { position: sticky; top: 0; z-index: 60; }
html.rb-sticky { scroll-padding-top: 9.5rem; }
@media (max-width: 760px), (max-height: 520px) {
  body.rb #geo-top { position: static; }
}

.rb-x { display: none !important; }

/* ---------- tab bar ---------- */
.ribbon { background: var(--rb-bar); border-bottom: 3px solid var(--orange-500); font-family: var(--font); }
.rb-bar { display: flex; align-items: flex-end; gap: 2px; padding: 0 0.5rem 0 0.5rem; min-height: var(--rb-bar-h); }
.rb-tabs { display: flex; align-items: flex-end; gap: 2px; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.rb-tabs::-webkit-scrollbar { display: none; }
.rb-tab {
  font: inherit; font-size: 0.9rem; color: #e6effa; background: transparent; border: 0; cursor: pointer;
  padding: 0 1rem; height: 30px; border-radius: 4px 4px 0 0; white-space: nowrap; flex: none;
}
.rb-tab:hover { background: rgba(255, 255, 255, 0.12); }
.rb-tab[aria-selected="true"] { background: var(--rb-panel-top); color: var(--blue-900); font-weight: 600; }
.rb-tab.rb-file { background: var(--orange-500); color: #1b1000; font-weight: 700; margin-right: 4px; }
.rb-tab.rb-file:hover { background: var(--orange-600); color: #fff; }
.rb-tab.rb-file[aria-selected="true"] { background: var(--rb-panel-top); color: var(--blue-900); }
.rb-tab:focus-visible, .rb-btn:focus-visible, .rb-collapse:focus-visible { outline: 3px solid var(--orange-500); outline-offset: -2px; }
.rb-spacer { flex: 1 1 auto; }
.rb-right { display: flex; align-items: center; gap: 0.75rem; padding: 0 0 4px 1rem; flex: none; }
.rb-brand { display: flex; align-items: center; gap: 0.45rem; color: #fff; text-decoration: none; font-size: 0.85rem; font-weight: 600; white-space: nowrap; }
.rb-brand img { display: block; border-radius: 5px; }
.rb-brand small { font-weight: 400; opacity: 0.8; }
@media (max-width: 900px) { .rb-brand span { display: none; } }
.rb-collapse { background: transparent; border: 0; color: #e6effa; cursor: pointer; width: 26px; height: 24px; border-radius: 4px; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.rb-collapse:hover { background: rgba(255, 255, 255, 0.14); }
.rb-collapse svg { width: 14px; height: 14px; transition: transform 0.15s; stroke: currentColor; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.ribbon.rb-collapsed .rb-collapse svg { transform: rotate(180deg); }

/* ---------- ribbon body ---------- */
.rb-body { background: linear-gradient(var(--rb-panel-top), var(--rb-panel-bot)); border-bottom: 1px solid var(--rb-sep); overflow-x: auto; }
.ribbon.rb-collapsed .rb-body { display: none; }
.rb-panel { display: flex; align-items: stretch; min-height: 98px; padding: 4px 4px 0; width: max-content; min-width: 100%; }
.rb-panel[hidden] { display: none; }
.rb-group { display: flex; flex-direction: column; padding: 0 6px; border-right: 1px solid var(--rb-sep); flex: none; }
.rb-group:last-child { border-right: 0; }
.rb-cols { display: flex; align-items: stretch; gap: 2px; flex: 1 1 auto; padding-top: 2px; }
.rb-col { display: flex; flex-direction: column; justify-content: center; gap: 1px; }
.rb-gl { text-align: center; font-size: 0.72rem; color: var(--muted); padding: 1px 4px 4px; white-space: nowrap; line-height: 1.2; }

/* ---------- command buttons ---------- */
.rb-btn {
  font: inherit; color: var(--ink); background: transparent; border: 1px solid transparent; border-radius: 4px;
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.78rem; line-height: 1.15; padding: 0; margin: 0;
}
.rb-btn:hover { background: var(--rb-hover); border-color: var(--rb-hover-line); }
.rb-btn:active { background: var(--rb-on); }
.rb-btn.on, .rb-btn[aria-pressed="true"] { background: var(--rb-on); border-color: var(--blue-600); box-shadow: inset 0 1px 2px rgba(10, 47, 92, 0.25); }
.rb-btn[disabled], .rb-btn.rb-off { opacity: 0.42; cursor: default; pointer-events: none; filter: grayscale(0.7); }
.rb-btn.l { flex-direction: column; justify-content: flex-start; gap: 3px; min-width: 58px; padding: 4px 6px 3px; text-align: center; }
.rb-btn.l .rb-ic { width: 32px; height: 32px; flex: none; }
.rb-btn.s { gap: 6px; height: 24px; padding: 0 8px 0 5px; justify-content: flex-start; white-space: nowrap; }
.rb-btn.s .rb-ic { width: 16px; height: 16px; flex: none; stroke-width: 2.6; }
.rb-btn.s .rb-t br { display: none; }
.rb-t { display: block; }

/* icons: ink outline with light fill, one accent colour per glyph */
.rb-ic { stroke: var(--rb-ink); stroke-width: 1.7; fill: none; stroke-linecap: round; stroke-linejoin: round; display: block; }
.rb-ic .lf { fill: #e6effa; }
.rb-ic .o { stroke: var(--orange-600); }
.rb-ic .of { fill: var(--orange-500); stroke: none; }
.rb-ic .g { stroke: var(--ok); }
.rb-ic .gf { fill: var(--ok); stroke: none; }
.rb-ic .r { stroke: var(--bad); }
.rb-ic .rf { fill: var(--bad); stroke: none; }
.rb-ic .w { stroke: #fff; }
.rb-ic .wf { fill: #fff; }

/* ---------- selects and ticks in the ribbon ---------- */
.rb-ctl { display: flex; align-items: center; gap: 6px; height: 24px; padding: 0 6px; font-size: 0.78rem; font-weight: 400; color: var(--ink); white-space: nowrap; margin: 0; }
.rb-ctl > span { color: var(--blue-900); min-width: 0; }
.rb-ctl select {
  display: inline-block; width: auto; max-width: 220px; margin: 0; padding: 1px 4px; height: 22px; font: inherit; font-size: 0.78rem;
  background: #fff; border: 1px solid #a9bdd7; border-radius: 3px; color: var(--ink);
}
.rb-ctl select:disabled { opacity: 0.5; }
.rb-ctl input[type="checkbox"] { width: 14px; height: 14px; margin: 0; accent-color: var(--orange-600); }
.rb-ctl.rb-off { opacity: 0.5; }
.rb-ctl select:focus-visible, .rb-ctl input:focus-visible { outline: 3px solid var(--orange-500); outline-offset: 1px; }

/* ---------- workflow strip: the tools of the suite ---------- */
.rb-flow { display: flex; align-items: center; gap: 0.25rem; background: #fff; border-bottom: 1px solid var(--line); padding: 0 0.75rem; overflow-x: auto; font-size: 0.8rem; scrollbar-width: thin; }
.rb-flow-l { color: var(--muted); padding: 0.3rem 0.5rem 0.3rem 0; white-space: nowrap; }
.rb-flow a { color: var(--muted); text-decoration: none; padding: 0.3rem 0.65rem; white-space: nowrap; border-bottom: 2px solid transparent; }
.rb-flow a:hover { color: var(--blue-700); }
.rb-flow a.active { color: var(--blue-900); font-weight: 600; border-bottom-color: var(--orange-500); }
.rb-flow a:focus-visible { outline: 3px solid var(--orange-500); outline-offset: -2px; }

/* ---------- tooltip ---------- */
#rb-tip { position: fixed; z-index: 1000; max-width: min(20rem, calc(100vw - 16px)); padding: 0.5rem 0.7rem; background: var(--blue-900); color: #fff; font-size: 0.82rem; line-height: 1.4; border-radius: 6px; border-left: 3px solid var(--orange-500); box-shadow: 0 4px 14px rgba(10, 47, 92, 0.3); pointer-events: none; }
#rb-tip b { display: block; margin-bottom: 0.1rem; }
#rb-tip[hidden] { display: none; }

/* the Tips switch now lives in the tab bar */
.rb-right .tipsw { margin: 0; }

@media print {
  .ribbon, #rb-tip, #geo-top { display: none !important; }
}

/* phones: the brand sat on top of the last tabs */
@media (max-width: 520px) { .rb-brand { display: none; } }
