/* ============================================================================
   SANDIX+  |  Design Tokens  (sandix-theme.css)
   ----------------------------------------------------------------------------
   The whole visual system is now built from exactly THREE brand colors:

     --sandix-red    #c53920   the ember red used on the "+" of the SANDIX+
                                logo. The only accent color in the system.
     --sandix-white  #e5e7eb   the off-white already used in the SANDIX
                                logo wordmark. Reference color for text and
                                important UI elements. Pure #ffffff is used
                                only where extra emphasis is needed.
     --sandix-black  #000000   the black already used everywhere in the
                                interface. Base of every background, on
                                every page except profiles.html.

   Every other token in this file is only an ALPHA or LIGHTNESS step of one
   of those three colors — no other hue is introduced anywhere. Surfaces,
   borders, hovers, overlays and shadows are all neutral (black/white)
   steps; the red is reserved for the brand mark, primary actions and
   "hot" indicators (Top 10, live badges, alerts).

   HOW TO USE THIS FILE
     Link it once, near the top of <head>, before page-specific <style>
     blocks so the tokens are available and any later rule can still
     override a specific spot on purpose:
       <link rel="stylesheet" href="sandix-theme.css">

     Prefer the tokens over hard-coded hex/rgb everywhere new work
     happens. Legacy variable names (--sandix-cyan, --sandix-gold) are
     kept as aliases pointing at white so any older markup that still
     reads them keeps working, unchanged, with the new palette.
   ============================================================================ */

:root {
  /* ── Backgrounds (pure neutral black family) ───────────────────────── */
  --sandix-bg:          #000000;                  /* required anchor: page background */
  --sandix-bg-raised:   #0a0a0a;                   /* headers, footers, sunken panels */
  --sandix-surface:     #111111;                   /* cards, panels, modals */
  --sandix-surface-2:   #1a1a1a;                   /* hovered / active surfaces */
  --sandix-surface-3:   #232323;                   /* menus, popovers, chips */

  /* ── Text (off-white brand family) ──────────────────────────────────── */
  --sandix-text:        #e5e7eb;                   /* required anchor: primary text — matches the SANDIX wordmark */
  --sandix-text-strong: #ffffff;                   /* headings / high emphasis / important text */
  --sandix-text-dim:    rgba(229, 231, 235, .68);  /* secondary text */
  --sandix-text-faint:  rgba(229, 231, 235, .46);  /* tertiary text, meta, placeholders */

  /* Alpha variants of the text color, for borders/overlays that need
     to sit on top of photos and video, not just flat surfaces. */
  --sandix-text-a10:  rgba(229, 231, 235, .10);
  --sandix-text-a14:  rgba(229, 231, 235, .14);
  --sandix-text-a20:  rgba(229, 231, 235, .20);
  --sandix-text-a35:  rgba(229, 231, 235, .35);

  /* ── Borders / separators ───────────────────────────────────────────── */
  --sandix-border:        var(--sandix-text-a10);
  --sandix-border-strong: var(--sandix-text-a20);

  /* ── Accent (single brand red — the only hue in the system) ──────────── */
  --sandix-red:        #c53920;
  --sandix-red-hover:  #d94a30;
  --sandix-red-dark:   #8f2717;
  --sandix-red-soft:   rgba(197, 57, 32, .16);

  /* Old variable names kept as aliases so any component or page still
     reading --sandix-gold / --sandix-cyan (focus rings, gradients, etc.)
     automatically gets neutral white instead — zero markup changes
     needed, zero extra hues introduced. */
  --sandix-gold: var(--sandix-text-strong);
  --sandix-cyan: var(--sandix-text-strong);

  /* ── Overlays / gradients / shadows ─────────────────────────────────── */
  --sandix-overlay:        rgba(0, 0, 0, .82);
  --sandix-scrim-top:      linear-gradient(to bottom, rgba(0,0,0,.9), transparent);
  --sandix-scrim-bottom:   linear-gradient(to top, rgba(0,0,0,.95), transparent);
  --sandix-shadow:         0 20px 60px rgba(0, 0, 0, .65);
  --sandix-radius:         12px;
}

