﻿:root {
  --bg-main: #0b0d12;
  --bg-alt: #121620;
  --surface: #171c27;
  --surface-soft: #1d2431;
  --line: #2a3345;
  --line-soft: #232b3b;
  --text-main: #e9edf5;
  --text-muted: #a8b2c3;
  --gold: #d4af37;
  --gold-soft: rgba(212, 175, 55, 0.14);
  --gold-glow: rgba(212, 175, 55, 0.26);
  --ok: #29b96f;
  --warn: #d25d57;
  --max-w: 1240px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  color: var(--text-main);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.72;
  text-rendering: optimizeLegibility;
  background:
    radial-gradient(1200px 620px at 12% -10%, rgba(212, 175, 55, 0.16), rgba(212, 175, 55, 0) 65%),
    radial-gradient(900px 420px at 90% 0%, rgba(105, 153, 255, 0.11), rgba(105, 153, 255, 0) 68%),
    linear-gradient(180deg, var(--bg-alt), var(--bg-main));
  min-height: 100vh;
}

.read-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  z-index: 120;
  background: rgba(233, 237, 245, 0.12);
}

.read-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #b18f2d, var(--gold));
  transition: width 0.2s ease;
}

.institute-page {
  width: min(var(--max-w), 96vw);
  margin: 0 auto;
  padding: 30px 18px 80px;
}

.institute-hero {
  position: relative;
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 30px;
  background: linear-gradient(145deg, rgba(23, 28, 39, 0.95), rgba(15, 19, 28, 0.9));
  box-shadow: 0 20px 46px rgba(0, 0, 0, 0.45);
  overflow: hidden;
}

.institute-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
  background-size: 22px 22px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.5), transparent 85%);
}

.back-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: var(--gold);
  font-weight: 700;
  margin-bottom: 14px;
}

.hero-kicker {
  margin: 0;
  color: var(--gold);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.78rem;
  font-weight: 700;
}

.institute-hero h1 {
  margin: 8px 0 12px;
  max-width: 22ch;
  font-size: clamp(1.85rem, 4.5vw, 3.3rem);
  line-height: 1.08;
  letter-spacing: -0.02em;
}

.hero-subtitle {
  margin: 0;
  max-width: 70ch;
  color: #c7cfdd;
  font-size: 1.08rem;
}

.hero-description {
  margin: 10px 0 0;
  max-width: 76ch;
  color: var(--text-muted);
}

.hero-cues {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.cue-card {
  margin: 0;
  border: 1px solid #30415f;
  border-radius: 12px;
  background: rgba(20, 28, 40, 0.82);
  padding: 10px;
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 10px;
  align-items: start;
}

.cue-card img {
  width: 40px;
  height: 40px;
  border-radius: 8px;
}

.cue-card h3 {
  margin: 0;
  font-size: 0.95rem;
}

.cue-card p {
  margin: 4px 0 0;
  font-size: 0.86rem;
  line-height: 1.45;
  color: #aebad0;
}

.hero-meta {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.meta-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(20, 25, 35, 0.85);
  padding: 10px 12px;
}

.meta-label {
  display: block;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-bottom: 2px;
}

.institute-layout {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.institute-toc {
  position: sticky;
  top: 16px;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 14px;
  background: rgba(18, 22, 32, 0.95);
}

.institute-toc h2 {
  margin: 0 0 10px;
  font-size: 1.05rem;
}

.toc-toggle {
  display: none;
}

.institute-toc ol {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 4px;
}

.institute-toc a {
  color: #c1cada;
  text-decoration: none;
  display: block;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 10px;
  min-height: 42px;
  font-size: 0.92rem;
  transition: all 0.2s ease;
}

.institute-toc a:hover {
  border-color: #44526c;
  background: rgba(35, 47, 66, 0.45);
}

.institute-toc a.is-active {
  border-color: var(--gold);
  background: var(--gold-soft);
  color: #f5e8c1;
  box-shadow: inset 0 0 0 1px rgba(212, 175, 55, 0.2);
}

.institute-content {
  min-width: 0;
}

.institute-module,
.consolidation {
  border: 1px solid var(--line-soft);
  border-radius: 16px;
  background: rgba(22, 27, 38, 0.88);
  padding: 22px 22px 18px;
  margin-bottom: 16px;
  position: relative;
  overflow: hidden;
  scroll-margin-top: 60px;
}

.institute-module::before {
  content: attr(data-index);
  position: absolute;
  top: 4px;
  right: 14px;
  font-size: clamp(4rem, 9vw, 7.5rem);
  line-height: 1;
  font-weight: 800;
  color: rgba(212, 175, 55, 0.08);
  pointer-events: none;
}

.institute-module.is-active {
  border-color: rgba(212, 175, 55, 0.58);
  box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.2), 0 0 26px rgba(212, 175, 55, 0.14);
}

.module-head {
  position: relative;
  z-index: 1;
}

.module-head h2 {
  margin: 0;
  font-size: clamp(1.34rem, 2.2vw, 1.9rem);
  line-height: 1.2;
  letter-spacing: -0.01em;
}

.module-subtitle {
  margin: 7px 0 14px;
  color: #b7c0d0;
}

.institute-module p,
.consolidation p {
  margin: 0 0 12px;
  max-width: 78ch;
}

.module-box {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 12px 0;
}

.module-box h3,
.module-summary h3,
.consolidation h2 {
  margin: 0 0 6px;
  line-height: 1.25;
}

.module-box.example {
  background: rgba(30, 42, 61, 0.58);
  border-color: rgba(101, 144, 202, 0.45);
}

.market-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.market-card {
  border: 1px solid #32435f;
  border-radius: 12px;
  background: rgba(19, 28, 43, 0.76);
  padding: 11px 12px;
}

.market-card h3 {
  margin: 0;
  color: #d8e6ff;
  font-size: 0.98rem;
}

.market-card p {
  margin: 6px 0 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #b3c1d7;
}

.inline-illustration {
  margin: 14px 0 16px;
  border: 1px solid #33445f;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(16, 22, 32, 0.88);
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.34);
}

