/* ==========================================================================
   Personal landing theme
   - Centered hero: avatar, name, tagline, social links; then a compact list
   - Light/dark toggle via html[data-theme]
   ========================================================================== */

:root,
html[data-theme="light"] {
  --bg: #fdfdfc;
  --bg-soft: #f2f3f1;
  --txt: #1f2421;
  --muted: #6b736e;
  --line: #e6e8e4;
  --accent: #1f9e7a;
  --accent-soft: rgba(31, 158, 122, 0.1);
  --code-2: #167a5f;

  --hl-red: #c4452f;
  --hl-green: #1f8a5a;
  --hl-yellow: #9a7320;
  --hl-blue: #2f6bcc;
  --hl-cyan: #0f8a8a;
  --hl-magenta: #8a4bc4;
  --hl-comment: #9aa39d;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14181a;
    --bg-soft: #1d2225;
    --txt: #e6ebe8;
    --muted: #8d968f;
    --line: #283033;
    --accent: #4fd6a8;
    --accent-soft: rgba(79, 214, 168, 0.13);
    --code-2: #6fe0b8;

    --hl-red: #f08a72;
    --hl-green: #74d6a0;
    --hl-yellow: #e0c074;
    --hl-blue: #7aa8f0;
    --hl-cyan: #5fd6d6;
    --hl-magenta: #c89ef0;
    --hl-comment: #5f6b64;
  }
}

html[data-theme="dark"] {
  --bg: #14181a;
  --bg-soft: #1d2225;
  --txt: #e6ebe8;
  --muted: #8d968f;
  --line: #283033;
  --accent: #4fd6a8;
  --accent-soft: rgba(79, 214, 168, 0.13);
  --code-2: #6fe0b8;

  --hl-red: #f08a72;
  --hl-green: #74d6a0;
  --hl-yellow: #e0c074;
  --hl-blue: #7aa8f0;
  --hl-cyan: #5fd6d6;
  --hl-magenta: #c89ef0;
  --hl-comment: #5f6b64;
}

:root {
  --b-txt: var(--txt);
  --b-bg-1: var(--bg);
  --b-bg-2: var(--bg-soft);
  --b-line: var(--line);
  --b-link: var(--accent);
  --b-focus: var(--accent);
  --b-font-main: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;
  --b-font-mono: ui-monospace, "JetBrains Mono", "SFMono-Regular", Menlo, Consolas, monospace;
}

/* --- Base layout ---------------------------------------------------------- */

html { scroll-behavior: smooth; }

body {
  max-width: 44rem;
  margin: 0 auto;
  padding: 3rem 1.5rem 5rem;
  background: var(--bg);
  color: var(--txt);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

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

/* --- Hero header ---------------------------------------------------------- */

.site-header {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 4rem;
}

.site-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 5rem;
  height: 5rem;
  border-radius: 50%;
  font-size: 2.4rem;
  text-decoration: none;
  background: var(--accent-soft);
  border: 1px solid var(--line);
  margin-bottom: 1.1rem;
  transition: transform 0.2s ease;
}
.site-avatar:hover { transform: scale(1.05) rotate(-4deg); }

.site-brand {
  font-family: var(--b-font-main);
  font-size: 1.9rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--txt);
  text-decoration: none;
}
.site-brand:hover { color: var(--accent); }

.site-tagline {
  font-size: 1.05rem;
  color: var(--muted);
  margin: 0.5rem 0 0;
  max-width: 30rem;
}
.site-tagline::before { content: ""; }

