/* =====================================================================
   HOME.CSS — the Home page "circle stage"

   What you see:
     - a full-screen background photo (changes with every slide)
     - a dotted ARC that starts at 9 o'clock, goes over the top and ends at
       6 o'clock, with a thick mark for every slide
     - a moving "sound wave" travels along the arc; each time it touches a
       mark, the photo, colours and words change, and the mark "bursts"
     - inside the circle: 3 lines of text + an arrow (opens a page or video)
     - under the start of the arc (9 o'clock): a logo

   Colours: each slide sets its own accent + title colour in Admin.
   The fallbacks are in assets/css/theme.css ("HOME PAGE CIRCLE").
   Every size scales from ONE number: --r (the circle's radius).
   ===================================================================== */

body.page-home { overflow: hidden; height: 100vh; height: 100svh; }

/* The home page is always on photos, so its header stays white in both modes */
.page-home .site-header { color: #fff; }
.page-home .site-header .logo-for-dark { display: block !important; }
.page-home .site-header .logo-for-light { display: none !important; }

/* ---------- The stage (full screen) ---------- */
.stage {
  --r: min(44vh, 30vw);                  /* circle radius on desktop */
  --cy: 50%;                             /* vertical position of the circle centre */
  --accent: var(--stage-accent);         /* replaced per slide by home.js */
  --title-color: var(--stage-title);     /* replaced per slide by home.js */
  position: relative;
  height: 100vh; height: 100svh;
  overflow: hidden; isolation: isolate;
  background: radial-gradient(ellipse 75% 95% at 75% 55%, var(--stage-bg-glow), var(--stage-bg-mid) 45%, var(--stage-bg-dark) 82%);
  color: #fff;
  touch-action: pan-x pan-y;
}

/* ---------- Background photos (cross-fade + slow zoom) ---------- */
.stage__bg {
  position: absolute; inset: 0; z-index: -2;
  width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transform: scale(1.08);
  transition: opacity 1.4s ease, transform 9s cubic-bezier(.2,.6,.3,1);
}
.stage__bg.is-active { opacity: 1; transform: scale(1); }
/* Soft shade so the words stay readable on any photo */
.stage::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(circle at 50% var(--cy), rgba(0,0,0,.35) 0, rgba(0,0,0,.12) calc(var(--r) * 1.2), rgba(0,0,0,.35) 100%);
}

/* ---------- The arc ---------- */
.stage__ring {
  position: absolute; z-index: 2;
  left: 50%; top: var(--cy);
  width: calc(var(--r) * 2.128);          /* svg radius 470 of 1000 = --r */
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  opacity: 0; scale: .94;
  transition: opacity 1.2s ease, scale 1.6s var(--ease-out);
}
.is-started .stage__ring { opacity: 1; scale: 1; }
.stage__ring > svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }

/* Colour changes smoothly when the slide changes */
.ring-wave, .ring-bars line, .ring-burst line { stroke: var(--accent); transition: stroke .9s ease; }
.ring-tick rect { fill: var(--accent); transition: fill .9s ease, transform .5s var(--ease-out); }

