/* ═══════════════════════════════════════════════════════
   Hawkin Connect — Shared Documentation Page Styles
   Used by: r.html, python.html
   ═══════════════════════════════════════════════════════ */

:root {
  --navy:        #425b79;
  --navy-dark:   #364a63;
  --navy-darker: #2d3e52;
  --navy-deep:   #1e2d3d;
  --teal:        #46acb9;
  --teal-dim:    rgba(70,172,185,0.12);
  --bg:          #f5f6f7;
  --card:        #ffffff;
  --text:        #1a1a1a;
  --muted:       #5c6370;
  --border:      #e4e5e7;
  --border-strong: #d0d2d6;
  --shadow:      0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-hover: 0 4px 12px rgba(0,0,0,0.12);
  --mono:        'Roboto Mono', monospace;
  --sans:        'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --heading:     'Raleway', sans-serif;
  --green:       #2d9d5e;
  --green-bg:    rgba(45,157,94,0.08);
  --blue:        #3574b8;
  --blue-bg:     rgba(53,116,184,0.08);
  --yellow:      #b8860b;
  --yellow-bg:   rgba(184,134,11,0.08);
  --red:         #c0392b;
  --red-bg:      rgba(192,57,43,0.08);
  --orange:      #d35400;
  --orange-bg:   rgba(211,84,0,0.08);
  --purple:      #7c3aed;
  --purple-bg:   rgba(124,58,237,0.08);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ── HEADER ── */
header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 0 48px;
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 200;
}

header img { height: 38px; width: auto; }

header nav { display: flex; gap: 28px; align-items: center; }
header nav a {
  color: var(--muted);
  text-decoration: none;
  font-family: var(--heading);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  transition: color 0.15s;
}
header nav a:hover { color: var(--navy); }
header nav a.active { color: var(--navy); border-bottom: 2px solid var(--teal); padding-bottom: 2px; }

/* Dropdown menu */
.nav-dropdown {
  position: relative;
}

.nav-dropdown > span {
  color: var(--muted);
  font-family: var(--heading);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: color 0.15s;
  -webkit-user-select: none;
  user-select: none;
}

.nav-dropdown > span::after {
  content: '';
  display: inline-block;
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid currentColor;
  margin-left: 5px;
  vertical-align: middle;
  transition: transform 0.15s;
}

.nav-dropdown:hover > span { color: var(--navy); }
.nav-dropdown:hover > span::after { transform: rotate(180deg); }

.nav-dropdown.active > span { color: var(--navy); border-bottom: 2px solid var(--teal); padding-bottom: 2px; }

.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  margin-top: 10px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
  min-width: 200px;
  padding: 6px 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s, visibility 0.15s;
  z-index: 300;
}

.nav-dropdown:hover .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
}

.nav-dropdown-menu a {
  display: block;
  padding: 10px 18px;
  color: var(--muted) !important;
  font-size: 0.825rem !important;
  font-weight: 500 !important;
  margin: 0 !important;
  border-bottom: none !important;
  transition: background 0.1s, color 0.1s;
}

.nav-dropdown-menu a:hover {
  background: var(--bg);
  color: var(--navy) !important;
}

.nav-dropdown-menu a.active {
  color: var(--navy) !important;
  font-weight: 600 !important;
  border-bottom: none !important;
}

/* ── LAYOUT ── */
.page-layout {
  display: flex;
  flex: 1;
  min-height: 0;
}