/* Brand gradient, unchanged class name: deep red sweeping into a muted
   gold. */
.sandix-accent {
  background: linear-gradient(
    90deg,
    var(--sandix-red-dark),
    #d5a000b5
  );
}

/* ── Global horizontal-overflow guard ──────────────────────────────────
   No section of the platform should ever be able to make the page
   itself wider than the viewport (a stray fixed-width element, a long
   unbroken string, a negative margin, etc.) - that's what let the
   mobile bottom nav's last item get pushed off-screen. This is loaded
   first, before any page-specific <style>, so it's a safe baseline
   every page inherits without having to repeat it. */
html, body { max-width: 100%; overflow-x: hidden; }

/* ── Card hover: light scale + thin outline (Netflix-style) ───────────
   The scale/lift itself is defined per-page (each page's own
   .sandixplus-card:hover rule) since it also needs a z-index bump
   there; this file only adds the thin white outline asked for, drawn
   as an inset box-shadow so it's never distorted by the scale
   transform and never needs the card to change its overflow mode. */
.sandixplus-card:hover {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .95);
}

/* ── Expanded hover preview popup ("détail vidéo") ─────────────────────
   Built by SandixCardPreview.attach() - see sandix-card-preview.js.
   Hovering a poster for HOVER_OPEN_DELAY pops this up, floating above
   everything (appended to <body>, not the card, so it's never clipped
   by a row's overflow:hidden/auto): trailer autoplays muted+looped at
   the top, quick actions below it, then age/duration/quality, then
   genres - matching the real Netflix preview card. A brief pass over
   a poster on its own does NOT trigger this - only the dwell delay
   does, so simple browsing never has trailers popping up everywhere.
*/
.sandix-hover-popup {
  position: absolute;
  z-index: 200;
  background: #141414;
  border-radius: .5rem;
  overflow: hidden;
  box-shadow: 0 12px 32px rgba(0,0,0,.65), 0 0 0 1px rgba(255,255,255,.08);
  opacity: 0;
  transform: scale(.94);
  transform-origin: center center;
  pointer-events: none;
  transition: opacity .16s ease, transform .16s ease;
}
.sandix-hover-popup.is-open {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}
.shp-media {
  position: relative;
  width: 100%;
  aspect-ratio: 290.5 / 163.56;
  background: #000;
  overflow: hidden;
  cursor: pointer; /* clicking the poster or the trailer plays it, same as the Play button */
}
.shp-media:hover .shp-poster,
.shp-media:hover .shp-video { filter: brightness(1.06); }
.shp-media .shp-poster,
.shp-media .shp-video {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.shp-media .shp-video { opacity: 0; transition: opacity .35s ease; }
.shp-media .shp-video.playing { opacity: 1; }

.shp-body { padding: .7rem .85rem .8rem; }

.shp-actions { display: flex; align-items: center; gap: .45rem; margin-bottom: .55rem; }
.shp-btn {
  width: 30px; height: 30px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.1);
  border: 1.5px solid rgba(255,255,255,.55);
  color: #fff;
  cursor: pointer;
  flex: 0 0 auto;
  padding: 0;
  transition: background .15s ease, transform .15s ease, border-color .15s ease;
}
.shp-btn svg { width: 15px; height: 15px; }
.shp-btn:hover { background: rgba(255,255,255,.25); transform: scale(1.08); }
.shp-btn.is-play { background: #fff; color: #000; border-color: #fff; }
.shp-btn.is-play:hover { background: rgba(255,255,255,.85); }
.shp-btn.is-active { background: var(--sandix-red); border-color: var(--sandix-red); }
.shp-spacer { flex: 1 1 auto; }

.shp-title {
  font-size: .95rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: .35rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.shp-meta {
  display: flex; align-items: center; gap: .5rem;
  font-size: .72rem;
  color: rgba(255,255,255,.85);
  margin-bottom: .4rem;
}
.shp-age {
  border: 1px solid rgba(255,255,255,.5);
  padding: 0 .3rem;
  border-radius: 2px;
  font-weight: 600;
}
.shp-hd {
  border: 1px solid rgba(255,255,255,.35);
  padding: 0 .3rem;
  border-radius: 2px;
  font-size: .62rem;
  color: rgba(255,255,255,.7);
}
.shp-genres { font-size: .72rem; color: rgba(255,255,255,.8); }
.shp-genre-dot { margin: 0 .3rem; color: rgba(255,255,255,.4); }

/* Touch devices have no real "hover": tapping already opens full
   details via the card's own onclick, so the preview popup - which
   needs a pointer dwelling over the card - never applies there. */
@media (hover: none) {
  .sandix-hover-popup { display: none !important; }
}

/* ══════════════════════════════════════════════════════════════════════
   MOBILE BOTTOM NAVIGATION  (shared component)
   ----------------------------------------------------------------------
   On phones/small tablets the desktop hamburger + left-side drawer is
   replaced by a fixed bottom bar (Home / Search / ZapMatch / Watch
   Later / More), the standard mobile pattern for a streaming app.
   Markup: <nav class="sandix-bottom-nav"><a/button class="sbn-item" ...>
   Add class "is-active" to the item matching the current page.
   ══════════════════════════════════════════════════════════════════════ */
.sandix-bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 500;
  display: none;
  align-items: stretch;
  justify-content: space-around;
  background: rgba(8, 8, 8, .97);
  backdrop-filter: blur(16px) saturate(1.1);
  border-top: 1px solid var(--sandix-border, rgba(229,231,235,.1));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  /* Belt-and-braces against the row ever spilling past the right edge
     (the reported bug: the last item - "More" - was getting clipped
     off-screen on some phones). Even if something upstream nudges the
     document a hair wider than the viewport, the bar itself can never
     exceed it. */
  width: 100%;
  max-width: 100vw;
  box-sizing: border-box;
  overflow: hidden;
}
.sbn-item {
  flex: 1 1 0;
  /* Flex items default to min-width:auto, i.e. "never shrink below my
     own content's width" - with 5 items that's exactly what silently
     pushed the last one (More) past the screen edge on narrow phones.
     min-width:0 lets every item actually honor flex:1 and shrink
     evenly, so all 5 always fit. */
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 8px 2px calc(6px + env(safe-area-inset-bottom, 0px) * 0);
  color: var(--sandix-text-dim, rgba(229,231,235,.6));
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .01em;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color .15s ease;
}
.sbn-item svg { width: 21px; height: 21px; flex: 0 0 auto; }
.sbn-item span {
  /* Guarantees the label itself can never force the item wider than
     its share of the bar - it truncates instead of overflowing. */
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sbn-item.is-active { color: var(--sandix-text-strong, #fff); }
.sbn-item.is-active svg { color: var(--sandix-red, #c53920); stroke: var(--sandix-red, #c53920); }

@media (max-width: 768px) {
  .sandix-bottom-nav { display: flex; }
  #hamburgerToggle { display: none !important; }
  /* Reserve enough room at the bottom of the page for the bar itself
     PLUS the phone's own safe-area inset (home indicator etc.), so
     the last row of content (e.g. a category's cards) never ends up
     hidden/overlapped behind it - the other half of the reported bug. */
  body { padding-bottom: calc(64px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 360px) {
  /* Extra-narrow phones: shave a little more room off each item so
     5 icons + labels are never tight against the edges. */
  .sbn-item { font-size: 9px; padding-left: 0; padding-right: 0; }
  .sbn-item svg { width: 19px; height: 19px; }
}

/* ── Horizontal carousel arrows ────────────────────────────────────────
   Requirement: keep them only on the Top 10 row (desktop), never show
   them on mobile, and never add them to any other row (rows scroll by
   touch/trackpad swipe instead - no arrow button needed there). */
.sandix-carousel-arrow { }
@media (max-width: 768px) {
  .sandix-carousel-arrow { display: none !important; }
}
@media (hover: none) {
  .sandix-carousel-arrow { display: none !important; }
}
