/* An Academy guide as one stretch of the route: a line runs down from the stop,
   every part of the guide is a point on it, and the line arrives at the next
   guide. A star rides the line at reading height and leaves it lit behind it.
   The star and its trail are CSS sticky, so they stay smooth on a phone; the
   small script only lights the points as they are reached. */
.ga {
  --ga-rail: 48px;      /* the strip that holds the line */
  --ga-line-at: 15px;   /* where the line runs inside that strip */
  --ga-ring-top: 16px;
  --ga-read: 42vh;      /* the height the star rides at */
  --ga-line: color-mix(in srgb, var(--brand-star) 32%, transparent);
  direction: rtl;
  color: var(--text-default);
  font-family: var(--font-body);
}
@supports (height: 1svh) { .ga { --ga-read: 42svh; } }
.ga * { box-sizing: border-box; }

.ga-route { position: relative; padding-inline-start: var(--ga-rail); }

/* The line, from the stop's number down to the last ring. */
.ga-rail {
  position: absolute;
  inset-inline-start: calc(var(--ga-line-at) + 1px - 20px);
  top: calc(var(--ga-ring-top) + 32px);
  bottom: 0;
  width: 40px;
  pointer-events: none;
}
.ga-rail::before {
  content: '';
  position: absolute;
  inset-block: 0;
  inset-inline-start: calc(50% - 1px);
  width: 2px;
  background: var(--ga-line);
}
.ga-star { display: none; }
@supports (overflow: clip) {
  .ga-rail { overflow: clip; }
  .ga-star {
    display: block;
    position: sticky;
    top: calc(var(--ga-read) - 12px);
    z-index: 3;
    width: 24px;
    height: 24px;
    margin-inline: auto;
  }
  /* The lit trail: as tall as any page, cut off by the rail where the line starts. */
  .ga-star::before {
    content: '';
    position: absolute;
    bottom: 50%;
    inset-inline-start: calc(50% - 1px);
    width: 2px;
    height: 30000px;
    background: var(--brand-star);
  }
}
.ga-star > svg {
  display: block;
  position: relative;
  fill: var(--brand-star);
  filter: drop-shadow(0 0 5px color-mix(in srgb, var(--brand-star) 75%, transparent));
}
/* Once, on arrival: the line draws itself down from the stop's number. It only
   needs to cover the first screen, and letting go at the end shows the rest. */
@media (prefers-reduced-motion: no-preference) {
  .ga-rail { animation: ga-draw 1.2s cubic-bezier(0.45, 0, 0.25, 1) backwards; }
  @keyframes ga-draw {
    from { clip-path: inset(0 0 100% 0); }
    to { clip-path: inset(0 0 calc(100% - 110vh) 0); }
  }
}
/* Where the browser can tie it to the scroll, the star turns a quarter at a time
   as the page moves, so most of the time it is the same star as the logo. */
@supports (animation-timeline: scroll()) {
  @media (prefers-reduced-motion: no-preference) {
    .ga-star > svg { animation: ga-turn cubic-bezier(0.8, 0, 0.2, 1) both; animation-timeline: scroll(root); }
    @keyframes ga-turn {
      0% { transform: rotate(0); }
      12.5% { transform: rotate(90deg); }
      25% { transform: rotate(180deg); }
      37.5% { transform: rotate(270deg); }
      50% { transform: rotate(360deg); }
      62.5% { transform: rotate(450deg); }
      75% { transform: rotate(540deg); }
      87.5% { transform: rotate(630deg); }
      100% { transform: rotate(720deg); }
    }
  }
}

