/* stokke.dev / blog – styles */

/* ===== Custom Properties ===== */
:root {
  color-scheme: light dark;

  --bg: #faf7f2;
  --surface: #f4f0e9;
  --elevated: #fffdf7;
  --text: #1c1917;
  --muted: #78716c;
  --border: #e2dbd0;
  --accent: #b07b00;
  --accent-soft: #fef3c2;
  --accent-glow: rgba(176, 123, 0, 0.06);
  --code-bg: #f0ede5;
  --focus: #b45309;
  --measure: 700px;
  --radius: 0.45rem;

  --font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", "Courier New", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1917;
    --surface: #25221f;
    --elevated: #2e2a25;
    --text: #e8e3d8;
    --muted: #a8a096;
    --border: #34312c;
    --accent: #f0b429;
    --accent-soft: #3d2808;
    --accent-glow: rgba(240, 180, 41, 0.06);
    --code-bg: #23201c;
    --focus: #f08c2e;
  }
}

/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; }

html {
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.65;
  background: var(--bg);
  color: var(--text);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  min-height: 100vh;
}

.container {
  width: min(var(--measure), calc(100% - 2rem));
  margin-inline: auto;
}

/* ===== Skip Link ===== */
.skip-link {
  position: absolute;
  left: 1rem;
  top: 1rem;
  transform: translateY(-200%);
  background: var(--bg);
  color: var(--text);
  padding: 0.5rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  z-index: 100;
}
.skip-link:focus { transform: translateY(0); }

/* ===== Typography ===== */
h1, h2, h3, h4, h5, h6 {
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin: 2.5rem 0 1rem;
  font-weight: 600;
  color: var(--text);
}

h1 { font-size: clamp(2rem, 6vw, 3rem); }
h2 { font-size: 1.5rem; }
h3 { font-size: 1.2rem; }

p, ul, ol, blockquote, pre, table { margin-block: 1rem; }

a {
  color: var(--accent);
  text-decoration-thickness: 0.1em;
  text-underline-offset: 0.2em;
  transition: opacity 0.15s ease;
}
a:hover { opacity: 0.75; }
a:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
  border-radius: 2px;
}

strong { font-weight: 600; }

/* ===== Header ===== */
.site-header {
  padding-block: 2rem;
  margin-bottom: 3rem;
  border-bottom: 1px solid var(--border);
}

.site-mark {
  margin-bottom: 0.5rem;
}

.site-title {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.site-section {
  color: var(--accent);
}

.site-tagline {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
  margin: 0 0 1rem;
  max-width: 42ch;
}

.site-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 1.25rem;
}

.site-nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
  padding-bottom: 0.15rem;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}

.site-nav a:hover {
  color: var(--text);
  opacity: 1;
  border-bottom-color: var(--accent);
}

.site-nav a[aria-current] {
  color: var(--text);
  border-bottom-color: var(--accent);
}

/* ===== Main ===== */
main { padding-bottom: 2rem; }

/* ===== Homepage Hero ===== */
.hero {
  margin-bottom: 3.5rem;
  padding-bottom: 2.5rem;
  border-bottom: 1px solid var(--border);
}

.hero-name {
  font-size: 0.9rem;
  color: var(--muted);
  margin: 0 0 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 500;
}

.hero-title {
  font-size: clamp(2rem, 5vw, 2.8rem);
  line-height: 1.2;
  letter-spacing: -0.025em;
  font-weight: 700;
  margin: 0 0 1.25rem;
  max-width: 20ch;
}

.hero-intro {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
  max-width: 50ch;
  margin: 0;
}

/* ===== Section Headings ===== */
.section-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin: 3rem 0 1.25rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.section-heading h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0;
}

.section-heading a {
  font-size: 0.9rem;
}

/* ===== Post Cards ===== */
.post-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 1rem;
}

.post-list li {
  margin: 0;
  padding: 0;
}

.post-card {
  display: block;
  padding: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.post-card:hover {
  border-color: var(--accent);
  box-shadow: 0 2px 16px var(--accent-glow);
}

.post-card-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0 0 0.35rem;
  line-height: 1.3;
}

