/*
 * Tablet and phone layout.
 *
 * main.css is the original desktop-only template (fixed 980px minimum width). Rather than edit
 * that minified file, this sheet is loaded after it and only overrides it below 1024px, so the
 * desktop layout is untouched.
 *
 *   ≤1023px  tablet: fluid width, 2-column post grid, simplified article page
 *   ≤767px   phone: single column, scrollable section nav, stacked footer
 *   hover:none  touch devices: hover-only overlays are hidden
 */

/* Touch devices: the slide-in rating panel and pink wipe only ever appear on hover. */
@media (hover: none) {
  .content .image-wrapper > div,
  .content .image-wrapper figure:before,
  .newsfeed ul li > a:first-child:before,
  .related ul li > a:first-child:before {
    display: none;
  }
}

/* The language menu opens on tap/keyboard focus as well as hover. */
.settings-wrapper > li.language-switcher:focus-within > div {
  max-height: 100px;
}
.settings-wrapper > li.language-switcher:focus {
  outline: none;
}
.settings-wrapper > li.language-switcher:focus-visible {
  outline: 1px solid #49526d;
  outline-offset: -1px;
}

/* ───────────────────────────── Tablet and below ───────────────────────────── */
@media screen and (max-width: 1023px) {
  html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  /* Drop the fixed desktop width everywhere. */
  body,
  header,
  .outer-nav,
  wrapper {
    min-width: 0;
  }
  body {
    overflow-x: hidden;
  }
  wrapper {
    padding-left: 24px;
    padding-right: 24px;
  }
  header wrapper {
    padding: 0 14px;
  }

  /* Bigger hit area for the 24px hamburger without changing how it looks. */
  button.menu:before {
    content: "";
    position: absolute;
    inset: -12px;
  }

  /* ── Hero: video, logo, section nav ── */
  .video-wrapper {
    height: auto;
    padding: 96px 0 48px;
  }
  .video-wrapper .videobg-placeholder {
    height: 100%;
  }
  .video-wrapper video {
    min-width: 0;
    left: 0;
    margin: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
  }
  .video-wrapper logo {
    width: 180px;
    height: 268px;
  }

  #second-header wrapper {
    padding: 0 24px;
  }
  nav,
  nav:not([data-drop="0"]),
  #nav {
    height: auto;
    margin: 40px 0 0;
  }
  #nav {
    justify-content: center;
    column-gap: 28px;
    row-gap: 12px;
  }
  .is-sticky #second-header wrapper nav,
  .is-sticky #nav {
    margin: 0;
    padding: 10px 0;
  }

  /* Content now starts below the hero instead of overlapping a 1044px video. */
  .content {
    margin-top: 40px;
  }
  .content > h1 {
    position: static;
    transform: none;
    width: auto;
    padding: 0;
    margin: 0 0 32px;
    text-align: center;
    white-space: normal;
    font-size: 36px;
    line-height: 1.1;
  }
  .content > h1:before {
    display: none;
  }

  /* ── Post grid ──
     The desktop layout is an 11-card collage built from floats, negative margins and absolute
     positioning keyed on :nth-of-type. Here every card is reset to one simple shape and laid out
     with grid. `.cloudGet` is in the selectors so they outrank the collage rules. */
  #dle-content {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 48px 24px;
  }
  #dle-content > div.fw:not(.page-title-number):not(.pagination) {
    display: none; /* empty spacer cells and the append anchor */
  }
  #dle-content > .page-title-number,
  #dle-content > .pagination {
    grid-column: 1 / -1;
    float: none;
    width: auto;
  }
  .page-title-number {
    font-size: 48px;
    padding: 24px 0 0;
  }

  .content article.cloudGet {
    float: none;
    width: auto;
    top: auto;
    margin: 0;
    padding: 0;
    z-index: auto;
    text-align: center;
  }
  .content article.cloudGet:before {
    display: none;
  }
  .content article.cloudGet > ul {
    padding: 0;
  }
  .content article.cloudGet > ul > li,
  .content article.cloudGet > ul > li:first-child,
  .content article.cloudGet > ul > li:last-child {
    float: none;
    width: auto;
    right: auto;
    margin: 0;
    padding: 0;
    position: relative;
  }
  .content article.cloudGet .image-wrapper {
    margin-top: 0;
    box-shadow: none;
  }
  .content article.cloudGet figure {
    width: 100%;
    height: auto;
    padding-top: 0;
    aspect-ratio: 4 / 5;
  }
  .content article.cloudGet h1 {
    font-size: 26px;
    line-height: 1.15;
    height: auto;
    margin: 20px 0 0;
    text-align: inherit;
    word-break: normal;
    overflow-wrap: break-word;
  }
  .content article.cloudGet h1:first-letter {
    font-size: 1.5em;
  }
  .content article.cloudGet h3 {
    position: static;
    height: auto;
    margin: 12px 0 0;
    font-size: 12px;
    letter-spacing: 2px;
    text-align: inherit;
  }
  .content article.cloudGet fieldset.date {
    position: static;
    float: none;
    width: auto;
    margin: 16px 0 0;
    padding: 0;
    border: 0;
    transform: none;
  }
  .content article.cloudGet fieldset.date legend {
    margin: 0 auto;
    left: auto;
  }
  .content article.cloudGet fieldset.date legend span:first-child,
  .content article.cloudGet fieldset.date span {
    color: #6b5e73;
  }
  .content article.cloudGet fieldset.date legend span:first-child:before,
  .content article.cloudGet fieldset.date span:before {
    color: #d1d1d1;
  }
  .content article.cloudGet fieldset.date span:last-child {
    display: block;
    color: #2f0125;
  }
  .content article.cloudGet p,
  .content article.cloudGet .read-more {
    display: block;
  }
  .content article.cloudGet p {
    float: none;
    margin: 28px 0 0;
    font-size: 14px;
    line-height: 21px;
    color: #5e6a71;
    text-align: inherit;
  }
  .content article.cloudGet .read-more {
    display: inline-block;
  }
  .content article.cloudGet div.fw {
    float: none;
    margin: 20px 0 0;
    text-align: inherit;
  }

  /* Every 11th card starting with the first is the feature card: full row, image beside text. */
  #dle-content > article.cloudGet:nth-of-type(11n-10) {
    grid-column: 1 / -1;
    text-align: left;
  }
  #dle-content > article.cloudGet:nth-of-type(11n-10) > ul {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    gap: 32px;
    align-items: center;
  }
  #dle-content > article.cloudGet:nth-of-type(11n-10) > ul:before,
  #dle-content > article.cloudGet:nth-of-type(11n-10) > ul:after {
    content: none;
  }
  #dle-content > article.cloudGet:nth-of-type(11n-10) h1 {
    font-size: 34px;
    margin-top: 0;
  }
  #dle-content > article.cloudGet:nth-of-type(11n-10) fieldset.date legend {
    margin: 0;
  }

  /* ── Article page ── */
  .content article.cloudGet.fullstory {
    text-align: left;
  }
  .content article.fullstory .newsfeed {
    display: none; /* duplicated by the related row below the story */
  }
  .content article.cloudGet.fullstory > ul > li:last-child {
    box-shadow: none;
    padding-top: 8px;
  }
  .content article.cloudGet.fullstory figure {
    aspect-ratio: 16 / 10;
  }
  .content article.cloudGet.fullstory h1 {
    font-size: 36px;
    margin-top: 28px;
  }
  .content article.cloudGet.fullstory fieldset.date {
    margin: 20px 0 24px;
    padding-top: 0;
    border-top: 1px solid #89bf3e;
  }
  .content article.cloudGet.fullstory fieldset.date legend span:first-child {
    color: #72a52b;
  }
  .full-story-data {
    font-size: 16px;
    line-height: 26px;
    overflow-wrap: break-word;
  }
  .full-story-data img,
  .full-story-data video {
    max-width: 100%;
    height: auto;
  }
  .full-story-data iframe {
    height: auto;
    aspect-ratio: 16 / 9;
  }
  .content article.cloudGet.fullstory .related {
    width: auto;
    margin: 40px 0 0;
    top: 0;
  }
  .related ul li {
    width: 33.333%;
  }

  /* ── Footer ── */
  footer {
    height: auto;
    min-height: 200px;
  }
  footer wrapper {
    padding: 0;
    height: auto;
  }
  footer ul,
  footer ul li:first-child {
    box-shadow: none;
  }
  footer ul {
    display: flex;
    height: auto;
    min-height: 200px;
  }
  footer ul li {
    float: none;
    height: auto;
  }
  footer ul li:first-child {
    flex: 0 0 240px;
  }
  footer ul li:last-child {
    flex: 1 1 auto;
    width: auto;
    padding-bottom: 64px;
  }
  footer .footer-nav {
    width: auto;
    max-width: 55%;
  }

  /* ── Off-canvas menu ──
     The links get their own scrollable area in the top part of the screen, and the tilted page
     card is pushed down so it peeks in below them instead of covering them. */
  .outer-nav {
    position: fixed;
    top: 74px;
    bottom: 70%;
    padding: 16px 16px 24px;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    visibility: hidden;
    transition: visibility 0s 0.4s; /* stay visible while the links fade out */
  }
  body.perspmenu .outer-nav {
    visibility: visible;
    transition-delay: 0s;
  }
  /* On a white card the dark logo and nav colors stay (desktop switches them to white). */
  body.perspmenu .video-wrapper logo:before {
    opacity: 0;
  }
  body.perspmenu nav a {
    color: #1f292f;
  }
  body.perspmenu nav li.ajaxActive a {
    color: #8c6a2b;
  }
  body.perspmenu section {
    transform: translateY(8vh) translateZ(-250px) rotateX(47deg);
  }
  body.perspmenu .main-section {
    background: #fff;
  }
  .outer-nav a {
    font-size: 22px;
    margin: 12px 16px;
  }

  /* ── 404 ── */
  .errors {
    width: auto;
    margin: 0 0 48px;
    padding: 120px 32px 40px;
    min-height: 0;
    top: 0;
    text-align: center;
    background-position: 50% 0;
  }
}