.ga-open { padding-block: var(--ga-ring-top) 64px; max-width: 42rem; }
.ga-stop {
  display: flex;
  align-items: center;
  min-height: 32px;
  width: fit-content;
  color: var(--text-muted);
  font-weight: 600;
  text-decoration: none;
}
.ga-stop:hover { color: var(--link); text-decoration: none; }
.ga-ring {
  position: absolute;
  inset-inline-start: 0;
  top: var(--ga-ring-top);
  z-index: 2;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: 700;
  color: var(--color-ink);
  background: var(--brand-star);
}
.ga-open h1 {
  font-family: var(--font-display);
  font-size: clamp(36px, 5vw, 56px);
  line-height: 1.12;
  margin: 12px 0 16px;
  view-transition-name: ga-heading;
}
.ga-lead { font-size: 1.1875rem; line-height: 1.65; color: var(--text-muted); margin: 0 0 24px; }
.academy-toc ul { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 22px; margin: 0; padding: 0; }
.academy-toc li { max-width: none; }
.academy-toc a { color: var(--text-muted); font-size: 0.95rem; text-decoration: underline; text-decoration-color: var(--border-subtle); text-underline-offset: 4px; }
.academy-toc a:hover { color: var(--link); text-decoration-color: currentColor; }

/* Each part: its point and name on the line, the text past that. The name stays
   beside the text while it scrolls. */
.ga-part {
  display: grid;
  grid-template-columns: minmax(0, 12rem) minmax(0, 1fr);
  gap: 32px;
  padding-block-end: 64px;
  scroll-margin-block-start: 24px;
}
.ga-name {
  position: sticky;
  top: 24px;
  z-index: 1;
  align-self: start;
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.3rem;
  line-height: 1.3;
}
.ga-name::before {
  content: '';
  position: absolute;
  inset-inline-start: calc(-1 * var(--ga-rail) + var(--ga-line-at) - 6px);
  top: 6px;
  box-sizing: border-box;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--surface-page);
  border: 2px solid var(--brand-star);
  transition: background 0.25s ease-out, transform 0.25s cubic-bezier(0.3, 1.8, 0.5, 1);
}
.ga-name.is-reached::before { background: var(--brand-star); transform: scale(1.15); }

.ga-body { min-width: 0; }
.ga-body p, .ga-body li { font-size: 1.0625rem; line-height: 1.75; }
.ga-body p { margin: 0 0 14px; }
.ga-body > :last-child { margin-block-end: 0; }
.ga-body pre { margin: 0 0 14px; padding: 14px 16px; border-radius: var(--radius-sm); background: var(--surface-inset); color: var(--color-white); }
.ga-body .answer-steps { list-style: none; counter-reset: ga-step; margin: 6px 0 14px; padding: 0; display: grid; gap: 12px; }
.ga-body .answer-steps li { counter-increment: ga-step; position: relative; padding-inline-start: 40px; max-width: none; }
.ga-body .answer-steps li::before {
  content: counter(ga-step);
  position: absolute;
  inset-inline-start: 0;
  top: 2px;
  box-sizing: border-box;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  border: 2px solid var(--brand-star);
}
.ga-links { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 6px; }

.ga-terms { margin: 0; display: grid; gap: 14px; }
.ga-terms div { display: grid; grid-template-columns: minmax(0, 7rem) minmax(0, 1fr); gap: 16px; }
.ga-terms dt { font-weight: 700; font-size: 1.0625rem; line-height: 1.75; }
.ga-terms dd { margin: 0; color: var(--text-muted); font-size: 1.0625rem; line-height: 1.75; max-width: 58ch; }

/* The one filled panel on the page: the part where the reader does something. */
.ga-try {
  padding: 22px 26px;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(130% 170% at 100% 0%, color-mix(in srgb, var(--brand-star) 30%, transparent), transparent 62%),
    var(--surface-raised);
  border: 1px solid color-mix(in srgb, var(--brand-star) 40%, transparent);
}
.ga-try p { margin: 0; font-size: 1.125rem; }
.ga-success { margin-block-start: 12px !important; font-size: 1rem !important; color: var(--text-muted); }
.ga-cta { margin-block-start: 22px !important; }

/* A prompt to paste into the AI tool (the first-site course): the words sit in a
   card on the line's side, the button copies them in one tap, and the card
   glows once in the star's color when it did. */
