/*
 * The first-run guide dialog (site.include.guide-dialog), shared by the landing page and the
 * athlete portal.
 *
 * Tokens resolve per page: --ap-* inside the athlete portal (athlete-portal.css), otherwise the
 * landing's own --green/--ink/--line (landing.css). The literal at the end of each chain is only
 * reached if the guide is dropped into a page that defines neither.
 *
 * The `atour__` class prefix predates the landing-page version and is kept deliberately: renaming
 * live classes to match a file name is churn, not clarity.
 *
 * The layout is two columns on a desktop — a rail listing all five steps, and the current card —
 * because the rail is the point: a new athlete should see the whole order at once, not only the step
 * they are on. Under 760px the rail collapses to a row of dots and the dialog becomes a bottom
 * sheet, which is where a thumb can reach the buttons.
 *
 * Nothing here depends on the writing direction: the rail sits on the inline start side, so it lands
 * on the right in Arabic and on the left in English with no override.
 */
.atour{
  --atour-green:var(--ap-green,var(--green,#087d59));
  --atour-ink:var(--ap-ink,var(--ink,#162724));
  --atour-muted:var(--ap-muted,var(--muted,#687975));
  --atour-line:var(--ap-line,var(--line,#d7e5df));
  --atour-mint:var(--ap-mint,#e8f6f0);
  /* Above the landing's fixed header (20), its mega menu (30) and its skip link (100), and above
     the portal's mobile sidebar and toast (50). */
  position:fixed;inset:0;z-index:200;display:grid;place-items:center;padding:20px;
}
.atour[hidden]{display:none}
.atour__scrim{
  position:absolute;inset:0;background:rgba(14,38,32,.55);
  -webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px);
  border:0;padding:0;margin:0;width:100%;cursor:pointer;
}
.atour__dialog{
  position:relative;width:min(760px,100%);max-height:calc(100vh - 40px);overflow:auto;
  background:#fff;border-radius:24px;box-shadow:0 30px 80px rgba(9,36,29,.35);
  display:grid;grid-template-columns:232px minmax(0,1fr);
  font-family:Tajawal,Arial,sans-serif;color:var(--atour-ink);
  animation:atour-in .28s cubic-bezier(.2,.8,.3,1) both;
}
@keyframes atour-in{from{opacity:0;transform:translateY(14px) scale(.985)}to{opacity:1;transform:none}}
@media (prefers-reduced-motion:reduce){
  .atour__dialog{animation:none}
}

/* --- the rail: the whole journey, with the current step marked ------------------------------- */
.atour__rail{
  background:linear-gradient(160deg,#0f8a61,#123e34);color:#fff;padding:22px 18px;
  display:flex;flex-direction:column;gap:14px;
}
.atour__brand{display:flex;align-items:center;gap:10px}
.atour__brand img{height:40px;width:auto}
.atour__brand span{font-size:11px;font-weight:800;letter-spacing:.04em;opacity:.78}
.atour__rail ol{list-style:none;margin:0;padding:0;display:grid;gap:4px;flex:1}
.atour__rail button{
  display:flex;align-items:center;gap:10px;width:100%;text-align:start;
  background:transparent;border:0;border-radius:12px;padding:9px 10px;cursor:pointer;
  color:rgba(255,255,255,.78);font:inherit;font-size:13px;font-weight:700;line-height:1.45;
}
.atour__rail button:hover{background:rgba(255,255,255,.1);color:#fff}
.atour__rail li.is-current button{background:rgba(255,255,255,.16);color:#fff;font-weight:900}
.atour__num{
  flex:0 0 auto;width:24px;height:24px;border-radius:999px;display:grid;place-items:center;
  background:rgba(255,255,255,.16);font-size:12px;font-weight:900;
}
.atour__rail li.is-current .atour__num{background:#fff;color:#0f3d32}
.atour__rail li.is-done .atour__num{background:rgba(255,255,255,.34);color:#fff}

/* --- the card ------------------------------------------------------------------------------- */
.atour__panel{padding:22px 24px 18px;display:flex;flex-direction:column;min-width:0}
.atour__close{
  position:absolute;inset-block-start:12px;inset-inline-end:14px;
  width:36px;height:36px;min-height:0;border-radius:10px;border:1px solid var(--atour-line);
  background:#fff;color:var(--atour-muted);font-size:19px;line-height:1;cursor:pointer;
  display:grid;place-items:center;
}
.atour__close:hover{background:var(--atour-mint);color:var(--atour-green)}
.atour__step{display:none;flex:1}
.atour__step.is-current{display:block;animation:atour-step .22s ease both}
@keyframes atour-step{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
@media (prefers-reduced-motion:reduce){
  .atour__step.is-current{animation:none}
}
.atour__icon{
  width:52px;height:52px;border-radius:16px;background:var(--atour-mint);color:var(--atour-green);
  display:grid;place-items:center;margin-bottom:14px;
}
.atour__icon svg{width:28px;height:28px}
.atour__eyebrow{
  display:block;color:var(--atour-green);font-size:11px;font-weight:900;letter-spacing:.04em;
  margin-bottom:6px;
}
.atour__step h2{margin:0 0 8px;font-size:21px;line-height:1.4}
.atour__step p{margin:0;color:#445a54;font-size:14.5px;line-height:1.85}
.atour__go{
  display:inline-flex;align-items:center;gap:6px;margin-top:14px;
  color:var(--atour-green);background:var(--atour-mint);border-radius:11px;
  padding:9px 14px;text-decoration:none;font-size:13px;font-weight:900;
}
.atour__go:hover{background:#d8efe5}
/* A step whose link is the thing the reader came for -- registering, browsing specialists -- says
   so in its own words and gets the weight of a real button. */
.atour__go--cta{background:var(--atour-green);color:#fff;padding:11px 18px;font-size:14px}
.atour__go--cta:hover{background:#0a6c4e;color:#fff}
.atour__go .atour__arrow{display:inline-block}
html[dir=ltr] .atour__go .atour__arrow{transform:scaleX(-1)}
.atour__footnote{
  margin:14px 0 0;color:var(--atour-muted);font-size:12px;font-weight:700;line-height:1.7;
}

/* --- the footer ----------------------------------------------------------------------------- */
.atour__foot{
  margin-top:18px;padding-top:14px;border-top:1px solid var(--atour-line);
  display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;
}
.atour__count{color:var(--atour-muted);font-size:12px;font-weight:800}
.atour__acts{display:flex;align-items:center;gap:8px;margin-inline-start:auto}
.atour__btn{
  min-height:42px;padding:0 16px;border-radius:12px;border:0;cursor:pointer;
  font-family:inherit;font-size:13.5px;font-weight:900;
}
.atour__btn--primary{background:var(--atour-green);color:#fff}
.atour__btn--primary:hover{background:#0a6c4e}
.atour__btn--ghost{background:var(--atour-mint);color:var(--atour-green)}
.atour__btn--quiet{background:transparent;color:var(--atour-muted);padding:0 8px}
.atour__btn--quiet:hover{color:var(--atour-ink)}
.atour__btn[hidden]{display:none}
.atour__dots{display:none;gap:7px}

/* The guide is driven from the keyboard as much as the mouse — arrows move between steps — so the
   focus ring has to be visible against both the white card and the green rail. */
.atour :focus-visible{outline:3px solid var(--atour-green);outline-offset:2px;border-radius:10px}
.atour__rail :focus-visible{outline-color:#fff}
/* Each step moves focus to its heading so a screen reader announces the new card. That is a
   programmatic focus, not a keyboard one, and a ring drawn around the title reads as a bordered box
   nobody asked for -- so the heading alone is exempt. Every button keeps its ring. */
.atour__step h2:focus,.atour__step h2:focus-visible{outline:none}

/* The landing page's own way back in: a quiet outline button under the «ابدأ رحلتك» heading, on
   the dark section, so it reads as an offer rather than as another call to action. */
.guide-reopen{
  display:inline-flex;align-items:center;gap:8px;margin-top:18px;
  background:rgba(255,255,255,.08);border:1px solid rgba(255,255,255,.28);color:#fff;
  border-radius:11px;padding:11px 18px;cursor:pointer;
  font-family:inherit;font-size:13.5px;font-weight:800;
}
.guide-reopen:hover{background:rgba(255,255,255,.16)}
.guide-reopen span{
  width:20px;height:20px;border-radius:999px;display:grid;place-items:center;
  background:#62d9ae;color:#132c27;font-size:12px;font-weight:900;
}

/* The portal sidebar entry that reopens the guide. It is a button inside the nav, so it borrows the
   nav link's shape rather than inventing one. */
.ap-nav .ap-nav__tour{
  display:flex;align-items:center;gap:10px;width:100%;padding:11px 12px;border-radius:12px;
  background:transparent;border:0;cursor:pointer;text-align:start;
  font-family:inherit;font-size:14px;font-weight:800;color:#3f5851;
}
.ap-nav .ap-nav__tour:hover{background:var(--ap-mint,#e8f6f0);color:var(--ap-green,#087d59)}
.ap-nav .ap-nav__tour::before{
  content:"?";flex:0 0 auto;width:18px;height:18px;border-radius:999px;
  background:var(--ap-mint,#e8f6f0);color:var(--ap-green,#087d59);
  display:grid;place-items:center;font-size:11px;font-weight:900;
}
.ap-nav .ap-nav__tour:hover::before{background:#fff}

/*
 * Phone: a bottom sheet, and a footer that stacks instead of crowding four things onto one line.
 * Reading order down the sheet is progress, then action, then position -- dots, buttons, "step 1 of
 * 4" -- so the thumb lands on the buttons without covering what it is about to read.
 */
@media (max-width:760px){
  .atour{padding:0;place-items:end stretch}
  .atour__dialog{
    width:100%;grid-template-columns:minmax(0,1fr);border-radius:22px 22px 0 0;
    /* dvh where it exists: on a phone 100vh sits behind the address bar. */
    max-height:90vh;max-height:90dvh;
  }
  .atour__rail{display:none}
  .atour__panel{padding:18px 16px calc(14px + env(safe-area-inset-bottom,0px))}
  .atour__close{inset-block-start:10px;inset-inline-end:12px}
  /* The icon moves up beside the eyebrow and the title. Stacked, it left a band of empty sheet
     between the close button and itself, and vertical space is the scarce thing here. */
  .atour__step.is-current{display:grid;grid-template-columns:46px minmax(0,1fr);column-gap:12px}
  .atour__icon{grid-area:1/1/3/2;width:46px;height:46px;border-radius:14px;margin:0;align-self:start}
  .atour__icon svg{width:25px;height:25px}
  .atour__eyebrow{grid-area:1/2/2/3;align-self:end;margin:0}
  /* Room for the close button, which floats over the end of this line. */
  .atour__step h2{grid-area:2/2/3/3;font-size:19px;margin:0;padding-inline-end:38px}
  .atour__step p,.atour__go,.atour__go--cta,.atour__footnote{grid-column:1/-1}
  .atour__step p{margin-top:12px}
  .atour__step p{font-size:14px;line-height:1.8}
  .atour__go,.atour__go--cta{width:100%;justify-content:center;padding-block:12px}
  .atour__footnote{font-size:11.5px}

  /* An explicit single column: with `grid-template-columns:auto` the track is content-sized, and a
     child's `width:100%` then resolves against that content width -- which is how the button row
     collapsed to 126px instead of filling the sheet. The track is the full width now, items stretch
     into it by default, and only the two that should be centred say so. */
  .atour__foot{display:grid;grid-template-columns:minmax(0,1fr);gap:12px;margin-top:16px}
  .atour__dots{display:flex;order:1;justify-self:center}
  .atour__acts{order:2;margin-inline-start:0;gap:8px}
  .atour__acts .atour__btn--primary{flex:1}
  .atour__count{order:3;justify-self:center}
}
/* typography.css gives every <button> a 42px min-height under 580px, for tap targets. These are
   indicators, not targets, so they opt out explicitly -- otherwise the row of dots becomes a row of
   42px pills, which is exactly what it did. */
.atour__dot{
  flex:0 0 auto;width:8px;height:8px;min-height:0;border-radius:999px;border:0;padding:0;
  cursor:pointer;background:var(--atour-line);
}
.atour__dot.is-current{background:var(--atour-green);width:22px}

/* The live-chat mascot is fixed at z-index 99999, so it floats over the dialog and lands on the
   «التالي» button on a phone. Raising the dialog above it would only trade one overlap for another:
   the widget is a second way to ask for help, and the guide is already the answer. It comes back
   the moment the dialog closes. */
html.is-guide-open #er_live_chat_root{display:none}
