/* ============================================================
   Subrata Acharya — phone & tablet layout

   Linked from every page with
     media="(max-width: 1024px), (hover: none) and (pointer: coarse) and (max-width: 1400px)"
   so desktops never use it. The desktop pages are built from absolutely
   positioned speech bubbles laid over one big drawing; here the page is a
   simple vertical story instead:

     top bar  ->  the whole drawing (never cropped)  ->  the copy  ->  Back/Next  ->  footer

   Speech bubbles and the hover pictures are hidden, the game is gone,
   and the copy fades in as you scroll (see mobile.js).
   ============================================================ */

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: hidden;
}
a, button { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }

body.m-page {
  --m-fg: #1c1c1c;
  --m-soft: #555;
  position: static !important;
  width: 100% !important;
  max-width: 100vw;
  margin: 0 !important;
  padding: 56px 0 0 !important;
  background: var(--m-bg, #fff) !important;
  color: var(--m-fg);
  overflow-x: hidden;
  min-height: 100vh;
}
body.m-dark {
  --m-fg: #f2f2f2;
  --m-soft: #b9b9b9;
}

/* ---------- top bar: logo + Home / Back / Next ---------- */
.navbar-fixed-top,
.navbar {
  height: 56px !important;
  min-height: 56px !important;
  margin: 0 !important;
  border-width: 0 0 1px 0 !important;
}
.navbar > .container-fluid {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
  height: 56px;
  padding: 0 8px 0 10px !important;
  margin: 0 !important;
}
.navbar > .container-fluid::before,
.navbar > .container-fluid::after { display: none !important; }
.navbar-header { float: none !important; margin: 0 !important; display: flex; align-items: center; }
.navbar-brand {
  float: none !important;
  height: 56px !important;
  padding: 9px 6px !important;
  margin: 0 !important;
  display: flex;
  align-items: center;
}
.navbar-brand img { height: 36px !important; width: auto !important; margin: 0 !important; }
.navbar-nav.navbar-right,
.nav.navbar-nav {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  float: none !important;
  margin: 0 !important;
}
.navbar-nav > li { float: none !important; display: block; }
.navbar-nav > li > a {
  padding: 0 !important;
  margin: 0 3px !important;
  height: 56px;
  display: flex !important;
  align-items: center;
  line-height: 1 !important;
}
.navbar-nav > li > a img {
  height: 30px !important;
  width: auto !important;
  max-width: none;
}

/* ---------- the drawing, whole and uncropped ---------- */
.image-container {
  position: relative !important;
  top: auto !important;
  left: auto !important;
  margin: 0 !important;
  width: 100% !important;
  height: auto !important;
  display: flex;
  flex-direction: column;
}
.image-container > .image,
.image-container > #image,
.image-container > img {
  order: 0;
  position: static !important;
  display: block !important;
  width: 100% !important;
  height: auto !important;
  max-width: 100% !important;
  right: auto !important;
  top: auto !important;
  pointer-events: none;            /* a tap must not jump to the next page */
  -webkit-user-drag: none;
  user-select: none;
}
.overlay,
.hover-image,
.image-container picture,
map { display: none !important; }
.image-container > :not(img):not(.mtitle):not(.mcopy):not(.overlay) { order: 3; }

/* ---------- speech bubbles & overlay captions: gone ---------- */
[id^="text"]:not(.mcopy):not(.mtitle) { display: none !important; }

/* ---------- the copy ---------- */
.mcopy,
.mtitle {
  order: 2;
  position: static !important;
  display: block !important;
  opacity: 1 !important;
  float: none !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  width: auto !important;
  height: auto !important;
  min-height: 0 !important;
  max-width: 700px;
  margin: 0 auto !important;
  box-sizing: border-box;
  background: none !important;
  background-image: none !important;
  transform: none;
  color: var(--m-fg) !important;
  text-align: center !important;
  pointer-events: none;
  overflow: visible !important;
}
.mcopy {
  padding: 30px 24px 12px !important;
  font-size: clamp(18px, 4.8vw, 23px) !important;
  line-height: 1.8 !important;
  letter-spacing: .005em;
}
.mcopy + .mcopy { padding-top: 6px !important; }
.mcopy *,
.mtitle * {
  font-size: inherit !important;
  line-height: inherit !important;
  color: inherit !important;
  text-align: center !important;
  margin-left: 0 !important;
  margin-right: 0 !important;
  max-width: 100% !important;
}
.mcopy p { margin-top: 0 !important; margin-bottom: .9em !important; }
.mcopy a { pointer-events: auto; }
.mtitle {
  order: 1;
  padding: 26px 24px 0 !important;
  font-size: clamp(26px, 7vw, 34px) !important;
  line-height: 1.3 !important;
}

/* copy rises into view while scrolling (see mobile.js) */
.js .mcopy,
.js .m-reveal {
  opacity: 0 !important;
  transform: translate3d(0, 26px, 0);
  transition: opacity .9s ease, transform .9s cubic-bezier(.2, .7, .2, 1);
  will-change: opacity, transform;
}
.js .mcopy.in,
.js .m-reveal.in {
  opacity: 1 !important;
  transform: none;
}

/* ---------- Back / Next buttons (added by mobile.js) ---------- */
.m-pager {
  display: flex;
  gap: 12px;
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
  padding: 22px 22px 34px;
  box-sizing: border-box;
}
.m-pager a {
  flex: 1;
  text-align: center;
  padding: 14px 10px;
  border: 1.5px solid var(--m-fg);
  border-radius: 999px;
  color: var(--m-fg) !important;
  text-decoration: none !important;
  font-size: 15px;
  letter-spacing: .12em;
  text-transform: uppercase;
  background: transparent;
  transition: background .2s ease, color .2s ease;
}
.m-pager a:active { background: var(--m-fg); color: var(--m-bg, #fff) !important; }
.m-pager a:only-child { max-width: 220px; margin: 0 auto; }

/* ---------- Chapter 8: the three "Come with me" bubbles become links ---------- */
.m-links {
  order: 3;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  padding: 4px 22px 30px;
}
.m-links a {
  padding: 11px 22px;
  border: 1.5px solid var(--m-fg);
  border-radius: 999px;
  color: var(--m-fg) !important;
  text-decoration: none !important;
  font-size: 16px;
}


/* ---------- Cinema page: video slider fits the screen ---------- */
.mb { display: none !important; }
.main-slider {
  width: 100% !important;
  max-width: 100vw;
  left: auto !important;
  margin: 10px auto 34px !important;
}
.main-slider .slick-slide { width: min(330px, 84vw) !important; }
.main-slider .slick-prev { left: 14px !important; right: auto !important; transform: translateY(-50%) !important; }
.main-slider .slick-next { right: 14px !important; left: auto !important; transform: translateY(-50%) !important; }
.main-slider .slick-dots { bottom: -26px; }
.main-slider .slick-dots li button:before { color: var(--m-fg); }


/* ---------- Sketch Book page: page-turning carousel ---------- */
#myCarousel {
  order: 3;
  width: min(92%, 560px) !important;
  margin: 26px auto 8px !important;
}
#myCarousel .carousel-inner > .item > img { width: 100% !important; height: auto !important; }
#myCarousel .carousel-control { width: 18%; }
#myCarousel .carousel-indicators { bottom: -34px; }
#myCarousel .carousel-indicators li { border-color: var(--m-fg); }
#myCarousel .carousel-indicators .active { background-color: var(--m-fg); }


/* ---------- Books page: the drawing only fills the left half of its picture,
   so on phones/tablets crop away the empty white on the right and let the figure
   fill and sit centred on screen. (Only for the built-in picture, books.jpg.) ---------- */
.image-container > img#image[src="books.jpg"] {
  width: 100% !important;
  aspect-ratio: 4 / 5;
  height: auto !important;
  object-fit: cover;
  object-position: 0% 50%;
}
@media (min-width: 700px) {
  .image-container > img#image[src="books.jpg"] {
    width: min(100%, 620px) !important;
    margin: 0 auto !important;
  }
}

