/* 技 Forbidden arts. The page's one light chapter: an ivory sheet with an accordion of three arts.
   Each art is shown by the revenant who wields it (Aya counters, Shion weaves, Goro unmakes), so the
   figure on the left changes with your choice. The section is a wrapper, the visible sheet is
   .combat-stage (it carries the dawn iris that opens it, see chapters.css). */

.combat {
  position: relative;
  background: var(--paper);
  color: var(--ink);
}
.combat-stage {
  position: relative;
  padding: 118px var(--pad) 70px;
  overflow: clip;
  isolation: isolate;
  background: var(--paper);
}
.combat-stage::before {
  /* a faint paper fibre, so the sheet reads as washi rather than a flat fill */
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(ellipse at 20% 10%, #fffaf0 0%, transparent 55%),
    repeating-linear-gradient(97deg, #0f130e05 0 1px, transparent 1px 7px);
}
.combat :is(.combat-head, .ability-list, .combat-hud, .combat-stage > .chapter-mark) {
  opacity: var(--chapter-ink, 1); /* dims while the districts open over it */
}
.combat-head {
  display: flex;
  justify-content: space-between;
  gap: 40px;
  align-items: end;
  margin-top: 26px;
}
.combat-head > p {
  max-width: 300px;
  margin-bottom: 8px;
  color: #5c6252;
}
.combat-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 8%;
  margin-top: 28px;
  align-items: center;
}

/* ---------- The wielder: three figures, one shown at a time ---------- */
.combat-visual {
  position: relative;
  aspect-ratio: 1.1;
  isolation: isolate;
  transform: translate3d(var(--stance-x, 0px), var(--stance-y, 0px), 0) rotate(var(--stance-turn, 0deg))
    scale(var(--stance-scale, 1));
}
.combat-visual::before {
  /* the red sun again, small, behind whoever holds the art */
  content: "";
  position: absolute;
  left: 50%;
  top: 44%;
  width: 46%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--shu);
  opacity: 0.9;
  transform: translate(-50%, -50%);
}
.combat-art {
  position: absolute;
  inset: 0 6% 40px;
  width: 88%;
  height: calc(100% - 40px);
  object-fit: contain;
  filter: drop-shadow(12px 18px 0 #8c96752a); /* a flat offset shadow, like a print */
  opacity: 0;
  transform: rotate(-4deg) translateX(-14px);
  transition:
    opacity 0.5s,
    transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.combat-visual[data-art="counter"] [data-art-figure="counter"],
.combat-visual[data-art="weave"] [data-art-figure="weave"],
.combat-visual[data-art="unmake"] [data-art-figure="unmake"] {
  opacity: 1;
  transform: rotate(-8deg);
}
.combat-visual[data-art="weave"] [data-art-figure="weave"] {
  transform: rotate(2deg);
}
.combat-hud {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding-top: 14px;
  border-top: 1px solid #0f130e30;
}
.sync {
  display: flex;
  align-items: center;
  gap: 12px;
}
.sync-bar {
  width: 110px;
  height: 2px;
  background: #0f130e22;
}
.sync-bar i {
  display: block;
  height: 100%;
  background: var(--shu);
  transform: scaleX(var(--sync, 0.84));
  transform-origin: left;
  transition: transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.sync b {
  min-width: 4ch;
  text-align: right;
}

/* ---------- The three arts (an accordion) ---------- */
.ability-list {
  min-height: 420px;
}
.ability {
  border-bottom: 1px solid #0f130e26;
  transform: translateX(var(--ability-x, 0px));
  clip-path: inset(0 0 0 var(--ability-cut, 0%)); /* wipes in from the left */
}
.ability > button {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 22px 0;
  text-align: left;
  color: #727866;
  transition: color 0.3s;
}
.ability > button:hover,
.ability > button[aria-expanded="true"] {
  color: var(--ink);
}
.ability-title {
  font: 800 var(--text-line) / 1.1 var(--font-display);
  text-transform: uppercase;
}
.ability button .icon {
  color: var(--shu);
}
.ability button[aria-expanded="true"] {
  --icon-open: 1; /* folds the plus into a minus (assets/icons.svg) */
}
.ability-content {
  padding: 0 0 24px;
}
.ability-content p {
  max-width: 400px;
  color: #50574a;
}
.ability-content .label {
  margin-top: 16px;
  color: var(--shu-deep);
}

/* ---------- Tablet ---------- */
@media (max-width: 1100px) {
  .combat-head > p {
    max-width: 240px;
  }
  .combat-grid {
    gap: 4%;
  }
}

/* ---------- Tall desktop: the sheet pins and fits one screen ---------- */
@media (min-width: 761px) and (min-height: 780px) {
  .combat-stage {
    position: sticky;
    top: 0;
    min-height: 100svh;
  }
  .combat-grid {
    grid-template-columns: 1.1fr 1fr;
  }
  .combat-visual {
    height: min(52svh, 600px);
    aspect-ratio: auto;
  }
}

/* ---------- Phone ---------- */
@media (max-width: 760px) {
  .combat {
    scroll-margin-top: 70px;
  }
  .combat-stage {
    padding: 84px 22px 60px;
  }
  .combat-head {
    display: block;
  }
  .combat-head > p {
    max-width: 320px;
    margin-top: 22px;
  }
  .combat-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
  }
  .combat-visual {
    width: 100%;
    aspect-ratio: 1;
    max-height: 420px;
  }
  .ability-list {
    width: 100%;
    min-height: 0;
  }
  .ability > button {
    padding: 20px 0;
  }
}

/* ---------- Reduced motion ---------- */
html:is(.reduced, .compact-layout) .combat-stage {
  position: relative;
  min-height: 0;
}
html:is(.reduced, .compact-layout) main :is(.combat-visual, .ability) {
  transform: none !important;
  clip-path: none !important;
  opacity: 1 !important;
}
