/* learning-notes — base.css
   全ページ共通のリセット、CSS変数、タイポグラフィ。
   個別ページのスタイルは index.css / article.css で。 */

/* ---------- CSS variables ---------- */
:root {
  /* Light theme (default) */
  --bg: #fdfcf9;
  --bg-soft: #f4f1ea;
  --bg-code: #f6f6f6;
  --fg: #1f1d1a;
  --fg-soft: #4a4742;
  --muted: #8a857d;
  --border: #e6e1d6;
  --accent: #b3471a;
  --accent-hover: #8e3613;
  --tag-bg: #ece6d8;
  --tag-fg: #5a5044;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --radius: 8px;
  --radius-lg: 14px;

  --font-sans: "Inter", "Noto Sans JP", -apple-system, BlinkMacSystemFont,
    "Helvetica Neue", "Hiragino Sans", "Yu Gothic", sans-serif;
  --font-serif: "Source Serif 4", "Noto Serif JP", Georgia, serif;
  --font-mono: "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;

  --fs-xs: 0.8125rem;
  --fs-sm: 0.875rem;
  --fs-base: 1rem;
  --fs-md: 1.0625rem;
  --fs-lg: 1.25rem;
  --fs-xl: 1.5rem;
  --fs-2xl: 1.875rem;
  --fs-3xl: 2.25rem;

  --lh-tight: 1.3;
  --lh-base: 1.7;
  --lh-loose: 1.85;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-8: 48px;
  --space-10: 64px;

  --width-article: 720px;
  --width-page: 1100px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14130f;
    --bg-soft: #1d1c17;
    --bg-code: #1a1a1a;
    --fg: #ece8df;
    --fg-soft: #b8b3a6;
    --muted: #837e72;
    --border: #2c2a25;
    --accent: #e87a4e;
    --accent-hover: #f59266;
    --tag-bg: #2a2722;
    --tag-fg: #c8bfae;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  }
}

/* ---------- Reset ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
}
body,
h1,
h2,
h3,
h4,
p,
ul,
ol,
figure,
blockquote {
  margin: 0;
}
ul,
ol {
  padding-left: 1.25em;
}
img,
svg {
  max-width: 100%;
  height: auto;
  display: block;
}
button {
  font: inherit;
}

/* ---------- Base ---------- */
html,
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: var(--lh-base);
  font-feature-settings: "palt";
  -webkit-font-smoothing: antialiased;
}
body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Links ---------- */
a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  transition: color 0.15s ease;
}
a:hover {
  color: var(--accent-hover);
}
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ---------- Skip link ---------- */
.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--bg);
  padding: var(--space-2) var(--space-4);
  text-decoration: none;
  border-radius: 0 0 var(--radius) 0;
  z-index: 100;
}
.skip:focus {
  left: 0;
}

/* ---------- Site header ---------- */
.site-header {
  border-bottom: 1px solid var(--border);
  padding: var(--space-4) var(--space-5);
}
.site-title {
  font-weight: 700;
  text-decoration: none;
  color: var(--fg);
  font-size: var(--fs-lg);
  letter-spacing: -0.01em;
}
.site-title:hover {
  color: var(--accent);
}

/* ---------- Tag chip ---------- */
.tag {
  display: inline-block;
  padding: 2px 10px;
  font-size: var(--fs-xs);
  font-weight: 500;
  background: var(--tag-bg);
  color: var(--tag-fg);
  border-radius: 999px;
  text-decoration: none;
  margin-right: 4px;
}
.tag:hover {
  background: var(--accent);
  color: var(--bg);
}

/* ---------- Site footer ---------- */
.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding: var(--space-5);
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-sm);
}

/* ---------- Selection ---------- */
::selection {
  background: var(--accent);
  color: var(--bg);
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  :root {
    --fs-md: 1rem;
    --fs-2xl: 1.5rem;
    --fs-3xl: 1.875rem;
  }
}
