/* ---------------------------------------------------------------------------
   orenbj.com — component layer
   ---------------------------------------------------------------------------
   Built on the tokens in brand.css, which this file requires:

       <link rel="stylesheet" href="/assets/brand.css">
       <link rel="stylesheet" href="/assets/ui.css">

   brand.css is injected on every branded page and stays small. This file is
   opt-in, because a map application needs none of it and should not pay for it.

   Adopt it when rebuilding a page rather than restyling by hand: a page built
   from these classes matches the home page by construction, and inherits the
   contrast results rather than re-earning them.

   Not every page should adopt it. Metric Equinox is deliberately exempt — its
   own palette and type are the substance of that project.
   --------------------------------------------------------------------------- */

/* --- base ---------------------------------------------------------------- */

.ob-page {
  background-color: var(--ob-bg);
  background-image:
    radial-gradient(circle at 10% 0%,   rgba(251, 146, 60, 0.10) 0%, transparent 40%),
    radial-gradient(circle at 90% 20%,  rgba(192, 132, 252, 0.10) 0%, transparent 40%),
    radial-gradient(circle at 50% 100%, rgba(96, 165, 250, 0.10) 0%, transparent 50%);
  background-attachment: fixed;
  color: var(--ob-fg);
  font-family: var(--ob-font);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.ob-container {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  padding-inline: clamp(1.25rem, 5vw, 2.5rem);
}

/* --- type ---------------------------------------------------------------- */

/* A page's kicker above its title: "orenbj.com · Living reference". */
.ob-eyebrow {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ob-muted);
}

/* The gradient wordmark. Reserved for a page's own title — using it on
   section headings spends the one bold move the palette has. */
.ob-display {
  font-size: clamp(2.5rem, 10vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  background: var(--ob-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  text-wrap: balance;
}

/* The display size and weight without the gradient, for a second display
   line on a page whose title already spent it. */
.ob-display--plain {
  background: none;
  -webkit-text-fill-color: currentColor;
  color: var(--ob-fg);
}

.ob-h2 {
  font-size: 1.5rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
  text-wrap: balance;
}

.ob-h3 {
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.ob-lead   { font-size: 1.1rem; }
.ob-muted  { color: var(--ob-muted); }
.ob-small  { font-size: 0.9rem; }

/* Read aloud, not shown: a table caption, a fieldset legend, a live region. */
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Digits that line up in a column — tables, timers, readouts. */
.ob-nums { font-variant-numeric: tabular-nums; }

/* --- surfaces ------------------------------------------------------------ */

.ob-card {
  background-color: var(--ob-surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--ob-border);
  border-radius: var(--ob-radius);
  padding: clamp(1.25rem, 4vw, 1.75rem);
  box-shadow: var(--ob-shadow);
}

/* Only for a card that is itself a link or button. A static card should not
   animate on hover — it promises an interaction it does not have. */
a.ob-card,
button.ob-card {
  display: block;
  text-align: left;
  text-decoration: none;
  color: inherit;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              border-color 0.3s ease, box-shadow 0.3s ease;
}

a.ob-card:hover,
a.ob-card:focus-visible,
button.ob-card:hover,
button.ob-card:focus-visible {
  transform: translateY(-4px);
  border-color: var(--ob-purple);
  box-shadow: var(--ob-shadow-hover);
}

.ob-grid {
  display: grid;
  /* min() so a column is never wider than the container. A bare 280px minimum
     forced 280px cards even on a narrower screen, and with the side padding
     everything under ~300px scrolled sideways - 20px at 280, which is the
     Galaxy Fold's folded width. Identical wherever 280px already fits. */
  grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr));
  gap: clamp(1rem, 3vw, 1.5rem);
}

/* --- controls ------------------------------------------------------------ */

.ob-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.1rem;
  border: 1px solid var(--ob-border);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--ob-fg);
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.2s ease, background-color 0.2s ease, border-color 0.2s ease;
}

@media (pointer: coarse) { .ob-btn, .ob-input { min-height: var(--ob-control-h-lg); } }

.ob-btn:hover,
.ob-btn:focus-visible {
  color: var(--ob-purple);
  border-color: var(--ob-purple);
  background: rgba(192, 132, 252, 0.10);
}

.ob-btn--primary {
  background: var(--ob-purple);
  border-color: var(--ob-purple);
  color: var(--ob-on-accent);
  font-weight: 600;
}

.ob-btn--primary:hover,
.ob-btn--primary:focus-visible {
  color: var(--ob-on-accent);
  background: #d4a5fd;
  border-color: #d4a5fd;
}

.ob-btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* One visible focus treatment for everything that takes focus. */
.ob-page :focus-visible,
.ob-btn:focus-visible,
.ob-input:focus-visible {
  outline: 2px solid var(--ob-purple);
  outline-offset: 2px;
}

/* A tabindex="-1" element is never in the tab order — it is focused
   programmatically, to move a screen reader to new content after a view
   change — so a keyboard focus ring on it is meaningless to the person who
   triggered it and confusing to everyone else. Chromium matches
   :focus-visible on these anyway, which drew a 2px purple rectangle around
   the whole of DiSC's <main> on first paint, before the visitor had touched
   anything. The focus still lands; only the ring is suppressed. */
