/* ============================================================
   Nelmes Pre School - Responsive mode
   (Theme Options > General Settings > Layout Mode = Responsive)

   Everything is scoped to body.responsive-mode. Above 1024px the
   site looks exactly like Normal mode (fixed 976px page card).
   Below 1024px:
     - the page card becomes fluid (backgrounds scale with it),
     - the left sidebar (#sidebar with the colorful menu) hides
       off-canvas to the left and slides out via the toggle button,
     - the animal strip (.stopka / .stopka2) stays under the page.
   ============================================================ */

/* Toggle button - hidden completely above the breakpoint */
.nelmes-nav-toggle{display:none}

@media screen and (max-width:1024px){

  /* ---------- Slide-out menu toggle ---------- */
  .nelmes-nav-toggle{
    position:fixed;top:8px;left:8px;z-index:99990;
    display:flex;align-items:center;gap:9px;
    padding:9px 16px 9px 12px;
    border:2px solid #333;border-radius:12px;
    background:#ffffff;color:#333;
    font:bold 16px/1 Arial,Helvetica,sans-serif;
    cursor:pointer;
    box-shadow:0 2px 10px rgba(0,0,0,.35);
  }
  .nelmes-toggle-bars{display:inline-block;width:20px}
  .nelmes-toggle-bars span{display:block;height:3px;margin:3px 0;background:#333;border-radius:2px;transition:transform .2s ease,opacity .2s ease}
  /* open state: hamburger becomes a cross (toggle in/out) */
  body.sidebar-open .nelmes-toggle-bars span:nth-child(1){transform:translateY(6px) rotate(45deg)}
  body.sidebar-open .nelmes-toggle-bars span:nth-child(2){opacity:0}
  body.sidebar-open .nelmes-toggle-bars span:nth-child(3){transform:translateY(-6px) rotate(-45deg)}

  /* Dark overlay behind the open drawer (added by js/responsive.js) */
  .nelmes-sidebar-overlay{display:none}
  body.responsive-mode .nelmes-sidebar-overlay{
    position:fixed;top:0;left:0;right:0;bottom:0;
    background:rgba(0,0,0,.45);
    z-index:99970;
  }

  /* ---------- Fluid page card ---------- */
  body.responsive-mode #wrapper{width:100%;max-width:976px;margin-left:auto;margin-right:auto}
  body.responsive-mode #topwrapper{width:100%;background-size:100% 19px}
  body.responsive-mode #mainwrapper{width:100%;background-size:100% 3px}
  body.responsive-mode #bottomwrapper{width:100%;background-size:100% 55px}

  /* ---------- Header ---------- */
  body.responsive-mode #header{width:auto;max-width:960px;height:auto;padding:0 12px 20px;margin:0 auto}
  body.responsive-mode #header a{display:block}
  body.responsive-mode #header img{max-width:100%;height:auto}
  body.responsive-mode #headerright{width:auto;max-width:100%;float:none;padding-top:10px}

  /* ---------- Main content ---------- */
  body.responsive-mode .center{width:auto;max-width:900px;padding:0 12px}
  body.responsive-mode .maincontent,
  body.responsive-mode .maincontent-right{width:auto;max-width:100%;float:none;padding:15px 0 0 0}
  body.responsive-mode .maincontent img{max-width:100%;height:auto}
  body.responsive-mode .maincontent iframe,
  body.responsive-mode .maincontent embed,
  body.responsive-mode .maincontent object{max-width:100%}

  /* Sliders: fixed-width boxes (#slide-wrapper 635px, #portfolio-slider 558px) are
     scaled down as a whole by js/responsive.js (wrapped in .nelmes-slider-fit +
     transform), so they can never stick out of the screen - slices, captions and
     nav arrows included. No CSS width overrides here on purpose: JS needs the
     natural size intact for measuring. */
  .nelmes-slider-fit{width:100%;overflow:hidden}

  /* Safety net: nothing inside the page card may cause horizontal scrolling */
  body.responsive-mode{overflow-x:hidden}
  body.responsive-mode #mainwrapper{overflow-x:hidden}

  /* ---------- Sidebar: off-canvas drawer (hides to the left) ---------- */
  body.responsive-mode #sidebar{
    position:fixed;top:0;left:0;bottom:0;
    width:280px;max-width:85vw;
    box-sizing:border-box;
    margin:0;float:none;
    padding:64px 12px 24px 12px;
    background:#ffffff;
    overflow-y:auto;overflow-x:hidden;
    -webkit-transform:translateX(-110%);transform:translateX(-110%);
    -webkit-transition:transform .25s ease;transition:transform .25s ease;
    box-shadow:0 0 20px rgba(0,0,0,.45);
    z-index:99980;
  }
  body.responsive-mode.sidebar-open #sidebar{-webkit-transform:translateX(0);transform:translateX(0)}
  body.responsive-mode.sidebar-open{overflow:hidden}
  body.responsive-mode.sidebar-open .nelmes-sidebar-overlay{display:block}

  /* Colorful menu fills the drawer; fly-out submenus expand in place (touch friendly) */
  body.responsive-mode #sidebar #navigation{width:100%;float:none;font-size:0.9em}
  body.responsive-mode #sidebar #navigation a{width:100%;height:auto;min-height:33px;line-height:1.3;padding:4px 8px 4px 10px;text-indent:0;box-sizing:border-box}
  body.responsive-mode #sidebar #navigation ul li ul{position:static;left:auto;margin-top:0;visibility:visible;padding-left:16px}
  body.responsive-mode #sidebar #navigation ul li ul li{width:auto !important}

  /* Sidebar images and the sub-pages box become fluid */
  body.responsive-mode #sidebar img{max-width:100%;height:auto}
  body.responsive-mode #sidebar .sidebar{width:100%;float:none;margin:20px 0 0 0}
  body.responsive-mode #sidebar .sidebartop,
  body.responsive-mode #sidebar .sidebarmain,
  body.responsive-mode #sidebar .sidebarbottom{width:100%}

  /* ---------- Footer ---------- */
  body.responsive-mode #footer{width:auto;max-width:900px;padding:0 12px}
  /* The copyright bar background (images/bg-copyright.png) is a 41px strip -
     exactly one line of text. When the stacked text wraps to 2-3 lines on
     tablets/phones, stretch it to the full bar height so no line sits
     outside the background (the strip is a flat rgba(0,0,0,0.2) fill,
     so stretching does not distort it). */
  body.responsive-mode .bottom{width:auto;max-width:890px;height:auto;min-height:31px;background-size:100% 100%}
  body.responsive-mode .footermenu{width:auto;max-width:55%}
  body.responsive-mode .copyright{width:auto;max-width:40%}

  /* ---------- Animal strip stays under the page ---------- */
  body.responsive-mode .stopka,
  body.responsive-mode .stopka2{height:426px}
  body.responsive-mode .stopka2{background-size:cover}
}

