/* ==========================================================================
   EDUBOOK V3 — SITE-WIDE CHROME (header + footer only)
   ==========================================================================

   This is a SCOPED subset of landing-v3/styles.css.

   Why a separate file at all: styles.css opens with unscoped global resets
   (`*`, `html`, `body`, `img`, `h1`-`h4`, `p`, `a`, `button`, `ul`) and a
   `:root` token block. Loading it site-wide would repaint all 99 Flatsome
   pages — that is exactly the blocker that kept the rollout out of the
   original deploy.

   The rules here are byte-equivalent in intent to their styles.css
   counterparts, with two deliberate changes:

     1. Every selector is scoped under `.ebv3-chrome`, which sits on the
        <header> and <footer> elements themselves. Nothing can reach page
        content.

     2. Design tokens are declared on `.ebv3-chrome` rather than `:root`, so
        they cannot collide with Flatsome's or a plugin's custom properties.

   The reset declarations the chrome genuinely depends on (box-sizing, link
   colour, list reset, button font inheritance, image display) are re-stated
   here in scoped form. Dropping them silently breaks the layout, because the
   chrome was authored assuming the global reset was present.

   Source of truth for the design remains v3-command-center/styles.css.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Tokens — scoped, not :root
   -------------------------------------------------------------------------- */
.ebv3-chrome {
  --paper: #F6F5FB;
  --paper-2: #EEECF7;
  --glass-bg: rgba(255, 255, 255, .65);
  --glass-border: rgba(83, 68, 139, .14);
  --brand: #53448B;
  --brand-deep: #3A2F63;
  --brand-tint: #E9E5F7;
  --ink: #241F3A;
  --ink-soft: #5D5878;

  /*
   * `--line` is referenced by .nav-login in styles.css but is never defined
   * there. An undefined custom property makes the whole `border` declaration
   * invalid at computed-value time, so the login pill renders with NO border.
   * Defined here at the value the design clearly intends (the glass border).
   */
  --line: rgba(83, 68, 139, .14);

  --font-display: "Baloo Bhaijaan 2", "Rubik", "Segoe UI", Tahoma, sans-serif;
  --font-body: "Rubik", "Segoe UI", Tahoma, Arial, sans-serif;

  --radius: 22px;
  --radius-sm: 14px;
  --shadow-soft: 0 8px 30px rgba(58, 47, 99, .08), 0 2px 8px rgba(58, 47, 99, .05);
  --shadow-lift: 0 18px 50px rgba(58, 47, 99, .14), 0 4px 14px rgba(58, 47, 99, .08);
  --header-h: 72px;
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);

  font-family: var(--font-body);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
}

/* --------------------------------------------------------------------------
   Scoped reset — only what the chrome depends on
   -------------------------------------------------------------------------- */
.ebv3-chrome, .ebv3-chrome *, .ebv3-chrome *::before, .ebv3-chrome *::after {
  box-sizing: border-box;
}
.ebv3-chrome img { max-width: 100%; display: block; }
.ebv3-chrome a { color: var(--brand); text-decoration: none; }
.ebv3-chrome button { font-family: inherit; cursor: pointer; }
.ebv3-chrome ul { margin: 0; padding: 0; list-style: none; }
.ebv3-chrome p { margin: 0 0 1em; }
.ebv3-chrome :focus-visible {
  outline: 3px solid #4BB969;
  outline-offset: 3px;
  border-radius: 6px;
}

/* --------------------------------------------------------------------------
   Body offset
   --------------------------------------------------------------------------
   The header is position:fixed. On the landing page the hero reserves its own
   space; every other page would slide underneath it. This class is added to
   <body> by ebv3_chrome_body_class() and is the ONLY rule outside .ebv3-chrome.
   -------------------------------------------------------------------------- */
/*
 * Page canvas.
 * --------------------------------------------------------------------------
 * Flatsome paints <html> a dark brand purple (rgb(71,61,114)). Per CSS, the
 * html element's background propagates to the canvas and is painted across the
 * whole viewport, so a body background alone cannot cover it — it shows as a
 * dark band above the content (in the header offset) and again below the footer
 * whenever the body box is shorter than the canvas.
 *
 * THIS IS THE ONE UNSCOPED SELECTOR IN THIS FILE, and it is safe because the
 * stylesheet is only ever enqueued when ebv3_chrome_active() is true. It is
 * never loaded on the landing template, so it cannot reach that page. It also
 * only sets a canvas colour — it touches no page content.
 *
 * `html:root` rather than `html`, deliberately. Flatsome's Customizer emits an
 * INLINE <style> in wp_head containing:
 *
 *     .absolute-footer, html { background-color: #473D72; }
 *
 * That has the same specificity as a bare `html` (0,0,1) but lands later in the
 * document, so it wins on source order and the dark purple came back below the
 * footer. Adding :root takes this to (0,1,1) and it wins cleanly — no
 * !important, which would be unbeatable by anything downstream including the
 * user's own future overrides.
 */
