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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-size-adjust: 100%;
}

body {
  font-family: var(--sans);
  background: var(--bg-0);
  color: var(--text-0);
  font-size: var(--text-base);
  line-height: 1.6;
  min-height: 100vh;
  transition: background var(--t-slow) var(--ease), color var(--t-slow) var(--ease);
}

h1 { font-size: var(--text-2xl); font-weight: 600; line-height: 1.2; letter-spacing: -0.02em; }
h2 { font-size: var(--text-xl); font-weight: 600; line-height: 1.3; letter-spacing: -0.01em; }
h3 { font-size: var(--text-lg); font-weight: 500; line-height: 1.4; }

a { color: var(--accent); text-decoration: none; transition: color var(--t-fast) var(--ease); }
a:hover { color: var(--accent-hover); }

code, pre { font-family: var(--mono); }
img, svg { display: block; max-width: 100%; }

button, input, textarea {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}
button { cursor: pointer; }

::selection { background: var(--accent-muted); color: var(--text-0); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-3); border-radius: var(--r-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* Layout */
.container { max-width: 960px; margin: 0 auto; padding: 0 var(--sp-4); }
.container-sm { max-width: 680px; margin: 0 auto; padding: 0 var(--sp-4); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

/* Back link */
.back-link {
  display: inline-flex; align-items: center; gap: var(--sp-2);
  color: var(--text-2); font-size: var(--text-sm);
  padding: var(--sp-3) 0;
  transition: color var(--t-fast) var(--ease);
}
.back-link:hover { color: var(--text-0); }

/* ---- Theme toggle ---- */
.theme-toggle {
  position: fixed;
  top: var(--sp-4);
  right: var(--sp-4);
  z-index: 900;
  width: 36px; height: 36px;
  border-radius: var(--r-full);
  background: var(--bg-2);
  border: 1px solid var(--border-1);
  color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all var(--t-fast) var(--ease);
}
.theme-toggle:hover { background: var(--bg-3); color: var(--text-0); }
.theme-toggle .ico-sun,
.theme-toggle .ico-moon { width: 16px; height: 16px; }
[data-theme="dark"] .theme-toggle .ico-sun  { display: block; }
[data-theme="dark"] .theme-toggle .ico-moon { display: none; }
[data-theme="light"] .theme-toggle .ico-sun  { display: none; }
[data-theme="light"] .theme-toggle .ico-moon { display: block; }
