/* ==========================================================================
   EasyCompare Quantitative Investing Guide - Stylesheet
   Font: Same clean system/Inter sans-serif stack as the EasyCompare landing page
   Width: Wide reading layout + friendly, legible sidebar
   ========================================================================== */

:root {
  --gd-bg: #fbfcfe;
  --gd-surface: #ffffff;
  --gd-surface-soft: #f3f6fb;
  --gd-ink: #0e1726;
  --gd-ink-body: #1e293b;
  --gd-ink-muted: #44516a;
  --gd-ink-subtle: #6b7890;
  --gd-border: #e4e9f2;
  --gd-border-strong: #cbd5e1;
  --gd-accent: #0f766e;
  --gd-accent-soft: #f0fdfa;
  --gd-accent-border: #99f6e4;
  --gd-brand: #3b5bdb;
  --gd-brand-soft: #edf2ff;
  --gd-crimson: #be123c;
  --gd-font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", Inter, "Segoe UI", "Helvetica Neue", sans-serif;
  --gd-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body.gd-body {
  margin: 0;
  background-color: var(--gd-bg);
  color: var(--gd-ink-body);
  font-family: var(--gd-font);
  font-size: 18px;
  line-height: 1.72;
  -webkit-font-smoothing: antialiased;
}

/* Top Site Navigation */
.gd-top-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(251, 252, 254, 0.94);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--gd-border);
  font-family: var(--gd-font);
}

.gd-top-inner {
  width: min(88%, 1440px);
  margin: 0 auto;
  padding: 14px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.gd-brand-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.gd-brand-link {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: var(--gd-ink);
  font-weight: 700;
  font-size: 16.5px;
}

.gd-brand-divider {
  color: var(--gd-border-strong);
  font-weight: 400;
}

.gd-guide-title {
  font-size: 16.5px;
  font-weight: 600;
  color: var(--gd-ink-muted);
  text-decoration: none;
}

.gd-guide-title:hover,
.gd-guide-title[aria-current="page"] {
  color: var(--gd-ink);
}

.gd-top-links {
  display: flex;
  align-items: center;
  gap: 24px;
  font-size: 15.5px;
}

.gd-top-links a {
  color: var(--gd-ink-muted);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.15s ease;
}

.gd-top-links a:hover,
.gd-top-links a[aria-current="page"] {
  color: var(--gd-ink);
  font-weight: 600;
}

.gd-top-cta {
  background: var(--gd-ink);
  color: #ffffff !important;
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600 !important;
  font-size: 14.5px;
}

.gd-top-cta:hover {
  background: #1e293b;
}

/* ==========================================================================
   COVER PAGE LAYOUT (`/guide`) - Simple, Single Vertical Flow, Large Cover
   ========================================================================== */

.gd-cover-shell {
  width: min(88%, 880px);
  margin: 0 auto;
  padding: 40px 0 96px;
}

.gd-cover-book-large {
  background: #ffffff;
  border: 1px solid #d8e2ef;
  border-radius: 18px;
  padding: clamp(28px, 4vw, 48px);
  box-shadow: 0 18px 46px rgba(14, 23, 38, 0.08);
  text-align: center;
}

.gd-cover-card-top {
  border-top: 2px solid #cbd5e1;
  border-bottom: 1px solid #cbd5e1;
  padding: 24px 16px 22px;
  margin-bottom: 28px;
}

.gd-cover-card-title {
  font-size: clamp(1.85rem, 3.2vw, 2.55rem);
  font-weight: 800;
  line-height: 1.18;
  letter-spacing: -0.025em;
  color: #b91c1c;
  margin: 0 0 12px;
  max-width: none;
}

.gd-cover-card-sub {
  font-size: clamp(1.08rem, 1.6vw, 1.3rem);
  line-height: 1.45;
  color: var(--gd-ink-muted);
  font-weight: 500;
  margin: 0 0 14px;
  max-width: none;
}

.gd-cover-card-author {
  font-size: 18px;
  font-weight: 700;
  color: var(--gd-ink);
  margin: 0;
}

.gd-cover-photo-wrap {
  max-width: 640px;
  margin: 0 auto 28px;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid #e2e8f0;
  background: #f1f5f9;
}

.gd-cover-photo-wrap img {
  display: block;
  width: 100%;
  height: auto;
}

.gd-cover-cta-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 14px;
}