.ob-page [tabindex="-1"]:focus,
.ob-page [tabindex="-1"]:focus-visible {
  outline: none;
}

.ob-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.ob-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ob-muted);
  letter-spacing: 0.01em;
}

.ob-input {
  width: 100%;
  padding: 0.55rem 0.75rem;
  /* --ob-control-border, not --ob-border: the edge has to clear 3:1 to
     identify the control (see brand.css). */
  border: 1px solid var(--ob-control-border);
  border-radius: var(--ob-radius-sm);
  background: var(--ob-surface-flat);
  color: var(--ob-fg);
  font: inherit;
  font-size: 0.95rem;
}

.ob-input::placeholder { color: var(--ob-muted); opacity: 1; }
.ob-input:focus { border-color: var(--ob-purple); outline-offset: 0; }

select.ob-input {
  appearance: none;
  padding-right: 2rem;
  /* Caret drawn as a gradient pair so it needs no image request. */
  background-image:
    linear-gradient(45deg, transparent 50%, var(--ob-muted) 50%),
    linear-gradient(135deg, var(--ob-muted) 50%, transparent 50%);
  background-position: right 1.1rem center, right 0.85rem center;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

/* Native checkboxes, radios and range sliders take the accent color rather
   than the browser's blue. */
.ob-page input[type="checkbox"],
.ob-page input[type="radio"],
.ob-page input[type="range"],
.ob-panel input[type="checkbox"],
.ob-panel input[type="range"] { accent-color: var(--ob-purple); }

/* --- filter and legend panels ------------------------------------------------
   The one kit for a web app's controls and key, whatever the layout: a
   dashboard's sidebar, a map's floating card, a chart's legend. The two maps
   keep their own markup and apply the same tokens to it, so change a value
   in brand.css, not here, or the maps drift. */

.ob-panel {
  background: var(--ob-panel);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid var(--ob-panel-border);
  border-radius: var(--ob-radius-panel);
  box-shadow: var(--ob-panel-shadow);
  padding: 12px 14px;
  color: var(--ob-fg);
  font-size: 0.8125rem;
  line-height: 1.4;
}

/* The panel's own name: "Census Mobility Map", "LA Bus Lanes". */
.ob-panel-title {
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.3;
}

/* One line under the title saying what the panel is for. */
.ob-panel-sub {
  margin-top: 2px;
  font-size: 0.75rem;
  color: var(--ob-muted);
}

/* A group heading inside a panel: "View options", "Legend". Uppercase and
   tracked, so it reads as structure rather than as one more setting. Full size
   in a sidebar column; a step smaller in a floating card over a map. */
.ob-section-label {
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ob-muted);
}
.ob-panel .ob-section-label { font-size: 0.75rem; }

/* Legend: a mark, then its label in text color. The mark carries identity;
   the words never take the series color. */
.ob-legend { list-style: none; margin: 0; padding: 0; }
.ob-legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 0;
  font-size: 0.75rem;
}
/* A row that is a checkbox, and a slider, are 44px on a touch screen. */
@media (pointer: coarse) {
  label.ob-legend-row { min-height: var(--ob-control-h); }
  input[type="range"] { min-height: var(--ob-control-h); }
}
.ob-swatch {                                   /* an area: tracts, regions */
  flex-shrink: 0;
  width: 14px;
  height: 10px;
  border-radius: 3px;
}
.ob-swatch--line {                             /* a line: routes, lanes */
  width: 28px;
  height: 3px;
  border-radius: 2px;
}

/* --- data ---------------------------------------------------------------- */

/* Wrap a table in this so a wide table scrolls on its own instead of
   pushing the page sideways. */
.ob-table-scroll { overflow-x: auto; }

.ob-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  font-variant-numeric: tabular-nums;
}

.ob-table th,
.ob-table td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--ob-border);
}

.ob-table th {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ob-muted);
  white-space: nowrap;
}

.ob-table tbody tr:hover { background: rgba(255, 255, 255, 0.03); }
.ob-table td.ob-num,
.ob-table th.ob-num { text-align: right; }

.ob-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  background: rgba(255, 255, 255, 0.06);
  color: var(--ob-muted);
}

.ob-badge--orange { background: rgba(251, 146, 60, 0.14); color: var(--ob-orange); }
.ob-badge--purple { background: rgba(192, 132, 252, 0.14); color: var(--ob-purple); }
.ob-badge--blue   { background: rgba(96, 165, 250, 0.14);  color: var(--ob-blue); }

.ob-rule {
  border: 0;
  border-top: 1px solid var(--ob-border);
  margin-block: clamp(2rem, 5vw, 3rem);
}

@media (prefers-reduced-motion: reduce) {
  .ob-btn,
  a.ob-card,
  button.ob-card { transition: none; }

  a.ob-card:hover,
  a.ob-card:focus-visible,
  button.ob-card:hover,
  button.ob-card:focus-visible { transform: none; }
}