/* ---------- Books page ---------- */
.book-carousel-wrap {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  box-sizing: border-box;
  margin: 18px auto 30px !important;
  padding: 0 22px !important;
}
.book-carousel, .book-viewport { min-width: 0; max-width: 100%; }
.book-carousel-heading { text-align: center; }
/* every cover is the same box as on desktop (240 x 260), centred in its slide */
.book-carousel .book-slide {
  display: flex !important;
  flex-direction: column;
  align-items: center;
  text-align: center;
}
.book-carousel .book-slide { padding: 0 8px !important; }
.book-viewport { padding: 10px 0 16px; }       /* room so the shadow isn't clipped */
.book-slide img {
  width: 240px !important;
  max-width: 100% !important;
  height: 260px !important;
  aspect-ratio: auto !important;
  object-fit: cover !important;
  margin: 0 auto;
  border-radius: 5px;
  border: 1px solid rgba(0, 0, 0, .12);
  box-shadow: 0 10px 22px rgba(0, 0, 0, .22), 0 2px 6px rgba(0, 0, 0, .14);
}
.book-slide-title { max-width: 100%; padding: 0 6px; }
.book-carousel .slick-prev, .book-carousel .slick-next { top: 46%; }

/* ---------- no game on phones / tablets ---------- */
.play-game-btn,
#playGameModal,
.modal-backdrop.game { display: none !important; }

