/* Responsive behaviour.
   IMPLEMENTATION DECISION — NOT FROM FIGMA: the Figma file read so far contains only the 1920px desktop frames.
   Breakpoints: >=1440 desktop (rules in the section files), 1024-1439 laptop, 768-1023 tablet, <768 mobile.
   Rules are overrides, written desktop-down. Reconcile with the mobile Figma page once it can be read. */

.dn-menu-toggle { display: none; }

/* ======================= Laptop: 1024-1439 (applies below 1440) ======================= */
@media all {   /* mockup-p: was (max-width: 1439px) */
  :root {
    --gutter: 40px;
    /* equals the internal structure of the about/services rows (126 + two fluid gaps), so every heading stays on one line */
    --content-offset: calc(126px + clamp(40px, min(6.5vw, 83.2px), 93px) + clamp(40px, min(7.6vw, 97.28px), 110px));
    --section-space: 120px;
    --fs-h1: clamp(72px, min(7vw, 89.6px), 100px);
    --fs-h2: clamp(60px, min(5.6vw, 71.68px), 80px);
    --fs-stat: clamp(48px, min(4.3vw, 55.04px), 62px);
    --fs-title: clamp(38px, min(3.2vw, 40.96px), 46px);
    --fs-footer-title: clamp(34px, min(2.9vw, 37.12px), 42px);
    --fs-item: clamp(34px, min(2.8vw, 35.84px), 40px);
  }

  .dn-header__row { gap: min(5vw, 64px); }
  .dn-header__bar { gap: 24px; }

  /* Hero */
  .dn-hero__indicator { left: calc(-1 * var(--content-offset)); }
  .dn-hero__lead { width: min(580px, 100%); }

  /* About */
  .dn-about__row { gap: clamp(40px, min(6.5vw, 83.2px), 93px); }
  .dn-about__main { gap: clamp(40px, min(7.6vw, 97.28px), 110px); }
  .dn-about__stamp { right: 6%; }

  /* Bestsellers: the plate keeps its own column; its right edge (0.642 x height) stays 48px left of the text */
  .dn-bestsellers__plate { height: calc((var(--content-offset) - 8px) / 0.642); top: calc((var(--content-offset) - 8px) / -4.6); }
  .dn-bestsellers__grid { grid-template-columns: repeat(3, minmax(0, 1fr)); column-gap: clamp(24px, min(3vw, 38.4px), 69px); width: 100%; max-width: 918px; }

  /* Services */
  .dn-services__layout { gap: clamp(40px, min(6.5vw, 83.2px), 93px); }
  .dn-services__body { flex: 1; min-width: 0; gap: clamp(40px, min(7.6vw, 97.28px), 110px); }
  .dn-services__rows { flex: 1; min-width: 0; width: auto; }
  .dn-service { height: auto; align-items: stretch; }
  .dn-service__image, .dn-service--reverse .dn-service__image { flex: 0 0 50%; width: 50%; height: auto; aspect-ratio: 486 / 450; }
  .dn-service__body { justify-content: flex-end; }
  .dn-service__desc { width: 100%; }
  .dn-service .dn-sticker {
    position: relative; left: auto; top: auto;
    margin: 0 0 4px 12px;
    transform: rotate(var(--dn-rot)) scale(0.85);
    transform-origin: 0 50%;
  }

  /* News */
  .dn-news__row { justify-content: flex-start; padding-left: calc(var(--content-offset) - 106px); gap: 40px; }
  .dn-news__main { flex: 1; min-width: 0; width: auto; }
  .dn-news-card__media { flex: 0 0 50%; width: 50%; height: auto; aspect-ratio: 486 / 360; }
  .dn-news-card__excerpt { width: 100%; }

  /* Contact */
  .dn-contact__form { width: 100%; }

  /* Photo strip */
  .dn-photos { padding-bottom: 96px; }

  /* Footer */
  .dn-footer__inner { gap: 40px; }
  .dn-footer__contact { gap: 20px; flex-wrap: wrap; justify-content: flex-end; }
}

/* Tighter header between 1024 and 1279 */
@media (max-width: 1279px) {
  .dn-header__row { gap: 24px; }
  .dn-nav__list { gap: 28px; }
  .dn-header__actions { gap: 20px; }
  .dn-header__bar .dn-button { padding-inline: 24px; }
  .dn-footer__inner { height: auto; min-height: 208px; }
  .dn-footer__left, .dn-footer__right { gap: 32px; }
}