.ga-prompt {
  margin: 18px 0 6px;
  padding: 16px 20px 14px;
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  border: 1px solid var(--border-subtle);
  border-inline-start: 3px solid var(--brand-star);
}
.ga-prompt-label { font-size: 0.9375rem; font-weight: 700; color: var(--text-muted); margin: 0 0 8px; }
.ga-body .ga-prompt-text {
  margin: 0;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-page);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.75;
  color: var(--text-default);
}
.ga-copy {
  margin-block-start: 12px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--brand-star) 55%, transparent);
  background: transparent;
  color: var(--text-default);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
}
.ga-copy:hover { background: color-mix(in srgb, var(--brand-star) 14%, transparent); }
.ga-prompt.is-copied { animation: ga-copied 1.2s ease-out; }
@keyframes ga-copied {
  from { box-shadow: 0 0 0 0 color-mix(in srgb, var(--brand-star) 55%, transparent); }
  40% { box-shadow: 0 0 0 8px color-mix(in srgb, var(--brand-star) 18%, transparent); }
  to { box-shadow: 0 0 0 0 transparent; }
}
@media (prefers-reduced-motion: reduce) {
  .ga-prompt.is-copied { animation: none; border-inline-start-color: var(--brand-star); }
}

.ga-fold { margin-block-start: 6px; border-block-end: 1px solid var(--border-subtle); }
.ga-fold summary {
  cursor: pointer;
  list-style: none;
  position: relative;
  padding-block: 12px;
  padding-inline-start: 22px;
  font-weight: 600;
  font-size: 1.0625rem;
  line-height: 1.5;
}
.ga-fold summary::-webkit-details-marker, .ga-q summary::-webkit-details-marker { display: none; }
.ga-fold summary::before {
  content: '';
  position: absolute;
  inset-inline-start: 2px;
  top: 19px;
  box-sizing: border-box;
  width: 9px;
  height: 9px;
  border-inline-start: 2px solid var(--text-muted);
  border-block-end: 2px solid var(--text-muted);
  transform: rotate(45deg);
  transition: transform 0.2s ease-out;
}
.ga-fold[open] summary::before { transform: rotate(225deg); }
.ga-fold summary:hover { color: var(--link); }
.ga-fold ul { margin: 0 0 14px; padding-inline-start: 20px; display: grid; gap: 6px; }
.ga-fold p { margin-block-end: 14px; color: var(--text-muted); }
.ga-fold[open] > :not(summary) { animation: ga-open 0.22s ease-out; }

/* The self-check: the question first, a tap for the answer, and the ring turns
   into the same star that rides the line. */
.ga-hint { color: var(--text-muted); font-size: 0.95rem !important; margin-block-end: 12px !important; }
.ga-q {
  margin-block-end: 10px;
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  border: 1px solid var(--border-subtle);
  transition: border-color 0.25s ease-out;
}
.ga-q[open] { border-color: var(--brand-star); }
.ga-q summary {
  cursor: pointer;
  list-style: none;
  position: relative;
  padding: 15px 18px;
  padding-inline-start: 50px;
  font-weight: 600;
  font-size: 1.0625rem;
  line-height: 1.5;
}
.ga-q summary::before {
  content: '';
  position: absolute;
  inset-inline-start: 18px;
  top: 19px;
  box-sizing: border-box;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--brand-star);
}
.ga-q[open] summary::before, .ga-q.was-open summary::before {
  border: 0;
  border-radius: 0;
  background: var(--brand-star);
  clip-path: polygon(50% 0, 59% 41%, 100% 50%, 59% 59%, 50% 100%, 41% 59%, 0 50%, 41% 41%);
  animation: ga-pop 0.42s cubic-bezier(0.3, 1.6, 0.5, 1);
}
.ga-q p { margin: 0; padding: 0 18px 16px; padding-inline-start: 50px; color: var(--text-muted); animation: ga-open 0.22s ease-out; }
@keyframes ga-pop { from { transform: scale(0.2) rotate(-120deg); } to { transform: scale(1) rotate(0); } }
@keyframes ga-open { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* Where the line arrives. */
.ga-end { position: relative; padding-inline-start: var(--ga-rail); }
.ga-end::before {
  content: '';
  position: absolute;
  top: 0;
  inset-inline-start: calc(var(--ga-line-at) + 1px - 12px);
  box-sizing: border-box;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--surface-page);
  border: 2px solid var(--brand-star);
  transition: background 0.3s ease-out;
}
.ga-end.is-reached::before { background: var(--brand-star); }
/* The riding star lands and becomes the earned one. */
.ga:has(.ga-end.is-reached.is-star) .ga-star > svg { opacity: 0; }
.ga-end.is-reached.is-star::before { /* every self-check answer was opened */
  top: -5px;
  inset-inline-start: calc(var(--ga-line-at) + 1px - 17px);
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 0;
  clip-path: polygon(50% 0, 59% 41%, 100% 50%, 59% 59%, 50% 100%, 41% 59%, 0 50%, 41% 41%);
  animation: ga-pop 0.5s cubic-bezier(0.3, 1.6, 0.5, 1);
}
/* What this guide just added to the reader's route. The row keeps its space, so
   nothing jumps at the moment the line arrives. */
