/* ============================================================
   ROBIOS BASE — reset, chrome (banner/nav/mascot), shared utils
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: var(--font-ui);
  font-size: var(--fs-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img, svg, video, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
input { font: inherit; color: inherit; }
::selection { background: var(--accent); color: var(--accent-text-on); }

/* Slick scrollbars, everywhere (page + every inner scroller).
   `scrollbar-color` inherits from the root; modern Chrome prefers the
   standard props over ::-webkit-* — keep both in sync. */
html { scrollbar-color: #2E3238 transparent; }
* { scrollbar-width: thin; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #26292E;
  border-radius: var(--radius-pill);
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background-color: #3A3F46; background-clip: padding-box; }
::-webkit-scrollbar-corner { background: transparent; }

/* ---------- Layout helpers ---------- */
.wrap { max-width: var(--content-max); margin-inline: auto; padding-inline: 16px; }
.sec { padding-block: 28px; }

/* Section header: small display title left + optional link right */
.sec-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 14px;
}
.sec-head h2 {
  font-family: var(--font-display);
  font-size: 18px; font-weight: 700;
  text-transform: uppercase; letter-spacing: var(--ls-display);
}
.sec-head .sec-link {
  font-size: 13px; color: var(--text-muted);
  transition: color var(--dur-fast) var(--ease-ui);
}
.sec-head .sec-link:hover { color: var(--accent); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 12px;
  border-radius: var(--radius-btn);
  font-size: 14px; font-weight: 500; white-space: nowrap;
  transition: background-color var(--dur-fast) var(--ease-ui),
              color var(--dur-fast) var(--ease-ui),
              filter var(--dur-fast) var(--ease-ui),
              transform var(--dur-fast) var(--ease-pop);
}
.btn-primary { background: var(--accent); color: var(--accent-text-on); }
.btn-primary:hover { filter: brightness(1.06); }
.btn-primary:active { transform: scale(0.97); }
.btn-ghost { background: var(--accent-08); color: var(--accent); }
.btn-ghost:hover { background: var(--accent-20); }
.btn-dark { background: var(--bg-elevated); color: var(--text-primary); }
.btn-dark:hover { background: #2B2F34; }

/* ---------- Badges ---------- */
.badge-new {
  display: inline-flex; align-items: center;
  background: var(--accent); color: var(--accent-text-on);
  border-radius: var(--radius-badge);
  font-size: var(--fs-badge); font-weight: var(--fw-badge);
  padding: 2px 6px; line-height: 1.3; letter-spacing: 0.01em;
}
.badge-soft {
  display: inline-flex; align-items: center;
  background: var(--accent-20); color: var(--accent);
  border-radius: var(--radius-badge);
  font-size: var(--fs-badge); font-weight: var(--fw-badge);
  padding: 2px 6px; line-height: 1.3;
}
.badge-hot {
  display: inline-flex; align-items: center;
  background: var(--hot-pink); color: #fff;
  border-radius: var(--radius-badge);
  font-size: var(--fs-badge); font-weight: var(--fw-badge);
  padding: 2px 6px; line-height: 1.3; font-style: italic;
}

/* ---------- Filter pills ---------- */
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 12px; font-weight: 500; color: var(--text-muted);
  transition: color var(--dur-fast) var(--ease-ui), background-color var(--dur-fast) var(--ease-ui);
}
.pill:hover { color: var(--text-primary); }
.pill.active { background: #fff; color: #1A1A1A; }

/* ---------- Cards ---------- */
.card {
  background: var(--bg-card);
  border-radius: var(--radius-card);
  box-shadow: var(--inset-highlight);
}
.card-lg { border-radius: var(--radius-card-lg); overflow: hidden; }

/* ---------- Scroll reveal (auto-wired by js/main.js) ---------- */
.reveal { opacity: 0; transform: translateY(12px); }
.reveal.in {
  opacity: 1; transform: none;
  transition: opacity 0.5s var(--ease-pop), transform 0.5s var(--ease-pop);
}
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; }
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- Terminal typewriter (used with Robi.helpers.typewriter) ---------- */
.tw { font-family: var(--font-mono); }
.tw-caret {
  display: inline-block; width: 8px; height: 1.1em;
  background: var(--accent); vertical-align: text-bottom; margin-left: 2px;
  animation: tw-blink 1s steps(1) infinite;
}
@keyframes tw-blink { 50% { opacity: 0; } }

/* ============================================================
   CHROME: promo banner + nav (built in index.html, not a section)
   ============================================================ */
.promo-banner {
  height: var(--promo-banner-h);
  background: var(--accent); color: var(--accent-text-on);
  display: flex; align-items: center; justify-content: center; gap: 8px;
  font-size: 14px; font-weight: 500; position: relative; z-index: 60;
}
.promo-banner b { font-weight: 700; }
.promo-banner .promo-close {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px; display: grid; place-items: center;
  border-radius: 8px; opacity: 0.7;
  transition: opacity var(--dur-fast) var(--ease-ui), background-color var(--dur-fast) var(--ease-ui);
}
.promo-banner .promo-close:hover { opacity: 1; background: rgba(0,0,0,0.08); }

.nav {
  position: sticky; top: 0; z-index: 50;
  height: var(--nav-h);
  background: var(--bg-base);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex; align-items: center;
}
.nav-inner {
  width: 100%; max-width: var(--content-max); margin-inline: auto;
  padding-inline: 16px;
  display: flex; align-items: center; gap: 20px;
}
.nav-logo { display: flex; align-items: center; gap: 8px; font-family: var(--font-display); font-weight: 700; font-size: 15px; letter-spacing: var(--ls-display); }
.nav-logo svg { width: 20px; height: 20px; }
.nav-links { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav-links::-webkit-scrollbar { display: none; }
.nav-links a {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 8px; border-radius: var(--radius-sm);
  font-size: var(--fs-nav); font-weight: var(--fw-nav); color: var(--text-muted);
  white-space: nowrap;
  transition: color var(--dur-fast) var(--ease-ui);
}
.nav-links a:hover { color: var(--text-primary); }
.nav-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.nav-burger { display: none; }

/* 11 links + logo + actions inside .nav-inner (capped at 1440px):
   roomier tabs so the row fills the bar without dead space on the right */
.nav-inner { gap: 18px; }
.nav-links { gap: 6px; }
.nav-links a { padding: 6px 13px; font-size: 13.5px; }
.nav-links a .badge-new,
.nav-links a .badge-hot { font-size: 9px; padding: 1px 4px; }
@media (max-width: 1400px) {
  .nav-links { gap: 2px; }
  .nav-links a { padding: 5px 7px; font-size: 12.5px; }
}
/* nav still overflowing (~1101-1300px): fade the clipped edge so it reads
   as scrollable, not broken; main.js drops the class at scroll end */
.nav-links.is-scroll {
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 30px), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 30px), transparent);
}

