/* Navigation belongs to the rotating headline and intro, outside the form. */
.home-message-controls[hidden] { display: none; }
.home-message-frame {
  /* Map these to the ORIGINAL title/intro values locally. Do not guess them. */
  --message-title-font: inherit;
  --message-title-size: inherit;
  --message-title-weight: inherit;
  --message-title-leading: inherit;
  --message-intro-font: inherit;
  --message-intro-size: inherit;
  --message-intro-leading: inherit;

  --message-ctrl: #8a96a8;          /* muted gray-blue at rest */
  --message-ctrl-strong: #46566f;   /* active pip / hover glyph */
  --message-focus: #2f5fd0;
  --message-controls-h: 0px;        /* set from JS: actual toolbar height */

  position: relative;
  container-type: inline-size;
  container-name: message;
  padding-bottom: var(--message-controls-h); /* reserve only the toolbar height */
  /* Keep existing margins and responsive gaps on the original elements or parent. */
}

.home-message-frame > h1 {
  font-family: var(--message-title-font);
  font-size: var(--message-title-size);
  font-weight: var(--message-title-weight);
  line-height: var(--message-title-leading);
}
.home-message-frame > .intro {
  font-family: var(--message-intro-font);
  font-size: var(--message-intro-size);
  line-height: var(--message-intro-leading);
}

.gallery-overlay {
  position: absolute;
  inset: auto 0 0 0;               /* sits on the frame's bottom edge, inside reserved space */
  display: flex;
  justify-content: center;
  pointer-events: none;            /* only the controls take clicks */
}

.home-message-controls {
  display: grid;
  grid-template-columns: 24px 44px minmax(0, 1fr) 44px;
  max-inline-size: 100%;
  align-items: center;
  background: transparent;         /* no boxed pill */
  pointer-events: auto;
}

/* Arrows: 44px hit area, 16px glyph */
.gallery-arrow {
  inline-size: 44px;
  block-size: 44px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--message-ctrl);
  cursor: pointer;
  transition: background-color .15s, color .15s;
}
.gallery-arrow svg { inline-size: 16px; block-size: 16px; fill: currentColor; }
.gallery-arrow:hover { color: var(--message-ctrl-strong); background: transparent; }

/* Quiet pips: 24px hit area, 3px dot; only selection is slightly stronger. */
.home-message-dots {
  display: flex;
  flex-wrap: wrap;                 /* wrap from actual available width and catalog size */
  min-inline-size: 0;
  justify-content: center;
}
.home-message-dots button {
  inline-size: 24px;
  flex: 0 0 24px;
  block-size: 24px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  transition: background-color .15s;
}
.home-message-dots button::before {
  content: "";
  inline-size: 3px;
  block-size: 3px;
  border-radius: 50%;
  background: var(--message-ctrl);  /* keep glyphs visible; the control surface stays transparent */
  opacity: .25;
  transition: background-color .15s, transform .15s;
}
.home-message-dots button:hover { background: transparent; }
.home-message-dots button:hover::before { background: var(--message-ctrl-strong); }
.home-message-dots button[aria-current="true"]::before {
  background: var(--message-ctrl-strong);
  opacity: .4;
  transform: scale(1.333333);
}

/* A small in-place toggle: first in visual and keyboard order. */
.gallery-rotation {
  inline-size: 24px;
  block-size: 24px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--message-ctrl);
  cursor: pointer;
}
.gallery-rotation:hover { color: var(--message-ctrl-strong); }
.gallery-rotation[data-state="playing"]::before {
  content: "";
  inline-size: 8px;
  block-size: 9px;
  background: linear-gradient(90deg, currentColor 0 3px, transparent 3px 5px, currentColor 5px 8px);
}
.gallery-rotation[data-state="paused"]::before {
  content: "";
  inline-size: 0;
  block-size: 0;
  border-block: 5px solid transparent;
  border-inline-start: 8px solid currentColor;
  margin-inline-start: 2px;
}

