/* v1.0（2026-11-25）：ニュートンリングの段階表示と数式
   v1.1（2026-11-25 ClaudeCode）：教材の図注の2段化・確認事項・対照表
   v1.2（2026-12-01 Antigravity）：冒頭のHTML/CSS概念図を追加 */
.pi-visual {
    margin: 28px auto;
    padding: 20px;
    background: var(--bg-white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

.pi-visual-heading {
    margin: 0 0 15px;
    color: var(--navy);
    font-size: 16px;
    font-weight: 700;
    line-height: 1.7;
}

.col-body .pi-visual-intro {
    margin: 0 0 18px;
    color: #526273;
    font-size: 13px;
    line-height: 1.8;
}

.pi-stage-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.pi-stage-title {
    color: var(--navy);
    font-size: 15px;
    font-weight: 700;
}

.pi-stage-counter {
    color: #526273;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.pi-svg-wrap {
    background: #f8fafc;
    border: 1px solid #e1e8ef;
    border-radius: 6px;
    overflow: hidden;
}

.pi-svg-wrap svg {
    display: block;
    width: 100%;
    height: auto;
}

.pi-svg-wrap svg text {
    font-family: "Noto Sans JP", sans-serif;
}

.col-body .pi-stage-description {
    min-height: 4.5em;
    margin: 15px 0;
    color: #334155;
    font-size: 14px;
    line-height: 1.8;
}

.pi-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.pi-control {
    min-width: 110px;
    padding: 10px 17px;
    border: 1px solid #315f8c;
    border-radius: 5px;
    background: var(--bg-white);
    color: #315f8c;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.pi-control-primary {
    background: #315f8c;
    color: #fff;
}

.pi-control:hover:not(:disabled) {
    background: #eaf2fa;
}

.pi-control-primary:hover:not(:disabled) {
    background: #21476d;
}

.pi-control:focus-visible {
    outline: 3px solid #7db5ed;
    outline-offset: 3px;
}

.pi-control:disabled {
    opacity: .4;
    cursor: default;
}

.col-body .pi-visual-caption {
    margin: 15px 0 0;
    color: #66727d;
    font-size: 12px;
    line-height: 1.8;
}

/* SVGの段階表示 */
.pi-visual [data-show-from] {
    opacity: 0;
    visibility: hidden;
    transition: opacity .3s ease;
}

.pi-visual [data-show-from].is-visible {
    opacity: 1;
    visibility: visible;
}

/* JS無効時は全経路を表示 */
.pi-visual:not(.is-interactive) [data-show-from] {
    opacity: 1;
    visibility: visible;
}

/* 光線の共通設定 */
.pi-ray {
    fill: none;
    stroke-width: 3.4;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.pi-ray-blue {
    stroke: #2563eb;
}

.pi-ray-green {
    stroke: #169b55;
}

.pi-ray-orange {
    stroke: #e87916;
}

@media (prefers-reduced-motion: reduce) {
    .pi-visual [data-show-from] {
        transition: none;
    }
}

.pi-equation {
    line-height: 1.85;
    overflow-wrap: anywhere;
    text-wrap: balance;
}

@media (max-width: 600px) {
    .pi-visual {
        padding: 14px 12px;
    }

    .pi-stage-title {
        font-size: 14px;
    }

    .col-body .pi-stage-description {
        font-size: 13px;
    }

    .pi-control {
        min-width: 95px;
        padding: 10px 12px;
        font-size: 13px;
    }
}

/* v1.1（2026-11-25 ClaudeCode）：Codex 改善案の反映。教材の図注の2段化、中心の明暗の前の確認事項、反射光①・②の対照表 */

.col-body .pi-figure-reading,
.col-body .pi-figure-notes p {
  margin: 0;
  color: inherit;
  font-size: inherit;
  line-height: inherit;
}

.col-body .pi-figure-reading {
  color: var(--navy);
  font-weight: 700;
}

.pi-figure-notes {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.col-body .pi-figure-notes p + p {
  margin-top: 6px;
}

.pi-compare-table {
  table-layout: fixed;
}

.pi-compare-table th[scope="row"] {
  width: 30%;
}

.pi-compare-table th,
.pi-compare-table td {
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.pi-compare-table .pi-boundary {
  display: inline-block;
  margin-top: 2px;
  color: var(--text-muted);
  font-size: 12.5px;
  white-space: nowrap;
}

@media (max-width: 600px) {
  .pi-compare-table th,
  .pi-compare-table td {
    padding: 10px 8px;
    font-size: 13px;
  }

  .pi-compare-table th[scope="row"] {
    width: 28%;
  }

  .pi-compare-table .pi-boundary {
    font-size: 11.5px;
  }
}

/* v1.2（2026-12-01 Antigravity）：冒頭のHTML/CSS概念図 */
.pi-hero-figure {
  max-width: none;
  margin: 0;
}

.pi-concept {
  padding: clamp(14px, 1.8vw, 20px);
  background: var(--bg-white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: center;
}

.pi-concept-title {
  margin: 0 0 12px;
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--navy);
  word-break: auto-phrase;
  text-wrap: balance;
}

.pi-concept-top {
  padding: 10px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-top: 2px solid var(--navy);
  border-radius: var(--radius);
}

.pi-concept-top-title {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
  color: var(--navy);
  word-break: auto-phrase;
  text-wrap: balance;
}

.pi-concept-top-desc {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text);
  word-break: auto-phrase;
  text-wrap: balance;
}

.pi-concept-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.pi-concept-card {
  padding: 10px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-top: 2px solid var(--navy);
  border-radius: var(--radius);
}

.pi-concept-name {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
  color: var(--navy);
  word-break: auto-phrase;
  text-wrap: balance;
}

.pi-concept-desc {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--text);
  word-break: auto-phrase;
  text-wrap: balance;
}

.pi-concept-arrow {
  margin: 8px 0;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  color: var(--navy);
}

.pi-concept-note {
  margin: 0;
  padding: 9px 12px;
  background: #faf2f0;
  border: 2px solid var(--accent);
  border-radius: var(--radius);
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.5;
  color: var(--accent);
  word-break: auto-phrase;
  text-wrap: balance;
}

@media (max-width: 960px) {
  .pi-hero-figure {
    max-width: 520px;
    width: 100%;
    margin: 0 auto;
  }
}

@media (max-width: 420px) {
  .pi-concept {
    padding: 12px;
  }

  .pi-concept-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}
