/* ============================================================
   Shared design foundation for sambanf.github.io
   Every page links this file, then adds page-specific styles
   in its own <style> block.
   ============================================================ */

:root {
  --bg: #fafaf9;
  --surface: #ffffff;
  --surface-2: #f5f5f4;
  --text: #1c1917;
  --text-muted: #78716c;
  --border: #e7e5e4;
  --accent: #0d9488;
  --accent-strong: #0f766e;
  --accent-soft: #ccfbf1;
  --accent-contrast: #ffffff;
  --positive: #16a34a;
  --negative: #dc2626;
  --shadow: 0 1px 3px rgb(0 0 0 / 0.06), 0 4px 16px rgb(0 0 0 / 0.06);
  --radius: 12px;
  --radius-sm: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, "SF Mono", monospace;
}

/* System dark mode — unless the user explicitly chose light via the
   theme toggle (data-theme is set by assets/theme.js). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0c0a09;
    --surface: #1c1917;
    --surface-2: #292524;
    --text: #e7e5e4;
    --text-muted: #a8a29e;
    --border: #33302c;
    --accent: #2dd4bf;
    --accent-strong: #5eead4;
    --accent-soft: #134e4a;
    --accent-contrast: #042f2e;
    --positive: #4ade80;
    --negative: #f87171;
    --shadow: 0 1px 3px rgb(0 0 0 / 0.4), 0 4px 16px rgb(0 0 0 / 0.4);
  }
}

/* Explicit dark choice — same tokens as the media query above.
   Keep the two blocks in sync when changing colors. */
:root[data-theme="dark"] {
  --bg: #0c0a09;
  --surface: #1c1917;
  --surface-2: #292524;
  --text: #e7e5e4;
  --text-muted: #a8a29e;
  --border: #33302c;
  --accent: #2dd4bf;
  --accent-strong: #5eead4;
  --accent-soft: #134e4a;
  --accent-contrast: #042f2e;
  --positive: #4ade80;
  --negative: #f87171;
  --shadow: 0 1px 3px rgb(0 0 0 / 0.4), 0 4px 16px rgb(0 0 0 / 0.4);
}

/* Native form controls, scrollbars, etc. follow the effective theme. */
:root { color-scheme: light dark; }
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
}

h1, h2, h3 { line-height: 1.25; margin: 0 0 0.5em; }
h1 { font-size: clamp(1.75rem, 4vw, 2.5rem); letter-spacing: -0.02em; }
h2 { font-size: clamp(1.25rem, 3vw, 1.6rem); letter-spacing: -0.01em; }
h3 { font-size: 1.1rem; }

p { margin: 0 0 1em; }

a { color: var(--accent-strong); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--accent); }

img, svg { max-width: 100%; }

code, .mono { font-family: var(--mono); font-size: 0.95em; }

.muted { color: var(--text-muted); }

.container {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { background: var(--surface-2); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-contrast);
}
.btn-primary:hover { background: var(--accent-strong); border-color: var(--accent-strong); }

/* ---------- Forms ---------- */

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.3rem;
}

input[type="number"],
input[type="text"],
input[type="search"],
select {
  width: 100%;
  padding: 0.55rem 0.75rem;
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

input:focus-visible,
select:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

input::placeholder { color: var(--text-muted); opacity: 0.7; }

/* ---------- Language toggle ---------- */

.lang-toggle {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}

.lang-toggle button {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  border: 0;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.lang-toggle button:hover { color: var(--text); }

.lang-toggle button[aria-pressed="true"] {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.lang-toggle .flag {
  display: block;
  width: 20px;
  height: 10px;
  border-radius: 2px;
  box-shadow: 0 0 0 1px var(--border);
}

/* ---------- Theme (dark mode) toggle ---------- */

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.15rem;
  height: 2.15rem;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.theme-toggle:hover {
  color: var(--text);
  border-color: var(--accent);
}

.theme-toggle svg { display: block; }

/* Show the moon in light mode, the sun in dark mode */
.theme-toggle .icon-sun { display: none; }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: block; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: none; }
}

:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }

/* ---------- Misc ---------- */

hr { border: 0; border-top: 1px solid var(--border); margin: 2rem 0; }

.site-footer {
  color: var(--text-muted);
  font-size: 0.875rem;
  padding: 2.5rem 0 2rem;
  text-align: center;
}
.site-footer a { color: inherit; }
