/* EngiAtlas site-wide information hierarchy and contrast fix */
:root {
  /* EngiAtlas Design System v1: typography */
  --ea-font-sans: "Noto Sans JP", "Helvetica Neue", Arial, sans-serif;
  --ea-font-math: "STIX Two Math", "Cambria Math", "Times New Roman", serif;
  --ea-body-size: 18px;
  --ea-support-size: 16px;
  --ea-label-size: 14px;
  --ea-h1-size: clamp(36px, 4.3vw, 48px);
  --ea-h2-size: 30px;
  --ea-h3-size: 20px;
  --ea-body-leading: 1.9;
  --ea-support-leading: 1.75;

  /* EngiAtlas Design System v1: colour and shape */
  --ea-text: #26323b;
  --ea-secondary: #46545e;
  --ea-metadata: #5f6c75;
  --ea-border: #aeb8c0;
  --ea-surface: #ffffff;
  --ea-surface-muted: #f4f6f7;
  --ea-radius: 2px;

  /* EngiAtlas Design System v1: 8 px spacing scale */
  --ea-space-1: 8px;
  --ea-space-2: 16px;
  --ea-space-3: 24px;
  --ea-space-4: 32px;
  --ea-space-6: 48px;
  --ea-space-8: 64px;
}

body {
  color: var(--ea-text);
  font-family: var(--ea-font-sans);
  font-size: var(--ea-body-size);
  line-height: var(--ea-body-leading);
}

.hero h1,
.section-head h2,
.article-hero h1,
.article-section h2 {
  font-weight: 650;
  font-feature-settings: "palt" 1;
}

.brand::after { font-size: 13px; }

.nav-links,
.lang-switch,
.meta-pill,
.article-facts,
.breadcrumb,
.article-toc a,
.side-node,
.node-meta,
.column-note,
.discipline,
.footer {
  font-size: var(--ea-label-size);
}

.eyebrow,
.kicker,
.article-label,
.section-index,
.column-number,
.principle-num,
.article-toc > p,
.side-map > p,
.symbol-table th,
.verification-note span,
.calc-field label,
.calc-result span {
  color: var(--ea-secondary);
  font-size: var(--ea-label-size);
  letter-spacing: .02em;
}

.article-deck,
.section-head p,
.hero-copy,
.path-banner p,
.principles p,
.trust-list p {
  color: #38454f;
  font-size: 17px;
}

.article-hero-inner { max-width: 1160px; }
.article-hero h1 {
  letter-spacing: -.01em;
}
.article-deck {
  max-width: 940px;
  color: #34424d;
  font-size: 18px;
  font-weight: 450;
  line-height: 1.9;
  line-break: strict;
  text-wrap: pretty;
}

.article-section h2 {
  align-items: baseline;
  gap: 14px;
  font-size: var(--ea-h2-size);
}
.section-index {
  min-width: 32px;
  color: var(--blue);
  font-family: var(--ea-font-sans);
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: .01em;
}
.article-body p,
.quick-box p {
  color: var(--ea-text);
  font-size: 18px;
}
.quick-box strong { font-size: 21px; }

