/* Ritchie Bros. brand foundation — shared across all pages.
   Reflects 2026 brand guidelines: black/white dominant, orange as 10–15% accent,
   Eina 01 (Bold for headlines, Regular for body) with Roboto then Arial as
   approved fallbacks. */

/* Font URLs are relative to this file (public/shared/), so they resolve under
   the production BASE_PATH mount as well as at the root. */
@font-face {
  font-family: 'Roboto';
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url('../fonts/Roboto-Regular.ttf') format('truetype');
}
@font-face {
  font-family: 'Roboto';
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: url('../fonts/Roboto-Bold.ttf') format('truetype');
}

:root {
  /* Primary palette */
  --rb-white: #FFFFFF;
  --rb-black: #000000;
  --rb-orange: #E87511;

  /* Black tints (per brand guideline ramp) */
  --rb-black-90: #191919;
  --rb-black-80: #323232;
  --rb-black-70: #4C4C4C;
  --rb-black-60: #666666;
  --rb-black-50: #7F7F7F;
  --rb-black-40: #999999;
  --rb-black-30: #B2B2B2;
  --rb-black-20: #CCCCCC;
  --rb-black-10: #E5E5E5;
  --rb-black-05: #F4F4F4;

  /* Semantic UI tokens */
  --bg: var(--rb-white);
  --surface: var(--rb-white);
  --surface-alt: var(--rb-black-05);
  --fg: var(--rb-black);
  --fg-muted: var(--rb-black-60);
  /* `black-50` only reaches 4.0:1 on white and drops further on the app's
     grey canvas. Subtle copy is still secondary at black-60, but remains
     readable at the 12-14px sizes used for placeholders and helper text. */
  --fg-subtle: var(--rb-black-60);
  --border: var(--rb-black-10);
  --border-strong: var(--rb-black-20);
  --accent: var(--rb-orange);
  --accent-hover: #C7620A;
  /* Dark-orange foreground for small labels/status text. Brand orange itself
     is reserved for larger fills and decoration because it misses 4.5:1. */
  --accent-text: #A64F00;
  --focus-ring: rgba(232, 117, 17, 0.35);

  /* Shared geometry/elevation. Page styles opt into these tokens rather than
     inventing unrelated radii and shadows for every surface. */
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05), 0 6px 18px rgba(0, 0, 0, 0.035);
  --shadow-md: 0 18px 48px rgba(0, 0, 0, 0.08);

  /* Buttons: a glass surface that presses in. Every button in the app draws
     from these tokens, and pages choose a radius token instead of inventing
     shadows of their own. Each shadow token has the same five layers in the
     same order (top highlight, bottom bevel, press well, near drop, far drop).
     box-shadow only animates between lists whose layers line up inset for
     inset, so this order is what lets rest, hover and press ease into each
     other instead of snapping. The overlays are translucent white and black
     only, so no button changes hue. */
  --btn-radius: 12px;
  --btn-radius-sm: 8px; /* compact controls under ~32px tall */
  --btn-duration: 120ms;
  --btn-ease: cubic-bezier(0.2, 0.7, 0.3, 1);
  --btn-transition:
    background-color var(--btn-duration) var(--btn-ease),
    color var(--btn-duration) var(--btn-ease),
    border-color var(--btn-duration) var(--btn-ease),
    box-shadow var(--btn-duration) var(--btn-ease),
    translate var(--btn-duration) var(--btn-ease),
    opacity var(--btn-duration) var(--btn-ease);
  /* Hover lifts, press sinks. Only `translate` moves, never padding or
     margins, so nothing around a button shifts. */
  --btn-lift: -1px;
  --btn-sink: 1px;
  /* Opaque here; the @supports block below turns it translucent wherever
     backdrop-filter exists, so the fallback is always a solid surface. */
  --btn-glass-fill: var(--surface);
  --btn-glass-blur: blur(14px) saturate(160%);
  --btn-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.38),
    inset 0 -1px 0 rgba(0, 0, 0, 0.08),
    inset 0 0 0 rgba(0, 0, 0, 0),
    0 1px 2px rgba(0, 0, 0, 0.08),
    0 4px 12px -3px rgba(0, 0, 0, 0.14);
  --btn-shadow-hover:
    inset 0 1px 0 rgba(255, 255, 255, 0.38),
    inset 0 -1px 0 rgba(0, 0, 0, 0.08),
    inset 0 0 0 rgba(0, 0, 0, 0),
    0 2px 4px rgba(0, 0, 0, 0.1),
    0 10px 22px -6px rgba(0, 0, 0, 0.22);
  /* Pressed: the drop shadows collapse and an inner shadow takes their place,
     so the button reads as pushed into the page. */
  --btn-shadow-press:
    inset 0 1px 0 rgba(255, 255, 255, 0),
    inset 0 -1px 0 rgba(0, 0, 0, 0),
    inset 0 2px 5px rgba(0, 0, 0, 0.24),
    0 0 0 rgba(0, 0, 0, 0),
    0 0 0 rgba(0, 0, 0, 0);
  /* Disabled: same edge, no elevation. It neither lifts nor presses. */
  --btn-shadow-flat:
    inset 0 1px 0 rgba(255, 255, 255, 0.38),
    inset 0 -1px 0 rgba(0, 0, 0, 0.05),
    inset 0 0 0 rgba(0, 0, 0, 0),
    0 0 0 rgba(0, 0, 0, 0),
    0 0 0 rgba(0, 0, 0, 0);

  /* State colors — kept muted; used only as semantic UX indicators, not as
     brand colors. */
  --state-success: #1B7F3B;
  --state-error: #B0271A;
  --state-error-bg: #FBE9E7;
  --state-warning: #B26A00;

  /* Typography */
  --font-headline: 'Eina 01', 'Roboto', Arial, sans-serif;
  --font-body: 'Eina 01', 'Roboto', Arial, sans-serif;
  --font-mono: ui-monospace, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* App-wide canvas. Painting html as well as body matters: body's
   min-height:100% never resolves against html's auto height, so body's
   background alone stops at content height and short pages would show a
   white void below the content. login.css overrides body with its own
   gradient; that still wins because page CSS loads after this file. */