/* ───────────────────────────── Phone ───────────────────────────── */
@media screen and (max-width: 767px) {
  wrapper {
    padding-left: 16px;
    padding-right: 16px;
  }
  header wrapper {
    padding: 0 6px;
  }

  /* Header: tighter icon cells; the logo shown when scrolled gets smaller so it fits between them. */
  .settings-wrapper > li {
    width: 44px;
  }
  .settings-wrapper > li.language-switcher {
    padding: 0 10px;
  }
  header .logo {
    width: 64px;
    margin-left: -32px;
    font-size: 40px;
    line-height: 54px;
  }
  .is-sticky header .logo {
    top: 10px;
  }

  .video-wrapper {
    padding: 88px 0 28px;
  }
  .video-wrapper logo {
    width: 130px;
    height: 193px;
  }

  /* Section nav becomes a single horizontally scrollable row. */
  #second-header wrapper {
    padding: 0;
  }
  nav,
  nav:not([data-drop="0"]),
  #nav {
    margin-top: 28px;
  }
  #nav {
    flex-wrap: nowrap;
    justify-content: flex-start;
    column-gap: 24px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scroll-padding-inline: 16px;
    scrollbar-width: none;
    padding: 12px 16px;
    -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 16px, #000 calc(100% - 32px), transparent);
    mask-image: linear-gradient(90deg, transparent 0, #000 16px, #000 calc(100% - 32px), transparent);
  }
  #nav::-webkit-scrollbar {
    display: none;
  }
  #nav > li {
    scroll-snap-align: start;
    flex: 0 0 auto;
  }
  #nav > li:after {
    display: none; /* strike-through hover line */
  }
  #nav > li a {
    padding: 6px 0;
  }
  .is-sticky #nav {
    padding: 10px 16px;
  }

  .content {
    margin-top: 24px;
  }
  .content > h1 {
    font-size: 30px;
    margin-bottom: 24px;
  }

  /* One card per row; the feature card stacks like the rest. */
  #dle-content {
    grid-template-columns: minmax(0, 1fr);
    gap: 56px;
  }
  #dle-content > article.cloudGet:nth-of-type(11n-10) {
    text-align: center;
  }
  #dle-content > article.cloudGet:nth-of-type(11n-10) > ul {
    display: block;
  }
  #dle-content > article.cloudGet:nth-of-type(11n-10) h1 {
    font-size: 28px;
    margin-top: 20px;
  }
  #dle-content > article.cloudGet:nth-of-type(11n-10) fieldset.date legend {
    margin: 0 auto;
  }
  .content article.cloudGet h1 {
    font-size: 24px;
  }
  .content article.cloudGet figure {
    aspect-ratio: 4 / 5;
  }
  .page-title-number {
    font-size: 40px;
  }

  /* Pagination: page numbers scroll inside the pill instead of overflowing the screen. */
  .pagination > div {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
  }
  .pagination .current-page {
    display: flex;
    margin: 0 6px;
    padding: 0 10px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .pagination .current-page::-webkit-scrollbar {
    display: none;
  }
  .pagination .current-page a,
  .pagination .current-page span {
    flex: 0 0 auto;
    min-width: 32px;
    margin: 0;
    text-align: center;
  }
  .pagination .next-page a,
  .pagination .next-page span,
  .pagination .prev-page a,
  .pagination .prev-page span {
    width: 44px;
    height: 44px;
    line-height: 44px;
  }

  /* Article page */
  .content article.cloudGet.fullstory figure {
    aspect-ratio: 4 / 3;
  }
  .content article.cloudGet.fullstory h1 {
    font-size: 30px;
  }
  .full-story-data {
    font-size: 16px;
    line-height: 25px;
  }
  .related ul {
    padding: 6px;
  }
  .related ul li {
    width: 50%;
    padding: 8px;
  }

  /* Footer stacks: studio banner, links, contact, copyright. */
  footer {
    margin: 56px -16px 0;
    width: calc(100% + 32px);
  }
  footer ul {
    display: block;
  }
  footer ul li,
  footer ul li:first-child,
  footer ul li:last-child {
    width: 100%;
    padding: 0;
  }
  footer ul li:first-child {
    height: 110px;
  }
  footer ul li:first-child a {
    background-position: 50% 50%;
  }
  footer ul li:last-child {
    display: flex;
    flex-direction: column;
    padding: 24px 20px 32px;
  }
  footer .footer-nav {
    order: 1;
    float: none;
    max-width: none;
    width: auto;
    margin: 0;
    display: flex;
    flex-direction: column;
    line-height: normal;
  }
  footer .footer-nav a {
    margin: 0;
    padding: 12px 0; /* 44px+ touch rows */
    transform: none;
    font-size: 15px;
  }
  footer .footer-nav a:after {
    top: 12px;
    height: auto;
  }
  footer .tel {
    order: 2;
    position: static;
    margin-top: 20px;
    font-size: 15px;
  }
  footer .copyright {
    order: 3;
    float: none;
    text-align: left;
    margin: 20px 0 0;
  }

  /* Fixed bottom "contact us" bar and scroll-to-top button */
  .contSlow {
    height: 44px;
  }
  body.perspmenu button.contactus,
  button.contactus {
    margin-top: 0;
    padding: 12px 14px;
    letter-spacing: 6px;
  }
  .main-section {
    padding-bottom: 44px;
  }
  button.scrollToTop {
    width: 44px;
    height: 44px;
    line-height: 44px;
    right: 16px;
    bottom: 60px;
  }

  /* Off-canvas menu: one link per line, so it needs more of the screen. */
  .outer-nav {
    bottom: 50%;
  }
  body.perspmenu section {
    transform: translateY(30vh) translateZ(-250px) rotateX(47deg);
  }
  .outer-nav a {
    display: block;
    font-size: 20px;
    line-height: 28px;
    margin: 6px 0;
    padding: 6px 0;
  }

  /* About / Services popups */
  .aboutUSPopup > table td {
    padding: 72px 0 16px;
  }
  .aboutUSPopup .closeAboutUS {
    top: 14px;
    right: 14px;
    width: 44px;
    height: 44px;
  }
  .aboutUSPopup .closeAboutUS:before {
    line-height: 44px;
  }
  .abooutUS {
    display: block;
    height: calc(100vh - 104px);
    height: calc(100dvh - 104px);
    margin: 0 12px;
    box-shadow: 0 0 0 6px rgba(13, 16, 31, 0.37);
    -webkit-overflow-scrolling: touch;
  }
  .abooutUS table td {
    padding: 20px 18px;
  }
  .abooutUS .servicesText p {
    padding-left: 0;
    text-align: left;
  }
  .abooutUS .aboutText {
    text-align: left;
  }

  .errors {
    padding: 100px 20px 32px;
    font-size: 15px;
    line-height: 22px;
  }
  .errors h1 {
    font-size: 30px;
  }
}

/* Very narrow phones: drop the social icons from the scrolled header so the logo has room. */
@media screen and (max-width: 400px) {
  .is-sticky .settings-wrapper > li.facebook,
  .is-sticky .settings-wrapper > li.instagram {
    display: none;
  }
}

/* Respect the OS "reduce motion" setting: no 3D menu tilt, smooth scrolling or entrance animations. */
@media (prefers-reduced-motion: reduce) {
  *,
  *:before,
  *:after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}
