/* /styles/base.css */

/* ============ Theme Tokens ============ */
:root {
  --accent: #8b0000;

  /* Dark Theme */
  --bg1-dark: #0a0012;
  --bg2-dark: #150022;
  --text-dark: #ffffff;
  --muted-dark: #cfcfd6;

  /* Light Theme */
  --bg1-light: #f6f6fb;
  --bg2-light: #ffffff;
  --text-light: #0a0a12;
  --muted-light: #5c5c6a;

  /* Footer */
  --footer-dark: #f3e1ff;
  --footer-light: #4b0076;
  --footer: var(--footer-dark);

  /* Defaults (dark mode) */
  --bg1: var(--bg1-dark);
  --bg2: var(--bg2-dark);
  --text: var(--text-dark);
  --muted: var(--muted-dark);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg1: var(--bg1-light);
    --bg2: var(--bg2-light);
    --text: var(--text-light);
    --muted: var(--muted-light);
    --footer: var(--footer-light);
  }
}

html[data-theme='dark'] {
  --bg1: var(--bg1-dark);
  --bg2: var(--bg2-dark);
  --text: var(--text-dark);
  --muted: var(--muted-dark);
  --footer: var(--footer-dark);
}

html[data-theme='light'] {
  --bg1: var(--bg1-light);
  --bg2: var(--bg2-light);
  --text: var(--text-light);
  --muted: var(--muted-light);
  --footer: var(--footer-light);
}

/* ============ Global Reset ============ */
* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, var(--bg1) 0%, var(--bg2) 100%);
  color: var(--text);
  font-family: "Charter", "Palatino", "Palatino Linotype", "Georgia", serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ============ Theme Toggle ============ */
.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5em; /* space between sun / moon */
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 14px;
  letter-spacing: 0.3px;
  cursor: pointer;
  user-select: none;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
}

.theme-toggle:hover {
  transform: translateY(-1px);
}

.theme-toggle:active {
  transform: translateY(0);
}

@media (prefers-color-scheme: light) {
  html:not([data-theme='dark']) .theme-toggle {
    border-color: rgba(0, 0, 0, 0.12);
    background: rgba(0, 0, 0, 0.04);
  }
}

html[data-theme='light'] .theme-toggle {
  border-color: rgba(0, 0, 0, 0.12);
  background: rgba(0, 0, 0, 0.04);
}

/* ============ Typography ============ */
h1, h2, h3 {
  font-weight: normal;
  line-height: 1.2;
  color: var(--text);
}

h1 {
  font-size: 28px;
  margin: 0.5em 0 0.2em;
}

h2 {
  font-size: 20px;
  margin-top: 2em;
}

p {
  margin: 1em 0;
}

/* ============ Layout ============ */
.topbar {
  width: 100%;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  padding: 8px 10px 0;
  gap: 8px;
}

.section {
  max-width: 820px;
  margin: 0 auto;
  padding: 24px 20px 60px;
  text-align: center;
}

/* ============ Utility ============ */
.muted {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 24px;
}

.codeblock {
  width: 100%;
  font-size: 14px;
  line-height: 1.5;
  padding: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  color: var(--text);
  background-color: var(--bg2);
  font-family: monospace;
  text-align: left;
  overflow-x: auto;
  white-space: pre-wrap;
}

.seal {
  width: 120px;
  max-width: 30vw;
  height: auto;
  display: block;
  margin: 40px auto 0;
  opacity: 0.9;
}

/* ============ Footer ============ */
footer {
  padding: 24px 0 40px;
  font-size: 14px;
  letter-spacing: 1px;
  width: 100%;
  text-align: center;
  color: var(--footer); /* <-- THIS LINE FIXES IT */
  font-weight: 500;
}

footer a {
  color: var(--footer);
  text-decoration: none;
  transition: color 0.2s ease, opacity 0.2s ease;
}

footer a:hover {
  text-decoration: underline;
  opacity: 0.85;
}

/* ============ Toggle Icons ============ */
.theme-toggle.light::before {
  content: "☀︎";
}

.theme-toggle.dark::before {
  content: "☾";
}

/* ============ Global Link Styles ============ */
a {
  color: var(--text); /* use text color for readability */
  text-decoration: none;
  transition: color 0.2s ease, opacity 0.2s ease;
}

a:hover {
  text-decoration: underline;
  opacity: 0.85;
}
