/*
 * HS Ziua României (1 Decembrie): home banner in place of the slider.
 * Loaded only on the home page while the banner is shown; html.hs-ro exists only then, so nothing else changes.
 * Same box as the Black Friday / Winter Sales banners (max 1400 px, 44 px padding, 24 / 18 px on phones).
 * Tricolour: official blue #002B7F, yellow #FCD116, red #CE1126. Flag and sparkles are CSS only (transform / opacity).
 */

html.hs-ro .hs-ro-hero {
  --ro-blue: #002B7F;
  --ro-yellow: #FCD116;
  --ro-red: #CE1126;
  --ro-night: #00153f;
  --ro-tricolour: linear-gradient(90deg, var(--ro-blue) 0 33.34%, var(--ro-yellow) 33.34% 66.67%, var(--ro-red) 66.67%);
  position: relative;
  margin: 0 0 24px;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(ellipse 45% 85% at 84% 45%, rgba(252, 209, 22, .16), transparent 70%),
    radial-gradient(ellipse 45% 80% at 0% 100%, rgba(206, 17, 38, .2), transparent 65%),
    radial-gradient(ellipse 50% 70% at 30% 0%, rgba(255, 255, 255, .08), transparent 70%),
    linear-gradient(150deg, #00358f 0%, #002468 48%, var(--ro-night) 100%);
  color: #fff;
  border-bottom: 5px solid var(--ro-yellow);
  border-image: var(--ro-tricolour) 1;
}

/* ---------- the slider is hidden while the banner is there (written by the server right after the header) ---------- */

html.hs-ro .hs-ro-hero ~ .top-row .grid-row:has(.module-master_slider) { display: none !important; }
/* the next row's top wave was drawn over the slider; it would cut into the banner */
html.hs-ro .hs-ro-hero ~ .top-row .grid-row:has(.module-master_slider) ~ .grid-row svg.wave-top { display: none !important; }

/* On the desktop home Journal3 pulls the content under the header (".desktop.route-common-home header
   { margin-bottom: -60px }", option "Top bar over"); --hs-ro-over is that height, so the banner starts below the header.
   Same selector as the theme, so it applies from the first paint. */
html.hs-ro.desktop.route-common-home .site-wrapper > header + .hs-ro-hero { margin-top: var(--hs-ro-over, 0px); }

/* ---------- layout ---------- */

html.hs-ro .hs-ro-hero-inner {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px 40px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 44px 24px;
}

html.hs-ro .hs-ro-hero-text { flex: 1 1 auto; min-width: 0; }

html.hs-ro .hs-ro-eyebrow {
  margin: 0 0 8px;
  color: var(--ro-yellow);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: .22em;
  text-transform: uppercase;
}

html.hs-ro .hs-ro-title {
  margin: 0;
  color: #fff;
  font-size: clamp(32px, 5.4vw, 72px);
  font-weight: 900;
  line-height: 1.04;
  letter-spacing: -.005em;
  text-shadow: 0 2px 18px rgba(0, 10, 40, .35);
}

html.hs-ro .hs-ro-sub {
  max-width: 560px;
  margin: 14px 0 22px;
  color: #e6ecf8;
  font-size: clamp(16px, 1.8vw, 21px);
  line-height: 1.4;
}

html.hs-ro .hs-ro-cta,
html.hs-ro .hs-ro-cta:visited {
  position: relative;
  display: inline-block;
  overflow: hidden;
  padding: 14px 26px;
  background: var(--ro-yellow);
  color: var(--ro-blue);
  font-size: 16px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: .05em;
  text-decoration: none;
  text-transform: uppercase;
  border-radius: 4px;
  transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease;
}

html.hs-ro .hs-ro-cta:hover,
html.hs-ro .hs-ro-cta:focus-visible {
  background: #fff;
  color: var(--ro-blue);
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(252, 209, 22, .35);
}

html.hs-ro .hs-ro-cta:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }

html.hs-ro .hs-ro-preview-note {
  position: absolute;
  top: 0;
  left: 50%;
  z-index: 2;
  margin: 0;
  padding: 3px 10px;
  background: var(--ro-yellow);
  color: var(--ro-night);
  font-size: 12px;
  white-space: nowrap;
  border-radius: 0 0 4px 4px;
  transform: translateX(-50%);
}

html.hs-ro .hs-ro-preview-note a { color: var(--ro-night); text-decoration: underline; }

/* ---------- the flag: pole + cloth in 40 vertical slices that move up and down one after another (a wave) ---------- */

html.hs-ro .hs-ro-flag {
  --fw: clamp(170px, 19vw, 270px);
  --fh: calc(var(--fw) * 2 / 3);
  --pw: calc(4px + var(--fw) / 60);
  position: relative;
  flex: 0 0 auto;
  width: calc(var(--pw) + var(--fw));
  height: calc(var(--fh) * 1.38);
  margin: calc(var(--pw) * 1.2) clamp(0px, 3vw, 56px) 0 0;
}

