/* Phone and tablet fixes: stop sideways scrolling and keep content inside the screen */
*, *::before, *::after { box-sizing: border-box; }
html, body { max-width: 100%; overflow-x: hidden; }
img, svg, video, iframe, canvas { max-width: 100%; height: auto; }
.slick-list, .slick-track { max-width: 100%; }
.slick-list { overflow: hidden; }
input, select, textarea, button { max-width: 100%; }

/* Scoped to the mobile/tablet range where the nav is the full-screen slide-out panel (not the
   desktop absolute-positioned dropdown), so clipping overflow here can never cut off a dropdown.
   At desktop widths these same elements are ancestors of the .level2 dropdown panels; giving them
   overflow-x: hidden there (even paired with overflow-y: visible/clip) makes the browser treat the
   y-axis as non-visible too per the CSS Overflow spec, which silently clips or scroll-traps any
   dropdown content taller than the 70px header bar. */
@media (max-width: 1024px) {
  #site-header, .content-wrapper, .header-wrapper, #header-menu { max-width: 100vw; overflow-x: hidden; }
}

@media (max-width: 767px) {
  .container, .wrapper { width: 100%; max-width: 100%; margin-left: 0; margin-right: 0; }
  .container, .wrapper { padding-left: 16px; padding-right: 16px; }
  /* Bootstrap's own grid CSS already handles col-xs-*/col-sm-*/col-md-*/col-lg-*
     correctly through its own breakpoints (confirmed present and working) --
     an earlier override here matched col-sm-*/col-md-*/col-lg-* by substring,
     which also matches elements that carry col-xs-* alongside them (the normal
     Bootstrap pattern), so it was fighting Bootstrap's own intentional 2-up
     phone layouts (e.g. col-xs-6) instead of only resetting wider breakpoints. */
  /* Several pages give individual grid items a fixed min-height (in their own
     inline <style>, e.g. .book-item.long, .template-item130) so a multi-column
     row lines up evenly. On a single phone-width column, an item that ends up
     alone in its row keeps that min-height with nothing to fill it, leaving a
     tall gap below short content. Unlike width/float, resetting min-height
     can't break a layout that's already working, so this is safe sitewide. */
  [class*="col-xs-"] { min-height: 0 !important; }
  h1 { font-size: 30px; line-height: 1.2; }
  h2 { font-size: 24px; line-height: 1.25; }
  .btn, .button { white-space: normal; }
  form, .form-group, .form-control { width: 100%; max-width: 100%; }

  /* Side gutters for page sections and forms, so content never runs to the screen edge */
  .content-wrapper > div, .content-wrapper > section, .content-wrapper > main,
  .content-wrapper > header, .content-wrapper > footer,
  .content-wrapper section, .content-wrapper main, .content-wrapper footer,
  .content-wrapper form, .content-wrapper .form, .content-wrapper [class*="form"] {
    max-width: 100%; padding-left: 16px; padding-right: 16px; box-sizing: border-box;
  }
  .content-wrapper section > *, .content-wrapper main > * { max-width: 100%; }
  .header-wrapper { padding-left: 12px; padding-right: 12px; }

  /* Full-width colour bands (hero, dark strips) keep the gutter inside them instead,
     so the colour itself reaches the screen edge */
  .wrapper { padding-left: 0; padding-right: 0; }
  .container-fluid { padding-left: 0; padding-right: 0; }
  .content-wrapper [class*="-banner"], .content-wrapper [class*="hero"] { padding-left: 16px; padding-right: 16px; }

  /* Header logo must not be cut off, and icon links need a comfortable tap target.
     Scoped to the logo classes only (not "#site-header img"/".header-wrapper img"), which
     also matched the nav dropdowns' promo thumbnails nested in the same header and squashed
     them to a 150x44 box. */
  .main-logo img, .img-logo { max-width: 150px; height: 44px; width: auto; }
  .nav-icons li > a { display: inline-flex; align-items: center; justify-content: center; min-width: 40px; min-height: 40px; }
  /* Pricing is already in the menu, so the phone bar keeps only the logo and working icons */
  #pricing-list-item { display: none; }
}

/* ---- Header: one clean bar on every device ---- */
/* Coming-soon links (header, footer and social icons alike) look unavailable and cannot be clicked */
.is-soon { opacity: 0.55; cursor: default; pointer-events: none; }
/* A small "Soon" tag on the text items in the main menu (Pricing, Bookshop, Login) */
#site-header .main-nav a.is-soon::after {
  content: "Soon"; margin-left: 6px; padding: 1px 6px; border-radius: 10px;
  background: #e7e5ef; color: #1E2147; font-size: 10px; font-weight: 700;
  letter-spacing: 0.04em; text-transform: uppercase; vertical-align: middle;
}
#pricing-list-item .is-soon { background: transparent; color: #1E2147; }
#pricing-list-item .is-soon::after { content: "Soon"; }

/* Desktop header: a line under the bar, and a shadow once the page has scrolled (like the main site) */
@media (min-width: 992px) {
  #site-header { border-bottom: 1px solid #e3e1ea; transition: box-shadow 0.2s ease; }
  #site-header.is-scrolled { box-shadow: 0 2px 12px rgba(30, 33, 71, 0.18); }
}

/* Above the mobile/tablet breakpoint (which already makes #site-header fixed for the
   slide-out menu), the header had no position rule at all, so it scrolled away with the
   page. A dropdown opened after scrolling would then render off-screen or need the page
   scrolled back to the top to be seen. Pin it so the nav and its dropdowns always overlay
   the page, like the rest of the site's fixed/overlay header behaviour. */
@media (min-width: 1025px) {
  #site-header { position: sticky; top: 0; z-index: 500; }
}

/* Phone header: the search/mail/menu icons sit in a block sized for a taller bar
   (li padding + a padding added up to a much taller tap target than the 50px bar
   actually is), so the icon glyphs rendered visibly below the logo's vertical
   centre instead of level with it. Tighten the tap target and re-centre it. */
@media (max-width: 1024px) {
  #mobile-header .right-nav { margin-top: -5.5px; }
  #mobile-header .right-nav .nav-icons li { padding: 0 2px; }
  #mobile-header .right-nav .nav-icons li a { padding: 10px 6px; }
}