/* ── SIDEBAR ── */
.sidebar {
  width: 260px;
  background: var(--card);
  border-right: 1px solid var(--border);
  position: sticky;
  top: 68px;
  height: calc(100vh - 68px);
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar-brand {
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-icon {
  width: 32px; height: 32px;
  border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  font-family: var(--heading);
  font-size: 16px;
  font-weight: 900;
  color: #fff;
}

.brand-icon.r-icon { background: var(--blue); }
.brand-icon.py-icon { background: #3572A5; }

.brand-name {
  font-family: var(--heading);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--navy);
  line-height: 1.2;
}

.brand-sub {
  font-size: 10px;
  color: var(--muted);
  font-family: var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.version-badge {
  font-family: var(--mono);
  font-size: 10px;
  background: var(--teal-dim);
  color: var(--teal);
  border: 1px solid rgba(70,172,185,0.3);
  border-radius: 4px;
  padding: 2px 7px;
  margin-left: auto;
}

.nav-section {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.nav-section-title {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 12px 20px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 400;
  transition: all 0.15s;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--sans);
}

.nav-item:hover { color: var(--text); background: var(--bg); }

.nav-item.active {
  color: var(--navy);
  background: rgba(66,91,121,0.06);
  border-right: 2px solid var(--teal);
  font-weight: 500;
}

.nav-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.4;
  flex-shrink: 0;
}

.nav-item.active .nav-dot { opacity: 1; }

.nav-fn-name {
  font-family: var(--mono);
  font-size: 11px;
}

/* ── MAIN ── */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

/* ── TOPBAR ── */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  height: 48px;
  display: flex;
  align-items: center;
  gap: 24px;
  position: sticky;
  top: 68px;
  z-index: 100;
}

.topbar-tab {
  font-family: var(--heading);
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  padding: 4px 0;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  background: none;
  transition: all 0.15s;
}

.topbar-tab:hover { color: var(--navy); }

.topbar-tab.active {
  color: var(--navy);
  border-bottom-color: var(--teal);
}

.topbar-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 4px;
}

.topbar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar-link {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  text-decoration: none;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 5px;
  transition: all 0.15s;
}

.topbar-link:hover { border-color: var(--border-strong); color: var(--text); }

/* ── CONTENT AREAS ── */
.content-area { display: none; flex: 1; }
.content-area.visible { display: block; }

/* ── OVERVIEW / GETTING STARTED ── */
.overview-wrap {
  max-width: 860px;
  margin: 0 auto;
  padding: 48px 32px 80px;
}

.hero-section { margin-bottom: 56px; }

.hero-tag {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--teal);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.hero-tag::before {
  content: '';
  display: inline-block;
  width: 20px; height: 1px;
  background: var(--teal);
}

.hero-title {
  font-family: var(--heading);
  font-size: 36px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 16px;
  color: var(--navy);
}

.hero-title span { color: var(--teal); }

.hero-desc {
  font-size: 16px;
  color: var(--muted);
  line-height: 1.7;
  max-width: 580px;
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 48px;
}

.info-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
  box-shadow: var(--shadow);
  transition: border-color 0.2s;
}

.info-card:hover { border-color: var(--border-strong); }