.hero-socials {
  display: flex;
  gap: 1rem;
  margin-top: 1.1rem;
  font-family: var(--b-font-mono);
  font-size: 0.85rem;
}
.hero-socials a {
  color: var(--muted);
  text-decoration: none;
  padding: 0.3rem 0.8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.hero-socials a:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

/* Theme toggle parked top-right */
.theme-toggle {
  position: absolute;
  right: 0;
  top: 0;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 999px;
  width: 2.2rem;
  height: 2.2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--muted);
  cursor: pointer;
  padding: 0;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.theme-toggle:hover { color: var(--accent); border-color: var(--accent); }

.theme-icon { display: none; line-height: 1; }
.theme-icon-dark { display: inline; }
.theme-icon-light { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-icon-dark { display: none; }
  :root:not([data-theme="light"]) .theme-icon-light { display: inline; }
}
html[data-theme="dark"] .theme-icon-dark { display: none; }
html[data-theme="dark"] .theme-icon-light { display: inline; }
html[data-theme="light"] .theme-icon-dark { display: inline; }
html[data-theme="light"] .theme-icon-light { display: none; }

/* --- Navigation ----------------------------------------------------------- */

.site-header nav {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 1.5rem;
  font-family: var(--b-font-mono);
  font-size: 0.85rem;
}
.site-header nav a { color: var(--muted); text-decoration: none; transition: color 0.15s ease; }
.site-header nav a:hover { color: var(--accent); }
.site-header nav a[aria-current="true"] { color: var(--accent); }

/* --- Home: compact list --------------------------------------------------- */

.all-posts { display: flex; flex-direction: column; gap: 2.25rem; }
.year-section { display: flex; flex-direction: column; gap: 0.5rem; }

.year-heading {
  font-family: var(--b-font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 0.5rem;
  border: 0;
  padding: 0;
}

.posts-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }

.post-row {
  padding: 1rem 1.1rem;
  border-radius: 10px;
  transition: background 0.15s ease;
}
.post-row:hover { background: var(--bg-soft); }

.post-link {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  text-decoration: none;
  color: var(--txt);
}
.post-arrow { color: var(--accent); transition: transform 0.15s ease; }
.post-link:hover .post-arrow { transform: translateX(3px); }
.post-title { font-weight: 600; flex: 1; transition: color 0.15s ease; }
.post-link:hover .post-title { color: var(--accent); }
.post-meta { font-family: var(--b-font-mono); font-size: 0.76rem; color: var(--muted); white-space: nowrap; }
.post-description { margin: 0.25rem 0 0 1.45rem; color: var(--muted); font-size: 0.92rem; line-height: 1.55; }

/* --- Post page ------------------------------------------------------------ */

.post-back {
  display: inline-block;
  font-family: var(--b-font-mono);
  font-size: 0.82rem;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 2rem;
  transition: color 0.15s ease;
}
.post-back:hover { color: var(--accent); }

.post-head { margin-bottom: 2.5rem; }
.post-head h1 { font-size: 2.2rem; font-weight: 800; margin: 0 0 0.75rem; line-height: 1.2; letter-spacing: -0.02em; }

.post-meta-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-family: var(--b-font-mono);
  font-size: 0.82rem;
  color: var(--muted);
}
.post-meta-sep { opacity: 0.5; }
.post-tags { display: inline-flex; gap: 0.5rem; margin-left: 0.25rem; }
.post-tag { color: var(--accent); }

.draft-badge {
  display: inline-block;
  font-family: var(--b-font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.2em 0.5em;
  border-radius: 4px;
  color: var(--hl-yellow);
  border: 1px solid var(--hl-yellow);
}

.post p, .post li { line-height: 1.75; }
.post h2, .post h3 { margin-top: 2.5rem; letter-spacing: -0.01em; }
.post img { border-radius: 10px; border: 1px solid var(--line); }
.post blockquote { border-left: 3px solid var(--accent); color: var(--muted); font-style: italic; }

/* --- Code ----------------------------------------------------------------- */

pre {
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 0.85rem;
  line-height: 1.6;
}
:not(pre) > code {
  background: var(--accent-soft);
  color: var(--code-2);
  border-radius: 5px;
  padding: 0.12em 0.4em;
  font-size: 0.875em;
}

.hljs-keyword, .hljs-selector-tag, .hljs-section, .hljs-link { color: var(--hl-magenta); }
.hljs-string, .hljs-attribute, .hljs-symbol, .hljs-bullet, .hljs-addition, .hljs-template-tag { color: var(--hl-green); }
.hljs-title, .hljs-name, .hljs-function .hljs-title, .hljs-type { color: var(--hl-blue); }
.hljs-variable, .hljs-template-variable, .hljs-attr, .hljs-property { color: var(--hl-cyan); }
.hljs-number, .hljs-regexp, .hljs-literal { color: var(--hl-yellow); }
.hljs-built_in, .hljs-class .hljs-title, .hljs-params { color: var(--hl-red); }
.hljs-comment, .hljs-quote, .hljs-deletion, .hljs-meta { color: var(--hl-comment); font-style: italic; }

/* --- Footer --------------------------------------------------------------- */

.site-footer {
  margin-top: 5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  font-family: var(--b-font-mono);
  font-size: 0.78rem;
  color: var(--muted);
}
.footer-links { display: flex; gap: 1.25rem; }
.footer-links a { color: var(--muted); text-decoration: none; }
.footer-links a:hover { color: var(--accent); }

/* --- Responsive ----------------------------------------------------------- */

@media (max-width: 540px) {
  body { padding: 2rem 1.1rem 3rem; }
  .post-head h1 { font-size: 1.8rem; }
}
