/* ============================================================
   DL2CC-REMOTE-CW User Documentation — Main Stylesheet
   ============================================================ */

:root {
  --primary:        #1a365d;
  --primary-hover:  #2c5282;
  --primary-light:  #ebf0f8;
  --accent:         #c97d1a;
  --accent-light:   #fff3dc;
  --success:        #276749;
  --success-bg:     #e6f6ee;
  --warning-bg:     #fffbea;
  --warning-border: #f6c90e;
  --info-bg:        #ebf4ff;
  --info-border:    #4299e1;
  --danger-bg:      #fff5f5;
  --danger-border:  #fc8181;
  --bg:             #f0f2f7;
  --card:           #ffffff;
  --text:           #1a202c;
  --text-muted:     #718096;
  --border:         #d8dde6;
  --code-bg:        #edf2f7;
  --code-text:      #2d3748;
  --sidebar-w:      270px;
  --topbar-h:       58px;
  --radius:         8px;
  --shadow:         0 2px 8px rgba(0,0,0,.08);
  --shadow-md:      0 4px 16px rgba(0,0,0,.12);
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
/* Anchor jumps: reserve the sticky-topbar height at the top of the scrollport so
   every scroll-to-anchor lands the heading (and any diagram right below it) just
   under the bar instead of beneath it. scroll-padding-top on the scroller is
   honored for BOTH native fragment navigation (the sidebar's "page.html#id"
   links) and scripted scrollIntoView — where per-heading scroll-margin-top was
   not applied for full-URL same-page fragment links. */
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--topbar-h) + 16px); }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen,
               Ubuntu, Cantarell, sans-serif;
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
}
a { color: var(--primary-hover); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; border-radius: var(--radius); }

/* ── Layout ─────────────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  background: var(--primary);
  color: #c8d8f0;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 200;
  display: flex;
  flex-direction: column;
  transition: transform .25s ease;
}
.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 4px; }

.sidebar-logo-link {
  text-decoration: none;
  color: inherit;
  display: block;
  /* Stay pinned to the top of the scrolling sidebar so there is
     always a one-click way back to the top of the navigation. */
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--primary);
  cursor: pointer;
}
.sidebar-logo-link:hover .app-name { color: #cfe1ff; }
.sidebar-logo {
  padding: 20px 20px 12px;
  border-bottom: 1px solid rgba(255,255,255,.1);
  display: flex;
  align-items: center;
  gap: 12px;
}
.sidebar-logo .app-logo-icon {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 9px;
}
.sidebar-logo .app-name {
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: .5px;
  line-height: 1.05;
}

.sidebar-nav { padding: 12px 0 24px; flex: 1; }

.nav-section-label {
  padding: 14px 20px 4px;
  font-size: .67rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: #6490bb;
}
/* A section heading that is itself the section's page link (clickable,
   carries the section icon). Overrides the generic .sidebar-nav a styling. */
.sidebar-nav a.nav-section-label {
  display: flex;
  align-items: center;
  gap: 8px;
  border-left: 3px solid transparent;
  text-decoration: none;
}
.sidebar-nav a.nav-section-label:hover { color: #9fc0e6; background: rgba(255,255,255,.05); }
.sidebar-nav a.nav-section-label .nav-icon { font-size: .9rem; width: 18px; text-align: center; flex-shrink: 0; }

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 20px;
  color: #bdd0eb;
  font-size: .875rem;
  border-left: 3px solid transparent;
  transition: background .15s, color .15s, border-color .15s;
  text-decoration: none;
}
.sidebar-nav a:hover {
  background: rgba(255,255,255,.07);
  color: #fff;
  text-decoration: none;
}
.sidebar-nav a.active {
  background: rgba(255,255,255,.12);
  color: #fff;
  border-left-color: var(--accent);
  font-weight: 600;
}
.sidebar-nav a .nav-icon { font-size: 1rem; width: 18px; text-align: center; flex-shrink: 0; }
.sidebar-nav a .nav-sub-icon { font-size: .75rem; width: 18px; text-align: center; flex-shrink: 0; opacity: .7; }

/* sub-items — indented past the parent link's TEXT start (icon + gap ≈ 47px),
   so each level sits clearly to the right of its heading's visible label */
.sidebar-nav .sub-item { padding-left: 56px; font-size: .82rem; }
.sidebar-nav .sub-item .nav-sub-icon { display: none; }
/* sub-sub-items (3rd level) */
.sidebar-nav .sub-sub-item { padding-left: 74px; font-size: .74rem; color: #8aa8cc; }
/* sub-sub-sub-items (4th level) */
.sidebar-nav .sub-sub-sub-item { padding-left: 92px; font-size: .72rem; color: #9bb4d2; }

/* ── Top Bar ────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  padding: 0 2rem;
  gap: 12px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.topbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: .875rem;
  color: var(--text-muted);
}
.topbar-breadcrumb .crumb-sep { opacity: .5; }
.topbar-breadcrumb .current { color: var(--text); font-weight: 600; }

.hamburger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  font-size: 1.3rem;
  color: var(--text);
}

/* ── Main Content ───────────────────────────────────────────── */
.page-wrap {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.content {
  padding: 2.5rem 3rem;
  max-width: 900px;
  width: 100%;
  flex: 1;
}

/* ── Page Header ─────────────────────────────────────────────── */
.page-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--border);
}
.page-header .page-badge {
  display: inline-block;
  background: var(--accent-light);
  color: var(--accent);
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 3px 10px;
  border-radius: 20px;
  margin-bottom: 10px;
}
.page-header h1 {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.2;
  margin-bottom: .5rem;
}
.page-header .lead {
  font-size: 1.05rem;
  color: var(--text-muted);
  max-width: 680px;
}

/* ── Typography ──────────────────────────────────────────────── */
h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--primary);
  margin: 4rem 0 .75rem;
  padding-bottom: .4rem;
  border-bottom: 1px solid var(--border);
}
h3 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin: 1.8rem 0 .5rem;
}
h4 {
  font-size: .95rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  margin: 1.2rem 0 .4rem;
}
p { margin-bottom: 1rem; }
ul, ol { margin: .5rem 0 1rem 1.5rem; }
li { margin-bottom: .25rem; }
strong { color: var(--text); }