html, body { min-height: 100%; background: var(--rb-black-05); }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-headline);
  font-weight: 700;
  color: var(--fg);
  letter-spacing: -0.005em;
}

/* Shared page-header text. Pages own the #page-head layout (column by
   default; meta runs a row) but the title/subtitle type is one system. */
#page-head h1 {
  margin: 0;
  font-family: var(--font-headline);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--fg);
}
.page-sub {
  margin: 0;
  color: var(--fg-muted);
  font-size: 14px;
}

a { color: var(--fg); }
a:hover { color: var(--accent); }

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: var(--fg);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Shared topnav used by every app page. flex-wrap is unconditional: it only
   engages when the links actually overflow, and a hard breakpoint would leave
   a dead band (nowrap links cannot shrink) just above whatever width was
   picked — the injected Admin link makes the nav wider for superadmins, so no
   single breakpoint is right for everyone. */
.rb-topnav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 14px 24px;
  background: var(--rb-white);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.rb-topnav .rb-logo {
  display: inline-flex;
  align-items: center;
  margin-right: 16px;
}
.rb-topnav .rb-logo img {
  display: block;
  height: 28px;
  width: auto;
}
.rb-topnav a {
  color: var(--fg-muted);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  transition: color 0.15s ease, background 0.15s ease;
}
.rb-topnav a:hover {
  color: var(--fg);
  background: var(--surface-alt);
}
.rb-topnav a.active {
  color: var(--fg);
  position: relative;
}
.rb-topnav a.active::after {
  content: '';
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 2px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}
.rb-topnav a.logout {
  margin-left: auto;
  color: var(--fg-subtle);
}

/* Tighter nav metrics once wrapping is likely, so it costs fewer rows. */
@media (max-width: 920px) {
  .rb-topnav {
    padding: 10px 16px;
    gap: 0 2px;
  }
  .rb-topnav .rb-logo { margin-right: 10px; }
  .rb-topnav a { padding: 6px 10px; }
}

/* A four-row sticky nav consumes most of a phone viewport. Keep the complete
   information architecture, but present it as one touch-scrollable rail. */
@media (max-width: 640px) {
  .rb-topnav {
    flex-wrap: nowrap;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    padding: 8px 12px;
    scrollbar-width: none;
  }
  .rb-topnav::-webkit-scrollbar { display: none; }
  .rb-topnav .rb-logo {
    flex: 0 0 auto;
    margin-right: 8px;
  }
  .rb-topnav .rb-logo img { height: 25px; }
  .rb-topnav a { flex: 0 0 auto; }
  .rb-topnav a.logout { margin-left: 0; }
}

/* Shared empty-state block — pages drop this in where a list/grid would
   render when there is nothing to show yet. */
.rb-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 48px 24px;
  border: 1px dashed var(--border-strong);
  border-radius: 6px;
  background: var(--surface);
  text-align: center;
}
.rb-empty-title {
  font-family: var(--font-headline);
  font-weight: 700;
  font-size: 15px;
  color: var(--fg);
}
.rb-empty-sub {
  font-size: 13px;
  color: var(--fg-muted);
  max-width: 44ch;
}
.rb-empty a { color: var(--fg); font-weight: 600; }
.rb-empty a:hover { color: var(--accent); }

/* Shared form controls. Pages may extend, but should not redefine these
   primitives. */
