/* base.css — variables, reset, typography */

:root {
  /* Palette — change a color here and it propagates everywhere.
     The active --color-* vars below pick one palette based on theme. */
  --light-bg:     #f9f1f5;
  --light-bg-2:   #f0e4ec;
  --light-text:   #2a1020;
  --light-muted:  #9a7090;
  --light-accent: #587818;
  --light-border: #ddc8d4;

  --dark-bg:      #1c1016;
  --dark-bg-2:    #281620;
  --dark-text:    #f0e0e8;
  --dark-muted:   #c870a0;
  --dark-accent:  #c8d858;
  --dark-border:  #4a2030;

  /* Default (light) — overridden by the dark media query / data-theme below. */
  --color-bg:      var(--light-bg);
  --color-bg-2:    var(--light-bg-2);
  --color-text:    var(--light-text);
  --color-muted:   var(--light-muted);
  --color-accent:  var(--light-accent);
  --color-border:  var(--light-border);
  --color-code-bg: var(--color-bg-2);

  --font-body: Avenir, "Avenir Next", "Century Gothic", "Trebuchet MS", sans-serif;
  --font-sans: Avenir, "Avenir Next", "Century Gothic", "Trebuchet MS", sans-serif;
  --font-mono: "Courier New", Courier, monospace;

  --line-height: 1.7;
  --max-width: 740px;
  --spacing: 1rem;
}

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

html {
  scroll-behavior: smooth;
  /* Lock the layout to a 330px minimum viewport. Below that, the page
     becomes horizontally scrollable rather than collapsing — keeps the
     mobile breakpoint's flex/grid sizing from breaking on the smallest
     phones (≤320px). */
  min-width: 330px;
}

body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: var(--line-height);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

body.page-index {
  font-size: 15px;
  line-height: 1.6;
}

body.page-post {
  font-size: 16px;
  line-height: 1.7;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-sans);
  font-weight: 600;
  line-height: 1.3;
  margin: 1.5em 0 0.5em;
}

h1 { font-size: 1.9rem; }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.15rem; }
h4 { font-size: 1rem; }
h5 { font-size: 0.9rem; }
h6 { font-size: 0.85rem; color: var(--color-muted); }

p {
  margin: 0 0 1em;
}

a {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

a:hover {
  opacity: 0.75;
}

blockquote {
  margin: 1.5em 0;
  padding: 0.5em 1.2em;
  border-left: 3px solid var(--color-border);
  color: var(--color-muted);
  font-style: italic;
}

code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--color-code-bg);
  padding: 0.1em 0.3em;
  border-radius: 3px;
}

pre {
  background: var(--color-code-bg);
  padding: 1em;
  overflow-x: auto;
  border-radius: 4px;
  line-height: 1.5;
}

pre code {
  background: none;
  padding: 0;
  font-size: 0.85rem;
}

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

ul, ol {
  padding-left: 1.5em;
  margin: 0 0 1em;
}

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

del {
  color: var(--color-muted);
}

/* Task lists */
.task-list-item {
  list-style: none;
  margin-left: -1.5em;
}

.task-list-item input[type="checkbox"] {
  margin-right: 0.5em;
  accent-color: var(--color-accent);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-color-scheme: dark) {
  :root {
    --color-bg:     var(--dark-bg);
    --color-bg-2:   var(--dark-bg-2);
    --color-text:   var(--dark-text);
    --color-muted:  var(--dark-muted);
    --color-accent: var(--dark-accent);
    --color-border: var(--dark-border);
  }
}

html[data-theme="dark"] {
  --color-bg:     var(--dark-bg);
  --color-bg-2:   var(--dark-bg-2);
  --color-text:   var(--dark-text);
  --color-muted:  var(--dark-muted);
  --color-accent: var(--dark-accent);
  --color-border: var(--dark-border);
}

html[data-theme="light"] {
  --color-bg:     var(--light-bg);
  --color-bg-2:   var(--light-bg-2);
  --color-text:   var(--light-text);
  --color-muted:  var(--light-muted);
  --color-accent: var(--light-accent);
  --color-border: var(--light-border);
}
