/* ── Hero (xwui-hero) ───────────────────────────────────────────────────── */
.ethar-hero-section {
  --ethar-hero-edge: 5vw;
  --ethar-hero-marker-width: clamp(2.75rem, 4.2vw, 3.75rem);
  --ethar-hero-marker-gap: var(--space-1, 0.25rem);

  position: relative;
  overflow: hidden;
  /* Community-poster fallback (theme-aware): an image we already ship, shown
   * instantly before any video loads AND behind the slides during cross-fades,
   * so the hero never reveals the previous warm photo as an orange/amber flash.
   * Posters are lightweight images — the hero never waits on a video. */
  background-color: var(--bg-app);
  background-image: url("/media/community-loops/v01_boulevard/photo.webp");
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
html[data-theme="ethar-dark"] .ethar-hero-section {
  background-image: url("/media/community-loops/v02_cinema/photo.webp");
}

/* Cross-fading video carousel behind the hero copy. Light cut (V01) in the
 * light theme, dark cut (V02) in the dark theme — sourced by heroCarousel.ts. */
.ethar-hero__slides {
  position: absolute;
  inset: 0;
  z-index: 0;
}
.ethar-hero__slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.9s ease;
}
.ethar-hero__slide[data-active] {
  opacity: 1;
}
.ethar-hero__video,
.ethar-hero__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0 !important;
  background-color: color-mix(in srgb, var(--ethar-teal, #0f3b38) 22%, #000);
}

.ethar-hero {
  /* xwui-hero design tokens (see XWUIHero.css) — white type on the photo. */
  --xwui-color-text-primary: #fff;
  --xwui-color-text-secondary: rgba(255, 255, 255, 0.92);
  --xwui-layout-max-width: none;

  background: transparent;
  position: relative;
  z-index: 2; /* above the video + amber wash */
}

.ethar-hero .xwui-hero__inner {
  min-height: clamp(360px, 52vh, 500px);
  grid-template-columns: 1fr;
  padding-left: var(--ethar-hero-edge);
  padding-right: var(--ethar-hero-edge);
}

.ethar-hero .xwui-hero__text {
  /* Pin the copy to the PHYSICAL right — the empty-sky safe box — in BOTH
   * languages. `end` flipped it to the left (onto the towers) in Arabic; `right`
   * is direction-independent so RTL and LTR both sit in the clear zone. */
  justify-self: right;
  align-items: flex-end;
  max-width: min(46vw, 40rem);
  text-align: right;
  direction: rtl;
}

/* Larger hero subtitle — the lead line under the headline. */
.ethar-hero .xwui-hero__subtitle {
  font-size: clamp(1.2rem, 2vw, 1.65rem);
  line-height: 1.9;
}

html[dir="rtl"] .ethar-hero .xwui-hero__title {
  width: 100%;
  font-weight: 400;
  text-align: right;
}

html[dir="ltr"] .ethar-hero .xwui-hero__text {
  direction: ltr;
  text-align: left;
}

html[dir="ltr"] .ethar-hero .xwui-hero__title {
  width: 100%;
  font-weight: 400;
  text-align: left;
}

/* Desktop: a tall, full-viewport-ish hero. The section is fixed to 80vh and the
 * xwui-hero fills it so the (now vertically centred) copy centres within the
 * whole banner rather than just its min-height box. */
@media (min-width: 961px) {
  .ethar-hero-section {
    height: 80vh;
  }
  .ethar-hero,
  .ethar-hero .xwui-hero__inner {
    height: 100%;
  }
}

@media (max-width: 60rem) {
  .ethar-hero-section {
    display: flex !important;
    flex-direction: column !important;
    min-height: 0;
    background-color: #050b17;
    background-image: none !important;
  }
  .ethar-hero__slides {
    position: relative;
    inset: auto;
    order: 1 !important;
    width: 100%;
    background-image: url("/pictures/mobile/home-bg-mobile.jpg");
    background-position: center center;
    background-repeat: no-repeat;
    background-size: cover;
    /* Portrait, matching the 1080×1920 mobile photo — shown vertically and
       uncropped (like the Projects / Contact mobile heroes), instead of being
       cover-cropped into a wide landscape strip. */
    aspect-ratio: 9 / 16;
    overflow: hidden;
  }
  .ethar-hero__slides > xwui-image {
    display: none;
  }
  .ethar-hero__slides picture {
    display: block;
    width: 100%;
    height: 100%;
  }
  .ethar-hero__img {
    object-fit: cover !important;
    object-position: center center !important;
  }
  .ethar-hero-section > xwui-hero {
    display: block !important;
    order: 2 !important;
    width: 100% !important;
  }
  .ethar-hero {
    order: 2 !important;
    width: 100%;
    padding-left: 20px !important;
    /* Copy block sits BELOW the photo on mobile, on a white surface. */
    background: #fff !important;
    --xwui-color-text-primary: #0c1422;
    --xwui-color-text-secondary: #3a4350;
  }
  .ethar-hero,
  .ethar-hero .xwui-hero__inner {
    min-height: 0;
  }
  .ethar-hero .xwui-hero__inner {
    display: flex;
    align-items: flex-start;
    padding-top: 0 !important;
    padding-right: clamp(1.25rem, 6vw, 2rem);
    padding-bottom: 0 !important;
    padding-left: 0 !important;
  }
  .ethar-hero .xwui-hero__text {
    width: 100%;
    max-width: min(100%, 34rem);
  }
  .ethar-hero .xwui-hero__title {
    max-width: 100%;
    color: #0c1422 !important;
    font-size: clamp(2.6rem, 12vw, 4.4rem) !important;
    line-height: 1.05 !important;
  }
  .ethar-hero .xwui-hero__subtitle {
    max-width: 100%;
    color: #3a4350 !important;
    font-size: clamp(1rem, 4.5vw, 1.35rem) !important;
    line-height: 1.65;
  }
}

@media (max-width: 40rem) {
  .ethar-hero-section {
    min-height: 0;
  }
  .ethar-hero,
  .ethar-hero .xwui-hero__inner {
    min-height: 0;
  }
}

.ethar-hero-markers {
  position: absolute;
  left: var(--ethar-hero-edge);
  bottom: clamp(var(--space-5, 1.25rem), 4vw, var(--space-10, 3rem));
  display: inline-flex;
  gap: var(--ethar-hero-marker-gap);
  z-index: 2; /* above the video + amber wash */
  /* white dashes over the video; sizing inherited by the generic dot */
  color: #fff;
  --ethar-dot-width: var(--ethar-hero-marker-width);
}

/* ── About intro (xwui-grid) ──────────────────────────────────────────────
 * Two-column content/media. xwui-grid owns the layout; this layer scopes
 * spacing, brand colours, and the image's full-bleed treatment. */
.ethar-about-section {
  /* 5% | 35% media | 10% gap | 40% copy | 10%. */
  --ethar-about-column-gap: clamp(3rem, 9vw, 7rem);
  /* Cool light gradient: flat top half, fading into a warm grey toward the
     bottom — sampled from the mockup (references/home2.png). */
  --ethar-about-bg: #ffffff;
  /* Light-theme brand colours sampled from the mockup: near-black heading +
     body, warm bronze for the tagline and the bold intro. Dark-theme values
     are overridden below. */
  --ethar-about-title-color: #0d121b;
  --ethar-about-lead-color: #5f4338;
  --ethar-about-intro-color: #5f4338;
  --ethar-about-copy-color: #1e232d;
  --ethar-about-dot-muted: #cdc7bf;
  --ethar-about-dot-active: #5f4338;

  background: #ffffff !important;
  padding-block: clamp(2.75rem, 7vw, 6.25rem);
  /* Logical insets so the gutters mirror with the language: in RTL the copy
   * (inline-start) side gets the larger 10% gutter; in LTR it flips. */
  padding-inline: clamp(1.5rem, 7vw, 7rem);

  /* Copy type scale — bumped so the about block reads larger overall. */
  --ethar-about-title-size: clamp(2.25rem, 6vw, 4.75rem);
  --ethar-about-lead-size: clamp(1.05rem, 2vw, 1.55rem);
  --ethar-about-intro-size: clamp(1rem, 1.8vw, 1.4rem);
  --ethar-about-body-size: clamp(1rem, 1.3vw, 1.25rem);
  /* Large enough to FILL the (now wider) media column — max-width:100% on the
   * element clamps it to the column, so the carousel reads as the big visual. */
  --ethar-about-media-size: min(52vw, 44rem);
}

/* No dark variant on purpose. The site is locked to the ethar-dark theme, but
   the about block is a permanent LIGHT surface to match the mockup
   (references/home2.png): white-to-warm-grey gradient with black + bronze text.
   This rule overrides the dark theme so the light palette wins in every theme. */
html[data-theme="ethar-dark"] .ethar-about-section,
html[data-theme="dark"] .ethar-about-section,
html[data-theme="night"] .ethar-about-section {
  --ethar-about-bg: #ffffff;
  background: #ffffff !important;
  --ethar-about-title-color: #0d121b;
  --ethar-about-lead-color: #5f4338;
  --ethar-about-intro-color: #5f4338;
  --ethar-about-copy-color: #1e232d;
  --ethar-about-dot-muted: #cdc7bf;
  --ethar-about-dot-active: #5f4338;
}

.ethar-about {
  width: 100%;
  margin: 0;
}

/* The <xwui-grid> custom-element host stamps dir="ltr" on itself, which the
 * inner grid div would otherwise inherit — pinning the columns to LTR in both
 * languages. Set the grid container's own direction per page direction (same
 * approach as the projects/stats/news sections) so the copy/media columns
 * swap sides with the language: copy on the reading-start side in both. */
html[dir="rtl"] .ethar-about {
  direction: rtl;
}
html[dir="ltr"] .ethar-about {
  direction: ltr;
}

.ethar-about__media {
  display: grid;
  gap: clamp(1.5rem, 4vw, 3.5rem);
  width: var(--ethar-about-media-size);
  max-width: 100%;
  justify-self: start;
}
html[dir="ltr"] .ethar-about__media {
  justify-self: end;
}

/* Cross-fading carousel slides (square). The container owns the 1:1 box; each
 * slide stacks absolutely and fades between unique clips. */
.ethar-about__slides {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  overflow: hidden;
  border-radius: 0;
}
.ethar-about__slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.9s ease;
}
.ethar-about__slide[data-active] {
  opacity: 1;
}
.ethar-about__video,
.ethar-about__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 0;
  background-color: color-mix(in srgb, var(--ethar-teal, #0f3b38) 22%, #000);
}
.ethar-about__img .xwui-image-wrapper,
.ethar-about__img .xwui-image {
  height: 100% !important;
}

.ethar-about__markers {
  display: inline-flex;
  gap: var(--space-1, 0.25rem);
  /* Controls sit on the inline-END side (opposite the image's start edge), so
     they mirror with the language along with everything else. */
  justify-self: end;
  /* accent dashes read on both the light and dark about surface */
  color: var(--ethar-about-dot-active);
  --ethar-dot-width: clamp(2.5rem, 4vw, 3rem);
}

.ethar-about__markers .ethar-carousel-dot__track {
  background: var(--ethar-about-dot-muted);
}
.ethar-about__markers .ethar-carousel-dot[data-active] .ethar-carousel-dot__track,
.ethar-about__markers .ethar-carousel-dot:hover .ethar-carousel-dot__track,
.ethar-about__markers .ethar-carousel-dot:focus-visible .ethar-carousel-dot__track {
  background: var(--ethar-about-dot-muted);
}
.ethar-about__markers .ethar-carousel-dot__fill {
  background: var(--ethar-about-dot-active);
}

.ethar-about__copy {
  /* Text direction + alignment follow the page direction (no hard-coding), so
   * the column mirrors when the language switches. */
  text-align: start;
  max-width: 48rem;
  justify-self: end;
}
html[dir="rtl"] .ethar-about__copy {
  direction: rtl;
  text-align: right;
}
html[dir="ltr"] .ethar-about__copy {
  direction: ltr;
  text-align: left;
  justify-self: start;
}

/* Typography family flows from <xwui-typography>'s variant; this layer sets
 * brand colour, spacing, and the bumped brand size scale. Parent-section
 * selectors bump specificity to 0,2,0 so these win over the component classes. */
.ethar-about-section .ethar-about__title {
  color: var(--ethar-about-title-color);
  font-size: var(--ethar-about-title-size);
  line-height: 1.05;
  margin: 0 0 clamp(1.75rem, 3.5vw, 2.75rem);
}

.ethar-about-section .ethar-about__lead {
  color: var(--ethar-about-lead-color);
  font-size: var(--ethar-about-lead-size);
  line-height: 1.65;
  margin: 0 0 clamp(1.5rem, 3vw, 2.25rem);
}

/* Bold lead paragraph (bronze, like the tagline above it) — generous gap below
   so it separates clearly from the lighter body paragraphs. */
.ethar-about-section .ethar-about__intro {
  color: var(--ethar-about-intro-color);
  font-size: var(--ethar-about-intro-size);
  line-height: 1.8;
  margin: 0 0 clamp(2.25rem, 5vw, 3.75rem);
}

/* Two body paragraphs with a large gap between them; the last sits flush. */
.ethar-about-section .ethar-about__body {
  color: var(--ethar-about-copy-color);
  /* !important so xwui-typography-body can't pull this below the token size. */
  font-size: var(--ethar-about-body-size) !important;
  line-height: 1.9;
  margin: 0 0 clamp(1.5rem, 3vw, 2.25rem);
}
.ethar-about-section .ethar-about__body:last-of-type {
  margin-bottom: 0;
}

@media (max-width: 60rem) {
  .ethar-about-section {
    --ethar-about-column-gap: clamp(2rem, 7vw, 3.5rem);
    --ethar-about-title-size: clamp(2.35rem, 10vw, 3.8rem);
    --ethar-about-lead-size: clamp(1rem, 4.6vw, 1.35rem);
    --ethar-about-intro-size: clamp(0.98rem, 4.3vw, 1.25rem);
    --ethar-about-body-size: clamp(0.95rem, 4vw, 1.12rem);
    --ethar-about-media-size: min(100%, 38rem);
    padding-block: clamp(2.75rem, 10vw, 5rem);
    padding-inline: clamp(1.25rem, 6vw, 2.5rem);
  }
  .ethar-about {
    grid-template-columns: 1fr !important;
    row-gap: clamp(2rem, 7vw, 3.5rem) !important;
  }
  .ethar-about__copy,
  html[dir="ltr"] .ethar-about__copy {
    width: min(100%, 42rem);
    max-width: 100%;
    justify-self: center;
  }
  html[dir="rtl"] .ethar-about__copy {
    justify-self: center;
  }
  .ethar-about__media,
  html[dir="ltr"] .ethar-about__media {
    width: var(--ethar-about-media-size);
    justify-self: center;
  }
  .ethar-about__slides {
    aspect-ratio: 4 / 3;
  }
  .ethar-about-section .ethar-about__title {
    margin-bottom: clamp(1.2rem, 5vw, 2rem);
  }
  .ethar-about-section .ethar-about__lead {
    margin-bottom: clamp(1rem, 4.5vw, 1.75rem);
  }
  .ethar-about-section .ethar-about__intro {
    margin-bottom: clamp(1.5rem, 6vw, 2.5rem);
  }
}

@media (max-width: 40rem) {
  .ethar-about-section {
    --ethar-about-media-size: 100%;
  }
  .ethar-about__slides {
    aspect-ratio: 1 / 1;
  }
  .ethar-about-section .ethar-about__body {
    line-height: 1.75;
  }
}

/* ── Statistics band ──────────────────────────────────────────────────────
 * Static gradient composition from references/home3.png: copy | figure | title
 * on desktop, then a centered stack on narrow screens. */
.ethar-stats-section {
  --ethar-stats-ink: #f7f5f2;
  --ethar-stats-title-size: clamp(2.79rem, 4.43vw, 5rem);
  --ethar-stats-value-size: clamp(3.57rem, 5.43vw, 6.71rem);
  --ethar-stats-copy-size: clamp(1.04rem, 1.46vw, 1.82rem);
  --ethar-stats-side-gap: clamp(3rem, 7.5vw, 8.75rem);

  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: clamp(13.5rem, 13.7vw, 17.5rem);
  padding-block: clamp(2.1rem, 3.2vw, 3.8rem);
  padding-inline: clamp(2rem, 8vw, 11.5rem);
  overflow: hidden;
  background: linear-gradient(180deg, #050b17 0%, #0a0d18 46%, #17151c 72%, #392a28 100%);
  color: var(--ethar-stats-ink);
}

.ethar-stats__panel {
  width: 100%;
  max-width: 104rem;
  margin-inline: auto;
}

.ethar-stats {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(18rem, 1fr) auto minmax(18rem, 1fr);
  grid-template-areas: "copy value title";
  align-items: center;
  justify-items: center;
  column-gap: var(--ethar-stats-side-gap);
  direction: ltr;
}

html[dir="ltr"] .ethar-stats {
  grid-template-areas: "title value copy";
}

.ethar-stats__copy {
  grid-area: copy;
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: clamp(0.35rem, 0.65vw, 0.7rem);
  text-align: right;
  color: var(--ethar-stats-ink);
}

html[dir="ltr"] .ethar-stats__copy {
  align-items: flex-start;
  text-align: left;
  direction: ltr;
}

html[dir="ltr"] .ethar-stats-section {
  --ethar-stats-copy-size: clamp(0.9rem, 1.1vw, 1.3rem);
}

.ethar-stats-section .ethar-stats__label,
.ethar-stats-section .ethar-stats__detail {
  margin: 0;
  color: var(--ethar-stats-ink);
  font-size: var(--ethar-stats-copy-size);
  font-weight: var(--font-weight-semibold, 600);
  line-height: 1.45;
  letter-spacing: 0;
  white-space: nowrap;
}

html[dir="ltr"] .ethar-stats-section .ethar-stats__label,
html[dir="ltr"] .ethar-stats-section .ethar-stats__detail {
  max-width: clamp(18rem, 26vw, 32rem);
  white-space: normal;
}

.ethar-stats__value-wrap {
  grid-area: value;
  display: flex;
  justify-content: center;
  align-items: center;
}

.ethar-stats-section .ethar-stats__value {
  margin: 0;
  color: var(--ethar-stats-ink);
  font-family: var(--font-headings-family) !important;
  font-size: var(--ethar-stats-value-size);
  font-weight: 400;
  line-height: 0.9;
  letter-spacing: 0;
  direction: ltr;
  unicode-bidi: isolate;
  white-space: nowrap;
}

/* KPI numbers are rendered as <xwui-statistic> figures so they count up from 0
 * when their band scrolls into view (driven by app/countup.ts). Make the figure's
 * value + affix elements INHERIT the surrounding heading styling so the animated
 * figure is visually identical to the static number it replaced. */
.ethar-stats-section .ethar-stats__value .xwui-statistic-value,
.ethar-stats-section .ethar-stats__value .xwui-statistic-suffix,
.ethar-stats-section .ethar-stats__value .xwui-statistic-prefix {
  font: inherit !important;
  color: inherit !important;
  letter-spacing: inherit !important;
}
.ethar-stats-section .ethar-stats__value .xwui-statistic-content {
  justify-content: center;
  gap: 0.04em;
}

.ethar-stats__title-wrap {
  grid-area: title;
  justify-self: end;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  direction: rtl;
}

.ethar-stats-section .ethar-stats__title {
  margin: 0;
  color: var(--ethar-stats-ink);
  font-size: var(--ethar-stats-title-size);
  font-weight: 400;
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
  text-align: right;
}

html[dir="ltr"] .ethar-stats__title-wrap {
  justify-self: start;
  justify-content: flex-start;
  direction: ltr;
}

html[dir="ltr"] .ethar-stats-section .ethar-stats__title {
  text-align: left;
}

@media (max-width: 76rem) {
  .ethar-stats-section {
    min-height: 0;
    padding-block: clamp(3rem, 7vw, 5rem);
  }

  .ethar-stats {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "title"
      "value"
      "copy";
    row-gap: clamp(1.25rem, 3vw, 2rem);
  }

  html[dir="ltr"] .ethar-stats {
    grid-template-areas:
      "title"
      "value"
      "copy";
  }

  .ethar-stats__copy,
  html[dir="ltr"] .ethar-stats__copy,
  .ethar-stats__title-wrap,
  html[dir="ltr"] .ethar-stats__title-wrap {
    justify-self: center;
    align-items: center;
    justify-content: center;
  }

  .ethar-stats__copy,
  html[dir="ltr"] .ethar-stats__copy,
  .ethar-stats-section .ethar-stats__title,
  html[dir="ltr"] .ethar-stats-section .ethar-stats__title {
    text-align: center;
  }
}

@media (max-width: 40rem) {
  .ethar-stats-section {
    --ethar-stats-title-size: clamp(2.14rem, 10vw, 3.39rem);
    --ethar-stats-value-size: clamp(2.71rem, 12.86vw, 3.86rem);
    --ethar-stats-copy-size: clamp(0.82rem, 3.71vw, 1.11rem);
    padding-inline: clamp(1.25rem, 6vw, 2rem);
  }

  .ethar-stats-section .ethar-stats__label,
  .ethar-stats-section .ethar-stats__detail {
    white-space: normal;
  }
}
