/* ── GitHub Light Theme ── */

:root {
  --color-bg-default: #ffffff;
  --color-bg-subtle: #f6f8fa;
  --color-bg-muted: #eaeef2;
  --color-bg-inset: #eff2f5;
  --color-border-default: #d0d7de;
  --color-border-muted: #d8dee4;
  --color-fg-default: #1f2328;
  --color-fg-muted: #656d76;
  --color-fg-subtle: #6e7781;
  --color-accent: #0969da;
  --color-accent-emphasis: #0550ae;
  --color-success: #1a7f37;
  --color-attention: #9a6700;
  --color-danger: #d1242f;
  --color-done: #8250df;
  --color-code-bg: #f6f8fa;
  --color-code-text: #1f2328;
  --color-inline-code-bg: rgba(175,184,193,0.2);
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --radius: 6px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 1rem;
}

body {
  background-color: var(--color-bg-default);
  color: var(--color-fg-default);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ── */

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem 6rem;
}

/* ── Header ── */

.page-header {
  border-bottom: 1px solid var(--color-border-default);
  padding-bottom: 1.5rem;
  margin-bottom: 2.5rem;
}

.page-header h1 {
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
  color: var(--color-fg-default);
}

.page-header .subtitle {
  color: var(--color-fg-muted);
  font-size: 1rem;
  line-height: 1.55;
}

.tags {
  display: flex;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.tag {
  background: #ddf4ff;
  color: var(--color-accent);
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.2em 0.7em;
  border-radius: 2em;
  text-decoration: none;
  border: 1px solid #aceaff;
}

.meta-line {
  color: var(--color-fg-subtle);
  font-size: 0.85rem;
  margin-top: 0.75rem;
}

/* ── Intro block ── */

.intro {
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 2.5rem;
  line-height: 1.7;
  color: var(--color-fg-default);
}

.intro code {
  background: var(--color-inline-code-bg);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.86em;
}

.intro a {
  color: var(--color-accent);
  text-decoration: none;
}

.intro a:hover {
  text-decoration: underline;
}

/* ── Sections ── */

.section {
  margin-bottom: 3rem;
}

.section-title {
  font-size: 1.5rem;
  font-weight: 600;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--color-border-default);
  margin-bottom: 1rem;
  color: var(--color-fg-default);
}

.section-description {
  color: var(--color-fg-muted);
  margin-bottom: 1.25rem;
  line-height: 1.7;
}

.section-description code {
  background: var(--color-inline-code-bg);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.86em;
  color: var(--color-fg-default);
}

.section-description strong {
  color: var(--color-fg-default);
  font-weight: 600;
}

.section-description a {
  color: var(--color-accent);
  text-decoration: none;
}

.section-description a:hover {
  text-decoration: underline;
}

.section-note {
  font-size: 0.88rem;
  color: var(--color-fg-subtle);
  font-style: italic;
  margin-top: 0.5rem;
  margin-bottom: 1rem;
}

.subsection-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: 1.75rem;
  margin-bottom: 0.75rem;
  color: var(--color-fg-default);
}

/* ── Code blocks ── */

.code-block {
  background: var(--color-code-bg);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius);
  overflow-x: auto;
  margin-bottom: 1.25rem;
}

.code-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.45rem 1rem;
  background: var(--color-bg-muted);
  border-bottom: 1px solid var(--color-border-default);
  font-size: 0.8rem;
  color: var(--color-fg-muted);
  font-family: var(--font-mono);
}

.code-block pre {
  padding: 1rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--color-code-text);
  tab-size: 4;
}

/* Syntax highlighting – GitHub light palette */
.kw  { color: #cf222e; }     /* keywords */
.fn  { color: #8250df; }     /* function/class names */
.str { color: #0a3069; }     /* strings */
.dec { color: #8250df; }     /* decorators */
.cm  { color: #6e7781; }     /* comments */
.nb  { color: #953800; }     /* builtins / type hints */
.op  { color: #1f2328; }     /* operators, punctuation */
.num { color: #0550ae; }     /* numbers */

/* ── Tables ── */

.table-wrapper {
  overflow-x: auto;
  margin-bottom: 1.25rem;
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius);
}

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

thead {
  background: var(--color-bg-subtle);
}

th {
  text-align: left;
  padding: 0.65rem 1rem;
  font-weight: 600;
  color: var(--color-fg-default);
  border-bottom: 1px solid var(--color-border-default);
  white-space: nowrap;
}

td {
  padding: 0.55rem 1rem;
  border-bottom: 1px solid var(--color-border-muted);
  color: var(--color-fg-muted);
  vertical-align: top;
}

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

tbody tr:hover {
  background: var(--color-bg-subtle);
}

td code {
  background: var(--color-inline-code-bg);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--color-fg-default);
  white-space: nowrap;
}

/* Status colors */
.status-green  { color: var(--color-success); font-weight: 600; }
.status-amber  { color: var(--color-attention); font-weight: 600; }
.status-red    { color: var(--color-danger); font-weight: 600; }

/* ── Tip / Note boxes ── */

.tip-box {
  border-left: 4px solid var(--color-accent);
  background: #ddf4ff;
  padding: 0.85rem 1rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-bottom: 1.25rem;
  font-size: 0.9rem;
  color: var(--color-fg-default);
  line-height: 1.6;
}

.tip-box code {
  background: rgba(175,184,193,0.25);
  padding: 0.1em 0.35em;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 0.86em;
}

.tip-box strong {
  color: var(--color-accent-emphasis);
}

/* ── Behavior notes list ── */

.notes-list {
  list-style: none;
  padding: 0;
}

.notes-list li {
  position: relative;
  padding: 0.75rem 0 0.75rem 1.5rem;
  border-bottom: 1px solid var(--color-border-muted);
  color: var(--color-fg-muted);
  line-height: 1.65;
}

.notes-list li:last-child {
  border-bottom: none;
}

.notes-list li::before {
  content: "▸";
  position: absolute;
  left: 0;
  color: var(--color-accent);
  font-weight: bold;
}

.notes-list li strong {
  color: var(--color-fg-default);
}

.notes-list li code {
  background: var(--color-inline-code-bg);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: var(--color-fg-default);
}

/* ── References ── */

.references {
  background: var(--color-bg-subtle);
  border: 1px solid var(--color-border-default);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.references h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.6rem;
  color: var(--color-fg-default);
}

.references h3:not(:first-child) {
  margin-top: 1.25rem;
}

.references ul {
  list-style: none;
  padding: 0;
}

.references li {
  padding: 0.25rem 0;
}

.references a {
  color: var(--color-accent);
  text-decoration: none;
  font-size: 0.9rem;
}

.references a:hover {
  text-decoration: underline;
}

/* ── Footer ── */

.page-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border-default);
  text-align: center;
  color: var(--color-fg-subtle);
  font-size: 0.82rem;
}

.page-footer a {
  color: var(--color-accent);
  text-decoration: none;
}

/* ── Responsive ── */

@media (max-width: 640px) {
  .container {
    padding: 1.25rem 1rem 4rem;
  }

  .page-header h1 {
    font-size: 1.5rem;
  }

  .section-title {
    font-size: 1.25rem;
  }

  .code-block pre {
    font-size: 0.8rem;
    padding: 0.75rem;
  }

  th, td {
    padding: 0.45rem 0.65rem;
    font-size: 0.82rem;
  }
}

.visit-counter {
    display:inline-flex;
    align-items:center;
    gap:6px;
    margin-bottom:10px;
    font-size:var(--fs-xs);
    color:rgba(255,255,255,.35);
    letter-spacing:.3px;
}
.visit-counter svg {
    opacity:.5;
}