.gd-btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--gd-accent);
  color: #ffffff !important;
  font-size: 16.5px;
  font-weight: 700;
  padding: 14px 28px;
  border-radius: 10px;
  text-decoration: none !important;
  transition: background 0.15s ease;
}

.gd-btn-primary:hover {
  background: #115e59;
}

.gd-btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #ffffff;
  color: var(--gd-ink) !important;
  border: 1px solid var(--gd-border-strong);
  font-size: 16px;
  font-weight: 600;
  padding: 13px 22px;
  border-radius: 10px;
  text-decoration: none !important;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.gd-btn-secondary:hover {
  background: var(--gd-surface-soft);
  border-color: var(--gd-ink);
}

/* Vertical Sections Below the Cover */
.gd-cover-vertical-sections {
  margin-top: 44px;
  display: flex;
  flex-direction: column;
  gap: 36px;
}

.gd-cover-section {
  padding-top: 32px;
  border-top: 1px solid var(--gd-border);
}

.gd-cover-section:first-child {
  padding-top: 0;
  border-top: none;
}

.gd-course-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 4px 0 10px;
}

.gd-course-form input {
  flex: 1 1 260px;
  font: inherit;
  font-size: 16.5px;
  padding: 13px 16px;
  border: 1px solid var(--gd-border-strong);
  border-radius: 10px;
  background: var(--gd-surface);
  color: var(--gd-ink);
}

.gd-course-form input:focus {
  outline: 2px solid var(--gd-brand);
  outline-offset: 1px;
  border-color: transparent;
}

.gd-course-form button {
  border: 0;
  cursor: pointer;
  font-family: inherit;
}

.gd-course-form button:disabled {
  opacity: 0.6;
  cursor: wait;
}

.gd-cover-section .gd-course-status {
  min-height: 1.5em;
  font-size: 15.5px;
  margin: 0;
  color: var(--gd-ink-muted);
}

.gd-course-status[data-tone="ok"] { color: var(--gd-accent); }
.gd-course-status[data-tone="error"] { color: var(--gd-crimson); }

.gd-cover-section h2 {
  font-size: 24px;
  font-weight: 700;
  color: var(--gd-ink);
  margin: 0 0 12px;
  letter-spacing: -0.02em;
}

.gd-cover-section p {
  font-size: 18px;
  line-height: 1.72;
  color: var(--gd-ink-body);
  margin: 0 0 16px;
  max-width: none;
}

.gd-cover-section p:last-child {
  margin-bottom: 0;
}

/* ==========================================================================
   FOCUSED CHAPTER LAYOUT (Centered Reading Column + Right-Side Contents Drawer)
   ========================================================================== */

.gd-layout {
  width: min(88%, 1080px);
  margin: 0 auto;
  padding: 44px 0 96px;
}

.gd-toc-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: #ffffff;
  border: 1px solid var(--gd-border-strong);
  border-radius: 8px;
  padding: 7px 14px;
  font-family: var(--gd-font);
  font-size: 14.5px;
  font-weight: 600;
  color: var(--gd-ink);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.gd-toc-toggle:hover,
.gd-toc-toggle[aria-expanded="true"] {
  border-color: var(--gd-ink);
  background: var(--gd-surface-soft);
}

.gd-toc-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(14, 23, 38, 0.28);
  opacity: 0;
  transition: opacity 0.2s ease;
}

body.gd-toc-open .gd-toc-overlay {
  opacity: 1;
}

body.gd-toc-open {
  overflow: hidden;
}

/* Right-Side Contents Drawer (Hidden Until Opened) */
.gd-sidebar {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  width: min(400px, 92vw);
  overflow-y: auto;
  font-family: var(--gd-font);
  background: var(--gd-surface);
  border-left: 1px solid var(--gd-border);
  padding: 28px 26px 40px;
  box-shadow: -18px 0 44px rgba(14, 23, 38, 0.12);
  transform: translateX(100%);
  visibility: hidden;
  transition: transform 0.25s ease, visibility 0s linear 0.25s;
}