/* ---------- language switch ---------- */
.lang-toggle {
  top: auto !important;
  bottom: max(14px, env(safe-area-inset-bottom)) !important;
  right: 14px !important;
  font-size: 13px;
}

/* ---------- footer ---------- */
footer {
  position: static !important;
  top: auto !important;
  width: 100% !important;
  margin: 0 !important;
}
footer section.mobile { display: none !important; }          /* the old "please use a desktop" note */
footer section.desktop { display: block !important; }
footer > section { padding: 30px 0 6px !important; }
footer > section .container {
  width: 100% !important;
  max-width: 640px;
  padding: 0 20px !important;
  margin: 0 auto !important;
}
footer > section .row {
  margin: 0 !important;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 6px 14px;
}
footer > section .row::before,
footer > section .row::after { display: none !important; }
footer > section .row > [class*="col-"] {
  float: none !important;
  width: auto !important;
  max-width: none !important;
  margin: 0 !important;
  padding: 0 !important;
}
footer > section .row > [class*="col-"]:first-child,
footer > section .row > [class*="col-"]:nth-child(4) { grid-column: 1 / -1; }
footer > section .row > [class*="col-"]:nth-child(4) { padding-top: 8px !important; }
/* the Contact block's second line sits just outside its column in the page markup */
footer > section .row > p { grid-column: 1 / -1; margin: 0 !important; padding: 0 !important; }
footer h6 { margin-bottom: 14px !important; }
footer .footer-photo img { width: 116px; height: 116px; }
footer p, footer a { overflow-wrap: anywhere; word-break: break-word; }
footer > div[style*="rgba(0, 0, 0, 0.05)"] { padding: 18px 12px calc(18px + env(safe-area-inset-bottom)) !important; font-size: 13px; }

/* ---------- tablets: a little more room ---------- */
@media (min-width: 700px) {
  body.m-page { padding-top: 64px !important; }
  .navbar-fixed-top, .navbar, .navbar > .container-fluid { height: 64px !important; min-height: 64px !important; }
  .navbar-brand { height: 64px !important; }
  .navbar-brand img { height: 42px !important; }
  .navbar-nav > li > a { height: 64px; margin: 0 6px !important; }
  .navbar-nav > li > a img { height: 36px !important; }
  .mcopy { padding-top: 40px !important; font-size: 22px !important; max-width: 760px; }
  .mtitle { font-size: 36px !important; }
  footer > section .container { max-width: 980px; }
  footer > section .row { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1.6fr); gap: 6px 22px; }
  footer > section .row > [class*="col-"]:first-child,
  footer > section .row > [class*="col-"]:nth-child(4) { grid-column: auto; padding-top: 0 !important; }
  footer > section .row > [class*="col-"]:nth-child(4) { grid-column: 4; grid-row: 1; }
  footer > section .row > p { grid-column: 4; grid-row: 2; }
}

/* very narrow phones (320px) */
@media (max-width: 350px) {
  .navbar-brand img { height: 32px !important; }
  .navbar-nav > li > a { margin: 0 1px !important; }
  .navbar-nav > li > a img { height: 26px !important; }
  .mcopy { padding-left: 18px !important; padding-right: 18px !important; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .mcopy, .js .m-reveal { transition: none; transform: none; }
}
