/* ============================================================
   OpenHamClock Manual — Design System
   ============================================================ */

/* ── Custom Properties ─────────────────────────────────── */
:root {
  /* Colours */
  --bg:           #f8f9fb;
  --surface:      #ffffff;
  --sidebar-bg:   #12151f;
  --sidebar-text: #c9cfe0;
  --sidebar-muted:#6b7690;
  --sidebar-active-bg: #1e2540;
  --sidebar-active: #60a5fa;
  --border:       #e2e6ef;
  --text:         #1a1d2e;
  --text-muted:   #6b7280;
  --link:         #2563eb;
  --link-hover:   #1d4ed8;
  --code-bg:      #1e2133;
  --code-text:    #f8c96b;

  /* Badge colours */
  --badge-intro:    #2563eb;
  --badge-install:  #059669;
  --badge-config:   #d97706;
  --badge-feature:  #7c3aed;
  --badge-advanced: #dc2626;
  --badge-ref:      #4b5563;

  /* Callout colours */
  --tip-bg:     #f0fdf4; --tip-border:  #22c55e; --tip-icon: #16a34a;
  --note-bg:    #eff6ff; --note-border: #3b82f6; --note-icon: #2563eb;
  --warn-bg:    #fffbeb; --warn-border: #f59e0b; --warn-icon: #d97706;
  --danger-bg:  #fef2f2; --danger-border:#ef4444;--danger-icon:#dc2626;

  /* Layout */
  --sidebar-w:  260px;
  --content-max:820px;
  --radius:     8px;
  --radius-sm:  4px;

  /* Typography */
  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

/* ── Reset & Base ───────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; scroll-behavior: smooth; }

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

a { color: var(--link); text-decoration: none; }
a:hover { color: var(--link-hover); text-decoration: underline; }

img { max-width: 100%; height: auto; display: block; }

/* ── Sidebar ────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  min-height: 100vh;
  background: var(--sidebar-bg);
  position: fixed;
  top: 0; left: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 20px 16px;
  border-bottom: 1px solid #1e2540;
  text-decoration: none;
}
.sidebar-logo .logo-mark {
  width: 36px; height: 36px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; flex-shrink: 0;
}
.sidebar-logo .logo-text {
  display: flex; flex-direction: column;
}
.sidebar-logo .logo-name {
  color: #ffffff;
  font-size: 0.9rem;
  font-weight: 700;
  line-height: 1.2;
}
.sidebar-logo .logo-sub {
  color: var(--sidebar-muted);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

nav.sidebar-nav { padding: 12px 0 24px; flex: 1; }

.nav-section {
  padding: 16px 20px 4px;
  color: var(--sidebar-muted);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.nav-section:first-child { padding-top: 8px; }

nav.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 20px;
  color: var(--sidebar-text);
  font-size: 0.875rem;
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  text-decoration: none;
}
nav.sidebar-nav a:hover {
  background: rgba(255,255,255,0.05);
  color: #ffffff;
  text-decoration: none;
}
nav.sidebar-nav a.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-active);
  border-left-color: var(--sidebar-active);
  font-weight: 600;
}
nav.sidebar-nav a .nav-icon { font-size: 1rem; width: 20px; text-align: center; }

/* ── Mobile header ──────────────────────────────────────── */
.mobile-header {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 56px;
  background: var(--sidebar-bg);
  z-index: 200;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  border-bottom: 1px solid #1e2540;
}
.mobile-header .logo-name { color: #fff; font-weight: 700; font-size: 0.95rem; }
.burger {
  margin-left: auto;
  background: none; border: none;
  color: var(--sidebar-text);
  font-size: 1.4rem;
  cursor: pointer;
  padding: 4px 8px;
}

/* ── Main content ───────────────────────────────────────── */
#main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
}

.content-wrap {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 48px 40px 80px;
}

/* ── Page header ────────────────────────────────────────── */
.page-header {
  margin-bottom: 40px;
  padding-bottom: 24px;
  border-bottom: 2px solid var(--border);
}

.page-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.page-number {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: block;
  margin-bottom: 6px;
}

.page-title {
  font-size: 2rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
  display: flex;
  align-items: center;
  gap: 12px;
}
.page-title .title-icon { font-size: 1.6rem; }

.page-tagline {
  color: var(--text-muted);
  font-size: 1rem;
  margin-top: 8px;
  max-width: 580px;
}

/* ── Badges ─────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #fff;
  white-space: nowrap;
  flex-shrink: 0;
}
.badge-intro    { background: var(--badge-intro); }
.badge-install  { background: var(--badge-install); }
.badge-config   { background: var(--badge-config); }
.badge-feature  { background: var(--badge-feature); }
.badge-advanced { background: var(--badge-advanced); }
.badge-ref      { background: var(--badge-ref); }

/* ── Typography ─────────────────────────────────────────── */
h2 {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
  margin: 40px 0 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text);
  margin: 28px 0 8px;
}