body.gd-toc-open .gd-sidebar {
  transform: translateX(0);
  visibility: visible;
  transition: transform 0.25s ease, visibility 0s;
}

.gd-toc-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  color: var(--gd-ink-muted);
  cursor: pointer;
}

.gd-toc-close:hover {
  background: var(--gd-surface-soft);
  color: var(--gd-ink);
}

.gd-sidebar-book-title {
  font-size: 19px;
  font-weight: 700;
  color: var(--gd-ink);
  line-height: 1.32;
  margin: 0 40px 6px 0;
}

.gd-sidebar-author {
  font-size: 15.5px;
  color: var(--gd-ink-muted);
  margin: 0 0 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--gd-border);
}

.gd-toc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.gd-toc-item a,
.gd-toc-item .gd-toc-upcoming {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 16.5px;
  line-height: 1.42;
  text-decoration: none;
  color: var(--gd-ink-body);
  transition: background 0.15s ease, color 0.15s ease;
}

.gd-toc-item a:hover {
  background: var(--gd-surface-soft);
  color: var(--gd-ink);
}

.gd-toc-item a.is-active {
  background: var(--gd-accent-soft);
  color: var(--gd-accent);
  font-weight: 700;
}

.gd-toc-num {
  font-family: var(--gd-mono);
  font-size: 14px;
  color: var(--gd-ink-subtle);
  min-width: 28px;
  flex-shrink: 0;
}

.gd-toc-item a.is-active .gd-toc-num {
  color: var(--gd-accent);
  font-weight: 700;
}

.gd-toc-upcoming {
  color: #7c8aa0;
  cursor: default;
}

.gd-toc-Part-label {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gd-ink-subtle);
  margin: 20px 12px 6px;
}

/* Main Article Content (Wide, Unconstrained by narrow ch/px caps) */
.gd-article {
  min-width: 0;
  width: 100%;
}

.gd-header {
  margin-bottom: 34px;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--gd-border);
}

.gd-chapter-eyebrow {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--gd-accent);
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.gd-reading-time {
  font-weight: 400;
  color: var(--gd-ink-subtle);
}

.gd-title {
  font-family: var(--gd-font);
  font-size: clamp(2rem, 3.4vw, 2.75rem);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.028em;
  color: var(--gd-ink);
  margin: 0 0 14px;
  max-width: none;
}

.gd-subtitle {
  font-family: var(--gd-font);
  font-size: clamp(1.08rem, 1.5vw, 1.26rem);
  line-height: 1.55;
  color: var(--gd-ink-muted);
  font-weight: 400;
  margin: 0;
  max-width: none;
}

.gd-byline {
  margin-top: 18px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  font-size: 14.5px;
  color: var(--gd-ink-muted);
}

.gd-byline strong {
  color: var(--gd-ink);
  font-weight: 600;
}

/* Prose Typography */
.gd-prose p {
  margin: 0 0 22px;
  max-width: none;
}

.gd-prose h2 {
  font-family: var(--gd-font);
  font-size: clamp(1.45rem, 2.2vw, 1.85rem);
  font-weight: 700;
  line-height: 1.24;
  color: var(--gd-ink);
  margin: 44px 0 16px;
  letter-spacing: -0.02em;
  max-width: none;
}

.gd-prose h3 {
  font-family: var(--gd-font);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--gd-ink);
  margin: 32px 0 12px;
  max-width: none;
}

/* Ordered/Unordered Steps List & Callout Box */
.gd-steps {
  margin: 18px 0 28px;
  padding-left: 24px;
}

.gd-steps li {
  margin-bottom: 14px;
  line-height: 1.7;
}

.gd-callout {
  margin: 36px 0;
  padding: 24px 28px;
  background: var(--gd-surface-soft);
  border: 1px solid var(--gd-border);
  border-left: 4px solid var(--gd-accent);
  border-radius: 14px;
}

