/* ================================================================
   coForward Virtual Keyboard — Developer Manual Styles
   ================================================================ */

:root {
  --navy:        #0d1b2a;
  --navy-mid:    #1a2f47;
  --navy-light:  #243c58;
  --deep-blue:   #0f3460;
  --accent:      #4a90d9;
  --accent-glow: #5ba3ef;
  --accent-dark: #2e6fad;
  --teal:        #00c9a7;
  --white:       #ffffff;
  --off-white:   #f8faff;
  --text:        #1e2d3d;
  --text-muted:  #6b7a8d;
  --border:      #dde3ec;

  --sidebar-w:  260px;
  --header-h:    60px;

  /* callout colours */
  --callout-info:   #e8f4fd;
  --callout-warn:   #fff8e1;
  --callout-tip:    #e8f8f0;
  --callout-danger: #fdecea;
}

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

body {
  font-family: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  color: var(--text);
  background: var(--off-white);
  line-height: 1.75;
  overflow-x: hidden;
}

/* ── Fixed Doc Header ──────────────────────────────────────────── */

.doc-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  z-index: 1000;
  background: rgba(13,27,42,.96);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  padding: 0 24px;
  justify-content: space-between;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.brand-mark {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--accent), var(--teal));
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-weight: 900; font-size: 11px; color: #fff;
}

.brand-text { color: #fff; font-size: 16px; font-weight: 700; }
.brand-text em { color: var(--accent-glow); font-style: normal; }

.header-meta {
  display: flex;
  align-items: center;
  gap: 20px;
}

.header-version {
  background: rgba(0,201,167,.15);
  color: var(--teal);
  border: 1px solid rgba(0,201,167,.3);
  border-radius: 5px;
  padding: 3px 10px;
  font-size: 11.5px;
  font-weight: 600;
  font-family: 'Fira Code', monospace;
}

.header-links { display: flex; gap: 16px; }
.header-links a {
  font-size: 13px;
  color: rgba(255,255,255,.55);
  text-decoration: none;
  transition: color .2s;
}
.header-links a:hover { color: #fff; }

/* ── Layout Grid ───────────────────────────────────────────────── */

.doc-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
  padding-top: var(--header-h);
}

/* ── Sidebar ───────────────────────────────────────────────────── */

.doc-sidebar {
  position: sticky;
  top: var(--header-h);
  height: calc(100vh - var(--header-h));
  overflow-y: auto;
  background: var(--navy);
  border-right: 1px solid rgba(255,255,255,.07);
  padding: 24px 0 48px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.1) transparent;
}

.doc-sidebar::-webkit-scrollbar { width: 5px; }
.doc-sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 3px; }

.sidebar-section { margin-bottom: 8px; }

.sidebar-group-label {
  display: block;
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: rgba(255,255,255,.32);
  padding: 6px 20px 4px;
}

.sidebar-nav { list-style: none; }

.sidebar-nav a {
  display: block;
  padding: 7px 20px;
  font-size: 13px;
  color: rgba(255,255,255,.55);
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: color .2s, border-color .2s, background .2s;
}
.sidebar-nav a:hover { color: rgba(255,255,255,.85); background: rgba(255,255,255,.05); }
.sidebar-nav a.active { color: var(--accent-glow); border-left-color: var(--accent); background: rgba(74,144,217,.1); }

/* ── Main Content ──────────────────────────────────────────────── */

.doc-main {
  padding: 48px 60px 80px;
  max-width: 960px;
}

/* ── Doc Section ───────────────────────────────────────────────── */

.doc-section { margin-bottom: 72px; }

.section-header {
  border-bottom: 2px solid var(--border);
  padding-bottom: 14px;
  margin-bottom: 28px;
}

.section-header h2 {
  font-size: 26px;
  font-weight: 800;
  color: var(--navy);
  line-height: 1.25;
}

.section-header .section-id {
  font-size: 12px;
  font-family: 'Fira Code', monospace;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 4px;
}

.doc-section h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--navy);
  margin-top: 36px;
  margin-bottom: 12px;
  padding-top: 8px;
}

.doc-section h4 {
  font-size: 15px;
  font-weight: 700;
  color: var(--navy-light);
  margin-top: 24px;
  margin-bottom: 8px;
}

.doc-section p { margin-bottom: 16px; color: var(--text); }
.doc-section p:last-child { margin-bottom: 0; }

.doc-section ul, .doc-section ol {
  margin-bottom: 16px;
  padding-left: 24px;
}
.doc-section li { margin-bottom: 4px; color: var(--text); font-size: 14.5px; }

/* ── Inline code ───────────────────────────────────────────────── */

code {
  font-family: 'Fira Code', monospace;
  font-size: 13px;
  background: rgba(74,144,217,.1);
  color: var(--accent-dark);
  border-radius: 4px;
  padding: 2px 6px;
}

/* ── Code blocks ───────────────────────────────────────────────── */

figure.code-block {
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 6px 24px rgba(13,27,42,.15);
  margin: 20px 0 28px;
}

