:root { color-scheme: light dark; }  /* page supports both */
html.dark { color-scheme: dark; }    /* when your dark class is active */

/* ---------- Theme Tokens (Light default) ---------- */
:root {
  --bg: #ffffff;
  --fg: #1f2937;
  --muted: #6b7280;
  --accent: #34d399;   /* green accent */
  --rule: #e5e5e5;
}

/* ---------- Dark theme variables (applied when html has .dark) ---------- */
html.dark {
  --bg: #1d1e21;
  --fg: #C9C9C9;
  --muted: #9ca3af;
  --accent: #34d399;
  --rule: #2a2a2a;
}

/* ---------- Base ---------- */
* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: "Meslo LG", ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  line-height: 1.6;
  max-width: 720px;
  padding: 72px 20px 40px;
  margin-inline: auto;
}

/* Prevent images and videos from overflowing */
img, video {
  max-width: 100%;
  height: auto;
}

/* Accessibility: respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

/* ---------- Header ---------- */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
}

.logo-icon {
  width: 3rem;
  height: auto;
  vertical-align: middle;
  margin-right: 0.35rem;
  display: inline-block;
}

header h1 {
  margin: 0;
  font-size: 1.8rem;
  color: var(--accent);
}

/* Title link: clean look, no underline or color change */
header h1 a,
header h1 a:visited,
header h1 a:hover,
header h1 a:focus-visible {
  color: inherit;
  text-decoration: none;
}

/* ---------- Navigation ---------- */
nav a,
nav a:visited {
  color: var(--accent);
  text-decoration: none;
  margin: 0 0.3rem;
}

nav a:hover,
nav a:focus-visible {
  text-decoration: none;
  opacity: 0.8;
  transition: opacity .15s ease-in-out;
}

/* ---------- Global links ---------- */
a,
a:visited {
  color: var(--accent);
  text-decoration: none;
}

a:hover,
a:focus,
a:active,
a:focus-visible {
  text-decoration: none;
  opacity: 0.8;
  transition: opacity .15s ease-in-out;
}

/* ---------- Theme Toggle Button ---------- */
.theme-toggle {
  border: 1px solid var(--rule);
  background: transparent;
  color: var(--fg);
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  font-size: 1.1rem;
}

.theme-toggle:hover,
.theme-toggle:focus-visible {
  opacity: 0.9;
}

/* ---------- Headings ---------- */
h2 {
  color: var(--accent);
  font-size: 1.3rem;
  margin-top: 2rem;
}


/* ---------- Content Links ---------- */
.intro a,
.writing a {
  color: var(--accent);
  text-decoration: none;
}

/* ---------- Post List ---------- */
.writing ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.writing li {
  display: flex;
  gap: 1rem;
  align-items: baseline;
  padding: 0.3rem 0;
  border-bottom: 1px dotted var(--rule);
}

.writing li span {
  min-width: 120px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-variant-numeric: tabular-nums;
}

/* ---------- Last Updated Tag ---------- */
.last-updated {
  background: rgba(52, 211, 153, 0.15); /* light green tint */
  color: var(--accent);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 0.85rem;
  font-weight: 500;
  display: inline-block;
  margin-left: 0.5rem;
}

/* ---------- Footer ---------- */
footer {
  margin-top: 40px;
  padding-top: 20px;
  /* border-top: 1px solid var(--rule); */
  color: var(--muted);
  text-align: center;
  font-size: 0.9rem;
}

/* ---------- Back to Home link ---------- */
.back-home,
.back-home:visited {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  border: none;
  transition: opacity .2s ease;
}

.back-home:hover,
.back-home:focus-visible {
  opacity: 0.8;
}

/* ---------- Admonitions (callouts) ---------- */
.admonition {
  border-left: 4px solid var(--accent);
  border-radius: 6px;
  padding: 1rem 1.2rem;
  margin: 1.5rem 0;
  background: rgba(52, 211, 153, 0.08);
  color: var(--fg);
  line-height: 1.55;
}

/* Title line (with icon inline) */
.admonition strong:first-child {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-weight: 600;
  margin-bottom: 0.4rem;
}

/* Variant: Info */
.admonition.info {
  border-color: #3b82f6;
  background: #1e293b;
  color: #bfdbfe;
}
.admonition.info strong:first-child::before {
  content: "ℹ️";
  color: #60a5fa;
}

/* Variant: Warning */
.admonition.warn {
  border-color: #f59e0b;
  background: #3d2f13;
  color: #fcd34d;
}
.admonition.warn strong:first-child::before {
  content: "⚠️";
  color: #fbbf24;
}

/* Variant: Danger */
.admonition.danger {
  border-color: #ef4444;
  background: #3b0d0d;
  color: #fca5a5;
}
.admonition.danger strong:first-child::before {
  content: "❌";
  color: #ef4444;
}

/* Variant: Tip */
.admonition.tip {
  border-color: #10b981;
  background: #0d3025;
  color: #6ee7b7;
}
.admonition.tip strong:first-child::before {
  content: "💡";
  color: #34d399;
}