/* ============================================
   I2S Orchestra — Chrome (Header & Footer)
   Clean alignment, premium sizing, mobile-first
   ============================================ */

/* ----------------------------
   Visibility helpers
---------------------------- */
.desktop-only { display: none !important; }
.mobile-only  { display: inline-flex !important; }
@media (min-width:1024px){
  .desktop-only { display: flex !important; }
  .mobile-only  { display: none !important; }
}

/* ----------------------------
   Header shell (glass + overlay)
---------------------------- */
.i2s-header{
  position: sticky; top: 0;
  z-index: 1000;                             /* keep reliably above content */
  backdrop-filter: var(--blur);
  background: color-mix(in oklab, var(--glass-1) 85%, transparent);
  border-bottom: 1px solid var(--hairline);
  transition:
    background var(--fast) var(--ease),
    border-color var(--fast) var(--ease),
    box-shadow var(--fast) var(--ease);
  will-change: transform;                    /* iOS/WebKit nudge for sticky */
}
.i2s-header.is-overlay{
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}
.i2s-header.is-overlay.is-scrolled{
  background: color-mix(in oklab, var(--glass-1) 92%, transparent);
  border-bottom: 1px solid var(--hairline);
  box-shadow: var(--elev-1);
}

/* ----------------------------
   Header bar (safe centered width)
---------------------------- */
.i2s-header__bar{
  height: var(--bar-h-mobile);
  width: min(100% - 2rem, var(--wrap-wide));
  margin-inline: auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--space-2);
  padding-inline: 1rem;
  will-change: transform;
}
@media (min-width:1024px){
  .i2s-header__bar{ height: var(--bar-h-desktop); padding-inline: 1.25rem; }
}

/* ----------------------------
   Brand
---------------------------- */
.i2s-logo{
  display: inline-flex; align-items: center; gap: .6rem;
  color: var(--text); text-decoration: none; font-weight: 800;
}
.i2s-logo__capsule{
  padding: .28rem .62rem; border-radius: 10px; color: #fff;
  background: linear-gradient(135deg, var(--accent-2), var(--accent));
  box-shadow: var(--elev-1);
  font-size: .95rem; font-weight: 700;
}
.i2s-logo__text{ font-size: 1rem; opacity: .95; }

/* ----------------------------
   Desktop nav (right aligned)
   Order in PHP: links -> toggle -> login -> CTA
---------------------------- */
.i2s-nav{
  display: none;
  align-items: center;
  gap: .5rem;
  margin-left: auto;                         /* push nav to the right */
}
@media (min-width:1024px){ .i2s-nav{ display:flex } }

.i2s-nav a{
  padding: .5rem .6rem;
  border-radius: 10px;
  color: var(--text);
  text-decoration: none;
  opacity: .9;
  transition: background var(--fast) var(--ease), opacity var(--fast) var(--ease);
}
.i2s-nav a:hover{ opacity: 1; background: var(--surface-2); }

/* Small CTA in header */
.i2s-nav .btn{ line-height: 1; }
.i2s-nav .btn.btn--primary.btn--sm{
  --btn-h: 34px;
  height: var(--btn-h);
  padding-inline: 12px;
  font-size: 13.5px; font-weight: 700;
  border-radius: 9px;

  /* CTA idle/hover colors */
  color: #fff;
  background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 82%, #000));
  border: 1px solid transparent;
}
.i2s-nav .btn.btn--primary.btn--sm:hover,
.i2s-nav .btn.btn--primary.btn--sm:focus{
  color: #000;                                /* invert on hover */
  background: #fff;
  border-color: var(--hairline);
  box-shadow: var(--elev-1);
}

/* ----------------------------
   Toggle — consistent size
---------------------------- */
.i2s-toggle{
  --trk: 32px; --th: 16px;
  width: var(--trk); height: 20px;
  padding: 0; border-radius: 999px;
  border: 1px solid var(--hairline);
  background: var(--surface-2);
  position: relative; cursor: pointer;
  flex: 0 0 auto;
}
.i2s-toggle::after{
  content:""; position:absolute; top:50%; left:2px; translate:0 -50%;
  width: var(--th); height: var(--th); border-radius:50%;
  background: var(--surface); box-shadow: var(--elev-1);
  transition: left var(--fast) var(--ease), background var(--fast) var(--ease);
}
html[data-theme="dark"] .i2s-toggle::after{ left: calc(var(--trk) - var(--th) - 2px); }

