/* dexteroot.net — minimal, typographic, light with auto dark.
   Serif body · sans headings · mono code. System fonts only. */

:root {
  --max: 44rem;

  /* dark theme — default */
  --bg:      #16171a;
  --fg:      #e4e4e2;
  --muted:   #9aa0a6;
  --border:  #2b2d31;
  --accent:  #9db2ff;
  --accent-2:#bcc8ff;
  --code-bg: #1e2024;
  --sel:     #2b3a67;

  --serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, "Times New Roman", serif;
  --sans:  system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono:  ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

/* light theme — opt-in via the header toggle */
[data-theme="light"] {
  --bg:      #fdfcfa;
  --fg:      #1b1b1a;
  --muted:   #6b6f76;
  --border:  #e7e3db;
  --accent:  #3a5ba0;
  --accent-2:#2c4680;
  --code-bg: #f4f1ec;
  --sel:     #dbe4ff;
}

* { box-sizing: border-box; }

html { font-size: 18px; -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--serif);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--sel); }

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 2.5rem 1.25rem 3rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.content { flex: 1 0 auto; }

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

/* ---- header ---- */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 3.25rem;
}
.site-title {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: -.01em;
  color: var(--fg);
  text-decoration: none;
}
.site-nav {
  font-family: var(--sans);
  font-size: .95rem;
  display: flex;
  align-items: center;
  gap: 1.1rem;
}
.site-nav a { color: var(--muted); text-decoration: none; }
.site-nav a:hover, .site-nav a.active { color: var(--fg); }
.nav-icons { display: inline-flex; align-items: center; gap: .8rem; }
.site-nav .icon { display: inline-flex; color: var(--muted); transition: color .12s ease; }
.site-nav .icon svg { width: 17px; height: 17px; display: block; }
.site-nav .icon:hover { color: var(--fg); }
.theme-toggle { background: none; border: 0; padding: 0; margin: 0; cursor: pointer; font: inherit; line-height: 0; }

/* keyboard focus, never on mouse */
a:focus-visible,
.icon:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}

/* ---- home / archive ---- */
.intro {
  font-family: var(--sans);
  color: var(--muted);
  font-size: 1rem;
  margin: -1.25rem 0 2.5rem;
}
.home-content { margin-bottom: 2.5rem; }

.archive-year { margin-bottom: 2rem; }
.year {
  font-family: var(--sans);
  font-size: .78rem;
  font-weight: 600;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 .6rem;
  padding-bottom: .3rem;
  border-bottom: 1px solid var(--border);
}
.post-list { list-style: none; margin: 0; padding: 0; }
.post-list li {
  display: flex;
  gap: 1rem;
  align-items: baseline;
  padding: .3rem 0;
}
.post-list time {
  font-family: var(--mono);
  font-size: .82rem;
  color: var(--muted);
  flex: 0 0 4.2rem;
  white-space: nowrap;
}
.post-list a { color: var(--fg); text-decoration: none; }
.post-list a:hover { color: var(--accent); text-decoration: underline; }

/* ---- post ---- */
.post-title {
  font-family: var(--sans);
  font-weight: 800;
  font-size: 2rem;
  line-height: 1.2;
  letter-spacing: -.02em;
  margin: 0 0 .5rem;
}
.post-meta {
  font-family: var(--sans);
  font-size: .85rem;
  color: var(--muted);
  margin-bottom: 2.5rem;
}
.post-meta .tag { color: var(--muted); text-decoration: none; margin-right: .15rem; }
.post-meta .tag:hover { color: var(--accent); }

.post-content { font-size: 1.05rem; }
.post-content h1,
.post-content h2,
.post-content h3,
.post-content h4 {
  font-family: var(--sans);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -.01em;
  margin: 2.2rem 0 .8rem;
}
.post-content h2 { font-size: 1.45rem; }
.post-content h3 { font-size: 1.2rem; }
.post-content h4 { font-size: 1.05rem; }
.post-content p { margin: 0 0 1.2rem; }
.post-content ul, .post-content ol { padding-left: 1.3rem; margin: 0 0 1.2rem; }
.post-content li { margin: .3rem 0; }
.post-content li > ul, .post-content li > ol { margin: .3rem 0; }
.post-content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 1.6rem auto;
  border: 1px solid var(--border);
  border-radius: 6px;
}
.post-content blockquote {
  margin: 1.4rem 0;
  padding: .1rem 0 .1rem 1.1rem;
  border-left: 3px solid var(--border);
  color: var(--muted);
  font-style: italic;
}
.post-content hr { border: 0; border-top: 1px solid var(--border); margin: 2.5rem 0; }

/* inline + block code */
code {
  font-family: var(--mono);
  font-size: .88em;
  background: var(--code-bg);
  padding: .12em .38em;
  border-radius: 4px;
}
pre {
  font-family: var(--mono);
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  margin: 1.5rem 0;
  line-height: 1.5;
}
pre code { background: none; padding: 0; font-size: .85rem; }
.highlight { margin: 1.5rem 0; }
.highlight pre { margin: 0; }

/* tables */
.post-content table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.5rem 0;
  font-size: .95rem;
}
.post-content th, .post-content td {
  border: 1px solid var(--border);
  padding: .5rem .7rem;
  text-align: left;
}
.post-content th { font-family: var(--sans); background: var(--code-bg); }

/* ---- post nav ---- */
.post-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-family: var(--sans);
  font-size: .9rem;
}
.post-nav a { color: var(--muted); text-decoration: none; }
.post-nav a:hover { color: var(--accent); }
.post-nav .next { text-align: right; }

/* ---- list header ---- */
.list-header h1 {
  font-family: var(--sans);
  font-weight: 800;
  font-size: 1.8rem;
  letter-spacing: -.02em;
  margin: 0 0 1.5rem;
}

/* ---- footer ---- */
.site-footer {
  flex-shrink: 0;
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-family: var(--sans);
  font-size: .82rem;
  color: var(--muted);
}
.site-footer p { margin: 0; }
.site-footer a { color: var(--muted); }
.site-footer a:hover { color: var(--accent); }
.site-footer .sep { opacity: .5; margin: 0 .2rem; }

/* ---- small screens ---- */
@media (max-width: 480px) {
  html { font-size: 17px; }
  .post-title { font-size: 1.7rem; }
  .post-list li { flex-wrap: wrap; gap: .15rem; }
  .post-list time { flex-basis: auto; }
}