/* ======================= Tablet: 768-1023 (applies below 1024) ======================= */
@media (max-width: 1023px) {
  :root {
    --gutter: 50px;                  /* Figma 768 and 1024 frames */
    --content-offset: 0px;
    --section-space: 96px;
    --fs-h1: clamp(72px, min(13vw, 166.4px), 100px);
    --fs-h2: 80px;
    --fs-stat: 62px;
    --fs-title: 36px;
    --fs-footer-title: 34px;
    --fs-item: 32px;
  }

  /* Header: logo + menu button, menu opens as a panel */
  .dn-header { padding-top: 24px; }
  .dn-header__row { justify-content: space-between; gap: 16px; }
  .dn-menu-toggle {
    display: grid;
    gap: 5px;
    place-content: center;
    width: 48px;
    height: 48px;
    padding: 0;
    border: 1px solid var(--typography-tertiary);
    border-radius: var(--radius);
    background: transparent;
  }
  .dn-menu-toggle span { display: block; width: 22px; height: 2px; background: var(--typography-tertiary); transition: transform var(--transition), opacity var(--transition); }
  .dn-menu-toggle[aria-expanded="true"] span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
  .dn-menu-toggle[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
  .dn-menu-toggle[aria-expanded="true"] span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
  .dn-menu-toggle:hover { background: var(--button-hover); border-color: var(--button-hover); }
  .dn-menu-toggle:hover span { background: var(--typography-primary); }

  .dn-header__bar {
    display: none;
    position: absolute;
    top: 100%;
    left: 0; right: 0;
    margin-top: 12px;
    flex-direction: column;
    align-items: flex-start;
    gap: 28px;
    padding: 28px var(--gutter) 32px;
    background: var(--background-secondary);
    box-shadow: var(--shadow-popup);
  }
  .dn-header__bar.is-open { display: flex; }
  .dn-nav__list { flex-direction: column; align-items: flex-start; gap: 20px; }
  .dn-header__actions { flex-wrap: wrap; gap: 20px 28px; }
  .dn-nav__item--sub { flex-wrap: wrap; }
  .dn-dropdown, .dn-dropdown--right {
    position: static;
    min-width: 0;
    width: 100%;
    padding: 6px 0 0 16px;
    background: transparent;
    box-shadow: none;
  }
  .dn-dropdown::before { display: none; }
  [data-dn-dropdown]:hover > .dn-dropdown { display: none; }          /* touch: only the toggle opens it */
  [data-dn-dropdown].is-open > .dn-dropdown { display: block; }
  .dn-lang { flex-wrap: wrap; }

  /* Cookie banner: fixed bottom sheet */
  .dn-cookie {
    position: fixed;
    top: auto;
    bottom: 16px;
    padding: 24px;
    gap: 24px;
  }
  .dn-support { right: 16px; bottom: calc(var(--dn-cookie-h, 0px) + 32px); width: 56px; height: 56px; }

  /* Hero */
  /* the text starts at the same height as on desktop (293px); the hero only grows downwards, so the arrows stay 32px under the text */
  .dn-hero { height: auto; min-height: 848px; padding-bottom: 172px; }   /* arrows: bottom 96 + 44 + 32 */
  .dn-hero__indicator { display: none; }
  .dn-hero__nav { top: auto; bottom: 96px; transform: none; }

  /* About */
  .dn-about { padding-top: 96px; }
  .dn-about__row { flex-direction: column; gap: 48px; }
  .dn-about__stats { width: 100%; height: auto; display: grid; grid-template-columns: repeat(2, 1fr); gap: 32px 24px; }
  .dn-about__main > .dn-divider { display: none; }
  .dn-about__body { width: 100%; }
  .dn-about__image { height: auto; aspect-ratio: 1400 / 520; min-height: 260px; margin-top: 48px; }
  .dn-about__stamp { width: 160px; height: 160px; top: -80px; right: 24px; }

  /* Bestsellers: plate moves into the flow above the heading, cropped by the left edge */
  .dn-bestsellers .dn-offset { padding-left: 0; }
  .dn-bestsellers__plate { position: relative; display: block; left: -40px; top: 0; height: 320px; margin-bottom: -120px; }
  .dn-bestsellers__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); --row-space: 40px; }

  /* Services: index and divider hidden (purpose still undecided in the design) */
  .dn-services__layout { margin-top: 32px; }
  .dn-services__index, .dn-services__body > .dn-divider { display: none; }
  .dn-service__body { padding-bottom: 32px; gap: 28px; }

  /* News */
  .dn-news__row { flex-direction: column; align-items: flex-start; gap: 32px; }
  .dn-news__indicator { flex-direction: row; width: auto; gap: 20px; align-items: center; }
  .dn-news__indicator .dn-indicator__bar { width: 40px; height: 4px; margin: 0; }
  .dn-news__indicator .dn-indicator__num { width: 64px; height: 40px; margin: 0; }
  .dn-news__indicator .dn-indicator__num span { width: 64px; height: 40px; font-size: 44px; line-height: 40px; }
  .dn-news__indicator .dn-indicator__dots { flex-direction: row; gap: 16px; }
  .dn-news.is-slider .dn-news__sticky { align-items: flex-start; padding-top: 12vh; }
  .dn-news.is-slider .dn-news__row { align-items: flex-start; }
  .dn-news__main { width: 100%; }

  /* Contact */
  .dn-contact__row { flex-wrap: wrap; }
  .dn-contact__row > * { flex: 1 1 calc(33% - 12px); min-width: 180px; }


  /* Footer */
  .dn-footer__inner { flex-direction: column; height: auto; gap: 40px; }
  .dn-footer__left, .dn-footer__right { height: auto; gap: 32px; }
  .dn-footer__right { align-items: flex-start; }
  .dn-footer__friends { align-items: flex-start; }
  .dn-footer__contact { justify-content: flex-start; }
  .dn-footer__ghost { opacity: 0.6; }
}