.ga-tally {
  min-height: 1.6em;
  margin: 0 0 14px;
  font-weight: 600;
  line-height: 1.6;
  color: var(--text-default);
  opacity: 0;
  transition: opacity 0.5s ease-out;
}
.ga-tally.is-shown { opacity: 1; }
.ga-tally a { font-weight: 400; margin-inline-start: 4px; }
.ga-next {
  display: block;
  padding: 24px 28px;
  border-radius: var(--radius-lg);
  background: var(--surface-raised);
  border: 2px solid var(--border-subtle);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.4s ease-out, box-shadow 0.4s ease-out;
}
.ga-end.is-reached .ga-next {
  border-color: var(--brand-star);
  box-shadow: 0 14px 44px -14px color-mix(in srgb, var(--brand-star) 70%, transparent);
}
.ga-next:hover { text-decoration: none; }
.ga-next-label { display: block; font-size: 0.95rem; color: var(--text-muted); }
.ga-next-title { display: block; width: fit-content; margin-block-start: 4px; font-family: var(--font-display); font-size: clamp(24px, 3vw, 32px); line-height: 1.2; color: var(--text-default); }
.ga-next:hover .ga-next-title { color: var(--link); }
.ga-next-blurb { display: block; margin-block-start: 8px; color: var(--text-muted); line-height: 1.6; max-width: 62ch; }
.ga-prev { display: inline-block; margin-block-start: 14px; color: var(--link); }
.ga-prev span { color: var(--text-muted); }

/* Room under the line, so the star can reach the end on a tall screen too. */
.ga-after { min-height: calc(58vh - 240px); padding-block-start: 36px; padding-inline-start: var(--ga-rail); }
.ga-after p { margin: 0 0 18px; }

/* Pressing the next guide: its title flows up into the next page's heading. */
.ga.is-leaving .ga-open h1 { view-transition-name: none; }
.ga.is-leaving .ga-next-title { view-transition-name: ga-heading; }