/* ----------------------------
   Mobile actions (right aligned)
---------------------------- */
.i2s-head-actions{
  margin-left: auto;
  display: flex; align-items: center; gap: .45rem;
}
@media (min-width:1024px){ .i2s-head-actions{ display:none } }

.i2s-burger{
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid var(--hairline); border-radius: 8px;
  background: var(--surface); color: var(--text);
  cursor: pointer;
}

/* ----------------------------
   Drawer (mobile)
---------------------------- */
.i2s-drawer{
  position: fixed; inset: 0 0 0 auto; width: min(88vw, 360px);
  transform: translateX(100%); visibility: hidden; pointer-events: none;
  transition: transform var(--med) var(--ease), visibility 0s linear .2s;
  background: var(--surface); color: var(--text);
  border-left: 1px solid var(--hairline); box-shadow: var(--elev-2);
  z-index: 120; display: flex; flex-direction: column;
}
.i2s-drawer.is-open{
  transform: translateX(0);
  visibility: visible; pointer-events: auto;
  transition: transform var(--med) var(--ease), visibility 0s;
}
.i2s-drawer__head{
  display:flex; align-items:center; justify-content:space-between;
  padding: 1rem; border-bottom: 1px solid var(--hairline);
}
.i2s-drawer__close{
  width:40px; height:40px;
  display:inline-flex; align-items:center; justify-content:center;
  border: 1px solid var(--hairline); border-radius: 8px;
  background: var(--surface); color: var(--text);
}
.i2s-drawer__nav{ display:grid; gap:.25rem; padding:.75rem .75rem 1rem; margin:0; }
.i2s-drawer__nav a{
  padding:.9rem 1rem; border-radius:10px; text-decoration:none; color: var(--text);
}
.i2s-drawer__nav a:hover{ background: var(--surface-2); }
.i2s-drawer__footer{
  margin-top:auto; padding:1rem; border-top:1px solid var(--hairline);
  display:flex; gap:.6rem; align-items:center;
}

/* Scrim behind drawer */
.i2s-scrim{
  position: fixed; inset: 0;
  background: rgba(0,0,0,.38);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity var(--med, .25s) var(--ease, cubic-bezier(.22,.61,.36,1));
  z-index: 119;                               /* under drawer (120) */
}
.i2s-scrim.is-open{ opacity: 1; visibility: visible; pointer-events: auto; }

/* Prevent background scroll when drawer open (single, canonical class) */
html.is-locked, html.is-locked body{ overflow: hidden; touch-action: none; }

/* Drawer CTA color (force white label in light) */
.i2s-drawer__nav .btn.btn--primary.btn--sm{
  color: #fff !important;
  background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 82%, #000));
  border: none;
}
.i2s-drawer__nav .btn.btn--primary.btn--sm:hover{
  filter: brightness(1.05);
  transform: translateY(-1px);
  transition: transform .12s var(--ease), filter .12s var(--ease);
}

