/* ==========================================================================
   DBELLERIVE — CHROME ONLY (device theme only)
   Header (navbar) + mobile drawer + footerbar
   Uses prefers-color-scheme (no JS toggle / no body class)

   This file is intentionally “chrome-scoped”:
   - It styles the header/footer/drawer UI shell.
   - It references the semantic tokens from styles.css:
       --bg, --surface, --surface-2, --text, --muted, --border
     and brand staples:
       --brand-red-600
   ========================================================================== */

/* --------------------------------------------------------------------------
   Tokens (namespaced so they won’t fight your main site CSS)
   -------------------------------------------------------------------------- */
:root{
  /* Pull from main semantic tokens */
  --chrome-panel: var(--surface);
  --chrome-panel2: var(--surface-2);
  --chrome-border: var(--border);

  --chrome-text: var(--text);
  --chrome-muted: var(--muted);

  --chrome-accent: var(--brand-red-600);

  --chrome-wrap: var(--container);

  --chrome-ease: cubic-bezier(.2,.8,.2,1);
  --chrome-fast: .18s;
  --chrome-med: .32s;
}

/* Focus ring (safe global) */
a:focus-visible,
button:focus-visible{
  outline: 3px solid rgba(225,29,72,.75);
  outline-offset: 3px;
  border-radius: 8px;
}

/* Extra hardening against global underline rules */
.body-section header.top a,
.body-section .footerbar a,
.body-section .drawer a{
  text-decoration: none !important;
}

/* Prevent sideways overflow glitches */
html, body{ overflow-x: hidden; }

/* ==========================================================================
   HEADER / NAV (sticky top bar)
   ========================================================================== */

header.top{
  position: sticky;
  top: 0;
  z-index: 1000;

  /* Default (dark). Light mode override below. */
  background: #0F172AEB;
  border-bottom: 1px solid rgba(255,255,255,.10);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);

  padding: 0 !important;
  text-align: left !important;
  overflow: visible !important;
}

.top__inner{
  width: min(var(--chrome-wrap), 100% - 2rem);
  margin: 0 auto;
  padding: .85rem 0;

  display: flex;
  align-items: center;
  gap: 1rem;

  min-width: 0;
  flex-wrap: nowrap;
}

/* Brand: force “real” image display */
header.top .brand,
.drawer .brand{
  display: inline-flex;
  align-items: center;
  min-width: 0;
}
header.top .brand picture,
header.top .brand img,
.drawer .brand picture,
.drawer .brand img{
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  height: auto !important;
  max-width: 100% !important;
}

/* Desktop nav */
header.top .nav{
  display: flex;
  gap: .9rem;

  margin-left: auto;
  margin-right: .25rem;
}
header.top .nav a{
  font-weight: 800;
  color: rgba(255,255,255,.84);
  padding: .45rem .6rem;
  border-radius: 999px;

  text-decoration: none !important;
  border-bottom: 0 !important;
}
header.top .nav a:hover{
  background: rgba(255,255,255,.08);
  color: #fff;
}

/* Right-side actions */
header.top .top__actions{
  display: flex;
  align-items: center;
  gap: .6rem;

  flex: 0 0 auto;
  margin-left: 0;
}

/* Buttons used in header + drawer */
.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;

  padding: .65rem .95rem;
  border-radius: 999px;

  border: 1px solid rgba(255,255,255,.16);
  background: transparent;

  color: rgba(255,255,255,.92);
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;

  text-decoration: none !important;
  transition: transform var(--chrome-fast) var(--chrome-ease),
              background var(--chrome-fast) var(--chrome-ease);
}
.btn:hover{
  background: rgba(255,255,255,.08);
}

.btn--primary{
  background: var(--chrome-accent);
  border-color: rgba(255,255,255,.10);
  color: #FFFF !important;
  font-weight: 500;
}

