/* templates_next/pages/tutorial.html — cluster page + graph. Colors from skins/*.css */

.tutorial-page {
  padding: 1.5rem 2rem 0;
}

.tutorial-page .tutorial-graph {
  max-width: var(--tutorial-max);
  margin: 0 auto 2.5rem;
}

.tutorial-body {
  max-width: var(--tutorial-max);
  margin: 0 auto;
}

.tutorial-body > *:first-child {
  margin-top: 0;
}

.tutorial-body > *:last-child {
  margin-bottom: 0;
}

.tutorial-body .lesson-audio-play {
  margin: 0.75rem 0 1.25rem;
}

.tutorial-body .lesson-audio-play__btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--color-cta);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-cta);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.tutorial-body .lesson-audio-play__btn svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: currentColor;
}

.tutorial-body .lesson-audio-play__btn:hover,
.tutorial-body .lesson-audio-play__btn:focus-visible {
  background: var(--color-cta-wash);
}

.tutorial-body .lesson-audio-play__btn:focus-visible {
  outline: 2px solid var(--color-text);
  outline-offset: 2px;
}

.tutorial-body .lesson-audio-play__btn.is-playing {
  background: var(--color-cta);
  color: var(--color-surface);
}

.tutorial-body .pair-table .lesson-audio-play__btn {
  margin-left: 0.4rem;
  padding: 0.2rem;
  vertical-align: middle;
  gap: 0;
}

.listen-passage__heading {
  position: relative;
}

.listen-passage__heading::before {
  content: "";
  position: absolute;
  right: 100%;
  top: 50%;
  width: 2.25rem;
  height: 2.25rem;
  margin-right: 0.65rem;
  translate: 0 -50%;
  border-radius: 50%;
  background-color: var(--color-green-wash);
  background-image: var(--image-listen-headphones);
  background-repeat: no-repeat;
  background-position: center;
  background-size: 1.15rem;
}

.listen-passage {
  max-width: 42rem;
  margin: 0.5rem 0 1.25rem;
}

.listen-passage:has([data-alphabet-sequence]) {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 0.5rem 0.65rem;
  margin: 0.35rem 0 0.5rem;
}

.listen-passage:has([data-alphabet-sequence]) .lesson-audio-play {
  margin: 0;
}

.listen-passage:has([data-alphabet-sequence]) .listen-reveal {
  flex: 0 1 auto;
  width: max-content;
  max-width: 100%;
  margin: 0;
}

.listen-passage:has([data-alphabet-sequence]) .listen-reveal__summary {
  padding: 0.45rem 0.85rem;
}

.listen-passage:has([data-alphabet-sequence]) .listen-reveal__summary::after {
  margin-left: 0;
}

.listen-reveal {
  margin: 0.75rem 0;
  border-radius: var(--radius-md);
}

.listen-reveal[open] {
  background: var(--color-listen-reveal-wash);
}

.listen-reveal__summary {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  list-style: none;
  padding: 0.7rem 1rem;
  border-radius: var(--radius-md);
  background: var(--color-listen-reveal-wash);
  color: var(--color-green);
  font-weight: 700;
  cursor: pointer;
}

.listen-reveal__summary::-webkit-details-marker {
  display: none;
}

.listen-reveal__summary::before {
  content: "";
  flex: 0 0 auto;
  width: 1.15rem;
  height: 1.15rem;
  background-color: var(--color-green);
  -webkit-mask: var(--image-listen-eye) center / contain no-repeat;
  mask: var(--image-listen-eye) center / contain no-repeat;
}

.listen-reveal__summary::after {
  content: "";
  flex: 0 0 auto;
  width: 0.45rem;
  height: 0.45rem;
  margin-left: auto;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg);
  translate: 0 -0.1em;
}

.listen-reveal[open] > .listen-reveal__summary::after {
  transform: rotate(-135deg);
  translate: 0 0.15em;
}

.listen-reveal[open] > .listen-reveal__summary {
  margin-bottom: 0;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  background: transparent;
}

