/* OCEX Hero Banner - full-width hero with live HTML text.
   Desktop (768px and up): the text sits over the calm side of the image, lined up with the
   page container, on a soft shade for legibility. Phones: the text moves below the image,
   so the picture is never covered or cropped. Controls follow OCEX Banner: thin line dots,
   arrows only on hover. Own namespace only (.ocex-hero...); the single page-level rule is
   the overflow-x clip on pages that show a full-width hero (the OCEX Rows technique). */

.ocex-hero {
  position: relative;
  /* 100cqw inside = the width of the page container: a full-width hero lines its text up with it */
  container-type: inline-size;
  margin: 0 0 30px;
}

/* --- full width: break out of the page container ----------------------- */
.ocex-hero--full .ocex-hero-frame {
  width: 100vw;
  max-width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
}

/* 100vw includes the vertical scrollbar, so the frame overhangs the viewport by its width:
   clip it on the page level, but only on pages that show a full-width hero. clip (unlike
   hidden) creates no scroll container, so position: sticky keeps working. */
html:has(.ocex-hero--full) {
  overflow-x: clip;
}
@supports not (overflow: clip) {
  html:has(.ocex-hero--full) { overflow-x: hidden; }
}

/* An OCEX Rows cell clips its own sideways overflow (against stray third-party modules), which
   cut the breakout back to the cell on the live homepage: a cell that holds a full-width hero
   lets it through. The page-level clip above still keeps the page from scrolling sideways. */
.ocex-row-cell:has(.ocex-hero--full) {
  overflow-x: visible;
}

/* --- slider ------------------------------------------------------------- */
.ocex-hero-frame { position: relative; }
.ocex-hero-vp { overflow: hidden; }
.ocex-hero-tray {
  display: flex;
  touch-action: pan-y pinch-zoom;
}
.ocex-hero-slide {
  position: relative;
  flex: 0 0 100%;
  min-width: 0;
}

/* --- image -------------------------------------------------------------- */
.ocex-hero-media {
  position: relative;
  /* a set width: with an auto width, aspect-ratio would carry a max height over to the width and the
     box would get narrower instead of cropping the image */
  width: 100%;
  aspect-ratio: var(--ocex-hero-ar, 2 / 1);
  /* optional limit for very wide screens: the image is cropped evenly at the top and bottom */
  max-height: var(--ocex-hero-max, none);
  overflow: hidden;
  background: #eef0f3;
}
/* tr-697: the <picture> wrapper (960 px + WebP sources) takes no box, the img stays the child of the frame */
.ocex-hero-media picture { display: contents; }
.ocex-hero-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  -webkit-user-drag: none;
}

/* --- text --------------------------------------------------------------- */
/* the theme's h2 look (padding, accent bar on the left, light colour in dark mode) is left off: the
   hero has its own type. Two classes, so it beats the theme's [data-ocex-theme="dark"] h2 colour. */
.ocex-hero .ocex-hero-title {
  margin: 0 0 .35em;
  padding: 0;
  border: 0;
  font-family: inherit;
  font-size: clamp(22px, 1.7vw + 13px, 48px);
  font-weight: 700;
  line-height: 1.15;
  color: inherit;
}
/* tr-1115: as H1 the headline keeps the same look. Themes often size the page title by id (e.g.
   "#content h1"), which beats any class rule, so the hero's own type is enforced here. */
.ocex-hero h1.ocex-hero-title {
  margin: 0 0 .35em !important;
  font-size: clamp(22px, 1.7vw + 13px, 48px) !important;
  line-height: 1.15 !important;
}
.ocex-hero-text {
  margin: 0;
  font-size: clamp(15px, .45vw + 11px, 19px);
  line-height: 1.5;
}
/* two classes here as well: the theme's [data-ocex-theme="dark"] a colour would win over one */
.ocex-hero .ocex-hero-btn {
  display: inline-block;
  margin-top: 1.1em;
  padding: .75em 1.6em;
  border-radius: 6px;
  background: var(--dide, #ed1e24);
  color: #fff;
  font-size: clamp(15px, .3vw + 12px, 17px);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  text-shadow: none;
  transition: filter .15s;
  -webkit-user-drag: none;
}
.ocex-hero .ocex-hero-btn:hover,
.ocex-hero .ocex-hero-btn:focus {
  color: #fff;
  text-decoration: none;
  filter: brightness(.9);
}

/* With a link the whole slide is clickable: the button (or an empty link when the slide has no
   button label) stretches over the slide. Embla swallows the click that ends a drag. */
.ocex-hero-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}
.ocex-hero-hit {
  position: absolute;
  inset: 0;
  z-index: 1;
}