.post-card-title a {
  color: var(--text);
  text-decoration: none;
}

.post-card-title a:hover {
  color: var(--accent);
  opacity: 1;
}

.post-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.75rem;
  align-items: center;
  font-size: 0.88rem;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.post-card-meta time {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--muted);
}

.post-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.post-card-tag {
  font-size: 0.78rem;
  padding: 0.12rem 0.55rem;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  font-weight: 500;
  text-decoration: none;
  transition: opacity 0.15s ease;
}

.post-card-tag:hover {
  opacity: 0.7;
}

.post-card-desc {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
  line-height: 1.55;
}

/* ===== Tag Chips ===== */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.tag-list li {
  margin: 0;
  padding: 0;
}

.tag-list a {
  display: inline-block;
  padding: 0.3rem 0.8rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.9rem;
  text-decoration: none;
  font-weight: 500;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.tag-list a:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
  opacity: 1;
}

/* ===== Post Page ===== */
.post-back {
  display: inline-block;
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.post-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.post-header h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(2rem, 5vw, 2.8rem);
  font-weight: 700;
  line-height: 1.15;
}

.post-deck {
  font-size: 1.1rem;
  color: var(--muted);
  line-height: 1.55;
  margin: 0.75rem 0 0;
  max-width: 50ch;
}

.post-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 1rem;
  align-items: center;
  font-size: 0.9rem;
  color: var(--muted);
}

.post-meta time {
  font-family: var(--font-mono);
  font-size: 0.82rem;
}

.post-header .tag-list {
  margin-top: 1rem;
}

/* Post body */
.e-content h2,
.e-content h3,
.e-content h4 {
  margin-top: 2.5rem;
}

.e-content p {
  line-height: 1.7;
}

.e-content a {
  text-decoration-thickness: 0.08em;
}

/* ===== Blockquote ===== */
blockquote {
  border-left: 3px solid var(--accent);
  margin-left: 0;
  margin-right: 0;
  padding: 0.25rem 0 0.25rem 1.25rem;
  color: var(--muted);
  background: var(--surface);
  border-radius: 0 var(--radius) var(--radius) 0;
}

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

:not(pre) > code {
  background: var(--code-bg);
  color: var(--text);
  padding: 0.1em 0.35em;
  border-radius: 0.25rem;
  font-size: 0.9em;
}

pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
  padding: 1.25rem;
  line-height: 1.55;
}

pre code {
  background: transparent;
  padding: 0;
  font-size: 0.88rem;
  color: var(--text);
}

/* ===== Images & Figures ===== */
img, svg, video {
  max-width: 100%;
  height: auto;
}

.e-content img {
  display: block;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  margin: 2rem auto;
}

.e-content figure {
  margin: 2rem 0;
}

.e-content figure img {
  margin-block: 0;
}

.e-content figcaption {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.5;
  margin-top: 0.75rem;
  text-align: center;
  font-style: italic;
}

/* ===== Tables ===== */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th {
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid var(--border);
  padding: 0.5rem 0.75rem;
}

td {
  border-bottom: 1px solid var(--border);
  padding: 0.5rem 0.75rem;
}

/* ===== Post Navigation ===== */
.post-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.95rem;
}

.post-nav a {
  font-weight: 500;
}

.post-nav a:last-child {
  text-align: right;
}

/* ===== About Page ===== */
.page-content h1 {
  margin-top: 0.5rem;
}

/* ===== Footer ===== */
.site-footer {
  margin-top: 4rem;
  padding-block: 2rem;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 0.9rem;
}

.site-footer .container {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.5rem 2rem;
}

.site-footer p {
  margin: 0;
}

/* ===== Mobile ===== */
@media (max-width: 520px) {
  html { font-size: 16px; }
  .site-header { padding-block: 1.5rem; margin-bottom: 2rem; }
  .hero-title { font-size: clamp(1.6rem, 6vw, 2rem); }
  .post-card { padding: 1.25rem; }
  .post-nav { grid-template-columns: 1fr; }
  .post-nav a:last-child { text-align: left; }
  .site-footer .container { flex-direction: column; }
}
