/* ------------------------------------------------------------------
   Alpine-inspired minimalist blog theme
   Centred single column, generous whitespace, light + dark palettes.
   ------------------------------------------------------------------ */

:root {
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system,
    "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
    "Liberation Mono", monospace;

  --measure: 44rem;
  --radius: 8px;
  --step: 1.5rem;

  /* Light palette (default) */
  --bg: #ffffff;
  --bg-subtle: #f6f7f9;
  --text: #16181d;
  --text-muted: #6b7280;
  --text-faint: #9ca3af;
  --border: #e6e8eb;
  --accent: #16181d;
  --code-bg: #f6f7f9;
  --selection: #dbeafe;
}

:root[data-theme="dark"] {
  --bg: #0d0e12;
  --bg-subtle: #16181d;
  --text: #e9eaec;
  --text-muted: #9ba1ac;
  --text-faint: #6b7280;
  --border: #23262d;
  --accent: #ffffff;
  --code-bg: #16181d;
  --selection: #1e3a5f;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

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

.wrap {
  width: 100%;
  max-width: var(--measure);
  margin-inline: auto;
  padding-inline: 1.5rem;
}

.skip-link {
  position: absolute;
  left: -9999px;
}
.skip-link:focus {
  left: 1rem;
  top: 1rem;
  z-index: 10;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.875rem;
}

/* ---------------------------- Header ---------------------------- */

.site-header {
  padding-block: 2.5rem 1rem;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 650;
  letter-spacing: -0.015em;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  font-size: 1.15rem;
  line-height: 1;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 1.375rem;
}

.site-nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.94rem;
  transition: color 0.15s ease;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--text);
}

.theme-toggle {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  margin-left: -0.25rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.theme-toggle:hover {
  color: var(--text);
  background: var(--bg-subtle);
}

.theme-toggle svg {
  width: 1.05rem;
  height: 1.05rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Show the icon for the theme you would switch *to*. */
:root[data-theme="light"] .icon-sun,
:root[data-theme="dark"] .icon-moon {
  display: none;
}

/* ----------------------------- Main ----------------------------- */

main {
  flex: 1;
  padding-block: 2rem 5rem;
}

.page-title {
  font-size: clamp(2rem, 1.5rem + 2vw, 2.75rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
  font-weight: 700;
  margin: 0 0 0.75rem;
}

.page-tagline {
  margin: 0 0 2rem;
  color: var(--text-muted);
  font-size: 1.075rem;
}

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

.post-date {
  display: block;
  margin-bottom: 0.6rem;
  color: var(--text-faint);
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* ----------------------------- Prose ---------------------------- */

.prose h2,
.prose h3,
.prose h4 {
  letter-spacing: -0.02em;
  line-height: 1.3;
  margin: 2.5rem 0 0.75rem;
}

.prose h2 {
  font-size: 1.5rem;
}
.prose h3 {
  font-size: 1.2rem;
}
.prose h4 {
  font-size: 1.05rem;
}

.prose p,
.prose ul,
.prose ol {
  margin: 0 0 1.25rem;
}

.prose ul,
.prose ol {
  padding-left: 1.25rem;
}

.prose li {
  margin-bottom: 0.35rem;
}

.prose a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--text-faint);
  text-underline-offset: 3px;
  transition: text-decoration-color 0.15s ease;
}

.prose a:hover {
  text-decoration-color: var(--text);
}

.prose strong {
  font-weight: 650;
}

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

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

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

.prose code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.35em;
}

.prose pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.125rem;
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.6;
  margin: 0 0 1.5rem;
}

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

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.5rem;
  font-size: 0.94rem;
}

.prose th,
.prose td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border);
}

/* ------------------------- Article list ------------------------- */

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

.article-list li + li {
  border-top: 1px solid var(--border);
}

.article-item {
  display: block;
  padding: 1.5rem 0;
  text-decoration: none;
  color: inherit;
}

.article-item:hover .article-title {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.article-date {
  display: block;
  margin-bottom: 0.3rem;
  color: var(--text-faint);
  font-size: 0.82rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.article-title {
  margin: 0 0 0.3rem;
  font-size: 1.2rem;
  font-weight: 650;
  letter-spacing: -0.015em;
  line-height: 1.35;
}

.article-description {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.97rem;
  line-height: 1.6;
}

.empty-state {
  color: var(--text-muted);
  padding: 1.5rem 0;
}

/* --------------------------- Link cards ------------------------- */

.link-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13rem, 1fr));
  gap: 0.75rem;
  margin: 1.5rem 0 2rem;
  padding: 0;
  list-style: none;
}

.link-grid a {
  display: block;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.link-grid a:hover {
  border-color: var(--text-faint);
  background: var(--bg-subtle);
}

.link-grid .label {
  display: block;
  font-weight: 600;
  font-size: 0.95rem;
}

.link-grid .value {
  display: block;
  color: var(--text-muted);
  font-size: 0.86rem;
}

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

.site-footer {
  border-top: 1px solid var(--border);
  padding-block: 2rem 3rem;
  font-size: 0.9rem;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  align-items: center;
  text-align: center;
}

.footer-nav,
.footer-socials {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.125rem;
}

.site-footer a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

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

.copyright {
  margin: 0.25rem 0 0;
  color: var(--text-faint);
  font-size: 0.84rem;
}

.back-link {
  display: inline-block;
  margin-top: 3rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.93rem;
}

.back-link:hover {
  color: var(--text);
}

.post-footer {
  border-top: 1px solid var(--border);
  margin-top: 3rem;
}

/* -------------------------- Focus ring -------------------------- */

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
  border-radius: 3px;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  * {
    transition-duration: 0.01ms !important;
  }
}