html.hs-ro .hs-ro-pole {
  position: absolute;
  z-index: 1;
  top: 0;
  bottom: 0;
  left: 0;
  width: var(--pw);
  background: linear-gradient(90deg, #8a6a22, #f3e2a6 40%, #c9a24a 70%, #7d5f1d);
  border-radius: var(--pw) var(--pw) 0 0;
  -webkit-mask-image: linear-gradient(#000 72%, transparent);
  mask-image: linear-gradient(#000 72%, transparent);
}

/* the ball on top of the pole (on the flag box: the pole's fade-out mask would cut it) */
html.hs-ro .hs-ro-flag::before {
  content: "";
  position: absolute;
  z-index: 2;
  left: calc(var(--pw) / 2);
  top: calc(var(--pw) * -1.5);
  width: calc(var(--pw) * 2.2);
  height: calc(var(--pw) * 2.2);
  background: radial-gradient(circle at 35% 30%, #fff6d0, #e0b84e 45%, #9c7424);
  border-radius: 50%;
  transform: translateX(-50%);
}

html.hs-ro .hs-ro-cloth {
  position: absolute;
  top: calc(var(--pw) * .6);
  left: calc(var(--pw) - 1px);
  display: flex;
  width: var(--fw);
  height: var(--fh);
}

/* Slice i shows its part of the tricolour; each is 1 px wider and overlaps the next, so no gap shows between them.
   --a: amplitude, small at the pole and larger towards the free end. Each slice runs the same up / down movement a little
   later than the one before it, so the wave travels away from the pole (about 1.2 waves across the flag). */
html.hs-ro .hs-ro-cloth i {
  --a: calc(var(--fh) * (.006 + .00114 * var(--i)));
  position: relative;
  display: block;
  flex: 0 0 calc(var(--fw) / 40 + 1px);
  height: 100%;
  margin-right: -1px;
  font-style: normal;
  background: var(--ro-tricolour) calc(var(--fw) / -40 * var(--i)) 0 / var(--fw) 100% no-repeat;
  will-change: transform;
  animation: hs-ro-wave 2.2s ease-in-out calc(var(--i) * .132s - 6s) infinite alternate;
}

/* light and shadow on the folds: a dark layer that comes and goes a quarter wave after the movement */
html.hs-ro .hs-ro-cloth i::after {
  content: "";
  position: absolute;
  inset: 0;
  background: #000814;
  opacity: 0;
  animation: hs-ro-shade 2.2s ease-in-out calc(var(--i) * .132s - 4.9s) infinite alternate;
}

@keyframes hs-ro-wave {
  from { transform: translateY(calc(-1 * var(--a))); }
  to { transform: translateY(var(--a)); }
}

@keyframes hs-ro-shade {
  from { opacity: 0; }
  to { opacity: .16; }
}

/* ---------- sparkles (four-point stars that twinkle, like fireworks far away) ---------- */

html.hs-ro .hs-ro-sky {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

html.hs-ro .hs-ro-spark {
  --size: calc(var(--s) * 1.8);
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--size);
  height: var(--size);
  margin: calc(var(--size) / -2) 0 0 calc(var(--size) / -2);
  background:
    radial-gradient(circle, #fffbe6 0 14%, rgba(252, 209, 22, .65) 28%, transparent 62%),
    linear-gradient(90deg, transparent 45%, #fff6c8 50%, transparent 55%),
    linear-gradient(0deg, transparent 45%, #fff6c8 50%, transparent 55%);
  opacity: 0;
  will-change: transform, opacity;
  animation: hs-ro-twinkle var(--t) ease-in-out var(--d) infinite;
}

@keyframes hs-ro-twinkle {
  0%, 100% { opacity: 0; transform: scale(.3) rotate(0deg); }
  45% { opacity: 1; transform: scale(1.3) rotate(45deg); }
  65% { opacity: .8; transform: scale(1) rotate(70deg); }
}

/* the button gets a light sweep every few seconds */
html.hs-ro .hs-ro-cta::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 40%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .55), transparent);
  transform: translateX(-160%) skewX(-20deg);
  animation: hs-ro-shine 4.5s ease-in-out 1.5s infinite;
  pointer-events: none;
}

@keyframes hs-ro-shine {
  0%, 70% { transform: translateX(-160%) skewX(-20deg); }
  100% { transform: translateX(320%) skewX(-20deg); }
}

/* ---------- phones: the flag next to the eyebrow and the title, text and button below on the full width ---------- */

@media (max-width: 767px) {
  html.hs-ro .hs-ro-hero-inner {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "eyebrow flag" "title flag" "sub sub" "cta cta";
    align-items: start;
    gap: 0 14px;
    padding: 24px 18px 26px;
  }

  html.hs-ro .hs-ro-hero-text { display: contents; }
  html.hs-ro .hs-ro-eyebrow { grid-area: eyebrow; margin-bottom: 6px; font-size: 13px; letter-spacing: .18em; }
  html.hs-ro .hs-ro-title { grid-area: title; }
  html.hs-ro .hs-ro-sub { grid-area: sub; margin: 12px 0 16px; }
  html.hs-ro .hs-ro-cta { grid-area: cta; justify-self: start; }

  html.hs-ro .hs-ro-flag {
    --fw: 84px;
    grid-area: flag;
    height: calc(var(--fh) * 1.45);
    margin: calc(var(--pw) * 1.2) 2px 0 0;
  }

  html.hs-ro .hs-ro-spark-wide { display: none; }
  html.hs-ro .hs-ro-preview-note { font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
  html.hs-ro .hs-ro-cta { transition: none; }
  /* a still flag (a wave shape where sin() is supported, else flat) and steady sparkles */
  html.hs-ro .hs-ro-cloth i,
  html.hs-ro .hs-ro-cloth i::after,
  html.hs-ro .hs-ro-spark,
  html.hs-ro .hs-ro-cta::after { animation: none; }
  html.hs-ro .hs-ro-cloth i { transform: translateY(calc(var(--a) * sin(var(--i) * .19rad))); }
  html.hs-ro .hs-ro-spark { opacity: .75; transform: rotate(45deg); }
  html.hs-ro .hs-ro-cta::after { display: none; }
}
