/* Tables inside technical guides on phones (MOBIL-RYCHLE-UPRAVY K3, 22. 11. 2026).
   Night audit on a 375 px phone: guide tables were wider than the screen (heat pump 701 px in a 313 px box, the price
   column out of sight; Wi-Fi repeater 560 px; magnetic contact 520 px) and nothing showed they scroll sideways.
   Cause: content-tables-20261025.css gives every cell of a 3+ column table min-width:140px on phones and the guide HTML
   sets min-width:640px inline on the table.
   Scope: loaded by information/information.twig only when guides_nav is set (pages listed in
   system/library/eletur_guides.php), every rule starts with #information-information:has(.et-guides-nav) .et-richtext and
   sits inside max-width:767px (same breakpoint as content-tables-20261025.css, at exactly 768 px nothing changes), so desktop, product cards, category texts and all other information pages stay the same.
   Same table filter as content-tables-20261025.css (no Bootstrap .table, no styl_tabulek.py tables, no layout tables).
   Only CSS: guide texts in the database are not changed. Browsers without :has() skip it and keep the previous look. */

@property --et-guide-fade {
  syntax: "<length>";
  inherits: false;
  initial-value: 0px;
}

@media (max-width: 767px) {
  /* Narrower, wrapping cells: 13 px text, small padding, columns may wrap instead of pushing the table to 700 px */
  #information-information:has(.et-guides-nav) .et-richtext table:not(.table):not([style*="#d9dde1"]):not(:has(img, table, [style*="#d9dde1"])):has(td, th) {
    min-width: 0 !important;
    font-size: 13px;
    line-height: 1.4;
  }

  /* Tables with inline table-layout:fixed (guide "Chytrá klika nebo chytrý zámek", min-width:760px inline): with
     min-width:0 a fixed layout squeezes them into equal 78 px columns that break words in the middle; auto layout
     lets the columns size by content and the table scrolls sideways instead. Both spellings ("table-layout:fixed"
     and "table-layout: fixed"), any letter case. */
  #information-information:has(.et-guides-nav) .et-richtext table:not(.table):not([style*="#d9dde1"]):not(:has(img, table, [style*="#d9dde1"])):has(td, th):is([style*="table-layout:fixed" i], [style*="table-layout: fixed" i]) {
    table-layout: auto !important;
  }

  #information-information:has(.et-guides-nav) .et-richtext table:not(.table):not([style*="#d9dde1"]):not(:has(img, table, [style*="#d9dde1"])):has(td, th) :is(td, th) {
    padding: 6px 8px;
    font-size: 13px;
    overflow-wrap: break-word;
    hyphens: auto;
  }

  #information-information:has(.et-guides-nav) .et-richtext table:not(.table):not([style*="#d9dde1"]):not(:has(img, table, [style*="#d9dde1"])):has(td, th):has(tr > :nth-child(3)) :is(td, th) {
    min-width: 6.5em; /* 85 px instead of 140 px */
  }

  /* First column stays in place while the rest scrolls (tables with 3+ columns and no inline cell styles) */
  #information-information:has(.et-guides-nav) .et-richtext table:not(.table):not([style*="#d9dde1"]):not(:has(img, table, [style], [bgcolor])):has(tr > :nth-child(3)) tr > :first-child {
    position: sticky;
    left: 0;
    z-index: 1;
    max-width: 38vw;
    box-shadow: 4px 0 6px -4px rgba(0, 0, 0, .28);
  }

  #information-information:has(.et-guides-nav) .et-richtext table:not(.table):not([style*="#d9dde1"]):not(:has(img, table, [style], [bgcolor])):has(tr > :nth-child(3)) tbody > tr:has(td):nth-child(odd) > :first-child {
    background-color: #fff; /* even rows keep the zebra colour, header cells keep the dark header */
  }

  /* Hint that the table scrolls: the right edge fades out while there is more to the right.
     The scroll container is the guide's own wrapper (div with overflow-x:auto) or the table itself (display:block from
     eletur.css). With scroll-driven animations the fade follows the scroll and is absent when nothing overflows. */
  #information-information:has(.et-guides-nav) .et-richtext :is(div:has(> table tr > :nth-child(3)), table:not(.table):has(tr > :nth-child(3))) {
    --et-guide-fade: 0px;
  }
}

@supports (animation-timeline: scroll()) {
  @keyframes et-guide-table-fade {
    0%, 92% { --et-guide-fade: 32px; }
    100% { --et-guide-fade: 0px; }
  }

  @media (max-width: 767px) {
    #information-information:has(.et-guides-nav) .et-richtext :is(div:has(> table tr > :nth-child(3)), table:not(.table):not([style*="display:table"]):has(tr > :nth-child(3))) {
      -webkit-mask-image: linear-gradient(to right, #000 calc(100% - var(--et-guide-fade)), rgba(0, 0, 0, .15));
      mask-image: linear-gradient(to right, #000 calc(100% - var(--et-guide-fade)), rgba(0, 0, 0, .15));
      animation: et-guide-table-fade linear both;
      animation-timeline: scroll(self inline);
    }
  }
}

@supports not (animation-timeline: scroll()) {
  @media (max-width: 767px) {
    /* Older browsers: a light fixed fade on the right edge of wide tables */
    #information-information:has(.et-guides-nav) .et-richtext div:has(> table tr > :nth-child(4)) {
      -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 20px), rgba(0, 0, 0, .35));
      mask-image: linear-gradient(to right, #000 calc(100% - 20px), rgba(0, 0, 0, .35));
    }
  }
}