.gd-callout h2,
.gd-callout h3,
.gd-callout-title {
  font-family: var(--gd-font);
  font-size: clamp(1.3rem, 1.9vw, 1.55rem);
  font-weight: 700;
  line-height: 1.28;
  letter-spacing: -0.018em;
  color: var(--gd-ink);
  margin: 0 0 12px !important;
}

.gd-callout p:last-child {
  margin-bottom: 0;
}

.gd-insight-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gd-accent);
  margin-bottom: 6px;
}

.gd-prose strong {
  color: var(--gd-ink);
  font-weight: 600;
}

.gd-prose a {
  color: var(--gd-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.gd-prose a:hover {
  color: #115e59;
}

.gd-lead {
  font-size: 1.12em;
  color: var(--gd-ink);
  line-height: 1.7;
}

/* Two-Column Insight Cards (for Introduction sections) */
.gd-insight-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 22px;
  margin: 30px 0 36px;
}

.gd-insight-card {
  background: var(--gd-surface);
  border: 1px solid var(--gd-border);
  border-top: 4px solid var(--gd-accent);
  border-radius: 14px;
  padding: 24px 26px;
  box-shadow: 0 4px 14px rgba(14, 23, 38, 0.04);
}

.gd-insight-card h3 {
  margin: 0 0 10px !important;
  font-size: 18px !important;
  font-weight: 700;
  color: var(--gd-ink);
}

.gd-insight-card p {
  margin: 0 !important;
  font-size: 16.5px;
  line-height: 1.65;
  color: var(--gd-ink-body);
}

/* Daily Return Visual Strip (Chapter 1) */
.gd-daily-strip {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 10px;
  margin: 24px 0 30px;
}

.gd-day-card {
  background: var(--gd-surface);
  border: 1px solid var(--gd-border);
  border-radius: 12px;
  padding: 14px 10px;
  text-align: center;
  box-shadow: 0 2px 6px rgba(14, 23, 38, 0.03);
}

.gd-day-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--gd-ink-subtle);
  margin-bottom: 6px;
}