.listen-reveal blockquote {
  width: auto;
  max-width: none;
  margin: 0;
  padding: 0 1rem 0.85rem;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.listen-passage:not(:has(.listen-reveal--fr[open])) .listen-reveal--en {
  opacity: 0.45;
}

.listen-passage:not(:has(.listen-reveal--fr[open])) .listen-reveal--en > :not(summary) {
  display: none;
}

.cluster-graph__canvas {
  position: relative;
  padding: 1.25rem 0.5rem 1.75rem;
}

.cluster-graph__edges {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.cluster-graph__edges path {
  fill: none;
  stroke: var(--color-line-strong);
  stroke-width: 1.75;
  stroke-linecap: round;
}

.cluster-graph__arrow {
  fill: var(--color-line-strong);
}

.cluster-graph__edge--sidequest {
  stroke: var(--color-purple);
  stroke-dasharray: 5 6;
  stroke-width: 1.5;
}

.cluster-graph__edge--from-sidequest {
  stroke-linecap: square;
  stroke-linejoin: miter;
}

.cluster-graph__layers {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 2.75rem;
}

.cluster-graph__layer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  column-gap: 1.15rem;
  min-width: 0;
}

.cluster-graph__side {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  justify-self: end;
  align-items: stretch;
  gap: 0.85rem 1.15rem;
  width: 15rem;
  max-width: 15rem;
  min-width: 0;
}

.cluster-graph__core {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: stretch;
  gap: 0.85rem 1.15rem;
}

.cluster-graph__node {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  width: min(17.5rem, 100%);
  padding: 0.85rem 1rem;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--color-surface-raised);
  box-shadow: 0 0 0 1px var(--color-cta);
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  transition:
    background var(--motion-fast),
    box-shadow var(--motion-fast),
    transform var(--motion-fast);
}

.cluster-graph__node:hover,
.cluster-graph__node[aria-expanded="true"] {
  transform: translateY(-1px);
  box-shadow:
    0 0 0 1px var(--color-cta),
    0 8px 22px var(--color-shadow);
}

.cluster-graph__node--start {
  box-shadow: 0 0 0 2px var(--color-cta);
}

.cluster-graph__node--start:hover,
.cluster-graph__node--start[aria-expanded="true"] {
  box-shadow:
    0 0 0 2px var(--color-cta),
    0 8px 22px var(--color-shadow);
}

.cluster-graph__node--sidequest {
  width: 15rem;
  flex-shrink: 0;
  background: transparent;
  box-shadow: 0 0 0 1px var(--color-purple);
}

.cluster-graph__node--sidequest:hover,
.cluster-graph__node--sidequest[aria-expanded="true"] {
  box-shadow:
    0 0 0 1px var(--color-purple),
    0 8px 22px var(--color-shadow);
}

.cluster-graph__node--next {
  background: transparent;
  box-shadow: 0 0 0 1px dashed var(--color-line-strong);
  color: var(--color-text-muted);
}

.cluster-graph__node--next:hover,
.cluster-graph__node--next[aria-expanded="true"] {
  box-shadow:
    0 0 0 1px dashed var(--color-line-strong),
    0 8px 22px var(--color-shadow);
}

.cluster-graph__node.is-placeholder {
  cursor: default;
  color: var(--color-text-muted);
  box-shadow: 0 0 0 1px var(--color-line);
}

.cluster-graph__node.is-placeholder:hover {
  transform: none;
  box-shadow: 0 0 0 1px var(--color-line);
}

.cluster-graph__node.is-complete {
  background: var(--color-green-wash);
  color: var(--color-green);
  box-shadow: 0 0 0 1px var(--color-green);
}

.cluster-graph__node.is-complete:hover,
.cluster-graph__node.is-complete[aria-expanded="true"] {
  background: var(--color-green-hover);
  box-shadow:
    0 0 0 1px var(--color-green),
    0 8px 22px var(--color-shadow);
}

