/* isaklab.com — minimal, technical, neutral.
   Light and dark themes follow the operating system. */

:root {
  --bg:        #0d1117;
  --fg:        #e6edf3;
  --muted:     #8b949e;
  --faint:     #6e7681;
  --rule:      #21262d;
  --accent:    #4493f8;
  --code-bg:   #161b22;
  --selection: #1f3a5f;

  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Cascadia Code", Menlo, Consolas, monospace;

  --measure: 42rem;
}

/* Dark is the default theme. The toggle can switch to light (data-theme="light").
   Nothing is stored — the choice lasts only for the current page. */
:root[data-theme="light"] {
  --bg:        #ffffff;
  --fg:        #1a1a1a;
  --muted:     #6b7280;
  --faint:     #9aa1ab;
  --rule:      #e7e7e9;
  --accent:    #1f6feb;
  --code-bg:   #f6f8fa;
  --selection: #d9e6ff;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

main {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ---------- header / footer ---------- */

.site-header,
.site-footer {
  max-width: var(--measure);
  margin: 0 auto;
  padding: 1.25rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 1rem;
}

.site-header {
  border-bottom: 1px solid var(--rule);
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
}

.site-header .site-nav { margin-left: auto; }

.lang-switch {
  display: flex;
  gap: 0.5rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  padding-left: 0.9rem;
  margin-left: 0.3rem;
  border-left: 1px solid var(--rule);
}

.lang-switch a { color: var(--faint); text-decoration: none; text-transform: uppercase; }
.lang-switch a:hover { color: var(--accent); }
.lang-switch a.active { color: var(--fg); }

.theme-toggle {
  display: none;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--faint);
  background: none;
  border: none;
  border-left: 1px solid var(--rule);
  padding-left: 0.9rem;
  margin-left: 0.3rem;
  cursor: pointer;
}
html.js .theme-toggle { display: inline; }
.theme-toggle:hover { color: var(--accent); }

.wordmark {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: -0.01em;
  color: var(--fg);
  text-decoration: none;
}

.site-nav,
.site-footer .links {
  display: flex;
  gap: 1.1rem;
  font-family: var(--mono);
  font-size: 0.82rem;
}

.site-nav a,
.site-footer .links a {
  color: var(--muted);
  text-decoration: none;
}

.site-nav a:hover,
.site-footer .links a:hover { color: var(--accent); }

.site-footer {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  flex-wrap: wrap;
}

.site-footer .colophon {
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--faint);
}

/* ---------- index ---------- */

.intro {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.intro p { margin: 0; }

/* ---------- search / filter (shown only when JS is available) ---------- */

.controls { display: none; margin-bottom: 1.5rem; }
html.js .controls { display: block; }

.search {
  width: 100%;
  font-family: var(--mono);
  font-size: 0.84rem;
  color: var(--fg);
  background: var(--code-bg);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 0.5rem 0.7rem;
}
.search::placeholder { color: var(--faint); }
.search:focus { outline: none; border-color: var(--accent); }

.filter-tags { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.7rem; }

button.tag { cursor: pointer; background: none; }
button.tag:hover { color: var(--fg); }
button.tag.active { color: var(--accent); border-color: var(--accent); }

.no-results { color: var(--faint); padding: 1.5rem 0; }

.post-list { list-style: none; margin: 0; padding: 0; }

.post-item {
  padding: 1.5rem 0;
  border-bottom: 1px solid var(--rule);
}
.post-item:last-child { border-bottom: none; }

.post-item time {
  display: block;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--faint);
  margin-bottom: 0.35rem;
}

.post-link {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--fg);
  text-decoration: none;
  line-height: 1.35;
}
.post-link:hover { color: var(--accent); }

.post-summary {
  margin: 0.4rem 0 0;
  color: var(--muted);
  font-size: 0.96rem;
}

.empty { color: var(--faint); }

/* ---------- tags ---------- */

.tags { margin: 0.6rem 0 0; display: flex; flex-wrap: wrap; gap: 0.4rem; }

.tag {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: 0.05rem 0.4rem;
}

/* ---------- post ---------- */

.post-header { margin-bottom: 2rem; }

.post-header h1 {
  font-size: 1rem;
  line-height: 1.3;
  letter-spacing: -0.01em;
  margin: 0 0 0.6rem;
}

.post-meta {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  font-family: var(--mono);
  font-size: 0.78rem;
  color: var(--faint);
}
.post-meta .tags { margin: 0; }

.back {
  margin: 3rem 0 0;
  font-family: var(--mono);
  font-size: 0.82rem;
}
.back a { color: var(--muted); text-decoration: none; }
.back a:hover { color: var(--accent); }

/* ---------- prose ---------- */

.prose { font-size: 0.9rem; }

.prose > * + * { margin-top: 1.3rem; }

.prose h2, .prose h3, .prose h4 {
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin-top: 2.4rem;
}
.prose h2 { font-size: 1.2rem; }
.prose h3 { font-size: 1.05rem; }
.prose h4 { font-size: 0.95rem; }

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

.prose img { max-width: 100%; height: auto; border-radius: 4px; }

.prose blockquote {
  margin-left: 0;
  padding-left: 1rem;
  border-left: 2px solid var(--rule);
  color: var(--muted);
}

.prose hr { border: none; border-top: 1px solid var(--rule); margin: 2.5rem 0; }

.prose ul, .prose ol { padding-left: 1.4rem; }
.prose li + li { margin-top: 0.35rem; }

.prose table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.92rem;
}
.prose th, .prose td {
  border: 1px solid var(--rule);
  padding: 0.45rem 0.7rem;
  text-align: left;
}
.prose th { font-weight: 600; }

/* ---------- code ---------- */

code, kbd, pre, samp { font-family: var(--mono); }

.prose :not(pre) > code {
  background: var(--code-bg);
  border-radius: 3px;
  padding: 0.12em 0.36em;
  font-size: 0.88em;
}

.prose pre,
.highlight {
  background: var(--code-bg);
  border-radius: 6px;
  padding: 1rem 1.1rem;
  overflow-x: auto;
  font-size: 0.86rem;
  line-height: 1.55;
}

.prose pre code { background: none; padding: 0; font-size: inherit; }

.highlight pre { margin: 0; background: none; padding: 0; }
