/* ==========================================================================
   YSERA home page: the journey through the logo, and the sections added to it.
   Loaded after brand.css. Colours and type are brand.css's tokens.
   The journey is one tall section with a stage pinned inside it; scrolling the
   section drives the model on the stage. Everything else is an ordinary section.
   ========================================================================== */

:root {
  --u: 0.8vh;            /* one journey scroll unit */
  --steel: #BFD3E2;
  --j-ink: #0B0A08;
  --bar: 0px;            /* how much of the stage a phone's address bar can cover */
}
@supports (height: 100lvh) {
  :root { --bar: calc(100lvh - 100svh); }
}

html, body.mode-scroll { scroll-behavior: auto; }

.slide-journey {
  display: block;
  height: calc(1030 * var(--u) + 100vh);
  min-height: 0;
  padding: 0;
  background: var(--j-ink);
}
body.mode-scroll .slide-journey { height: calc(1030 * var(--u) + 100vh); min-height: 0; }

.j-stage {
  user-select: none;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100lvh;        /* constant, unlike the window: what sits near the bottom keeps clear with --bar */
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 42%, #1E1913 0%, var(--j-ink) 62%);
}
#j-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#j-tags { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.svg-defs { position: absolute; width: 0; height: 0; }

/* --- labels pinned to the model --- */
.j-tag {
  position: absolute;
  left: 0;
  top: 0;
  display: grid;
  grid-template-columns: auto auto;
  column-gap: 0.55rem;
  row-gap: 2px;
  align-items: center;
  white-space: nowrap;
  opacity: 0;
  will-change: transform, opacity;
  text-shadow: 0 0 10px var(--j-ink), 0 0 3px var(--j-ink);
}
.j-tag::before { content: ""; grid-area: 1 / 1; width: 5px; height: 5px; border-radius: 50%; background: var(--gold-2); box-shadow: 0 0 8px var(--gold); }
.j-tag b { grid-area: 1 / 2; font: 600 11px/1.3 'Montserrat', sans-serif; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold-2); }
.j-tag span { grid-area: 2 / 2; font: 400 12px/1.3 'Montserrat', sans-serif; color: var(--mut); }
.j-tag.flip { text-align: right; }
.j-tag.flip::before { grid-area: 1 / 2; }
.j-tag.flip b { grid-area: 1 / 1; }
.j-tag.flip span { grid-area: 2 / 1; }
.j-tag.era::before { display: none; }
.j-tag.era b { font: 500 clamp(30px, 3.4vw, 46px)/1 'Cormorant Garamond', serif; letter-spacing: 0.01em; text-transform: none; }
.j-tag.era span { font: 400 clamp(17px, 1.6vw, 22px)/1.4 'Amiri', serif; color: var(--gold); }
.j-tag.era.now-tag b, .j-tag.era.now-tag span { color: var(--steel); }