.btn--primary:hover{ background: var(--brand-red-700, #960000); }

.btn--ghost{ background: transparent; }

/* Hamburger / icon buttons */
.iconBtn{
  appearance: none;
  border: 1px solid rgba(255,255,255,.16);
  background: transparent;
  color: rgba(255,255,255,.92);

  border-radius: 999px;
  padding: .55rem .7rem;

  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .25rem;

  transition: transform var(--chrome-fast) var(--chrome-ease),
              background var(--chrome-fast) var(--chrome-ease);
}
.iconBtn:hover{
  background: rgba(255,255,255,.08);
  transform: translateY(-1px);
}
.iconBtn__bar{
  width: 18px;
  height: 2px;
  background: rgba(255,255,255,.92);
  display: block;
  border-radius: 2px;
}
.iconBtn--close{
  font-weight: 950;
  width: 40px;
  height: 40px;
}

/* Responsive: hide desktop nav on mobile, show hamburger */
@media (max-width: 980px){
  header.top .nav{ display: none; }
  #menuBtn{ display: inline-flex; }

  header.top .top__actions{ margin-left: auto; }
}
@media (min-width: 981px){
  #menuBtn{ display: none; }
}

/* Optional: hide big CTA on very small screens */
@media (max-width: 520px){
  header.top .top__actions .btn--primary{ display: none; }
}
/* ==========================================================================
   MOBILE DRAWER + SCRIM (polished)
   ========================================================================== */

/* Mobile header: hide big CTA whenever hamburger layout is active */
@media (max-width: 980px){
  header.top .nav{ display: none; }

  header.top .top__actions{ margin-left: auto; }

  header.top .top__actions .btn--primary{
    display: none !important;
  }

  #menuBtn{ display: inline-flex; }
}

/* Keep icon sizing consistent */
.iconBtn{
  width: 3rem;
  height: 3rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.iconBtn svg{
  width: 22px;     /* <- your preferred size */
  height: 22px;
  display: block;
}

/* -------------------------
   Scrim (fade, not pop)
   ------------------------- */
.scrim{
  position: fixed;
  inset: 0;
  z-index: 2000;

  background: rgba(0,0,0,.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);

  opacity: 0;
  pointer-events: none;
  transition: opacity .26s var(--chrome-ease);
}

.scrim{
  pointer-events: auto;
}
.scrim[hidden]{
  display: none !important;
  pointer-events: none;
}

/* If you can: instead of hidden, toggle .is-open on scrim too */
.scrim.is-open{
  opacity: 1;
  pointer-events: auto;
}

/* -------------------------
   Drawer shell
   ------------------------- */
.drawer{
  position: fixed !important;
  top: 0;
  right: 0;
  bottom: 0;
  left: auto;

  width: min(360px, 88vw);
  height: 100vh;
  height: 100dvh;

  z-index: 2100;
  background: var(--chrome-panel2);
  padding: 1rem;

  display: grid;
  grid-template-rows: auto 1fr auto; /* top | nav space | cta pinned */
  gap: 1rem;

  /* Slide timing: slower + smoother */
  transform: translate3d(105%,0,0);
  -webkit-transform: translate3d(105%,0,0);
  transition: transform .42s var(--chrome-ease);

  overflow: auto;
  -webkit-overflow-scrolling: touch;

  pointer-events: none;
  will-change: transform;
}

.drawer.is-open{
  transform: translate3d(0,0,0);
  -webkit-transform: translate3d(0,0,0);
  pointer-events: auto;

  box-shadow: -30px 0 80px rgba(0,0,0,.60);
  border-left: 1px solid rgba(255,255,255,.12);
}

/* Top row */
.drawer__top{
  display: flex;
  align-items: right;
  justify-content: space-between;
  gap: .75rem;
}

/* NAV (don’t “fill” the 1fr row) */
.drawer__nav{
  align-self: start;
  align-content: start;  /* important: prevents grid distributing height */
  display: grid;
  gap: .7rem;
  padding-top: .25rem;
}

/* Menu links: large text, not “buttons” */
.drawer__nav a{
  display: block;

  font-size: clamp(1.35rem, 3.4vw, 1.8rem);
  font-weight: 500;
  line-height: 1.25;
  text-align: center;
  color: var(--chrome-text);
  text-decoration: none;

  padding: 1rem 0;
  margin: 0;
  border-bottom: 1px solid rgba(255,255,255,.08);
  padding-bottom: .45rem;
  

  /* Base interaction */
  transition:
    opacity .22s var(--chrome-ease),
    transform .22s var(--chrome-ease);
}

.drawer__nav a:hover{
  opacity: .7;
  transform: translate3d(10px,0,0);
}

/* CTA pinned bottom */
.drawer__cta{
  align-self: end;
  display: grid;
  gap: .65rem;
}

.drawer__cta .btn{
  width: 100%;
  max-width: 100%;
  padding: .9rem 1rem;
}

/* Ensure drawer content uses chrome tokens */
.drawer,
.drawer *{
  color: var(--chrome-text);
}

/* ==========================================================================
   OPEN ANIMATIONS (nav only — CTA visible immediately)
   Polished: delayed start, softer motion, better ease, tighter stagger
   ========================================================================== */

/* A slightly “softer” ease just for the reveal (keep your chrome-ease for drawer) */
:root{
  --drawer-reveal-ease: cubic-bezier(.16, 1, .3, 1); /* smooth + gentle settle */
}

/* Closed state */
.drawer__nav a{
  opacity: 0;
  transform: translate3d(0, 8px, 0); /* subtle vertical float looks more premium */
  transition:
    opacity .55s var(--drawer-reveal-ease),
    transform .55s var(--drawer-reveal-ease);
  will-change: transform, opacity;
}

/* Open state */
.drawer.is-open .drawer__nav a{
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

/* Stagger (start later so drawer is mostly in first) */
.drawer.is-open .drawer__nav a:nth-child(1){ transition-delay: 260ms; }
.drawer.is-open .drawer__nav a:nth-child(2){ transition-delay: 320ms; }
.drawer.is-open .drawer__nav a:nth-child(3){ transition-delay: 380ms; }
.drawer.is-open .drawer__nav a:nth-child(4){ transition-delay: 440ms; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce){
  .drawer, .scrim{ transition: none !important; }
  .drawer__nav a{
    transition: none !important;
    transform: none !important;
    opacity: 1 !important;
  }
}
/* ==========================================================================
   FOOTERBAR
   Desktop: left stacked (logo + meta), right: nav + social side-by-side
   Mobile: social only centered
   ========================================================================== */

.footerbar{
  background: var(--chrome-panel);
  border-top: 1px solid rgba(255,255,255,.10);
  color: var(--chrome-text);
  position: relative;
  z-index: 10;
}

.footerbar__inner{
  width: min(var(--chrome-wrap), 100% - 2rem);
  margin: 0 auto;
  padding: 1rem 0;

  display: grid !important;
  grid-template-columns: 1fr auto auto !important; /* brand | nav | social */
  align-items: center !important;
  gap: 30px !important;

  min-width: 0;
}

/* Left block stacked */
.footerbar__brand{
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  gap: 12px !important;

  color: var(--chrome-text);
  text-decoration: none !important;
  border-bottom: 0 !important;
}

.footerbar__brand picture,
.footerbar__brand img{
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
  height: auto !important;
  max-width: 220px !important;
}

.footerbar__meta{
  font-size: .9rem;
  color: var(--chrome-muted);
  white-space: normal !important;
  line-height: 1.3 !important;
  overflow-wrap: anywhere;
}

/* Nav + social */
.footerbar__nav{
  display: inline-flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 14px !important;
}
.footerbar__nav a{
  color: var(--chrome-text);
  text-decoration: none !important;
  border-bottom: 1px solid transparent;
}
.footerbar__nav a:hover,
.footerbar__nav a:focus-visible{
  border-bottom-color: rgba(255,255,255,.85);
  outline: none;
}

.footerbar__social{
  display: inline-flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  gap: 14px !important;

  list-style: none;
  margin: 0 !important;
  padding: 0 !important;
  flex-wrap: wrap;
}
.footerbar__social a{
  display: inline-flex;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;

  color: var(--chrome-text);
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,.12);
  background: var(--chrome-panel2);

  text-decoration: none !important;
  transition: opacity var(--chrome-med) var(--chrome-ease);
}
.footerbar__social a:hover,
.footerbar__social a:focus-visible{
  opacity: .7;
  outline: none;
}
.footerbar__social svg{
  width: 22px;
  height: 22px;
  fill: currentColor;
}

/* Kill inherited underlines in footer */
.footerbar a,
.footerbar a:visited,
.footerbar a:hover,
.footerbar a:active{
  text-decoration: none !important;
}

/* Mobile: ONLY social icons centered */
@media (max-width: 850px){
  .footerbar__inner{
    grid-template-columns: 1fr !important;
    justify-items: center !important;
    text-align: center !important;
  }

  .footerbar__brand{ display: none !important; }
  .footerbar__nav{ display: none !important; }

  .footerbar__social{
    justify-content: center !important;
  }
}

/* ==========================================================================
   LIGHT MODE (device preference only)
   ========================================================================== */

@media (prefers-color-scheme: light){
  /* Use your staple “light chrome” shade with alpha */
  header.top{
    background: #e5e7ebb6;
    border-bottom-color: rgba(0,0,0,.10) !important;
  }

  /* Swap nav text treatment for light */
  header.top .nav a{ color: rgba(0,0,0,.78); }
  header.top .nav a:hover{
    background: rgba(0,0,0,.06);
    color: rgba(0,0,0,.92);
  }

  /* Buttons */
  .btn,
  .iconBtn{
    border-color: rgba(0,0,0,.12);
    color: rgba(0,0,0,.90);
  }
  .iconBtn__bar{ background: rgba(0,0,0,.90); }

  /* Light scrim */
  .scrim{ background: rgba(0,0,0,.25); }

  /* Drawer border/shadow in light mode */
  .drawer.is-open{
    border-left-color: rgba(0,0,0,.12);
    box-shadow: -30px 0 80px rgba(0,0,0,.18);
  }
  .drawer__nav a{ border-color: rgba(0,0,0,.12); }

  /* Footer borders/hover */
  .footerbar{ border-top-color: rgba(0,0,0,.10); }

  .footerbar__nav a:hover,
  .footerbar__nav a:focus-visible{
    border-bottom-color: rgba(0,0,0,.75);
  }

  .footerbar__social a{ border-color: rgba(0,0,0,.12); }

  /* IMPORTANT:
     Footer background is var(--chrome-panel) which comes from --surface.
     Your semantic tokens already set --surface to #fff in light mode.
     So we don’t hardcode footer background here.
  */
}

/* ==========================================================================
   Reduced motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce){
  .btn,
  .iconBtn,
  .drawer{
    transition: none !important;
  }
}