/* ── Callout Boxes ───────────────────────────────────────────── */
.callout {
  border-radius: var(--radius);
  padding: .9rem 1.1rem;
  margin: 1.2rem 0;
  border-left: 4px solid transparent;
  font-size: .9rem;
}
.callout-title {
  font-weight: 700;
  margin-bottom: .2rem;
  display: flex;
  align-items: center;
  gap: 6px;
}
.callout.info    { background: var(--info-bg);    border-color: var(--info-border); }
.callout.warning { background: var(--warning-bg); border-color: var(--warning-border); }
.callout.success { background: var(--success-bg); border-color: #48bb78; }
.callout.danger  { background: var(--danger-bg);  border-color: var(--danger-border); }
.callout.info    .callout-title { color: #2b6cb0; }
.callout.warning .callout-title { color: #744210; }
.callout.success .callout-title { color: var(--success); }
.callout.danger  .callout-title { color: #c53030; }

/* ── Tables ──────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; margin: 1rem 0 1.5rem; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
thead tr { background: var(--primary); color: #fff; }
thead th {
  padding: 10px 14px;
  text-align: left;
  font-weight: 600;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .5px;
}
tbody tr { border-bottom: 1px solid var(--border); }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--primary-light); }
tbody td { padding: 9px 14px; vertical-align: top; }
tbody td:first-child { font-weight: 500; }

/* ── Code ────────────────────────────────────────────────────── */
code {
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
  background: var(--code-bg);
  color: var(--primary);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: .875em;
}
pre {
  background: #1e2a3a;
  color: #c8d8f0;
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  overflow-x: auto;
  font-size: .85rem;
  line-height: 1.6;
  margin: 1rem 0;
  font-family: 'Cascadia Code', 'Fira Code', 'Consolas', monospace;
}
pre code { background: none; color: inherit; padding: 0; font-size: inherit; }

/* ── Hardware Hero Banner (Home) ─────────────────────────────── */
.hw-hero {
  display: flex;
  align-items: center;
  gap: 1.6rem;
  background: linear-gradient(135deg, #1a365d 0%, #2c5282 60%, #c97d1a 100%);
  color: #fff;
  border-radius: var(--radius);
  padding: 1.6rem 2rem;
  margin: 1.8rem 0;
  box-shadow: var(--shadow-md);
}
.hw-hero-icon { font-size: 3rem; flex-shrink: 0; }
.hw-hero-body { flex: 1; }
.hw-hero-body h2 {
  font-size: 1.25rem;
  margin: 0 0 .4rem;
  color: #fff;
  border: none;
  padding: 0;
}
.hw-hero-body p {
  font-size: .9rem;
  margin: 0 0 .8rem;
  color: rgba(255,255,255,.88);
  line-height: 1.55;
}
.hw-hero-body .hw-hero-badge {
  display: inline-block;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.35);
  border-radius: 4px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 2px 8px;
  margin-bottom: .7rem;
  color: #ffe29a;
}
.hw-hero a.hw-hero-btn {
  display: inline-block;
  background: #c97d1a;
  color: #fff;
  font-weight: 700;
  font-size: .88rem;
  padding: .45rem 1.1rem;
  border-radius: 6px;
  text-decoration: none;
  transition: background .2s, transform .15s;
}
.hw-hero a.hw-hero-btn:hover {
  background: #a86414;
  transform: translateY(-1px);
  text-decoration: none;
}
@media (max-width: 540px) {
  .hw-hero { flex-direction: column; text-align: center; }
}

/* ── Feature Cards (Home) ─────────────────────────────────────── */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1.2rem;
  margin: 1.5rem 0;
}
.feature-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.2rem 1.4rem;
  box-shadow: var(--shadow);
  border-top: 3px solid var(--primary);
  transition: box-shadow .2s, transform .2s;
}
.feature-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.feature-card .card-icon { font-size: 1.6rem; margin-bottom: .5rem; }
.feature-card h3 { font-size: .95rem; margin: 0 0 .4rem; color: var(--primary); }
.feature-card p  { font-size: .82rem; color: var(--text-muted); margin: 0; }
.feature-card a  { display: inline-block; margin-top: .6rem; font-size: .8rem;
                    font-weight: 600; color: var(--accent); }

/* accent-border variants */
.feature-card.green  { border-top-color: #38a169; }
.feature-card.teal   { border-top-color: #2b7a78; }
.feature-card.orange { border-top-color: #dd6b20; }
.feature-card.purple { border-top-color: #6b46c1; }
.feature-card.red    { border-top-color: #e53e3e; }
.feature-card.pink   { border-top-color: #d53f8c; }

/* ── Step List ───────────────────────────────────────────────── */
.steps { counter-reset: steps; list-style: none; margin: 1rem 0 1.5rem; padding: 0; }
.steps li {
  counter-increment: steps;
  position: relative;
  padding: .8rem 1rem .8rem 3.2rem;
  margin-bottom: .6rem;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.steps li::before {
  content: counter(steps);
  position: absolute;
  left: .9rem;
  top: .85rem;
  width: 24px; height: 24px;
  background: var(--primary);
  color: #fff;
  border-radius: 50%;
  font-size: .78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ── Screenshot Placeholder ──────────────────────────────────── */
.screenshot {
  background: var(--card);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 1rem;
  text-align: center;
  color: var(--text-muted);
  font-size: .85rem;
  margin: 1.2rem 0;
}
.screenshot .ss-icon { font-size: 2rem; margin-bottom: .5rem; display: block; opacity: .4; }
.screenshot img { border: 1px solid var(--border); }
.screenshot.has-image { border-style: solid; border-color: var(--border); padding: .5rem; }

/* ── Badge / Pill ────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: .72rem;
  font-weight: 700;
}
.badge-blue   { background: var(--info-bg);    color: #2b6cb0; }
.badge-green  { background: var(--success-bg); color: var(--success); }
.badge-orange { background: var(--accent-light); color: var(--accent); }
.badge-gray   { background: var(--code-bg);    color: var(--text-muted); }

/* ── Inline Icon ─────────────────────────────────────────────── */
.icon-inline { vertical-align: middle; font-style: normal; }

/* ── Two-Col Layout for feature lists ───────────────────────── */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin: .8rem 0 1.2rem;
}
@media (max-width: 640px) { .two-col { grid-template-columns: 1fr; } }

/* ── Requirement Boxes ───────────────────────────────────────── */
.req-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: .8rem;
  margin: 1rem 0;
}
.req-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: .8rem 1rem;
  box-shadow: var(--shadow);
  font-size: .85rem;
}
.req-card .req-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .8px;
                        color: var(--text-muted); margin-bottom: 3px; }
.req-card .req-val   { font-weight: 600; color: var(--primary); }

/* ── Footer ──────────────────────────────────────────────────── */
footer {
  margin-left: var(--sidebar-w);
  padding: 1.2rem 3rem;
  font-size: .8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: var(--card);
}

/* ── Sidebar Overlay ─────────────────────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 199;
}

/* ── Responsive ──────────────────────────────────────────────── */
@media (max-width: 820px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay.open { display: block; }
  .page-wrap { margin-left: 0; }
  footer { margin-left: 0; }
  .hamburger { display: block; }
  .content { padding: 1.5rem 1.2rem; }
  .feature-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 500px) {
  .feature-grid { grid-template-columns: 1fr; }
  .page-header h1 { font-size: 1.5rem; }
}

/* -- UI label (do-not-translate marker) ----------------------- */
.ui-label {
  font-family: inherit;
  font-style: italic;
  color: var(--text);
}

/* -- Language switcher ---------------------------------------- */
.lang-switcher {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;          /* push to far right of topbar */
  flex-shrink: 0;
}
.lang-btn {
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 5px;
  padding: 3px 9px;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--text-muted);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  line-height: 1.4;
}
.lang-btn:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}
.lang-btn.lang-active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  cursor: default;
}
.lang-sep {
  color: var(--border);
  font-size: .75rem;
  user-select: none;
}