/* --- opening: the emblem is drawn across the whole window, so it stays sharp while the view zooms into its lattice --- */
.j-pin {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 1.6vh, 18px);
  padding: 62px max(16px, env(safe-area-inset-right, 0px)) calc(8px + var(--bar)) max(16px, env(safe-area-inset-left, 0px));
  pointer-events: none;
}
.j-full { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.j-mark { width: min(54vh, 84vw); aspect-ratio: 1; flex: none; max-width: 100%; }
.j-mark svg { width: 100%; height: 100%; display: block; overflow: visible; }
.j-word { position: relative; margin: 0 -0.62em 0 0; font: 500 clamp(22px, 3.4vh, 34px)/1.1 'Montserrat', sans-serif; letter-spacing: 0.62em; color: var(--gold-2); }
.j-motto { position: relative; margin: 0; font: 500 clamp(19px, 2.9vh, 28px)/1.2 'Cormorant Garamond', serif; color: var(--ink); letter-spacing: 0.03em; text-align: center; }
.j-cue { position: relative; display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 6px 22px; pointer-events: auto; font: 500 11px/1.4 'Montserrat', sans-serif; letter-spacing: 0.24em; text-transform: uppercase; color: var(--mut); }
.j-skip { appearance: none; background: none; border: 0; padding: 6px 2px; font: inherit; letter-spacing: inherit; text-transform: inherit; color: var(--gold-2); border-bottom: 1px solid var(--line); cursor: pointer; }
.j-skip:hover { color: var(--ink); border-bottom-color: var(--gold); }

/* --- captions: each belongs to one stretch of the journey; script fades them --- */
.j-say {
  position: absolute;
  z-index: 2;
  top: 50%;
  transform: translateY(-50%);
  width: min(29rem, calc(100% - 32px));
  display: flex;
  flex-direction: column;
  gap: 14px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  text-shadow: 0 0 22px var(--j-ink), 0 0 6px var(--j-ink);
}
.j-say::before { content: ""; position: absolute; inset: -18% -24%; z-index: -1; background: radial-gradient(closest-side, rgba(11, 10, 8, 0.84), rgba(11, 10, 8, 0.5) 62%, rgba(11, 10, 8, 0)); }
.j-left { left: clamp(16px, 7vw, 110px); }
.j-right { right: clamp(16px, 6vw, 90px); }
.j-narrow { width: min(23rem, calc(100% - 32px)); }
.j-say p, .j-say h2 { margin: 0; }
.j-ar { font: 700 clamp(30px, 4.4vw, 46px)/1.25 'Amiri', serif; color: var(--gold); align-self: flex-start; }
.j-eyebrow { font: 600 11.5px/1.4 'Montserrat', sans-serif; letter-spacing: 0.24em; text-transform: uppercase; color: var(--gold); }
.j-say h2 { font: 500 clamp(36px, 4.9vw, 66px)/1.04 'Cormorant Garamond', serif; color: var(--ink); text-wrap: balance; }
.j-say p.j-body { font: 400 clamp(15px, 1.25vw, 17px)/1.65 'Montserrat', sans-serif; color: #CFC8B9; }

/* --- closing: the emblem assembles around the S --- */
#j-closing {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  visibility: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 1.8vh, 18px);
  padding: 62px max(16px, env(safe-area-inset-right, 0px)) calc(16px + var(--bar)) max(16px, env(safe-area-inset-left, 0px));
}
#j-closing .j-mark { width: min(48vh, 80vw); }
#mark-close .ring { animation: none; }
#mark-close:not(.settled) .glint, #mark-close:not(.settled) .ray { display: none; }
.j-close-text { opacity: 0; margin: 0; position: relative; }
.j-services { font: 500 clamp(11px, 1.5vh, 13px)/1.9 'Montserrat', sans-serif; letter-spacing: 0.22em; text-transform: uppercase; color: var(--ink); text-align: center; }
.j-ar-line { font: 400 clamp(19px, 2.8vh, 26px)/1.4 'Amiri', serif; color: var(--gold-2); }
.j-continue { pointer-events: auto; }

/* --- the emblem's own motion: one eight-second breath --- */
.j-stage .ring { stroke-dasharray: 101; stroke-dashoffset: 101; transform: rotate(-90deg); transform-origin: 44px 44px; animation: j-draw 2.6s cubic-bezier(0.6, 0.05, 0.2, 1) 0.1s forwards; }
.j-stage .ring-b { animation-delay: 0.5s; }
#mark-close .ring-b { animation: none; }
@keyframes j-draw { to { stroke-dashoffset: 0; } }
.pane { opacity: var(--o); animation: j-breathe 8s ease-in-out infinite; animation-delay: calc(var(--k) * 0.7s + var(--j) * 0.5s); }
@keyframes j-breathe { 0%, 34%, 100% { opacity: var(--o); } 12% { opacity: 1; } }
.glint { stroke-dasharray: 14 200; stroke-dashoffset: 14; stroke-linecap: round; opacity: 0; }
.glint-tail { animation: j-run-tail 8s linear infinite; }
.glint-s { animation: j-run-s 8s linear infinite; }
@keyframes j-run-tail { 0%, 12% { stroke-dashoffset: 14; opacity: 0; } 17%, 39% { opacity: 0.55; } 44%, 100% { stroke-dashoffset: -100; opacity: 0; } }
@keyframes j-run-s { 0%, 42% { stroke-dashoffset: 14; opacity: 0; } 46%, 61% { opacity: 0.55; } 66%, 100% { stroke-dashoffset: -100; opacity: 0; } }
.ray { opacity: 0; animation: j-ray 8s ease-in-out infinite; animation-delay: calc(var(--i) * 0.07s); }
@keyframes j-ray { 0%, 60%, 84%, 100% { opacity: 0; } 71% { opacity: 0.8; } }

/* --- the marquee, now a band between the journey and the services --- */
.j-band { position: relative; z-index: 1; padding: 22px 0; background: var(--bg-0); border-block: 1px solid var(--line-soft); }
.j-band .marquee { position: relative; bottom: auto; opacity: 0.8; }

/* --- the page is an ordinary scrolling page now --- */
.slide-services, .slide-software, .slide-learn, .slide-about, .slide-tools, .slide-contact { min-height: 0; }
body.mode-scroll .slide { min-height: 0; }
body.mode-scroll .slide-contact { min-height: 100svh; }
.services-grid { height: auto; }
.service-card { min-height: 300px; }
a.service-card { text-decoration: none; color: inherit; }

/* --- software --- */
.slide-software { background: linear-gradient(180deg, var(--bg-0), var(--bg-1)); }
.sw-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 8px; }
.sw-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  padding: clamp(22px, 2.2vw, 30px);
  background: linear-gradient(165deg, var(--card-hi), var(--card-lo));
  border: 1px solid var(--line-soft);
}
.sw-kicker { display: flex; align-items: center; justify-content: space-between; gap: 10px; font: 600 10px/1.4 'Montserrat', sans-serif; letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold); }
.sw-state { padding: 3px 8px; border: 1px solid var(--line); color: var(--gold-2); letter-spacing: 0.14em; white-space: nowrap; }
.sw-name { margin: 0; font: 500 clamp(25px, 2.3vw, 32px)/1.1 'Cormorant Garamond', serif; color: var(--ink); }
.sw-lead { margin: 0; font-size: 14.5px; line-height: 1.65; color: #CFC8B9; }
.sw-points { margin: 2px 0 0; padding: 0; list-style: none; display: grid; gap: 10px; font-size: 13.5px; line-height: 1.55; color: var(--mut); }
.sw-points li { position: relative; padding-left: 18px; }
.sw-points li::before { content: ""; position: absolute; left: 1px; top: 0.55em; width: 7px; height: 7px; border: 1px solid var(--gold); transform: rotate(45deg); }
.sw-foot { margin-top: auto; padding-top: 8px; font-size: 12px; color: var(--mut-2); }
.sw-ask { align-self: flex-start; }

/* --- courses on the home page --- */
.learn-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-top: 8px; }
.learn-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: clamp(22px, 2.2vw, 28px);
  text-decoration: none;
  color: inherit;
  background: linear-gradient(165deg, var(--card-hi), var(--card-lo));
  border: 1px solid var(--line-soft);
  transition: border-color 0.25s ease, transform 0.35s var(--ease-pop);
}
.learn-card:hover { border-color: var(--line); transform: translateY(-4px); }
.learn-cat { font: 600 10px/1.4 'Montserrat', sans-serif; letter-spacing: 0.22em; text-transform: uppercase; color: var(--gold); }
.learn-title { margin: 0; font: 500 clamp(23px, 2vw, 28px)/1.15 'Cormorant Garamond', serif; color: var(--ink); text-wrap: balance; }
.learn-summary { margin: 0; font-size: 14px; line-height: 1.6; color: var(--mut); }
.learn-meta { margin-top: auto; padding-top: 10px; display: flex; align-items: baseline; justify-content: space-between; gap: 10px; border-top: 1px solid var(--line-soft); font-size: 12.5px; color: var(--mut-2); }
.learn-price { font: 500 24px/1 'Cormorant Garamond', serif; color: var(--gold-2); }
.learn-cta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 26px; }