figure.code-block figcaption {
  background: var(--navy-mid);
  padding: 10px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.code-mac-dots { display: flex; gap: 6px; }
.code-mac-dots span { width: 11px; height: 11px; border-radius: 50%; }
.code-mac-dots span:nth-child(1) { background: #ff5f57; }
.code-mac-dots span:nth-child(2) { background: #ffbd2e; }
.code-mac-dots span:nth-child(3) { background: #28c840; }

.code-file {
  font-size: 12.5px;
  font-family: 'Fira Code', monospace;
  color: rgba(255,255,255,.45);
  margin-left: 4px;
}

figure.code-block pre {
  background: #0d1117;
  padding: 24px 28px;
  overflow-x: auto;
  margin: 0;
  font-family: 'Fira Code', monospace;
  font-size: 13px;
  line-height: 1.8;
  color: #e6edf3;
  tab-size: 2;
}

/* Syntax colours */
pre .cm { color: #8b949e; }
pre .kw { color: #ff7b72; }
pre .fn { color: #d2a8ff; }
pre .st { color: #a5d6ff; }
pre .nm { color: #f8c57d; }
pre .tg { color: #7ee787; }
pre .cl { color: #7ee787; }
pre .at { color: #79c0ff; }
pre .an { color: #ffa657; }

/* ── Tables ────────────────────────────────────────────────────── */

.table-wrap {
  overflow-x: auto;
  margin: 20px 0 28px;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.table-wrap table {
  border-collapse: collapse;
  width: 100%;
  min-width: 580px;
  font-size: 13.5px;
}

.table-wrap th {
  background: var(--off-white);
  color: var(--navy);
  font-weight: 700;
  text-align: left;
  padding: 11px 16px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.table-wrap td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
  line-height: 1.55;
}

.table-wrap tr:last-child td { border-bottom: none; }
.table-wrap tr:hover td { background: rgba(74,144,217,.04); }

.table-wrap td code { font-size: 12px; }
.table-wrap td .req { font-size: 11px; background: rgba(255,123,114,.15); color: #d93025; border-radius: 3px; padding: 1px 5px; font-weight: 600; }
.table-wrap td .opt { font-size: 11px; background: rgba(74,144,217,.12); color: var(--accent-dark); border-radius: 3px; padding: 1px 5px; font-weight: 600; }

/* ── Endpoint blocks ───────────────────────────────────────────── */

.endpoint {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--navy);
  border-radius: 8px;
  padding: 10px 18px;
  margin: 18px 0 12px;
}

.method {
  font-family: 'Fira Code', monospace;
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 5px;
  flex-shrink: 0;
}
.method.post { background: rgba(0,201,167,.2); color: var(--teal); }
.method.get  { background: rgba(74,144,217,.2); color: var(--accent-glow); }

.endpoint-path {
  font-family: 'Fira Code', monospace;
  font-size: 13px;
  color: rgba(255,255,255,.75);
}

/* ── Callouts ──────────────────────────────────────────────────── */

.callout {
  border-radius: 10px;
  padding: 16px 20px;
  margin: 20px 0;
  display: flex;
  gap: 14px;
  align-items: flex-start;
}

.callout-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }

.callout-body strong { font-size: 13.5px; font-weight: 700; display: block; margin-bottom: 4px; }
.callout-body p { font-size: 13.5px; margin: 0; color: inherit; }
.callout-body code { font-size: 12px; }

.callout-info   { background: var(--callout-info);   border-left: 4px solid var(--accent); color: #1a3a5c; }
.callout-warn   { background: var(--callout-warn);   border-left: 4px solid #f0b429; color: #5a3e00; }
.callout-tip    { background: var(--callout-tip);    border-left: 4px solid var(--teal); color: #0d4030; }
.callout-danger { background: var(--callout-danger); border-left: 4px solid #d93025; color: #6b1a1a; }

/* ── Overview hero ─────────────────────────────────────────────── */

.overview-hero {
  background: linear-gradient(135deg, var(--navy), var(--deep-blue));
  border-radius: 16px;
  padding: 36px;
  margin-bottom: 36px;
  color: #fff;
}

.overview-hero h3 {
  font-size: 22px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 8px;
  margin-top: 0;
  padding-top: 0;
}

.overview-hero p { color: rgba(255,255,255,.7); margin-bottom: 24px; }

.overview-stats {
  display: flex;
  gap: 36px;
  flex-wrap: wrap;
}

.ov-stat-num   { font-size: 26px; font-weight: 900; color: var(--accent-glow); display: block; }
.ov-stat-label { font-size: 12px; color: rgba(255,255,255,.45); margin-top: 2px; }

/* ── Keypad type cards ─────────────────────────────────────────── */

.keypad-types-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
  margin: 24px 0;
}

.keypad-type-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px;
  background: var(--white);
  transition: box-shadow .25s;
}
.keypad-type-card:hover { box-shadow: 0 8px 24px rgba(74,144,217,.12); }
.keypad-type-card .kt-icon  { font-size: 30px; display: block; margin-bottom: 10px; }
.keypad-type-card h4        { font-size: 16px; font-weight: 700; color: var(--navy); margin-bottom: 4px; }
.keypad-type-card .kt-value { font-family: 'Fira Code', monospace; font-size: 13px; color: var(--accent); font-weight: 600; }
.keypad-type-card p         { font-size: 13px; color: var(--text-muted); margin-top: 6px; line-height: 1.55; }

/* ── CSS variable preview ──────────────────────────────────────── */

.css-var-list {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.css-var-list li {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-family: 'Fira Code', monospace;
  font-size: 12.5px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.css-var-list li code { background: none; padding: 0; font-size: 12.5px; color: var(--accent-dark); }
.css-var-list li span { color: var(--text-muted); font-size: 11.5px; }

/* ── Responsive ────────────────────────────────────────────────── */

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

  .doc-sidebar {
    display: none;
  }

  .doc-main {
    padding: 32px 24px 60px;
    max-width: 100%;
  }

  .keypad-types-grid { grid-template-columns: 1fr; }
  .css-var-list { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
  .header-links { display: none; }
  .doc-main { padding: 24px 16px 48px; }
}