html:root { background-color: #F6F5FB; }

body.ebv3-chrome-on {
  padding-block-start: calc(72px + 1.6rem);
  background-color: #F6F5FB;
}

/*
 * Flatsome's #wrapper paints solid white, which left the page in three
 * different tones: paper behind the header, white through the content, and
 * paper-2 in the footer. Making the wrapper transparent lets the single paper
 * tone run from the top of the header to the bottom of the page, matching the
 * landing design.
 *
 * Sections that set their own background (hero bands, coloured rows, cards)
 * are unaffected — this only clears the base layer they sit on.
 */
body.ebv3-chrome-on #wrapper { background-color: transparent; }

/*
 * Flatsome's <main id="main"> paints solid white across the entire content
 * area. That produced a hard seam directly under the floating header pill:
 * paper above, white below. Clearing it lets the page canvas run unbroken from
 * the header through to the footer, matching the landing page.
 *
 * Individual rows and sections that set their own background are untouched —
 * this only clears the single full-height base layer they sit on.
 */
body.ebv3-chrome-on #main { background-color: transparent; }

/* --------------------------------------------------------------------------
   Ambient background scene
   --------------------------------------------------------------------------
   Copied from the landing design so the two surfaces are visually identical.
   Fixed, non-interactive, and behind everything at z-index -1.
   -------------------------------------------------------------------------- */
.ebv3-chrome.bg-scene {
  position: fixed; inset: 0;
  pointer-events: none;
  z-index: -1;
  overflow: hidden;
}
.ebv3-chrome .bg-blob {
  position: absolute;
  width: 55vmax; height: 55vmax;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .5;
}
.ebv3-chrome .blob-violet {
  background: radial-gradient(circle, rgba(233,229,247,.9), rgba(233,229,247,0) 65%);
  inset-block-start: -18vmax; inset-inline-end: -14vmax;
  animation: ebv3BlobDrift 26s ease-in-out infinite alternate;
}
.ebv3-chrome .blob-green {
  background: radial-gradient(circle, rgba(223,243,230,.85), rgba(223,243,230,0) 65%);
  inset-block-end: -22vmax; inset-inline-start: -16vmax;
  animation: ebv3BlobDrift 32s ease-in-out infinite alternate-reverse;
}
/* Namespaced keyframes — `blobDrift` already exists in the landing stylesheet,
   and a duplicate global name would be ambiguous if both ever loaded. */
@keyframes ebv3BlobDrift {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(4vmax, 6vmax, 0) scale(1.12); }
}
.ebv3-chrome .bg-grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(rgba(83,68,139,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(83,68,139,.05) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(ellipse 90% 65% at 50% 0%, black 30%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 90% 65% at 50% 0%, black 30%, transparent 78%);
}
.ebv3-chrome .bg-noise {
  position: absolute; inset: 0;
  opacity: .35;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 .33 0 0 0 0 .27 0 0 0 0 .55 0 0 0 .05 0'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
}

@media (max-width: 768px) {
  body.ebv3-chrome-on { padding-block-start: calc(62px + 1.2rem); }
}

/* --------------------------------------------------------------------------
   Glass helper
   -------------------------------------------------------------------------- */
.ebv3-chrome.glass, .ebv3-chrome .glass {
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  border: 1px solid var(--glass-border);
}

/* --------------------------------------------------------------------------
   Skip link
   -------------------------------------------------------------------------- */
/*
 * Both forms are required. The skip link carries the .ebv3-chrome class on
 * ITSELF (it has no chrome ancestor to inherit from), so a descendant selector
 * alone matches nothing and the link renders visibly in the page flow. Same
 * reason .glass and the header/footer are written with a compound selector.
 *
 * The token declarations live on .ebv3-chrome, so var(--brand) resolves here
 * because the element carries that class.
 */
.ebv3-chrome.skip-link, .ebv3-chrome .skip-link {
  position: fixed;
  inset-block-start: .75rem; inset-inline-start: .75rem;
  z-index: 200;
  background: var(--brand);
  color: #fff;
  padding: .6rem 1.2rem;
  border-radius: 999px;
  font-weight: 600;
  transform: translateY(-300%);
  transition: transform .25s;
}
.ebv3-chrome.skip-link:focus-visible, .ebv3-chrome .skip-link:focus-visible { transform: translateY(0); }

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */
header.ebv3-chrome.site-header {
  position: fixed;
  inset-block-start: 0; inset-inline: 0;
  z-index: 100;
  padding: .8rem clamp(.75rem, 2.5vw, 2rem) 0;
  transition: padding .3s;
}
.ebv3-chrome .header-inner {
  max-width: 1240px;
  margin-inline: auto;
  height: var(--header-h);
  border-radius: 999px;
  box-shadow: var(--shadow-soft);
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding-inline: clamp(1rem, 2.5vw, 1.75rem);
  transition: height .3s, box-shadow .3s;
}
.ebv3-chrome.scrolled .header-inner { height: 60px; box-shadow: var(--shadow-lift); }
.ebv3-chrome .logo { display: flex; align-items: center; flex-shrink: 0; }
.ebv3-chrome .logo img { width: clamp(104px, 11vw, 132px); height: auto; }

.ebv3-chrome .main-nav {
  display: flex;
  gap: clamp(.25rem, 1vw, .75rem);
  margin-inline-start: clamp(1rem, 3vw, 2.5rem);
  align-items: center;
}
.ebv3-chrome .main-nav a {
  font-size: .95rem;
  font-weight: 500;
  color: var(--ink-soft);
  padding: .35rem .65rem;
  border-radius: 999px;
  transition: color .2s, background .2s;
  white-space: nowrap;
}
.ebv3-chrome .main-nav a:hover { color: var(--brand); background: var(--brand-tint); }

/* Current page gets a persistent tint — the landing page had no concept of a
   "current" item because it was a single page. Site-wide it needs one. */
.ebv3-chrome .main-nav a[aria-current="page"] { color: var(--brand); background: var(--brand-tint); }

.ebv3-chrome .header-actions {
  display: flex; align-items: center; gap: .6rem;
  margin-inline-start: auto;
  flex-shrink: 0;
}
.ebv3-chrome .main-nav + .header-actions { margin-inline-start: auto; }

.ebv3-chrome .lang-toggle {
  background: var(--brand-tint);
  color: var(--brand);
  border: 1px solid transparent;
  border-radius: 999px;
  font-weight: 600;
  font-size: .9rem;
  padding: .45rem 1rem;
  transition: background .2s, color .2s, transform .2s;
}
.ebv3-chrome .lang-toggle:hover { background: var(--brand); color: #fff; transform: translateY(-1px); }

/* --------------------------------------------------------------------------
   Header auth actions
   -------------------------------------------------------------------------- */
.ebv3-chrome .nav-auth { display: flex; align-items: center; gap: .5rem; flex-shrink: 0; }
.ebv3-chrome .nav-login {
  font-size: .9rem;
  font-weight: 600;
  color: var(--ink-soft);
  padding: .45rem .95rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  white-space: nowrap;
  transition: color .2s, border-color .2s, background .2s;
}
.ebv3-chrome .nav-login:hover { color: var(--brand); border-color: var(--brand); background: var(--brand-tint); }
.ebv3-chrome .nav-register {
  font-size: .9rem;
  font-weight: 700;
  color: #fff;
  background: var(--brand);
  padding: .5rem 1.05rem;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: var(--shadow-soft);
  transition: transform .2s, box-shadow .2s, background .2s;
}
.ebv3-chrome .nav-register:hover { background: var(--brand-deep); transform: translateY(-1px); box-shadow: var(--shadow-lift); }

/* --------------------------------------------------------------------------
   Burger + drawer
   -------------------------------------------------------------------------- */
.ebv3-chrome .nav-burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 44px; height: 44px;
  background: transparent;
  border: none;
  border-radius: 12px;
}
.ebv3-chrome .nav-burger span {
  display: block; height: 2px; width: 22px;
  margin-inline: auto;
  background: var(--brand);
  border-radius: 2px;
  transition: transform .3s, opacity .3s;
}
.ebv3-chrome .nav-burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.ebv3-chrome .nav-burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.ebv3-chrome .nav-burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.ebv3-chrome .mobile-nav[hidden] { display: none; }
.ebv3-chrome .mobile-nav {
  margin: .5rem auto 0;
  max-width: 1240px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lift);
  padding: 1rem;
  display: grid;
  gap: .25rem;
}
.ebv3-chrome .mobile-nav a {
  padding: .7rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  color: var(--ink);
}
.ebv3-chrome .mobile-nav a:hover { background: var(--brand-tint); color: var(--brand); }
.ebv3-chrome .mobile-nav .mob-register { background: var(--brand); color: #fff; font-weight: 700; text-align: center; }
.ebv3-chrome .mobile-nav .mob-register:hover { background: var(--brand); color: #fff; opacity: .92; }
.ebv3-chrome .mobile-nav .mob-cta { background: var(--brand-tint); color: var(--brand); font-weight: 700; text-align: center; }

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */
footer.ebv3-chrome.site-footer {
  background: var(--paper-2);
  border-block-start: 1px solid var(--glass-border);
  padding-block: 3.5rem 1.5rem;
  margin-block-start: 3rem;
}
.ebv3-chrome .container {
  width: min(1200px, 100% - 2.5rem);
  margin-inline: auto;
}
.ebv3-chrome .footer-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: 2.5rem;
  padding-block-end: 2.5rem;
}
.ebv3-chrome .footer-logo { width: 132px; height: auto; margin-block-end: 1rem; }
.ebv3-chrome .footer-about p { color: var(--ink-soft); font-size: .92rem; max-width: 40ch; }
.ebv3-chrome .footer-links { display: flex; flex-direction: column; gap: .55rem; }
.ebv3-chrome .footer-links a {
  color: var(--ink-soft);
  font-size: .95rem;
  width: fit-content;
  transition: color .2s, transform .2s;
}
.ebv3-chrome .footer-links a:hover { color: var(--brand); transform: translateX(calc(4px * var(--dirx, 1))); }
[dir="rtl"] .ebv3-chrome .footer-links a { --dirx: -1; }
.ebv3-chrome .footer-app-title {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--brand-deep);
  margin-block-end: 1rem;
}
.ebv3-chrome .store-badges { display: flex; flex-direction: column; gap: .7rem; align-items: flex-start; }
.ebv3-chrome .store-badge {
  display: inline-flex;
  align-items: center;
  gap: .7rem;
  background: var(--brand-deep);
  color: #fff;
  border-radius: 14px;
  padding: .55rem 1.1rem;
  min-width: 170px;
  transition: transform .25s var(--ease-spring), background .25s;
}
.ebv3-chrome .store-badge:hover { transform: translateY(-3px); background: var(--brand); }
.ebv3-chrome .store-badge svg { width: 24px; height: 24px; flex-shrink: 0; }
.ebv3-chrome .store-badge .sb-txt { line-height: 1.25; }
.ebv3-chrome .store-badge .sb-small { display: block; font-size: .62rem; opacity: .8; }
.ebv3-chrome .store-badge .sb-big { display: block; font-weight: 600; font-size: .95rem; font-family: var(--font-display); }
.ebv3-chrome .footer-bottom {
  border-block-start: 1px solid var(--glass-border);
  padding-block-start: 1.4rem;
  text-align: center;
}
.ebv3-chrome .footer-bottom p { margin: 0; font-size: .85rem; color: var(--ink-soft); }