.info-card-label {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.info-card-value {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
}

.info-card-value small {
  font-size: 12px;
  color: var(--muted);
  font-weight: 400;
}

/* ── SCROLL OFFSET for sticky header + topbar ── */
[id] {
  scroll-margin-top: 130px;
}

/* ── SECTION BLOCKS ── */
.section-block { margin-bottom: 48px; }

.section-block h2 {
  font-family: var(--heading);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
  letter-spacing: -0.01em;
  color: var(--navy);
}

.section-block h3 {
  font-family: var(--heading);
  font-size: 15px;
  font-weight: 700;
  margin: 28px 0 8px;
  color: var(--text);
}

.section-block .sub {
  color: var(--muted);
  margin-bottom: 20px;
  font-size: 14px;
}

.section-block p {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
  margin-bottom: 16px;
}

/* ── STEPS ── */
.steps {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.step {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
  transition: background 0.15s;
}

.step:last-child { border-bottom: none; }
.step:hover { background: var(--bg); }

.step-num {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: var(--teal);
  background: var(--teal-dim);
  border: 1px solid rgba(70,172,185,0.3);
  border-radius: 50%;
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.step-content h4 {
  font-family: var(--heading);
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 4px;
  color: var(--text);
}

.step-content p { color: var(--muted); font-size: 13px; line-height: 1.6; margin-bottom: 0; }

/* ── CODE BLOCKS ── */
.code-block {
  background: var(--navy-darker);
  border: 1px solid var(--navy-dark);
  border-radius: 8px;
  padding: 20px 24px;
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.8;
  overflow-x: auto;
  position: relative;
  color: #e8edf2;
  white-space: pre;
  margin-bottom: 20px;
}

.code-block .comment  { color: #6a7a8a; }
.code-block .keyword  { color: #b09aff; }
.code-block .string   { color: #6ec98a; }
.code-block .variable { color: #6ab0f3; }
.code-block .method   { color: #e8a64a; }
.code-block .prop     { color: #f0c66a; }

.copy-btn {
  position: absolute;
  top: 12px; right: 12px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.6);
  font-family: var(--mono);
  font-size: 10px;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
  letter-spacing: 0.05em;
}

.copy-btn:hover { color: #fff; border-color: rgba(255,255,255,0.4); }

.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--teal);
  text-decoration: none;
  padding: 6px 12px;
  border: 1px solid rgba(70,172,185,0.3);
  border-radius: 4px;
  background: var(--teal-dim);
  cursor: pointer;
  transition: all 0.15s;
  margin-top: 8px;
}

.download-btn:hover { background: rgba(70,172,185,0.2); border-color: var(--teal); }

/* ── DOWNLOAD CARDS ── */
.download-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 24px;
  background: var(--card);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  transition: border-color 0.2s;
}

.download-card:hover { border-color: var(--border-strong); }

.download-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.download-card-title {
  font-family: var(--heading);
  font-size: 16px;
  font-weight: 700;
  color: var(--navy);
}

.download-card-meta {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  margin-left: auto;
}

.download-card-desc {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  margin-bottom: 12px;
}

.download-card-files {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.8;
  padding-left: 20px;
  margin-bottom: 16px;
}

.recommended-badge {
  font-family: var(--mono);
  font-size: 9px;
  padding: 2px 7px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--green-bg);
  color: var(--green);
  border: 1px solid rgba(45,157,94,0.25);
}

/* Prism.js overrides */
pre[class*="language-"] {
  background: var(--navy-darker) !important;
  border: 1px solid var(--navy-dark);
  border-radius: 8px;
  padding: 20px 24px;
  font-family: var(--mono) !important;
  font-size: 13px;
  line-height: 1.8;
  overflow-x: auto;
  position: relative;
  margin-bottom: 20px;
}

code[class*="language-"] {
  font-family: var(--mono) !important;
  font-size: 13px;
  text-shadow: none !important;
}

/* Inline code */
p code, li code, td code, h4 code {
  font-family: var(--mono);
  font-size: 0.85em;
  background: rgba(66,91,121,0.08);
  color: var(--navy);
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid var(--border);
}

/* ── TABLES ── */
.region-table,
.param-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 20px;
}

.region-table th,
.param-table th {
  background: var(--bg);
  padding: 10px 16px;
  text-align: left;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
}

.region-table td,
.param-table td {
  padding: 12px 16px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}

.region-table tr:last-child td,
.param-table tr:last-child td { border-bottom: none; }

.param-table td code {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--blue);
  background: var(--blue-bg);
  padding: 1px 5px;
  border-radius: 3px;
  border: none;
}

/* ── CALLOUTS ── */
.callout {
  background: var(--teal-dim);
  border: 1px solid rgba(70,172,185,0.3);
  border-left: 3px solid var(--teal);
  border-radius: 0 6px 6px 0;
  padding: 14px 18px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 20px;
}

.callout strong { color: var(--navy); }

.callout-warn {
  background: var(--yellow-bg);
  border-color: rgba(184,134,11,0.3);
  border-left-color: var(--yellow);
}

.callout-warn strong { color: var(--yellow); }

.callout-deprecation {
  background: var(--red-bg);
  border-color: rgba(192,57,43,0.2);
  border-left-color: var(--red);
}

.callout-deprecation strong { color: var(--red); }

/* ── FUNCTION REFERENCE ACCORDION ── */
.fn-category {
  margin-bottom: 32px;
}

.fn-category-title {
  font-family: var(--heading);
  font-size: 14px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: 0.02em;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.fn-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 8px;
  background: var(--card);
  overflow: hidden;
  transition: border-color 0.15s;
}

.fn-card:hover { border-color: var(--border-strong); }

.fn-card[open] {
  border-color: var(--teal);
  box-shadow: 0 2px 8px rgba(70,172,185,0.1);
}

.fn-header {
  padding: 14px 18px;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.fn-header::-webkit-details-marker { display: none; }

.fn-header::before {
  content: '';
  width: 0; height: 0;
  border-left: 5px solid var(--muted);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  flex-shrink: 0;
  transition: transform 0.15s;
}

.fn-card[open] .fn-header::before {
  transform: rotate(90deg);
}

.fn-sig {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  font-weight: 500;
}

.fn-sig .fn-name {
  color: var(--navy);
  font-weight: 600;
}

.fn-body {
  padding: 0 18px 18px;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.fn-body .fn-desc {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
  margin-bottom: 16px;
}

.fn-body h5 {
  font-family: var(--heading);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 16px 0 8px;
}

.fn-body h5:first-child { margin-top: 0; }

.deprecated-badge {
  font-family: var(--mono);
  font-size: 9px;
  padding: 2px 7px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--red-bg);
  color: var(--red);
  border: 1px solid rgba(192,57,43,0.25);
  margin-left: 8px;
}

/* ── CHANGELOG ── */
.changelog-wrap {
  max-width: 760px;
  margin: 0 auto;
  padding: 48px 32px 80px;
}

.changelog-entry {
  display: flex;
  gap: 24px;
  margin-bottom: 40px;
}

.changelog-date {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  width: 80px;
  flex-shrink: 0;
  padding-top: 2px;
}

.changelog-line {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.changelog-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  border: 2px solid var(--teal);
  background: var(--bg);
  flex-shrink: 0;
  margin-top: 4px;
}

.changelog-connector {
  width: 1px;
  flex: 1;
  background: var(--border);
  min-height: 40px;
}

.changelog-content { flex: 1; padding-bottom: 12px; }

.changelog-version {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--teal);
  margin-bottom: 8px;
}

.changelog-content h4 {
  font-family: var(--heading);
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text);
}

.changelog-content p { color: var(--muted); font-size: 13px; line-height: 1.7; }
.changelog-content ul { color: var(--muted); font-size: 13px; line-height: 1.8; padding-left: 20px; margin-bottom: 8px; }

.change-tag {
  display: inline-block;
  font-family: var(--mono);
  font-size: 9px;
  padding: 2px 7px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-right: 6px;
  margin-bottom: 6px;
}

.tag-updated { background: var(--yellow-bg); color: var(--yellow); border: 1px solid rgba(184,134,11,0.25); }
.tag-added   { background: var(--green-bg); color: var(--green); border: 1px solid rgba(45,157,94,0.25); }
.tag-removed { background: var(--red-bg); color: var(--red); border: 1px solid rgba(192,57,43,0.25); }
.tag-fixed   { background: var(--blue-bg); color: var(--blue); border: 1px solid rgba(53,116,184,0.25); }
.tag-breaking { background: var(--orange-bg); color: var(--orange); border: 1px solid rgba(211,84,0,0.25); }

/* ── FOOTER ── */
footer {
  background: var(--navy-deep);
  color: rgba(255,255,255,0.6);
  text-align: center;
  padding: 48px 24px 32px;
  font-size: 0.8rem;
}

.footer-logo { margin-bottom: 24px; }
.footer-logo img { height: 56px; width: auto; opacity: 0.85; }

footer a { color: rgba(255,255,255,0.7); text-decoration: none; margin: 0 12px; transition: color 0.15s; }
footer a:hover { color: #fff; }
.footer-links { margin-bottom: 12px; }
.footer-copy { opacity: 0.5; }

/* ── SCROLLBAR ── */
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  .sidebar { display: none; }
  header { padding: 0 20px; }
  header nav { display: none; }
  .topbar { padding: 0 16px; }
  .overview-wrap { padding: 32px 16px 60px; }
  .info-grid { grid-template-columns: 1fr; }
  .changelog-wrap { padding: 32px 16px 60px; }
}