.cluster-graph__node.is-complete .cluster-graph__step,
.cluster-graph__node.is-complete .cluster-graph__time {
  color: var(--color-green);
}

.cluster-graph__node.is-complete .cluster-graph__glyph {
  background: var(--color-green);
}

.cluster-graph__step {
  flex-shrink: 0;
  min-width: 1.35rem;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.5;
  color: var(--color-cta);
}

.cluster-graph__glyph {
  flex-shrink: 0;
  width: 0.7rem;
  height: 0.7rem;
  margin-top: 0.4em;
  background: var(--color-cta);
  border-radius: 50%;
}

.cluster-graph__glyph--grammar {
  border-radius: 2px;
  background: var(--color-blue);
}

.cluster-graph__glyph--verbs {
  border-radius: 1px;
  transform: rotate(45deg);
  background: var(--color-terracotta);
}

.cluster-graph__glyph--vocabulary {
  border-radius: 50%;
  background: var(--color-green);
}

.cluster-graph__glyph--pronunciation {
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  background: var(--color-purple);
}

.cluster-graph__glyph--part-1,
.cluster-graph__glyph--clusters {
  border-radius: 2px;
  height: 0.45rem;
  margin-top: 0.55em;
}

.cluster-graph__copy {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 0.2rem;
}

.cluster-graph__kicker,
.cluster-graph__time {
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--color-text-muted);
}

.cluster-graph__kicker {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-purple);
}

.cluster-graph__title {
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.3;
}

.cluster-graph__pane {
  position: fixed;
  z-index: 20;
  width: min(19rem, calc(100vw - 2rem));
  pointer-events: none;
}

.cluster-graph__detail {
  --tail-top: 1.5rem;
  position: relative;
  padding: 1.05rem 1.15rem 1.15rem;
  border-radius: var(--radius-md);
  background: var(--color-surface-raised);
  box-shadow:
    0 0 0 1px var(--color-line),
    0 14px 36px var(--color-shadow-strong);
  pointer-events: auto;
}

.cluster-graph__detail::before {
  content: "";
  position: absolute;
  top: var(--tail-top);
  left: -5px;
  width: 10px;
  height: 10px;
  background: var(--color-surface-raised);
  box-shadow: -1px 1px 0 var(--color-line);
  transform: translateY(-50%) rotate(45deg);
}

.cluster-graph__pane.is-flipped .cluster-graph__detail::before {
  left: auto;
  right: -5px;
  box-shadow: 1px -1px 0 var(--color-line);
}

.cluster-graph__detail-title,
.cluster-graph__detail-blurb,
.cluster-graph__detail-meta {
  margin: 0;
  padding: 0;
}

.cluster-graph__detail-title {
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.25;
}

.cluster-graph__detail-blurb {
  margin-top: 0.45rem;
  font-size: 0.9375rem;
  line-height: 1.45;
}

.cluster-graph__detail-rule {
  margin: 0.7rem 0 0.55rem;
  border: 0;
  border-top: 1px solid var(--color-line);
}

.cluster-graph__detail-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem 0.35rem;
  list-style: none;
  font-size: 0.75rem;
  color: var(--color-text-muted);
}

.cluster-graph__detail-dot {
  color: var(--color-line-strong);
}

.cluster-graph__detail-cta {
  display: inline-block;
  margin-top: 0.9rem;
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--color-cta);
}

.cluster-graph__list {
  margin: 1rem 0 0;
  padding-left: 1.2rem;
}

@media (max-width: 640px) {
  .cluster-graph__canvas {
    padding: 0.75rem 0 1.25rem;
  }

  .cluster-graph__layers {
    gap: 2rem;
  }

  .cluster-graph__layer {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 0.85rem;
  }

  .cluster-graph__side {
    justify-content: center;
    justify-self: stretch;
    width: auto;
    max-width: none;
  }

  .cluster-graph__node,
  .cluster-graph__node--sidequest {
    width: 100%;
  }
}