/* Focus: clear, independent of hover */
.gallery-rotation:focus-visible,
.gallery-arrow:focus-visible,
.home-message-dots button:focus-visible {
  outline: 2px solid var(--message-focus);
  outline-offset: 1px;
}

/* Narrow columns cap the dot region at six targets per row.
   Rows follow the catalog size; arrow and pause targets retain their width. */
@container message (max-width: 375px) {
  .home-message-dots {
    flex-wrap: wrap;
    max-inline-size: calc(6 * 24px);
  }
}

@media (forced-colors: active) {
  .gallery-arrow, .gallery-rotation { color: ButtonText; }
  .gallery-rotation[data-state="playing"]::before {
    background: linear-gradient(90deg, ButtonText 0 3px, transparent 3px 5px, ButtonText 5px 8px);
  }
  .home-message-dots button::before { background: ButtonText; }
  .home-message-dots button[aria-current="true"]::before { background: Highlight; }
}
@media (prefers-reduced-motion: reduce) {
  .gallery-arrow, .home-message-dots button, .home-message-dots button::before { transition: none; }
}

/* Preserve the approved headline/intro typography after grouping their nodes. */
.home-message-frame {
  --message-title-font: var(--head);
  --message-title-size: clamp(36px, 3.541667vw, 51px);
  --message-title-weight: 650;
  --message-title-leading: 1.1;
  --message-intro-size: 18px;
  --message-intro-leading: 1.5;
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding-bottom: max(0px, calc(var(--message-controls-h) - 20px));
}
.home-message-frame > h1 { letter-spacing: -.9px; margin: 0 0 24px; }
.home-message-frame > .intro { max-width: 100%; margin: 0 0 20px; }
.gallery-arrow { font: inherit; font-size: 16px; line-height: 1; }
.home-message-count {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
@media (max-width: 700px) { .home-message-frame { --message-intro-size: 17px; } }

/* Tall side chevrons and bottom dots. Rotation, dots, and labels keep their existing controls. */
.home-message-frame{padding-inline:44px}
.gallery-overlay{inset:0}
.gallery-overlay>.gallery-arrow{
  position:absolute;
  top:calc(50% - 15px);
  width:44px;
  height:88px;
  border-radius:0;
  background:transparent;
  pointer-events:auto;
  --chevron-shift:8px;
}
.gallery-overlay>[data-home-previous]{left:0}
.gallery-overlay>[data-home-next]{right:0}
.gallery-overlay>.gallery-arrow svg{
  display:block;
  width:14px;
  height:76px;
  overflow:visible;
  fill:none;
}
.gallery-overlay>[data-home-previous] svg{transform:translateX(calc(-1 * var(--chevron-shift)))}
.gallery-overlay>[data-home-next] svg{transform:translateX(var(--chevron-shift))}
.gallery-overlay>.gallery-arrow svg path{
  fill:none;
  stroke:currentColor;
  stroke-width:1.5;
  stroke-linecap:round;
  stroke-linejoin:round;
}
.home-message-frame .home-message-controls{
  position:absolute;
  left:50%;
  bottom:0;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:0;
  width:max-content;
  max-width:calc(100% - 88px);
  transform:translateX(-50%);
  background:transparent;
}
.home-message-frame .home-message-dots{max-width:384px}
@media(max-width:1000px) and (min-width:761px){
  .gallery-overlay>.gallery-arrow{top:calc(50% - 27px);--chevron-shift:11px}
  .home-message-frame .home-message-controls{max-width:calc(100% - 88px)}
  .home-message-frame .home-message-dots{max-width:192px}
}
@media(max-width:760px){
  .gallery-overlay>.gallery-arrow{height:88px;top:calc(50% - 27px);--chevron-shift:13px}
  .gallery-overlay>.gallery-arrow svg{width:10px;height:64px}
  .home-message-frame .home-message-dots{max-width:144px}
}