.about-grid { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); align-items: center; gap: clamp(28px, 5vw, 72px); }
.about-side { display: flex; flex-direction: column; gap: 26px; align-items: flex-start; min-width: 0; }
.about-side .about-stats { margin-top: 0; }
.about-mark { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line-soft); font-size: 14px; color: var(--mut); }
.about-mark strong { color: var(--gold-2); font-weight: 500; }

@media (max-width: 1100px) {
  .bs-nav button { padding: 8px 9px; letter-spacing: 0.16em; }
  .sw-grid, .learn-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px), (max-aspect-ratio: 1/1) {
  .j-say { top: auto; bottom: calc(5vh + var(--bar)); left: max(16px, env(safe-area-inset-left, 0px)); right: max(16px, env(safe-area-inset-right, 0px)); transform: none; width: auto; }
  .j-tag span { display: none; }
  .j-tag.era span { display: block; }
  .j-say p.j-body { font-size: 15px; }
}

@media (max-width: 760px) {
  .sw-grid, .learn-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  .j-stage .ring { animation: none; stroke-dashoffset: 0; }
  .pane { animation: none; }
  .glint, .ray { display: none; }
}
.slide.was-active .reveal { opacity: 1; transform: none; }

/* The slide deck's counter and rail described pages; on a scrolling page they sat on top of the content. The dots stay where there is room for them. */
.deck-counter, .deck-rail { display: none; }
@media (max-width: 1290px) { .deck-dots { display: none; } }