.inline-illustration img {
  width: 100%;
  height: auto;
  display: block;
  aspect-ratio: 16 / 9;
  object-fit: cover;
}

.inline-illustration figcaption {
  padding: 10px 11px;
  border-top: 1px solid #2f3c52;
  font-size: 0.87rem;
  line-height: 1.45;
  color: #b9c7de;
}

.module-box.error {
  background: rgba(56, 29, 29, 0.45);
  border-color: rgba(210, 93, 87, 0.52);
}

.module-summary {
  border: 1px solid rgba(212, 175, 55, 0.34);
  border-radius: 12px;
  background: rgba(212, 175, 55, 0.09);
  padding: 12px 14px;
  margin-top: 12px;
}

.module-summary ul,
.consolidation ul {
  margin: 0;
  padding-left: 18px;
}

.module-summary li,
.consolidation li {
  margin-bottom: 5px;
}

.checkpoint {
  margin: 14px 0 0;
  padding: 10px 12px;
  border: 1px dashed #4c5f7f;
  border-radius: 10px;
  color: #bfccdf;
  background: rgba(26, 35, 50, 0.55);
}

.checkpoint::before {
  content: "Checkpoint";
  margin-right: 8px;
  font-size: 0.74rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8ea4c6;
}

.checkpoint.is-complete {
  border-color: rgba(41, 185, 111, 0.7);
  background: rgba(25, 60, 47, 0.48);
  color: #c8f3de;
}

.consolidation {
  background: linear-gradient(140deg, rgba(27, 33, 46, 0.96), rgba(20, 24, 35, 0.92));
  border-color: rgba(90, 106, 130, 0.55);
}

.consolidation h2 {
  font-size: clamp(1.14rem, 2vw, 1.42rem);
  color: #d4dded;
}

.fade-in {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.fade-in.is-visible {
  opacity: 1;
  transform: none;
}

@media (max-width: 1100px) {
  .institute-layout {
    grid-template-columns: 1fr;
  }

  .institute-toc {
    position: static;
  }

  .institute-toc ol {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  body {
    line-height: 1.66;
  }

  .institute-page {
    width: min(100vw, var(--max-w));
    padding: 12px 10px calc(56px + env(safe-area-inset-bottom));
  }

  .institute-hero {
    padding: 18px 14px;
    border-radius: 14px;
  }

  .institute-hero::after {
    display: none;
  }

  .institute-hero h1 {
    max-width: 100%;
    font-size: clamp(1.62rem, 7vw, 2.05rem);
    line-height: 1.14;
  }

  .hero-subtitle {
    font-size: 0.98rem;
  }

  .hero-description {
    font-size: 0.95rem;
  }

  .hero-meta {
    grid-template-columns: 1fr;
  }

  .hero-cues {
    grid-template-columns: 1fr;
  }

  .institute-toc {
    padding: 10px;
    border-radius: 12px;
  }

  .toc-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid #3a4961;
    background: rgba(31, 40, 56, 0.85);
    color: #d6deec;
    border-radius: 10px;
    min-height: 44px;
    padding: 9px 12px;
    font-size: 0.92rem;
    margin-bottom: 8px;
  }

  .toc-toggle::after {
    content: "+";
    font-size: 1.08rem;
    color: #9cb0cf;
  }

  .institute-toc:not(.is-collapsed) .toc-toggle::after {
    content: "-";
  }

  .institute-toc.is-collapsed ol {
    display: none;
  }

  .institute-toc ol {
    grid-template-columns: 1fr;
  }

  .institute-toc a {
    min-height: 44px;
    font-size: 0.9rem;
  }

  .institute-module,
  .consolidation {
    padding: 15px 13px;
    border-radius: 12px;
  }

  .module-head h2 {
    font-size: 1.2rem;
  }

  .module-subtitle {
    font-size: 0.92rem;
  }

  .institute-module p,
  .consolidation p,
  .module-summary li,
  .consolidation li {
    font-size: 0.97rem;
  }

  .market-board {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .inline-illustration figcaption {
    font-size: 0.84rem;
  }

  .institute-module::before {
    font-size: 4.2rem;
    right: 8px;
  }

  .checkpoint {
    font-size: 0.92rem;
    line-height: 1.55;
  }
}

@media (max-width: 430px) {
  .institute-page {
    padding: 10px 8px calc(50px + env(safe-area-inset-bottom));
  }

  .institute-module,
  .consolidation {
    padding: 14px 12px;
  }

  .module-box,
  .module-summary {
    padding: 10px 11px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .fade-in {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
