/*
  Tech-minimal theme
  - Light/dark via CSS variables (Jade Pebble Morning palette)
  - Reader override via html[data-theme]
*/

:root {
  --bg: #e6e6e6;
  --bg-accent: #bac8b1;
  --fg: #404e3b;
  --muted: #6c8480;
  --accent: #7b9669;
  --border: #bac8b1;

  --link: #404e3b;
  --link-hover: #7b9669;

  --max-width: 68rem;
  --radius: 0px;
  --line: 1.65;

  --code-bg: #f4f4f4;
  --code-fg: #1a1a1a;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #404e3b;
    --bg-accent: #6c8480;
    --fg: #e6e6e6;
    --muted: #bac8b1;
    --accent: #7b9669;
    --border: rgba(230, 230, 230, 0.25);

    --link: #e6e6e6;
    --link-hover: #bac8b1;

    --code-bg: rgba(0, 0, 0, 0.25);
    --code-fg: #e6e6e6;
  }
}

html[data-theme="light"] {
  --bg: #e6e6e6;
  --bg-accent: #bac8b1;
  --fg: #404e3b;
  --muted: #6c8480;
  --accent: #7b9669;
  --border: #bac8b1;

  --link: #404e3b;
  --link-hover: #7b9669;

  --code-bg: #f4f4f4;
  --code-fg: #1a1a1a;
}

html[data-theme="dark"] {
 /*
  * #404E3B
  */
  --bg: #242c21;
  --bg-accent: #6c8480;
  --fg: #e6e6e6;
  --muted: #bac8b1;
  --accent: #7b9669;
  --border: rgba(230, 230, 230, 0.25);

  --link: #e6e6e6;
  --link-hover: #bac8b1;

  --code-bg: rgba(0, 0, 0, 0.25);
  --code-fg: #e6e6e6;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

body {
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji",
    "Segoe UI Emoji";
  background: var(--bg);
  color: var(--fg);
  line-height: var(--line);
}

a {
  color: var(--link);
  text-decoration: none;
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
}

a:hover,
a:focus {
  color: var(--link-hover);
}

hr {
  border: 0;
  border-top: 1px solid var(--border);
  margin: 1.5rem 0;
}

.site-header {
  position: sticky;
  top: 0;
  backdrop-filter: blur(6px);
  background: color-mix(in oklab, var(--bg) 92%, transparent);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}

.site-nav {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}

.site-title {
  font-weight: 700;
  text-decoration: none;
}

.site-links {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.site-links a {
  text-decoration: none;
  padding: 0.25rem 0.35rem;
  border-radius: var(--radius);
}

.site-links a:hover,
.site-links a:focus {
  background: color-mix(in oklab, var(--bg-accent) 35%, transparent);
}

.theme-toggle {
  margin-left: auto;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--fg);
  border-radius: var(--radius);
  padding: 0.4rem 0.6rem;
  cursor: pointer;
}

.theme-toggle:hover,
.theme-toggle:focus {
  border-color: var(--accent);
}

.site-main {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 1rem 3rem;
}

.home-hero h1 {
  margin: 0;
  font-size: clamp(2rem, 4vw, 3.5rem);
  letter-spacing: -0.02em;
}

.home-tagline {
  margin: 0.75rem 0 0;
  color: var(--muted);
  max-width: 50rem;
}

.home-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
}

@media (min-width: 860px) {
  .home-grid {
    grid-template-columns: 1fr 1.2fr;
    gap: 2rem;
  }
}

.home-section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
}

.topic-grid,
.topic-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.topic-pill {
  display: inline-block;
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 0px;
  padding: 0.25rem 0.6rem;
}

.topic-pill:hover,
.topic-pill:focus {
  border-color: var(--accent);
  background: color-mix(in oklab, var(--bg-accent) 35%, transparent);
}

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

.post-list li {
  display: flex;
  gap: 0.75rem;
  justify-content: space-between;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--border);
}

.post-list li:last-child {
  border-bottom: 0;
}

.post-date {
  white-space: nowrap;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.pager {
  display: flex;
  gap: 0.75rem;
  margin-top: 1rem;
}

.pager-link {
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.35rem 0.6rem;
}

.pager-newer {
  margin-left: auto;
}

.page-header h1 {
  margin: 0;
}

.page-subtitle,
.page-description,
.post-meta {
  margin: 0.35rem 0 0;
  color: var(--muted);
}

.prose {
  margin-top: 1rem;
}

.about-avatar {
  width: 180px;
  max-width: 45%;
  float: right;
  margin: 0 0 1rem 1rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.prose img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
}

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

.prose pre {
  background: var(--code-bg);
  color: var(--code-fg);
  padding: 0.85rem;
  border-radius: var(--radius);
  overflow: auto;
}

.prose code {
  background: color-mix(in oklab, var(--code-bg) 75%, transparent);
  padding: 0.15rem 0.25rem;
  border-radius: 4px;
}

.prose pre code {
  background: transparent;
  padding: 0;
}

.link-list {
  margin: 0;
  padding-left: 1rem;
}

.site-footer {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 1.5rem 1rem 2rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
}

.site-footer a {
  color: var(--muted);
}