/* --------------------------------------------------------------------------
   Responsive — mirrors styles.css breakpoints exactly
   -------------------------------------------------------------------------- */
@media (max-width: 1100px) {
  .ebv3-chrome .main-nav { display: none; }
  .ebv3-chrome .nav-burger { display: flex; }

  .ebv3-chrome .header-inner {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: .5rem;
  }
  .ebv3-chrome .header-actions { display: contents; }

  /* grid-row: 1 is REQUIRED on all three. Grid's sparse auto-placement never
     moves the cursor backwards, so with a column but no row the burger
     (column 1) cannot return to row 1 after the logo (2) and actions (3) are
     placed — it gets pushed to a second row, below the header pill. */
  .ebv3-chrome .nav-burger { grid-column: 1; grid-row: 1; justify-self: start; }
  .ebv3-chrome .logo       { grid-column: 2; grid-row: 1; justify-self: center; margin: 0; }
  .ebv3-chrome .nav-auth   { grid-column: 3; grid-row: 1; justify-self: end; }
}

@media (max-width: 768px) {
  .ebv3-chrome { --header-h: 62px; }
  .ebv3-chrome .footer-grid { grid-template-columns: 1fr; gap: 2rem; }
  .ebv3-chrome .footer-about p { max-width: none; }
}

@media (max-width: 780px) {
  /* Login collapses into the drawer; register stays as the visible action. */
  .ebv3-chrome .nav-login { display: none; }
}

@media (max-width: 560px) {
  /* Phone header is burger + centred logo. Language, login and register all
     live in the drawer. The empty third grid cell keeps the logo centred. */
  .ebv3-chrome .nav-auth { display: none; }
  .ebv3-chrome .logo img { width: 96px; }
  .ebv3-chrome .header-inner { gap: .5rem; padding-inline: 1rem; }
  .ebv3-chrome .mobile-nav { max-height: calc(100vh - var(--header-h) - 2rem); overflow-y: auto; }
}

@media (max-width: 400px) {
  .ebv3-chrome .container { width: min(1200px, 100% - 1.6rem); }
  .ebv3-chrome .header-inner { gap: .5rem; }
}

@media (prefers-reduced-motion: reduce) {
  .ebv3-chrome *, .ebv3-chrome *::before, .ebv3-chrome *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .15s !important;
  }
  /* Matches the landing stylesheet: the drifting blobs stop entirely rather
     than snapping to their end state at .01ms. */
  .ebv3-chrome .bg-blob { animation: none !important; }
}