h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 20px 0 6px;
}

p { margin-bottom: 14px; }

ul, ol {
  margin: 0 0 16px 1.4em;
}
li { margin-bottom: 4px; }

strong { font-weight: 700; }
em { font-style: italic; }

/* ── Inline code ────────────────────────────────────────── */
code {
  font-family: var(--font-mono);
  font-size: 0.82em;
  background: #e8ecf4;
  color: #c2410c;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

/* ── Code blocks ────────────────────────────────────────── */
.code-block {
  position: relative;
  background: var(--code-bg);
  border-radius: var(--radius);
  margin: 16px 0 24px;
  overflow: hidden;
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: rgba(255,255,255,0.05);
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.code-block-lang {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: #8892b0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.copy-btn {
  background: none;
  border: 1px solid rgba(255,255,255,0.15);
  color: #8892b0;
  font-size: 0.72rem;
  padding: 2px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font-sans);
  transition: all 0.15s;
}
.copy-btn:hover { background: rgba(255,255,255,0.08); color: #fff; }
.copy-btn.copied { color: #4ade80; border-color: #4ade80; }

.code-block pre {
  margin: 0;
  padding: 16px 20px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--code-text);
}

.code-block pre .comment { color: #8892b0; font-style: italic; }
.code-block pre .key     { color: #79b8ff; }
.code-block pre .value   { color: #f8c96b; }
.code-block pre .string  { color: #9ecbff; }
.code-block pre .prompt  { color: #64d18a; user-select: none; }
.code-block pre .output  { color: #8892b0; }

/* ── Callout boxes ──────────────────────────────────────── */
.callout {
  display: flex;
  gap: 14px;
  padding: 14px 18px;
  border-radius: var(--radius);
  border-left: 4px solid;
  margin: 20px 0;
}
.callout-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 1px; }
.callout-body { flex: 1; }
.callout-title {
  font-weight: 700;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}
.callout-body p:last-child { margin-bottom: 0; }

.callout-tip    { background: var(--tip-bg);    border-color: var(--tip-border);    color: #14532d; }
.callout-tip .callout-title    { color: var(--tip-icon); }
.callout-note   { background: var(--note-bg);   border-color: var(--note-border);   color: #1e3a5f; }
.callout-note .callout-title   { color: var(--note-icon); }
.callout-warn   { background: var(--warn-bg);   border-color: var(--warn-border);   color: #78350f; }
.callout-warn .callout-title   { color: var(--warn-icon); }
.callout-danger { background: var(--danger-bg); border-color: var(--danger-border); color: #7f1d1d; }
.callout-danger .callout-title { color: var(--danger-icon); }

/* ── Tables ─────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; margin: 16px 0 24px; border-radius: var(--radius); border: 1px solid var(--border); }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

thead th {
  background: #f1f4f9;
  padding: 10px 14px;
  text-align: left;
  font-weight: 700;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #f8f9fb; }
tbody td code { font-size: 0.78em; }

/* ── Screenshot / figure ────────────────────────────────── */
.figure {
  margin: 24px 0 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}

.figure-placeholder {
  background: linear-gradient(135deg, #1a1d27 0%, #12151f 100%);
  min-height: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #4b5470;
  font-size: 0.875rem;
}
.figure-placeholder .placeholder-icon { font-size: 3rem; opacity: 0.4; }
.figure-placeholder .placeholder-label { font-weight: 600; opacity: 0.6; }

.figure img {
  width: 100%;
  display: block;
}

.figure-caption {
  padding: 12px 16px;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: #f8f9fb;
}

/* ── Annotated callouts (numbered circles on screenshots) ── */
.annotation {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  background: #ef4444;
  color: #fff;
  border-radius: 50%;
  font-size: 0.7rem;
  font-weight: 700;
  flex-shrink: 0;
}

.annotation-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.annotation-list li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 0.875rem;
  margin: 0;
}

/* ── Feature cards grid (used on intro page) ────────────── */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin: 20px 0 32px;
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  text-decoration: none;
  color: var(--text);
  transition: box-shadow 0.15s, border-color 0.15s, transform 0.15s;
  display: block;
}
.feature-card:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.08);
  border-color: #c7d0e8;
  transform: translateY(-2px);
  text-decoration: none;
  color: var(--text);
}
.feature-card .card-icon { font-size: 1.6rem; margin-bottom: 10px; }
.feature-card .card-title {
  font-size: 0.9rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.feature-card .card-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ── Step list ──────────────────────────────────────────── */
.step-list {
  list-style: none;
  margin: 0 0 24px;
  padding: 0;
  counter-reset: steps;
}
.step-list li {
  counter-increment: steps;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.step-list li:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.step-list li::before {
  content: counter(steps);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  background: var(--link);
  color: #fff;
  border-radius: 50%;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}
.step-list .step-body { flex: 1; }
.step-list .step-title { font-weight: 700; margin-bottom: 4px; }

/* ── Two-column layout for content ─────────────────────── */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin: 16px 0 24px;
}
@media (max-width: 680px) {
  .two-col { grid-template-columns: 1fr; }
}

/* ── Info box (key-value pairs) ─────────────────────────── */
.info-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin: 16px 0 24px;
}
.info-row {
  display: flex;
  padding: 9px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
  gap: 16px;
}
.info-row:last-child { border-bottom: none; }
.info-label {
  font-weight: 600;
  color: var(--text-muted);
  min-width: 160px;
  flex-shrink: 0;
}

/* ── Breadcrumb ─────────────────────────────────────────── */
.breadcrumb {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--link); text-decoration: none; }
.breadcrumb .sep { opacity: 0.4; }
.breadcrumb .current { color: var(--text); }

/* ── Page nav (prev/next) ───────────────────────────────── */
.page-nav {
  display: flex;
  gap: 16px;
  margin-top: 56px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
.page-nav-link {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: box-shadow 0.15s, border-color 0.15s;
}
.page-nav-link:hover {
  box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  border-color: #c7d0e8;
  text-decoration: none;
  color: var(--text);
}
.page-nav-link.next { text-align: right; justify-content: flex-end; }
.page-nav-link .nav-arrow { font-size: 1.2rem; color: var(--text-muted); }
.page-nav-meta { display: flex; flex-direction: column; }
.page-nav-label { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; }
.page-nav-title { font-weight: 700; font-size: 0.9rem; }

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 900px) {
  #sidebar {
    transform: translateX(-100%);
  }
  #sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 24px rgba(0,0,0,0.3);
  }
  #main {
    margin-left: 0;
    padding-top: 56px;
  }
  .mobile-header { display: flex; }
  .content-wrap { padding: 32px 20px 60px; }
  .page-title { font-size: 1.6rem; }
  .page-nav { flex-direction: column; }
}

@media (max-width: 480px) {
  .feature-grid { grid-template-columns: 1fr 1fr; }
}

/* ── Overlay (mobile sidebar) ───────────────────────────── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}
.sidebar-overlay.show { display: block; }

/* ── Utility classes ────────────────────────────────────── */
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }
.font-mono { font-family: var(--font-mono); }

/* ── Section divider ────────────────────────────────────── */
.section-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 40px 0;
}

/* ── Google Translate — suppress injected top banner ────── */
.goog-te-banner-frame { display: none !important; }
body { top: 0 !important; }
#google_translate_element { display: none; }

/* ── Translate widget (sidebar) ─────────────────────────── */
.translate-widget {
  margin: 8px 12px 16px;
  padding: 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 8px;
}
.translate-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--sidebar-muted);
  margin-bottom: 8px;
}
.translate-select {
  width: 100%;
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: 6px;
  color: var(--sidebar-text);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  padding: 7px 28px 7px 9px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236b7690' stroke-width='1.5' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
}
.translate-select:focus {
  outline: none;
  border-color: rgba(96,165,250,0.4);
}
.translate-select option {
  background: #1a1d2e;
  color: var(--sidebar-text);
}