/* --- desktop: the text over the image ----------------------------------- */
@media (min-width: 768px) {
  /* "Fill the screen": the image box ends at the bottom of the first screen, so nothing hangs below
     it. --ocex-hero-top (everything above the hero) and --ocex-hero-below (the part of the tiles
     below the image) come from the small script after the hero markup. The box only ever shrinks
     (the image is cropped evenly at the top and bottom), never below 360px, and a max height in px
     still applies. */
  .ocex-hero--fit .ocex-hero-media {
    max-height: min(var(--ocex-hero-max, 9999px), max(360px, calc(100vh - var(--ocex-hero-top, 0px) - var(--ocex-hero-below, 0px))));
  }
  /* tablets: svh = the screen with the browser bars shown */
  @supports (height: 100svh) {
    .ocex-hero--fit .ocex-hero-media {
      max-height: min(var(--ocex-hero-max, 9999px), max(360px, calc(100svh - var(--ocex-hero-top, 0px) - var(--ocex-hero-below, 0px))));
    }
  }
  .ocex-hero-copy {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    padding: 0 48px;
    pointer-events: none;
  }
  /* a full-width hero lines its text up with the page content (without container units: 48px) */
  .ocex-hero--full .ocex-hero-copy {
    padding-left: max(24px, (100vw - 100cqw) / 2);
    padding-right: max(24px, (100vw - 100cqw) / 2);
  }
  .ocex-hero-slide--right .ocex-hero-copy { justify-content: flex-end; }
  .ocex-hero-box {
    width: 42%;
    min-width: 320px;
    max-width: 600px;
    pointer-events: auto;
  }
  .ocex-hero-slide--light .ocex-hero-box {
    color: #fff;
    text-shadow: 0 1px 3px rgba(0, 0, 0, .35);
  }
  .ocex-hero-slide--dark .ocex-hero-box { color: #161b22; }

  /* "Caption is on the image" (admin switch, tr-655): the picture carries the caption on computers, so the
     HTML text and the shade are left off and the image shows as it is; a link keeps the slide clickable
     through .ocex-hero-hit. Phones are not affected: this sits inside the desktop block only. */
  .ocex-hero-slide--onimg .ocex-hero-copy { display: none; }
  .ocex-hero-slide--onimg .ocex-hero-media::after { display: none; }

  /* soft shade on the text side, for legibility on any image */
  .ocex-hero-media::after {
    content: "";
    position: absolute;
    inset: 0;
    pointer-events: none;
  }
  .ocex-hero-slide--light .ocex-hero-media::after {
    background: linear-gradient(90deg, rgba(12, 16, 22, .55) 0%, rgba(12, 16, 22, .3) 35%, rgba(12, 16, 22, 0) 62%);
  }
  .ocex-hero-slide--light.ocex-hero-slide--right .ocex-hero-media::after {
    background: linear-gradient(270deg, rgba(12, 16, 22, .55) 0%, rgba(12, 16, 22, .3) 35%, rgba(12, 16, 22, 0) 62%);
  }
  .ocex-hero-slide--dark .ocex-hero-media::after {
    background: linear-gradient(90deg, rgba(255, 255, 255, .8) 0%, rgba(255, 255, 255, .5) 35%, rgba(255, 255, 255, 0) 62%);
  }
  .ocex-hero-slide--dark.ocex-hero-slide--right .ocex-hero-media::after {
    background: linear-gradient(270deg, rgba(255, 255, 255, .8) 0%, rgba(255, 255, 255, .5) 35%, rgba(255, 255, 255, 0) 62%);
  }
}

/* --- phones: the text below the image ----------------------------------- */
@media (max-width: 767px) {
  .ocex-hero-copy { padding: 14px 0 2px; }
  .ocex-hero--full .ocex-hero-copy {
    padding-left: 15px;
    padding-right: 15px;
    padding-left: max(15px, (100vw - 100cqw) / 2);
    padding-right: max(15px, (100vw - 100cqw) / 2);
  }
}

/* --- arrows: desktop only, on hover only -------------------------------- */
.ocex-hero-arrow {
  position: absolute;
  top: 50%;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .78);
  color: #2b3440;
  cursor: pointer;
  opacity: 0;
  transform: translateY(-50%);
  transition: opacity .18s;
}
.ocex-hero-arrow svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ocex-hero-prev { left: 16px; }
.ocex-hero-next { right: 16px; }
/* a full-width frame overhangs the viewport by half a scrollbar on each side: keep ~16px visible */
.ocex-hero--full .ocex-hero-prev { left: 24px; }
.ocex-hero--full .ocex-hero-next { right: 24px; }
.ocex-hero:hover .ocex-hero-arrow,
.ocex-hero-arrow:focus-visible { opacity: 1; }
.ocex-hero-arrow:hover { background: #fff; }
.ocex-hero-arrow[hidden] { display: none; }
@media (max-width: 767px), (hover: none) {
  .ocex-hero-arrow { display: none; }
}

/* --- line dots: a 3px bar inside a taller, easier to tap button ---------- */
/* background-color only: the background shorthand would reset the content-box clip */
.ocex-hero-dots {
  display: flex;
  justify-content: center;
  gap: 7px;
  padding: 4px 0 0;
}
.ocex-hero-dot {
  width: 18px;
  height: 19px;
  padding: 8px 0;
  border: 0;
  border-radius: 2px;
  background-color: rgba(0, 0, 0, .18);
  background-clip: content-box;
  cursor: pointer;
  transition: background-color .15s;
}
.ocex-hero-dot.on { background-color: var(--dide, #ed1e24); }

/* desktop: the dots sit on the image, near its bottom edge; a light bar with a thin dark halo
   (drop-shadow follows the painted 3px bar) shows on light and dark pictures alike */
@media (min-width: 768px) {
  .ocex-hero-dots {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 8px;
    z-index: 2;
    padding: 0;
    pointer-events: none;
  }
  .ocex-hero-dot {
    background-color: rgba(255, 255, 255, .9);
    filter: drop-shadow(0 0 1px rgba(0, 0, 0, .55));
    pointer-events: auto;
  }
}

/* --- category tiles ------------------------------------------------------ */
/* Phones: two columns below the slider. Computers: one row in the page container, pulled up over
   the bottom edge of the image by --ocex-hero-lift; the dots and the text move up by the same
   amount, so the tiles cover none of them. A tile: the category icon above the name (the full
   tile width is left for long names in every language); the arrow only where there is room. */
.ocex-hero-tiles {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}
/* two classes: the theme's [data-ocex-theme="dark"] a colour would win over one */
.ocex-hero .ocex-hero-tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  padding: 12px;
  border: 1px solid #e3e6ea;
  border-radius: 8px;
  background: #fff;
  color: #161b22;
  text-decoration: none;
  transition: box-shadow .18s, transform .18s;
  /* the name is sized to the tile (cqi units) */
  container-type: inline-size;
}
.ocex-hero-tile-img {
  width: 30px;
  height: 30px;
}
.ocex-hero-tile-img img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.ocex-hero-tile-name {
  max-width: 100%;
  margin-top: 8px;
  font-size: 13px;
  /* as large as the tile allows: a 17-letter word ("Alarmkommunikator") still fits on one line */
  font-size: clamp(13px, 100cqi / 11.5, 15px);
  font-weight: 600;
  line-height: 1.25;
  overflow-wrap: break-word;
  hyphens: auto;
}
.ocex-hero-tile-go { display: none; }

@media (min-width: 768px) {
  .ocex-hero--tiles { --ocex-hero-lift: clamp(40px, 4vw, 72px); }
  .ocex-hero-tiles {
    grid-template-columns: repeat(var(--ocex-hero-n, 4), minmax(0, 1fr));
    gap: clamp(12px, 1.1vw, 20px);
    margin-top: calc(-1 * var(--ocex-hero-lift));
    /* the gaps between the tiles let a click through to the slide below */
    pointer-events: none;
  }
  .ocex-hero .ocex-hero-tile {
    padding: clamp(14px, 1.25vw, 24px);
    border-color: rgba(16, 24, 40, .06);
    box-shadow: 0 10px 30px rgba(16, 24, 40, .16);
    pointer-events: auto;
  }
  .ocex-hero-tile-img {
    width: clamp(40px, 2.9vw, 56px);
    height: clamp(40px, 2.9vw, 56px);
  }
  .ocex-hero-tile-name {
    margin-top: 12px;
    font-size: clamp(14px, .5vw + 9px, 17px);
    font-size: clamp(13px, min(100cqi / 11.5, .5vw + 9px), 17px);
    font-weight: 700;
  }
  .ocex-hero .ocex-hero-tile:hover,
  .ocex-hero .ocex-hero-tile:focus-visible {
    color: #161b22;
    text-decoration: none;
    transform: translateY(-2px);
    box-shadow: 0 14px 36px rgba(16, 24, 40, .22);
  }

  .ocex-hero--tiles .ocex-hero-dots { bottom: calc(var(--ocex-hero-lift) + 10px); }
  .ocex-hero--tiles .ocex-hero-copy { padding-bottom: var(--ocex-hero-lift); }
  .ocex-hero--tiles .ocex-hero-arrow { top: calc(50% - var(--ocex-hero-lift) / 2); }
}
/* wide screens: an arrow in the bottom right corner, beside the last line of the name */
@media (min-width: 1200px) {
  .ocex-hero-tile-name { padding-right: 26px; }
  .ocex-hero-tile-go {
    display: block;
    position: absolute;
    right: clamp(14px, 1.25vw, 24px);
    bottom: clamp(14px, 1.25vw, 24px);
    width: 20px;
    height: 20px;
    fill: none;
    stroke: var(--dide, #ed1e24);
    stroke-width: 2.2;
    stroke-linecap: round;
    stroke-linejoin: round;
    transition: transform .18s;
  }
  .ocex-hero-tile:hover .ocex-hero-tile-go,
  .ocex-hero-tile:focus-visible .ocex-hero-tile-go { transform: translateX(3px); }
}
@media (prefers-reduced-motion: reduce) {
  .ocex-hero .ocex-hero-tile,
  .ocex-hero-tile-go { transition: none; }
}

/* --- dark mode ---------------------------------------------------------- */
[data-ocex-theme="dark"] .ocex-hero-media { background: #262a33; }
[data-ocex-theme="dark"] .ocex-hero .ocex-hero-tile {
  border-color: #424757;
  background: var(--awhi, #2b2e39);
  color: var(--dtxt, #d9d9d9);
}
@media (min-width: 768px) {
  [data-ocex-theme="dark"] .ocex-hero .ocex-hero-tile { box-shadow: 0 10px 30px rgba(0, 0, 0, .4); }
  [data-ocex-theme="dark"] .ocex-hero .ocex-hero-tile:hover,
  [data-ocex-theme="dark"] .ocex-hero .ocex-hero-tile:focus-visible {
    color: var(--dtxt, #d9d9d9);
    box-shadow: 0 14px 36px rgba(0, 0, 0, .5);
  }
}
/* phones only: there the dots sit on the page; on desktop they are on the image in both themes */
@media (max-width: 767px) {
  [data-ocex-theme="dark"] .ocex-hero-dot { background-color: rgba(255, 255, 255, .22); }
  [data-ocex-theme="dark"] .ocex-hero-dot.on { background-color: var(--dide, #ed1e24); }
}
[data-ocex-theme="dark"] .ocex-hero-arrow { background: rgba(38, 42, 51, .82); color: #dfe4ea; }
[data-ocex-theme="dark"] .ocex-hero-arrow:hover { background: #262a33; }