@media (max-width: 1100px) {
  .nav-links { display: none; }
  .nav-burger { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; color: var(--text-muted); }
  .nav-burger:hover { color: var(--text-primary); background: var(--bg-white-5); }
}

/* ============================================================
   CHROME: Robi assistant widget (built by js/main.js)
   ============================================================ */
.robi-assist {
  position: fixed; right: 16px; bottom: 16px; z-index: 80;
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px;
  pointer-events: none;
}
.robi-assist * { pointer-events: auto; }
.robi-bubble {
  max-width: 260px;
  background: var(--bg-card); color: var(--text-primary);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px; border-bottom-right-radius: 4px;
  box-shadow: var(--shadow-card-xl);
  padding: 10px 12px; font-size: 13px; line-height: 1.45;
  opacity: 0; transform: translateY(6px) scale(0.98);
  transition: opacity var(--dur-med) var(--ease-pop), transform var(--dur-med) var(--ease-pop);
}
.robi-bubble.show { opacity: 1; transform: none; }
.robi-bubble .robi-bubble-close {
  float: right; margin-left: 8px; color: var(--text-faint); font-size: 11px;
}
.robi-bubble .robi-bubble-close:hover { color: var(--text-primary); }
.robi-face {
  width: 56px; height: 56px; border-radius: 50%;
  overflow: hidden; border: 2px solid var(--accent);
  box-shadow: 0 0 0 3px rgba(209,254,23,0.15), var(--shadow-card-xl);
  cursor: pointer;
  transition: transform var(--dur-med) var(--ease-pop);
  animation: robi-breathe 4s ease-in-out infinite;
}
.robi-face:hover { transform: scale(1.08); }
.robi-face.bounce { animation: robi-bounce 0.3s var(--ease-pop); }
.robi-face img { width: 100%; height: 100%; object-fit: cover; }
@keyframes robi-breathe { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-2px); } }
@keyframes robi-bounce { 0% { transform: scale(1); } 40% { transform: scale(0.88); } 100% { transform: scale(1); } }

/* ============================================================
   A11Y + MOBILE NAV (added 2026-07-16)
   Keyboard focus rings for shared chrome, skip-to-content link,
   and the working mobile burger dropdown. Purely additive — no
   existing rule above is modified.
   ============================================================ */

/* Keyboard focus ring for shared chrome. Only shows for keyboard users
   (:focus-visible); reuses the --ring-accent pattern already used in
   ~17 component files, so it reads as part of the same system. */
.btn:focus-visible,
.nav-logo:focus-visible,
.nav-links a:focus-visible,
.nav-burger:focus-visible,
.pill:focus-visible {
  outline: none;
  box-shadow: var(--ring-accent);
}
/* promo-close sits on the lime banner, where a lime ring would vanish. */
.promo-banner .promo-close:focus-visible {
  outline: 2px solid rgba(0, 0, 0, 0.55);
  outline-offset: 1px;
}

/* Skip to content: the first tab stop on every page, off-screen until
   focused, then it slides in. Jumps focus to <main id="main-content">. */
.skip-link {
  position: fixed;
  top: 8px; left: 8px;
  z-index: 100;
  padding: 8px 14px;
  border-radius: var(--radius-btn);
  background: var(--accent);
  color: var(--accent-text-on);
  font-size: 14px; font-weight: 600;
  box-shadow: var(--shadow-card-xl);
  transform: translateY(calc(-100% - 12px));
  transition: transform var(--dur-fast) var(--ease-ui);
}
.skip-link:focus { outline: none; transform: none; }

/* Mobile nav dropdown — js/main.js toggles .nav-open on the sticky <header class="nav">.
   Higher specificity than the .nav-links { display:none } rule above, so it wins. */
@media (max-width: 1100px) {
  .nav-open .nav-links {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    position: absolute;
    top: 100%; left: 0; right: 0;
    max-height: calc(100vh - var(--nav-h));
    padding: 8px;
    overflow-x: hidden;
    overflow-y: auto;
    background: var(--bg-base);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: var(--shadow-card-xl);
    -webkit-mask-image: none;
    mask-image: none;
    z-index: 55;
  }
  .nav-open .nav-links a {
    padding: 11px 12px;
    font-size: 15px;
    border-radius: var(--radius-sm);
  }
  .nav-open .nav-links a:hover { background: var(--bg-white-5); }
  .nav-burger[aria-expanded="true"] {
    color: var(--text-primary);
    background: var(--bg-white-5);
  }
}