.equation-card {
  border-color: var(--ea-border);
  background: #fff;
}
.advanced-equation { background: #fff; }

.equation-label {
  display: block;
  margin: 0 0 18px;
  padding: 3px 0 3px 12px;
  border-left: 3px solid var(--blue);
  color: #24333e;
  font-size: 16px;
  font-weight: 750;
  line-height: 1.55;
  letter-spacing: 0;
  text-align: left;
  text-transform: none;
}

.equation-note {
  position: relative;
  display: block;
  max-width: 700px;
  margin: 20px auto 0;
  padding: 15px 0 0 106px;
  border-top: 1px solid #c7cfd5;
  color: #34434e;
  font-size: 16px;
  font-weight: 500;
  line-height: 1.8;
  text-align: left;
}
:lang(ja) .equation-note::before { content: "この式の意味"; }
:lang(en) .equation-note::before { content: "What it means"; }
.equation-note::before {
  position: absolute;
  top: 17px;
  left: 0;
  color: var(--blue);
  font-size: 14px;
  font-weight: 750;
  line-height: 1.5;
}

.symbol-table { font-size: 16px; }
.derive-step p,
.condition-card p,
.calculator > p,
.mistake p,
.verification-note p,
.source-list li,
.next-card p,
.application-tags span {
  color: var(--ea-text);
  font-size: 16px;
}
.source-list li { line-height: var(--ea-support-leading); }
.condition-card h3,
.calculator h3 { font-size: 18px; }

.condition-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
  border-top: 1px solid #8998a2;
  border-bottom: 1px solid #8998a2;
}
.condition-card,
.condition-card.good,
.condition-card.warn {
  padding: 24px 28px 26px;
  border: 0;
  border-radius: 0;
  background: transparent;
}
.condition-card + .condition-card {
  border-left: 1px solid var(--ea-border);
}
.condition-card h3 {
  margin: 0 0 14px;
  color: var(--ea-text);
  font-size: 19px;
  font-weight: 650;
}
.condition-card.good h3 { color: #1f665b; }
.condition-card.warn h3 { color: #8a402f; }
.condition-card p {
  margin: 7px 0;
  color: var(--ea-text);
  font-size: 17px;
  line-height: 1.75;
}

.given {
  display: flex;
  align-items: center;
  min-width: 0;
  padding: 10px 14px;
  border-right: 1px solid #b8c1c8;
  color: #26343e;
  font-size: 14px;
}
.given:last-child { border-right: 0; }
.example-given {
  position: relative;
  display: grid;
  grid-template-columns: auto repeat(4, minmax(0, 1fr));
  margin-top: 22px;
  border-color: #b8c1c8;
  background: #f7f8f9;
}
:lang(ja) .example-given::before { content: "条件"; }
:lang(en) .example-given::before { content: "Given"; }
.example-given::before {
  display: flex;
  align-items: center;
  padding: 8px 13px;
  border-right: 1px solid #aeb8c0;
  background: #435561;
  color: #fff;
  font-size: 14px;
  font-weight: 750;
}

.example-relation { margin-top: 26px !important; }
:lang(ja) .example-relation::before { content: "使う式"; }
:lang(en) .example-relation::before { content: "Equation used"; }
.example-relation::before {
  display: block;
  margin: 0 0 13px;
  color: var(--blue);
  font-size: 15px;
  font-weight: 750;
  text-align: left;
}

.answer-line {
  margin-top: 25px;
  padding-top: 20px;
  border-top-color: #b8c1c8;
}
:lang(ja) .answer-line::before { content: "解答"; }
:lang(en) .answer-line::before { content: "Answer"; }
.answer-line::before {
  display: block;
  margin: 0 0 15px;
  color: #26343e;
  font-size: 16px;
  font-weight: 750;
  text-align: left;
}

.calc-field label,
.calc-result span {
  color: #3e4d58;
  font-size: 14px;
}
.calc-result {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
  padding: 0;
  border-top: 1px solid var(--ea-border);
  border-bottom: 0;
  background: transparent;
}
.calc-result > div {
  display: grid;
  grid-template-columns: minmax(190px, 1fr) auto;
  gap: 24px;
  align-items: baseline;
  padding: 15px 0;
  border-bottom: 1px solid var(--ea-border);
}
.calc-result strong {
  margin: 0;
  font-family: var(--font-body);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}
.concept-figure figcaption span,
.concept-glossary dd,
.beginner-sequence p { color: #3d4b55; }

.diagram-label text:nth-last-child(-n+2) {
  font-size: 14px;
}

/* Keep the inlet and outlet labels equal; the generic diagram rule makes the
   final two SVG labels smaller for the pipe-width annotations. */
.control-volume-figure .diagram-label text:nth-child(2) {
  fill: #263640;
  font-size: 17px;
  font-weight: 650;
}

@media (max-width: 720px) {
  body { font-size: 17px; }
  .article-section h2 { font-size: 27px; }
  .section-index {
    min-width: 29px;
    font-size: 17px;
  }
  .article-body p,
  .quick-box p { font-size: 17px; }
  .equation-label { font-size: 15px; }
  .equation-note {
    padding-left: 0;
    font-size: 16px;
  }
  .equation-note::before {
    position: static;
    display: block;
    margin-bottom: 7px;
  }
  .example-given {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .example-given::before {
    grid-column: 1 / -1;
    width: 100%;
    border-right: 0;
  }
  .given {
    border-top: 1px solid #b8c1c8;
  }
  .given:nth-of-type(odd) {
    border-right: 1px solid #b8c1c8;
  }
  .given:nth-of-type(even) {
    border-right: 0;
  }
  .calc-result > div {
    grid-template-columns: 1fr auto;
    gap: 16px;
  }
  .condition-grid {
    grid-template-columns: 1fr;
  }
  .condition-card,
  .condition-card.good,
  .condition-card.warn {
    padding: 22px 4px;
  }
  .condition-card + .condition-card {
    border-top: 1px solid var(--ea-border);
    border-left: 0;
  }
  .nav-links { font-size: 13px; }
}

@media (max-width: 480px) {
  .article-deck {
    font-size: 17px;
    line-height: 1.85;
  }
  .example-given {
    grid-template-columns: 1fr;
  }
  .given,
  .given:nth-of-type(odd),
  .given:nth-of-type(even) {
    border-right: 0;
  }
  .calc-result > div {
    grid-template-columns: 1fr;
    gap: 5px;
  }
  .calc-result strong {
    text-align: left;
  }
  .control-volume-figure .diagram-label text:nth-child(2) {
    font-size: 15px;
  }
}