/* ======================= Mobile: below 768 ======================= */
@media (max-width: 767px) {
  :root {
    --gutter: 20px;
    --section-space: 64px;
    --fs-h1: 72px;                   /* Figma 375 frame */
    --fs-h2: 62px;
    --fs-stat: 56px;
    --fs-title: 32px;
    --fs-footer-title: 30px;
    --fs-item: 28px;
    --fs-text: 16px;
  }
  body { font-size: 16px; }

  .dn-header { padding-top: 16px; }
  .dn-header__logo { width: 80px; height: 51px; }
  .dn-menu-toggle { width: 44px; height: 44px; }
  .dn-header__actions { flex-direction: column; align-items: flex-start; }
  .dn-button { font-size: 16px; padding-inline: 28px; }
  .dn-support { width: 52px; height: 52px; }

  .dn-cookie { flex-direction: column; align-items: stretch; gap: 16px; padding: 20px; }
  .dn-cookie .dn-button { width: 100%; }
  .dn-cookie__text { font-size: 14px; }

  /* Hero */
  .dn-hero { min-height: 640px; }
  .dn-hero__title { white-space: normal; }
  .dn-hero__lead { font-size: 16px; }
  .dn-hero__bubble--one { left: 0; top: -104px; width: 206px; height: 93px; }
  .dn-bubble { --bs: 0.75; }   /* RU / EL live-text bubbles: same 75% as the artwork above */
  .dn-hero__bubble--two { left: 100px; top: -88px; width: 232px; height: 90px; }

  /* About */
  .dn-about { padding-top: 64px; }
  .dn-about__stats { gap: 28px 16px; }
  .dn-about__image { width: 100%; aspect-ratio: 4 / 3; margin-top: 40px; }   /* width: min-height + aspect-ratio would widen it past the container at 360px */
  .dn-about__stamp { width: 112px; height: 112px; top: -56px; right: 16px; }

  /* Bestsellers */
  .dn-bestsellers__grid { grid-template-columns: 1fr; }
  .dn-bestsellers__plate { height: 230px; left: -30px; margin-bottom: -80px; }
  .dn-bestsellers__inner { gap: 36px; }
  .dn-bestsellers__head { margin-bottom: 8px; }
  .dn-bestsellers__head { gap: 12px; }
  .dn-bestsellers__nav { gap: 8px; flex: none; }
  .dn-bestsellers__arrow { width: 40px; height: 40px; }

  /* Services: image on top, sticker overlapping its bottom edge, text below */
  .dn-services__layout { margin-top: 24px; }
  .dn-services__rows { display: flex; flex-direction: column; gap: 48px; }
  .dn-service, .dn-service--reverse { flex-direction: column; align-items: stretch; gap: 0; }
  .dn-service__image, .dn-service--reverse .dn-service__image { order: 1; flex: none; width: 100%; aspect-ratio: 486 / 450; }
  .dn-service__body { order: 3; padding: 0; gap: 24px; }
  .dn-service .dn-sticker { align-self: flex-start; margin: -40px 0 4px 16px; }

  /* News */
  .dn-news-card { flex-direction: column; align-items: stretch; gap: 24px; }
  .dn-news-card__media { flex: none; width: 100%; height: auto; aspect-ratio: 486 / 360; }

  /* Contact */
  .dn-contact__row { flex-direction: column; flex-wrap: nowrap; }
  .dn-contact__row > * { flex: none; width: 100%; min-width: 0; }
  .dn-contact__form .dn-button { width: 100%; }

  /* Photo strip */
  .dn-photos { padding-bottom: 64px; }

  /* Footer */
  .dn-footer { padding: 48px 0; }
  .dn-newsletter { width: 100%; }
  .dn-footer__title { white-space: normal; }
  .dn-footer__legal { flex-direction: column; align-items: flex-start; gap: 16px; }
  .dn-footer__contact { flex-direction: column; gap: 12px; }
  .dn-footer__ghost { display: none; }
}