/* ====================
   Footer (multi-column)
==================== */
.i2s-footer{
  background: color-mix(in oklab, var(--glass-1) 92%, transparent);
  border-top: 1px solid var(--hairline);
  margin-top: var(--space-8);
  color: var(--text);
}
.i2s-footer__inner{
  width: min(100% - 2rem, var(--wrap-wide));
  margin-inline: auto;
  padding-block: clamp(28px, 6vw, 56px);
  display: grid;
  gap: clamp(22px, 4vw, 32px);
  grid-template-columns: 1.6fr 1fr 1fr 1fr;
}
@media (max-width: 1023px){
  .i2s-footer__inner{ grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px){
  .i2s-footer__inner{
    grid-template-columns: 1fr;
    place-items: center;              /* center children on phones */
    text-align: center;
  }
  .i2s-footer__brand,
  .i2s-footer__col{
    width: 100%;
    display: grid;
    justify-items: center;
  }
}

/* Brand & tagline */
.i2s-footer__brand{ display: grid; align-content: start; gap: .5rem; }
.i2s-footer__brand .i2s-logo{ margin-bottom: .5rem; }
.i2s-footer__tagline{ color: var(--muted); margin: .25rem 0 1rem; max-width: 46ch; }

/* Link columns */
.i2s-footer__col{ display: grid; gap: .25rem; align-content: start; }
.i2s-footer__col strong{
  display: block; margin-bottom: .35rem; font-weight: 700; color: var(--text);
}
.i2s-footer__col a{
  display: inline-block;
  padding: .32rem 0;
  color: var(--text);
  text-decoration: none;
  opacity: .9;
}
.i2s-footer__col a:hover{ opacity: 1; text-decoration: underline; color: var(--accent); }

/* Bottom row */
.i2s-footer__bottom{
  grid-column: 1 / -1;
  display: flex; flex-wrap: wrap;
  align-items: center; justify-content: space-between;
  gap: .75rem;
  padding-top: 18px;
  margin-top: 6px;
  border-top: 1px solid var(--hairline);
  color: var(--muted);
}
.i2s-footer__bottom a{ color: inherit; text-decoration: none; }
.i2s-footer__bottom a:hover{ text-decoration: underline; color: var(--text); }

/* =========================
   Footer — Opt-in (Unified)
   - Replaces pill grid with input + button layout
   - Mobile: stack with equal widths
========================= */
.i2s-footer__form{
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: .5rem;

  width: min(480px, 100%);
  margin: .5rem 0;

  background: transparent;
  border: none;
  box-shadow: none;
  height: auto;
  border-radius: 0;
  overflow: visible;
}
.i2s-footer__input{
  flex: 1 1 auto;
  height: 48px;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  padding: 0 14px;
  font: 500 15px/1 var(--font);
  box-shadow: none;
}
.i2s-footer__input:focus{
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 45%, var(--hairline));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
.i2s-footer__submit{
  display: inline-flex;
  align-items: center;
  justify-content: center;

  height: 48px;
  padding: 0 18px;
  min-width: 120px;

  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent-2, #fa643e), var(--accent, #164459));
  color: #fff;
  font: 700 15px/1 var(--font, "Inter", system-ui, sans-serif);
  white-space: nowrap;
  cursor: pointer;
  box-shadow: var(--elev-1);
  transition: transform .12s var(--ease), filter .12s var(--ease);
}
.i2s-footer__submit:hover{
  transform: translateY(-1px);
  filter: brightness(1.05);
}
.i2s-footer__micro{
  color: var(--muted);
  margin-top: .75rem;
  font-size: 13.5px;
  text-align: left;
}

/* Mobile stacking: input + button full width */
@media (max-width: 640px){
  .i2s-footer__form{
    flex-direction: column;
    align-items: stretch;
    gap: .4rem;
    width: min(480px, 100%);
    margin: .5rem auto;
  }
  .i2s-footer__input,
  .i2s-footer__submit{
    width: 100%;
    box-sizing: border-box;
    border-radius: 10px;
    height: 48px;
  }
  .i2s-footer__input{ text-align: center; }
  .i2s-footer__input::placeholder{ text-align: center; }
  .i2s-footer__submit{ margin-top: .4rem; padding: 0 14px; }
}

/* === Toggle contrast + state, independent of theme === */
.i2s-toggle{
  --trk: 32px; --th: 16px;
  width: var(--trk); height: 20px; position: relative;
  border-radius: 999px; border:1px solid var(--hairline);
  background: var(--surface-2); cursor: pointer; padding:0; flex:0 0 auto;
  outline: none;
}

/* Track colors per theme (ensure contrast) */
html[data-theme="dark"]  .i2s-toggle{ background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.22); }
html[data-theme="light"] .i2s-toggle{ background: rgba(255, 147, 219, 0.05);      border-color: rgba(142, 142, 142, 0.12); }

/* Thumb */
.i2s-toggle::after{
  content:""; position:absolute; top:50%; left:2px; translate:0 -50%;
  width:var(--th); height:var(--th); border-radius:50%;
  background:#fff; box-shadow: 0 1px 2px rgba(0,0,0,.25);
  transition: left .18s cubic-bezier(.4,0,.2,1), background .18s;
}
html[data-theme="light"] .i2s-toggle::after{ background:rgb(255, 255, 255); } /* dark thumb on light */

/* State control — works with either [aria-pressed="true"] or a .is-on class */
.i2s-toggle[aria-pressed="true"]::after,
.i2s-toggle.is-on::after{
  left: calc(var(--trk) - var(--th) - 2px);
}

/* Focus ring so it’s always visible */
.i2s-toggle:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; }