/* ============================================================
   Typography in rem (Responsive mode only)

   Why not pt? pt is a print unit: on screens every browser converts
   it at a fixed ratio (1pt = 1.333px @96dpi), so it does NOT adapt
   to 2K/4K monitors or phones - it behaves exactly like px.
   rem follows the root font size, so we can keep the current look
   on ordinary screens and give big monitors slightly bigger text.
   ============================================================ */

/* Main copy: 1.25rem x root 16px = 20px, exactly like the current design */
body.responsive-mode{font-size:1.20rem}
body.responsive-mode p,
body.responsive-mode td{font-size:0.9em}
body.responsive-mode #footer p {font-size:0.8em}
/* Headings keep their current sizes but follow the root scale too
   (h1 36px ... h6 12px in the fixed stylesheet) */
body.responsive-mode h1{font-size:2.25rem;line-height:1.15}
body.responsive-mode h2{font-size:1.875rem;line-height:1.2}
body.responsive-mode h3{font-size:1.5rem;line-height:1.25}
body.responsive-mode h4{font-size:1.125rem;line-height:1.3}
body.responsive-mode h5{font-size:0.875rem;line-height:1.3}
body.responsive-mode h6{font-size:0.75rem;line-height:1.3}

/* 2K / 4K monitors: bigger base text (body copy ~22.5px / ~25px) */
@media screen and (min-width:1800px){
  html{font-size:18px}
}
@media screen and (min-width:2400px){
  html{font-size:20px}
}

@media screen and (max-width:640px){
  body.responsive-mode{-webkit-text-size-adjust:100%;text-size-adjust:100%}
  /* slightly smaller, comfortable copy on phones (17px at root 16px) */
  body.responsive-mode,
  body.responsive-mode p,
  body.responsive-mode td{font-size:1.0625rem}

  body.responsive-mode .footermenu,
  body.responsive-mode .copyright{width:auto;max-width:100%;float:none;text-align:left;margin:6px 0}

  body.responsive-mode #footer .footerbox{width:auto;max-width:100%;float:none;clear:both;margin:0 0 16px 0}

  /* Animals: a shorter strip so it does not dominate the small screen */
  body.responsive-mode .stopka,
  body.responsive-mode .stopka2{height:240px}
}