.ring-track, .ring-wave { fill: none; stroke-linecap: round; stroke-dasharray: 0.1 9; }
.ring-track { stroke: var(--stage-dots); stroke-width: 3.2; }
.ring-wave { stroke-width: 4.4; }
.wave-mask { fill: none; stroke: #fff; stroke-width: 40; }
.ring-wave-group { transition: opacity .55s ease; }
.ring-wave-group.is-resetting { opacity: 0; }

/* The moving "sound wave": short bars standing out from the arc */
.ring-bars line { stroke-width: 6; stroke-linecap: butt; }

/* Marks (one per slide) */
.ring-tick rect { transform-box: fill-box; transform-origin: center; }
.ring-tick.is-active rect { transform: scale(1.3); }

/* Burst when the wave touches a mark */
.ring-burst line { stroke-width: 5; opacity: 0; transform-box: fill-box; transform-origin: left center; }
.ring-tick.is-burst .ring-burst line { animation: burst 1.1s var(--ease-out) both; }
.ring-tick.is-burst .ring-burst line:nth-child(2n) { animation-delay: .06s; }
.ring-tick.is-burst .ring-burst line:nth-child(3n) { animation-delay: .12s; }
@keyframes burst {
  0%   { opacity: 1; transform: scaleX(.1); }
  45%  { opacity: 1; transform: scaleX(1); }
  100% { opacity: 0; transform: scaleX(.3) translateX(30px); }
}

/* Invisible click targets on top of each mark */
.stage__points { list-style: none; padding: 0; margin: 0; }
.stage__point { position: absolute; width: 44px; height: 44px; transform: translate(-50%, -50%); border-radius: 50%; }
.stage__point:focus-visible { outline: 2px solid var(--accent); }
.stage__point .point-label {
  position: absolute; left: 50%; top: -4px; transform: translate(-50%, -100%);
  white-space: nowrap; pointer-events: none;
  font-family: var(--font-hero); font-size: 12px; font-weight: 500; letter-spacing: .22em; text-transform: uppercase;
  color: #fff; opacity: 0; transition: opacity .3s;
}
.stage__point:hover .point-label, .stage__point:focus-visible .point-label { opacity: .9; }

/* ---------- Words inside the circle ---------- */
.stage__title {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; pointer-events: none;
  font-family: var(--font-hero); font-weight: 300; color: var(--title-color);
  text-transform: uppercase; line-height: 1.12;
  text-shadow: 0 2px 18px rgba(0,0,0,.35);
}
.stage__title h1, .stage__title h2 { font: inherit; text-transform: inherit; letter-spacing: inherit; }
.stage__title .t-kicker { font-size: calc(var(--r) * .072); font-weight: 400; letter-spacing: .1em; margin-bottom: calc(var(--r) * .05); }
.stage__title .t-line1 { display: block; font-size: calc(var(--r) * .128); letter-spacing: .08em; }
.stage__title .t-line2 { display: block; font-size: calc(var(--r) * .152); letter-spacing: .08em; margin-top: calc(var(--r) * .04); }
.stage__arrow {
  pointer-events: auto; margin-top: calc(var(--r) * .05);
  display: grid; place-items: center; width: 56px; height: 44px;
  color: var(--accent); transition: color .9s ease;
}
.stage__arrow svg { width: 28px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; animation: nudge 1.8s ease-in-out infinite; }
.stage__arrow--video svg { width: 22px; height: 22px; stroke-width: 1.8; animation: none; }
.stage__arrow:hover svg { animation-duration: .7s; }
@keyframes nudge { 0%, 100% { transform: translateX(-4px); } 50% { transform: translateX(5px); } }

/* Change animation: old words fade away, new words come in line by line */
.stage__title > * { opacity: 0; transform: translateY(14px); filter: blur(6px); transition: opacity .45s ease, transform .45s ease, filter .45s ease; }
.stage__title.is-active > * { opacity: 1; transform: none; filter: none; transition: opacity .9s ease, transform 1s var(--ease-out), filter .9s ease; }
.stage__title.is-active > :nth-child(1) { transition-delay: .15s; }
.stage__title.is-active > :nth-child(2) { transition-delay: .3s; }
.stage__title.is-active > :nth-child(3) { transition-delay: .45s; }
.stage__title.is-active .t-line1, .stage__title.is-active .t-line2 { animation: track-in 1.2s var(--ease-out) both; }
@keyframes track-in { from { letter-spacing: .3em; } to { letter-spacing: .08em; } }

/* ---------- Logo under the start of the arc (9 o'clock) ---------- */
.stage__logo {
  position: absolute; z-index: 3;
  left: max(calc(50% - var(--r)), calc(var(--gutter) + 70px));
  top: calc(var(--cy) + 2.4rem);
  width: 160px; height: 90px; transform: translateX(-50%);
}
.stage__logo-item {
  position: absolute; inset: 0; display: grid; place-items: start center;
  opacity: 0; transform: translateY(10px); visibility: hidden;
  transition: opacity .5s ease, transform .6s var(--ease-out), visibility 0s linear .6s;
}
.stage__logo-item.is-active { opacity: 1; transform: none; visibility: visible; transition: opacity .8s ease .35s, transform .9s var(--ease-out) .35s, visibility 0s; }
.stage__logo-item img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; filter: drop-shadow(0 4px 14px rgba(0,0,0,.4)); }


/* ---------- Tablets and phones (portrait) ---------- */
@media (max-width: 900px), (max-aspect-ratio: 4/5) {
  .stage { --r: min(44vw, 30svh); --cy: 44%; }
  .stage__logo { width: 110px; height: 64px; top: calc(var(--cy) + 2rem); }
}
@media (min-width: 600px) and (max-width: 900px) { .stage { --r: min(36vw, 28svh); } }

/* Phones: a slightly smaller circle, so the logo fits CENTRED under the
   first point (9 o'clock) and nothing touches the screen edges */
@media (max-width: 599px) {
  .stage { --r: min(35vw, 30svh); }
  .stage__logo {
    left: calc(50% - var(--r));
    width: clamp(64px, calc((50vw - var(--r)) * 2 - 16px), 110px);
    height: 60px;
  }
  .stage__title .t-kicker { font-size: max(11px, calc(var(--r) * .072)); }
  .stage__title .t-line1 { font-size: max(17px, calc(var(--r) * .128)); }
  .stage__title .t-line2 { font-size: max(20px, calc(var(--r) * .152)); }
}

/* Touch screens: the small names above the points are only a mouse-hover
   hint; on phones they would stick after a tap and get cut off at the edge */
@media (hover: none), (max-width: 900px) {
  .stage__point .point-label { display: none; }
}

/* Reduced motion: no zoom/blur; the wave only moves when a mark is clicked */
@media (prefers-reduced-motion: reduce) {
  .stage__bg, .stage__bg.is-active { transform: none; }
  .stage__title > *, .stage__title.is-active > * { filter: none; transform: none; }
  .stage__arrow svg { animation: none; }
}
