/* ============================================================
   RESET & BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.78;
  color: var(--txt);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--teal); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--teal-dark); }

/* ============================================================
   TYPOGRAPHY
   ============================================================ */
h1 { font-size: 1.6rem; font-weight: 700; color: var(--navy); margin: 40px 0 16px; letter-spacing: -0.3px; }
h2 { font-size: 1.15rem; font-weight: 600; color: var(--navy); margin: 32px 0 12px; }
h3 { font-size: 1rem; font-weight: 600; color: var(--teal-dark); margin: 24px 0 10px; }
p { margin-bottom: 16px; color: var(--txt-secondary); }
ul, ol { margin-bottom: 16px; padding-left: 24px; color: var(--txt-secondary); }
li { margin-bottom: 6px; }
li::marker { color: var(--teal); }
strong { color: var(--navy); font-weight: 600; }
blockquote {
  border-left: 3px solid var(--gold);
  padding: 12px 20px;
  margin: 20px 0;
  background: rgba(200,169,81,0.04);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  font-style: italic;
  color: var(--txt-secondary);
}

/* ============================================================
   PROGRESS BAR
   ============================================================ */
#progress-bar {
  position: fixed;
  top: 0; left: 0;
  height: 3px;
  width: 0%;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold), var(--gold-light));
  z-index: 9999;
  transition: width 80ms linear;
  box-shadow: 0 0 8px rgba(200,169,81,0.3);
}

/* ============================================================
   TABLES
   ============================================================ */
.table-wrap {
  overflow-x: auto;
  margin: 20px 0;
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  background: var(--card);
}
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th {
  background: var(--navy);
  color: #fff;
  padding: 13px 18px;
  font-weight: 600;
  text-align: left;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
td {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: top;
  color: var(--txt-secondary);
}
tr:nth-child(even) { background: #f9fafb; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(46,139,139,0.03); }

/* ============================================================
   CALLOUT BOXES
   ============================================================ */
.note {
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
  border-left: 4px solid var(--teal);
  padding: 18px 22px;
  margin: 24px 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.9rem;
  line-height: 1.65;
  color: var(--txt-secondary);
}
.note strong { color: var(--teal-dark); }
.related-party-box {
  background: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
  border-left: 4px solid #ea580c;
  padding: 18px 22px;
  margin: 24px 0;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 0.9rem;
  color: #7c2d12;
}
.disclaimer-box {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1px solid #fde68a;
  border-radius: var(--radius);
  padding: 28px 32px;
  margin-bottom: 32px;
  font-size: 0.88rem;
  line-height: 1.75;
  color: #78350f;
}

/* ============================================================
   DIAGRAM CONTAINERS
   ============================================================ */
.diagram-container {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px 20px;
  margin: 28px 0;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}
.diagram-container:hover { box-shadow: var(--shadow-md); }
.diagram-title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--txt-muted);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.diagram-title::before {
  content: '';
  width: 10px; height: 10px;
  border-radius: 3px;
  background: linear-gradient(135deg, var(--teal), var(--teal-light));
  flex-shrink: 0;
}
.mermaid { text-align: center; }
.mermaid svg { max-width: 100%; height: auto; }

/* ============================================================
   BACK TO TOP
   ============================================================ */
.back-to-top {
  position: fixed;
  bottom: 28px; right: 28px;
  width: 46px; height: 46px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--gold), var(--gold-light));
  color: var(--navy);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(200,169,81,0.35);
  opacity: 0;
  transform: translateY(16px);
  transition: all var(--transition);
  z-index: 50;
}
.back-to-top.visible { opacity: 1; transform: translateY(0); }
.back-to-top:hover { transform: translateY(-2px); box-shadow: 0 6px 24px rgba(200,169,81,0.45); }
.back-to-top svg { width: 20px; height: 20px; stroke: var(--navy); fill: none; stroke-width: 2.5; }

/* ============================================================
   FOOTER
   ============================================================ */
footer {
  margin-top: 72px;
  padding: 32px 0;
  border-top: 2px solid var(--border);
  font-size: 0.8rem;
  color: var(--txt-muted);
  text-align: center;
}