/* Its Arabic watermark hangs past the edge by design; the section clips it. */
body.mode-scroll .slide-contact { overflow: hidden; }

.j-continue { font: 500 11px/1.4 'Montserrat', sans-serif; letter-spacing: 0.24em; text-transform: uppercase; }

/* The deck no longer moves, so it should not hold a page-sized layer. */
.deck { will-change: auto; transition: none; }
body.in-journey .slide:not(.slide-journey) *, body.in-journey .j-band * { animation-play-state: paused !important; }

/* The duct's branches as the menu: a box at each branch end, placed by client/journey.js. */
.j-branches { position: absolute; inset: 0; z-index: 2; pointer-events: none; }
.j-branch {
  position: absolute;
  left: 0;
  top: 0;
  visibility: hidden;
  opacity: 0;
  pointer-events: auto;
  padding: 7px 12px;
  white-space: nowrap;
  text-decoration: none;
  font: 600 10.5px/1.2 'Montserrat', sans-serif;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold-2);
  background: rgba(11, 10, 8, 0.82);
  border: 1px solid var(--gold);
  transition: background 0.2s ease, color 0.2s ease;
}
.j-branch:hover, .j-branch:focus-visible { background: var(--gold); color: #14110A; }
.j-branch.is-contact { background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: #14110A; }
.j-short { display: none; }

/* An obstacle placed in the air. */
.j-obstacle {
  position: absolute;
  left: 0;
  top: 0;
  border-radius: 50%;
  pointer-events: none;
  border: 1px solid rgba(233, 201, 122, 0.8);
  background: radial-gradient(circle, rgba(233, 201, 122, 0.16), rgba(233, 201, 122, 0.03) 62%, transparent 72%);
  box-shadow: 0 0 22px rgba(201, 168, 76, 0.28);
  will-change: transform, opacity;
}
.j-hint {
  position: absolute;
  z-index: 2;
  left: clamp(16px, 3vw, 44px);
  bottom: calc(22px + var(--bar));
  margin: 0;
  pointer-events: none;
  font: 500 10.5px/1.4 'Montserrat', sans-serif;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--mut-2);
  transition: opacity 0.5s ease;
}
.j-hint.is-used { opacity: 0; }
@media (pointer: coarse) { .j-hint { display: none; } }

@media (max-width: 860px), (max-aspect-ratio: 1/1) {
  .j-long { display: none; }
  .j-short { display: inline; }
  .j-branch { padding: 5px 8px; font-size: 9.5px; letter-spacing: 0.08em; }
}
@media (max-width: 860px) {
  .about-grid { grid-template-columns: minmax(0, 1fr); }
}

/* The menu gained an item: the header stays on one line at every width where it shows. */
.bs-btn, .bs-sub { white-space: nowrap; }
@media (max-width: 1400px) {
  .bs-header { gap: 18px; }
  .bs-nav { gap: 2px; }
  .bs-nav button, .bs-nav a { padding: 8px 9px; font-size: 11px; letter-spacing: 0.14em; }
}
@media (max-width: 1080px) {
  .bs-sub { display: none; }
  .bs-nav button, .bs-nav a { padding: 8px 6px; font-size: 10.5px; letter-spacing: 0.1em; }
  .bs-actions .bs-btn { padding-inline: 12px; }
}

/* Smaller landscape screens: short names on the branches and a tighter caption beside them. */
@media (max-width: 1239px) {
  .j-long { display: none; }
  .j-short { display: inline; }
  .j-narrow { width: min(20rem, calc(100% - 32px)); }
  .j-narrow h2 { font-size: clamp(32px, 3.9vw, 46px); }
  .j-narrow p.j-body { font-size: 14px; }
}

/* The Courses section while the catalogue is closed. */
.learn-soon { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; margin-top: 8px; padding: clamp(24px, 3vw, 40px); background: linear-gradient(165deg, var(--card-hi), var(--card-lo)); border: 1px solid var(--line-soft); }
.learn-soon-text { margin: 0; max-width: 40rem; font-size: 15px; line-height: 1.65; color: #CFC8B9; }
.learn-soon .learn-cta { margin-top: 6px; }