.gd-day-val {
  font-size: 18px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.gd-day-val.is-pos {
  color: var(--gd-accent);
}

.gd-day-val.is-neg {
  color: var(--gd-crimson);
}

/* Visual Figure Card + Larger Caption + Interactive Bridge Footer */
.gd-figure {
  margin: 34px 0 42px;
  background: var(--gd-surface);
  border: 1px solid var(--gd-border);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(14, 23, 38, 0.06);
}

.gd-figure-canvas {
  padding: 14px 16px 6px;
  background: #ffffff;
}

.gd-figure-canvas svg,
.gd-figure-canvas img {
  display: block;
  width: 100%;
  height: auto;
}

.gd-figure-caption {
  padding: 16px 26px 18px;
  font-family: var(--gd-font);
  font-size: 16px;
  line-height: 1.62;
  color: var(--gd-ink-muted);
  border-top: 1px solid #f1f5f9;
  background: #ffffff;
  max-width: none;
}

.gd-figure-caption strong {
  color: var(--gd-ink);
}

/* Interactive Bridge Bar Below Visuals */
.gd-figure-bridge {
  padding: 16px 26px;
  background: var(--gd-surface-soft);
  border-top: 1px solid var(--gd-border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.gd-bridge-label {
  font-size: 14.5px;
  font-weight: 500;
  color: var(--gd-ink-body);
}

.gd-bridge-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.gd-bridge-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none !important;
  transition: all 0.15s ease;
}

.gd-bridge-btn-snapshot {
  background: #ffffff;
  color: var(--gd-ink) !important;
  border: 1px solid var(--gd-border-strong);
}

.gd-bridge-btn-snapshot:hover {
  border-color: var(--gd-ink);
  background: #f1f5f9;
}

.gd-bridge-btn-live {
  background: var(--gd-accent);
  color: #ffffff !important;
  border: 1px solid var(--gd-accent);
}

.gd-bridge-btn-live:hover {
  background: #115e59;
}

/* Interactive Allocation Calculator Widget (Chapter 2) */
.gd-interactive-widget {
  margin: 36px 0;
  background: var(--gd-surface);
  border: 1px solid var(--gd-border-strong);
  border-radius: 18px;
  padding: 26px 28px;
  box-shadow: 0 6px 20px rgba(14, 23, 38, 0.04);
}

.gd-widget-header {
  margin-bottom: 10px;
}

.gd-widget-title {
  font-size: 19px;
  font-weight: 700;
  color: var(--gd-ink);
  margin: 0;
}

.gd-widget-desc {
  font-size: 15.5px;
  color: var(--gd-ink-muted);
  line-height: 1.6;
  margin: 0 0 18px;
}

.gd-widget-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.gd-pair-btn {
  padding: 9px 15px;
  border-radius: 8px;
  border: 1px solid var(--gd-border-strong);
  background: #f8fafc;
  color: var(--gd-ink-body);
  font-family: var(--gd-font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.gd-pair-btn:hover {
  border-color: var(--gd-accent);
}

.gd-pair-btn.is-selected {
  background: var(--gd-accent);
  color: #ffffff;
  border-color: var(--gd-accent);
}

.gd-widget-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}

.gd-widget-card {
  background: #f8fafc;
  border: 1px solid var(--gd-border);
  border-radius: 12px;
  padding: 16px 18px;
}

.gd-widget-card h4 {
  margin: 0 0 6px;
  font-size: 15.5px;
  color: var(--gd-ink);
}

.gd-widget-stat {
  font-size: 24px;
  font-weight: 800;
  color: var(--gd-ink);
  margin: 6px 0;
}

.gd-widget-sub {
  font-size: 14px;
  color: var(--gd-ink-muted);
}

/* Semantic Data Tables */
.gd-table-wrap {
  margin: 28px 0 38px;
  overflow-x: auto;
  background: var(--gd-surface);
  border: 1px solid var(--gd-border);
  border-radius: 14px;
}

.gd-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--gd-font);
  font-size: 15.5px;
}

.gd-table th,
.gd-table td {
  padding: 14px 18px;
  text-align: left;
  border-bottom: 1px solid #f1f5f9;
}

.gd-table th {
  background: #f8fafc;
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--gd-ink-subtle);
  border-bottom: 1px solid var(--gd-border);
}

.gd-table tr:last-child td {
  border-bottom: none;
}

.gd-table td.num,
.gd-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* Bottom Next/Prev Chapter Pager */
.gd-pager {
  margin-top: 56px;
  padding-top: 28px;
  border-top: 1px solid var(--gd-border);
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.gd-pager-link {
  display: flex;
  flex-direction: column;
  padding: 20px 22px;
  background: var(--gd-surface);
  border: 1px solid var(--gd-border);
  border-radius: 14px;
  text-decoration: none !important;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.gd-pager-link:hover {
  border-color: var(--gd-accent);
  box-shadow: 0 4px 14px rgba(14, 23, 38, 0.05);
}

.gd-pager-link.is-next {
  text-align: right;
}

.gd-pager-dir {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--gd-ink-subtle);
  margin-bottom: 6px;
}

.gd-pager-title {
  font-size: 16.5px;
  font-weight: 700;
  color: var(--gd-ink);
}

/* Footnotes & References */
.gd-footnotes {
  margin-top: 48px;
  padding-top: 22px;
  border-top: 1px solid var(--gd-border);
  font-size: 14px;
  color: var(--gd-ink-muted);
}

.gd-footnotes h4 {
  margin: 0 0 10px;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gd-ink-subtle);
}

.gd-footnotes ol {
  margin: 0;
  padding-left: 18px;
}

.gd-footnotes li + li {
  margin-top: 6px;
}

/* Responsive adjustments */
@media (max-width: 640px) {
  .gd-top-inner,
  .gd-cover-shell,
  .gd-layout {
    width: 90%;
  }

  body.gd-body {
    font-size: 17px;
  }

  .gd-top-links .gd-hide-mobile {
    display: none;
  }

  .gd-daily-strip {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .gd-figure-bridge {
    flex-direction: column;
    align-items: flex-start;
  }
}