/* ======================= Inner pages (pages.css): provisional, same breakpoints ======================= */
.dn-contact-info { margin-top: 228px; }
@media (max-width: 1279px) {
  .dn-contact-page { gap: 48px; }
  .dn-service-top { gap: 40px; }
  .dn-service-top__image { width: 38%; }
  .dn-listing { gap: 48px; }
  .dn-listing__body { gap: 48px; }
  .dn-news-row__image { width: 280px; height: 240px; }
  .dn-article__title { font-size: 56px; }
}
@media (max-width: 1023px) {
  .dn-page { padding-top: 96px; }
  .dn-block, .dn-page > .dn-container + .dn-container { margin-top: 80px; }
  .dn-cols { grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 40px 24px; }
  .dn-service-top { flex-direction: column; }
  .dn-service-top__image { width: 100%; aspect-ratio: 16 / 10; }
  .dn-contact-page { flex-direction: column; align-items: stretch; }
  .dn-contact-info { margin-top: 0; }
  .dn-contact-page__form > div[style] { margin-top: 40px !important; }
  .dn-listing { flex-direction: column; gap: 32px; }
  .dn-filter { flex-direction: row; width: auto; gap: 32px; }
  .dn-filter a { flex-direction: row; align-items: baseline; gap: 10px; }
  .dn-listing__body > .dn-divider { display: none; }
  .dn-news-row { flex-direction: column-reverse; align-items: stretch; gap: 24px; }
  .dn-news-row__image { width: 100%; height: auto; aspect-ratio: 360 / 240; }
  .dn-article__title { font-size: 48px; }
  .dn-article-nav { margin-top: 64px; }
  .dn-map { height: 320px; }
}
@media (max-width: 767px) {
  .dn-page { padding-top: 64px; }
  .dn-block, .dn-page > .dn-container + .dn-container { margin-top: 56px; }
  .dn-cols { grid-template-columns: 1fr; }
  .dn-article__title { font-size: 36px; }
  .dn-article__text { font-size: 18px; }
  .dn-article__content { gap: 32px; }
  .dn-article-nav { margin-top: 48px; grid-template-columns: minmax(0, 1fr); }
  .dn-article-nav__link--next { grid-column: auto; align-items: flex-start; text-align: left; }
  .dn-article-nav__title { font-size: 20px; }
  .dn-pagehead { height: 120px; }
  .dn-map { height: 260px; }
  .dn-contact-info li { gap: 20px; }
  .dn-search { width: 100%; }
  .dn-notfound .dn-heading { font-size: var(--fs-h2); }
}

/* News slider numbers on tablet/mobile: horizontal indicator, digits not rotated, they roll vertically */
@media (max-width: 1023px) {
  .dn-news.is-slider .dn-indicator__num--roll span { transform: translateY(24px); }
  .dn-news.is-slider .dn-indicator__num--roll span.is-past { transform: translateY(-24px); }
  .dn-news.is-slider .dn-indicator__num--roll span.is-active { transform: none; }
  .dn-news__indicator .dn-indicator__num span { transform: none; }
}

/* Homepage corporate-clients notice (not dismissible): on tablet/phone it stays where it is on desktop, overlapping the bottom of the hero,
   instead of becoming a fixed bottom sheet like the cookie banner */
@media (max-width: 1023px) {
  .dn-cookie.dn-notice { position: relative; top: auto; bottom: auto; left: auto; transform: none; margin: -60px auto 40px; width: min(var(--container), 100% - 2 * var(--gutter)); }
}

/* The news tag menu is a real filter, so it stays visible where the home services index is hidden */
@media (max-width: 1279px) {
  .dn-services__index.dn-filter { display: flex; }
}
@media (max-width: 1023px) {
  .dn-filter { flex-wrap: wrap; }
}

/* mockup-p: the plate fills the side margin on wide screens */
@media (min-width: 1280px) {
  .dn-bestsellers__plate { --h: min(794px, calc((50vw - 600px + var(--content-offset) - 43px) / 0.642)); height: var(--h); top: calc(var(--h) * -0.14); }
}