.rb-input,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="number"],
select,
textarea {
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 10px 12px;
  font: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  width: 100%;
}
input::placeholder, textarea::placeholder {
  color: var(--fg-subtle);
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
input[aria-invalid="true"] {
  border-color: var(--state-error);
}
textarea {
  resize: vertical;
  min-height: 120px;
  font-family: var(--font-body);
}

/* Buttons.
   - .rb-btn (default) = secondary outline button, black on frosted white.
   - .rb-btn-primary = solid black button with white text, dark gray on hover.
   - .rb-btn-accent  = orange button — reserve for the single primary CTA on
     the page (per brand: orange limited to 10–15% of the design).
   Solid fills stay fully opaque so label contrast never depends on what sits
   behind a button; the glass comes from the highlight, bevel and shadow. */
button,
.rb-btn {
  background: var(--btn-glass-fill);
  -webkit-backdrop-filter: var(--btn-glass-blur);
  backdrop-filter: var(--btn-glass-blur);
  color: var(--fg);
  border: 1px solid var(--fg);
  border-radius: var(--btn-radius);
  padding: 10px 16px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: var(--btn-transition);
}

/* Depth and press, for every button. Each selector sits inside :where() so it
   has zero specificity: any page rule can restyle or opt out (a bare text or
   icon button sets box-shadow: none and translate: none) without fighting
   these. Movement uses the standalone `translate` property, which composes
   with a page's own `transform` (e.g. translateY(-50%) centring) instead of
   replacing it. */
:where(button, .rb-btn, .rb-btn-primary, .rb-btn-accent) {
  border-radius: var(--btn-radius);
  box-shadow: var(--btn-shadow);
}
:where(button, .rb-btn, .rb-btn-primary, .rb-btn-accent):where(:hover:not(:disabled, [aria-disabled="true"])) {
  box-shadow: var(--btn-shadow-hover);
  translate: 0 var(--btn-lift);
}
:where(button, .rb-btn, .rb-btn-primary, .rb-btn-accent):where(:active:not(:disabled, [aria-disabled="true"])) {
  box-shadow: var(--btn-shadow-press);
  translate: 0 var(--btn-sink);
}
:where(button, .rb-btn, .rb-btn-primary, .rb-btn-accent):where(:disabled, [aria-disabled="true"]) {
  box-shadow: var(--btn-shadow-flat);
  translate: none;
}
button:hover:not(:disabled),
.rb-btn:hover:not(:disabled) {
  background: var(--fg);
  color: var(--rb-white);
}
button:disabled,
.rb-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.rb-btn-primary {
  background: var(--fg);
  color: var(--rb-white);
  border-color: var(--fg);
}
.rb-btn-primary:hover:not(:disabled) {
  background: var(--rb-black-80);
  color: var(--rb-white);
  border-color: var(--rb-black-80);
}

.rb-btn-accent {
  background: var(--accent);
  /* Brand orange + white is only ~3:1. Black preserves the approved orange
     while clearing AA contrast for normal-size button labels. */
  color: var(--rb-black);
  border-color: var(--accent);
}
.rb-btn-accent:hover:not(:disabled) {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--rb-black);
}
.rb-btn-accent:disabled {
  background: var(--rb-black-20);
  border-color: var(--rb-black-20);
  color: var(--rb-black-50);
  opacity: 1;
}

/* Compact secondary buttons of the copy repeaters, which Generate (Bulk) and
   Meta share. */
.copy-remove {
  background: var(--btn-glass-fill);
  border: 1px solid var(--border-strong);
  color: var(--fg-muted);
  padding: 0 8px;
  height: 28px;
  border-radius: var(--btn-radius-sm);
  cursor: pointer;
  font-size: 12px;
  line-height: 1;
  font-family: inherit;
  flex: 0 0 auto;
}
.copy-remove:hover {
  background: var(--surface-alt);
  color: var(--fg);
}
.copy-add {
  align-self: flex-start;
  margin-top: 6px;
  padding: 4px 10px;
  font-size: 12px;
  background: var(--btn-glass-fill);
  border: 1px solid var(--border-strong);
  color: var(--fg);
  border-radius: var(--btn-radius-sm);
  cursor: pointer;
  font-family: inherit;
}
.copy-add:hover { background: var(--surface-alt); }
.copy-add:disabled { opacity: 0.5; cursor: not-allowed; }

/* Glass needs backdrop-filter; without it the fill above stays opaque. */
@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  :root { --btn-glass-fill: rgba(255, 255, 255, 0.72); }
}

/* Reduced motion: buttons keep their shadow feedback but never move. */
@media (prefers-reduced-motion: reduce) {
  :root {
    --btn-lift: 0px;
    --btn-sink: 0px;
  }
}

/* The `hidden` attribute must always win. Author rules like display:flex on
   a section otherwise beat the UA's [hidden] { display: none } and leave
   "hidden" content visible — every page toggling `hidden` on styled
   containers relies on this. */
[hidden] { display: none !important; }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