@media (max-width: 760px) {
  .ga { --ga-rail: 44px; }
  .ga-open { padding-block-end: 44px; }
  .ga-part { grid-template-columns: minmax(0, 1fr); gap: 12px; padding-block-end: 44px; }
  .ga-name { position: relative; top: auto; }
  .ga-terms div { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .ga-try { padding: 18px 20px; }
  .ga-next { padding: 20px 22px; }
  .ga-after { padding-inline-start: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .ga-name::before, .ga-end::before, .ga-next, .ga-q, .ga-fold summary::before { transition: none; }
  .ga-name.is-reached::before { transform: none; }
  .ga-q[open] summary::before, .ga-q.was-open summary::before, .ga-q p, .ga-fold[open] > :not(summary), .ga-end.is-reached.is-star::before { animation: none; }
  .ga-tally { transition: none; }
}

/* A glossary word in the text (glossary-links.ts): dotted under, and a tap opens
   its meaning right under it (glossary-tap.js). While it is open, a line of the
   star's color draws under the word from where the reading starts. Without the
   script the word is a plain link to the glossary. */
.ga-body a.gt {
  color: inherit;
  text-decoration: underline dotted;
  text-decoration-thickness: 2px;
  text-decoration-color: color-mix(in srgb, var(--brand-star) 70%, var(--text-muted));
  text-underline-offset: 6px;
  background: linear-gradient(var(--brand-star), var(--brand-star)) no-repeat right 0 bottom -1px / 0% 2px;
  padding-block-end: 3px;
  transition: background-size 0.35s cubic-bezier(0.45, 0, 0.25, 1), text-decoration-color 0.2s ease-out;
}
.ga-body a.gt:hover { text-decoration-color: var(--brand-star); }
.ga-body a.gt[aria-expanded='true'] { background-size: 100% 2px; text-decoration-color: transparent; }

.gt-card {
  --gt-x: 50%;
  position: absolute;
  z-index: 20;
  display: block;
  width: min(22rem, calc(100vw - 32px));
  padding: 14px 18px 12px;
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  border: 1px solid color-mix(in srgb, var(--brand-star) 45%, var(--border-subtle));
  box-shadow: 0 16px 36px -16px color-mix(in srgb, var(--brand-star) 55%, transparent), 0 2px 10px -4px color-mix(in srgb, var(--text-default) 25%, transparent);
  text-align: start;
}
.gt-card[hidden] { display: none; }
.gt-card::before { /* points up at the word */
  content: '';
  position: absolute;
  top: -6px;
  left: calc(var(--gt-x) - 5px);
  width: 10px;
  height: 10px;
  background: var(--surface-raised);
  border-left: 1px solid color-mix(in srgb, var(--brand-star) 45%, var(--border-subtle));
  border-top: 1px solid color-mix(in srgb, var(--brand-star) 45%, var(--border-subtle));
  transform: rotate(45deg);
}
.gt-name { display: block; font-weight: 700; font-size: 1rem; line-height: 1.5; }
.gt-name::before { /* the star that rides the line */
  content: '';
  display: inline-block;
  vertical-align: -1px;
  width: 12px;
  height: 12px;
  margin-inline-end: 7px;
  background: var(--brand-star);
  clip-path: polygon(50% 0, 59% 41%, 100% 50%, 59% 59%, 50% 100%, 41% 59%, 0 50%, 41% 41%);
}
.gt-def { display: block; margin-block: 4px 8px; color: var(--text-muted); font-size: 0.975rem; line-height: 1.65; }
.gt-more { font-size: 0.925rem; }
@media (prefers-reduced-motion: no-preference) {
  .gt-card.is-in { animation: gt-in 0.22s ease-out; }
  .gt-card.is-in .gt-name::before { animation: ga-pop 0.42s cubic-bezier(0.3, 1.6, 0.5, 1); }
  @keyframes gt-in { from { opacity: 0; transform: translateY(-4px); } }
}
@media (prefers-reduced-motion: reduce) {
  .ga-body a.gt { transition: none; }
}

/* Course by mail (HH_ACADEMY_MAIL): a quiet card under a lesson's end button,
   for a learner who has no time now. The address is typed left to right. */
.ga-after .ga-mail {
  max-width: 560px;
  margin: 4px 0 28px;
  padding: 18px 20px;
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  border: 1px solid var(--border-subtle);
}
.ga-after .ga-mail h2 { font-size: 1.125rem; line-height: 1.4; margin: 0 0 6px; }
.ga-after .ga-mail p { margin: 0 0 12px; }
.ga-after .ga-mail label { display: block; font-weight: 700; font-size: 0.9375rem; margin: 0 0 6px; }
.ga-mail-row { display: flex; flex-wrap: wrap; gap: 10px; }
.ga-mail-row input {
  flex: 1 1 220px;
  min-width: 0;
  min-height: 44px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-subtle);
  background: var(--surface-page);
  color: var(--text-default);
  font: inherit;
  text-align: left; /* side-bound on purpose: an email address is typed left to right */
}
.ga-mail-row .btn { flex: 0 0 auto; }
.ga-after .ga-mail .ga-mail-privacy { margin: 12px 0 0; font-size: 0.875rem; color: var(--text-muted); }
.ga-after .ga-mail .notice { margin: 0; }

/* English site (spec 2026-11-14): the block is right-to-left by rule above; an English page turns it. */
.ga[dir='ltr'] { direction: ltr; }
