/*
 * Editorial engineer design system — see DESIGN.md for tokens and rules.
 * Fonts are self-hosted (app/assets/fonts); no Node, no CDN, no framework.
 * @font-face blocks live in the layout so Propshaft digests the URLs via asset_path.
 */

/* ---------- Tokens ---------- */
:root {
  --primary: oklch(49.6% 0.08 258);
  --primary-deep: oklch(42.4% 0.07 258);
  --ink: oklch(20.5% 0.004 258);
  --ink-soft: oklch(41.4% 0.012 258);
  --ink-faint: oklch(62.5% 0.02 258);
  --surface: oklch(99% 0.002 258);
  --raised: oklch(98% 0.002 258);
  --hairline: oklch(89.7% 0.008 258);

  --font-display: "Newsreader", Georgia, serif;
  --font-body: "Hanken Grotesk", system-ui, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, monospace;

  --radius-sm: 6px;
  --radius-md: 10px;

  --space-xs: 8px;
  --space-sm: 16px;
  --space-md: 24px;
  --space-lg: 40px;
  --space-xl: 72px;

  --measure: 65ch;
}

/* Prose containers get the reading measure */
main p {
  max-width: var(--measure);
}

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

html {
  text-size-adjust: 100%;
  scrollbar-color: var(--hairline) var(--surface);
  caret-color: var(--primary);
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: color-mix(in oklab, var(--primary) 22%, var(--surface));
  color: var(--ink);
}

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 2px;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 520;
  letter-spacing: -0.01em;
  line-height: 1.15;
  text-wrap: balance;
}

p {
  margin: 0;
}

a {
  color: var(--primary);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: color-mix(in oklab, var(--primary) 45%, transparent);
}

a:hover {
  color: var(--primary-deep);
  text-decoration-color: currentColor;
  text-decoration-thickness: 2px;
}

img {
  max-width: 100%;
  border-radius: var(--radius-sm);
}

code,
pre,
kbd {
  font-family: var(--font-mono);
  font-variant-ligatures: none;
}

time,
.date {
  font-variant-numeric: tabular-nums;
}

/* Avoid orphaned words on wrapped lines */
p,
li {
  text-wrap: pretty;
}

/* ---------- Type voices ---------- */
.display {
  font-size: clamp(2.1rem, 5.5vw, 3.6rem);
  font-weight: 560;
  line-height: 1.08;
  letter-spacing: -0.02em;
}

.title-lg {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 520;
}

.title-sm {
  font-size: 1.25rem;
  font-weight: 520;
}

.label {
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.muted {
  color: var(--ink-soft);
}

/* ---------- Frame ---------- */
.page {
  max-width: 62rem;
  margin: 0 auto;
  padding-left: var(--space-md);
  padding-right: var(--space-md);
}

.site-header {
  border-bottom: 1px solid var(--hairline);
}

.site-header .page {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-md);
  padding-top: var(--space-md);
  padding-bottom: var(--space-md);
}

.brand {
  font-family: var(--font-display);
  font-weight: 560;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-decoration: none;
}

.brand:hover {
  color: var(--ink);
}

.brand span {
  color: var(--primary);
}

.site-nav {
  display: flex;
  gap: var(--space-md);
  align-items: baseline;
}

.site-nav a {
  color: var(--ink-soft);
  text-decoration: none;
  font-weight: 400;
}

.site-nav a:hover {
  color: var(--ink);
}

.site-nav a[aria-current="page"] {
  color: var(--ink);
  font-weight: 500;
  border-bottom: 2px solid var(--primary);
}

/* The one authored motion: content rises once on load */
@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

main.page {
  padding-top: var(--space-xl);
  padding-bottom: var(--space-xl);
  animation: rise 420ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

@media (prefers-reduced-motion: reduce) {
  main.page {
    animation: none;
  }
}

.site-footer {
  border-top: 1px solid var(--hairline);
}

.site-footer .page {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm) var(--space-md);
  justify-content: space-between;
  align-items: baseline;
  padding-top: var(--space-md);
  padding-bottom: var(--space-md);
  font-size: 0.875rem;
  color: var(--ink-soft);
}

/* ---------- Sections ---------- */
section + section {
  margin-top: var(--space-xl);
}

.section-heading {
  margin-bottom: var(--space-md);
}

/* ---------- Hero (home) ---------- */
.hero {
  display: flex;
  align-items: flex-start;
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.hero-avatar {
  width: 72px;
  height: 72px;
  border-radius: var(--radius-sm);
  object-fit: cover;
  flex-shrink: 0;
  margin-top: 10px;
}

.hero p {
  max-width: var(--measure);
}

.hero-role {
  color: var(--ink-soft);
  margin-top: var(--space-xs);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  align-items: center;
  margin-top: var(--space-lg);
}

.button {
  display: inline-block;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  font-weight: 500;
  font-size: 1rem;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  border: 0;
  cursor: pointer;
}

.button:hover {
  background: var(--primary-deep);
  color: #fff;
}

.button:focus-visible {
  outline: 2px solid var(--primary-deep);
  outline-offset: 2px;
}

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

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

.post-list li {
  padding: var(--space-md) 0;
}

.post-list .meta {
  margin-top: 4px;
  color: var(--ink-soft);
}

.post-list p {
  margin-top: var(--space-xs);
  max-width: var(--measure);
}

.link-more {
  display: inline-block;
  margin-top: var(--space-md);
}

/* ---------- Tag pills ---------- */
.tag {
  display: inline-block;
  padding: 2px 10px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--ink-soft);
}

/* ---------- Article (blog show) ---------- */
.article-header {
  max-width: var(--measure);
  margin-bottom: var(--space-lg);
}

.article-header time {
  color: var(--ink-soft);
  display: inline-block;
  margin-top: var(--space-xs);
}

.article-header .lede {
  margin-top: var(--space-sm);
  color: var(--ink-soft);
  font-size: 1.125rem;
}

.prose {
  max-width: var(--measure);
}

.prose h2 {
  font-size: 1.5rem;
  padding-top: var(--space-lg);
  margin-bottom: var(--space-xs);
}

.prose h3 {
  font-size: 1.1875rem;
  padding-top: var(--space-lg);
  margin-bottom: var(--space-xs);
}

.prose p,
.prose ul,
.prose ol {
  margin-bottom: var(--space-sm);
}

.prose ul,
.prose ol {
  padding-left: 1.4em;
}

.prose blockquote {
  margin: var(--space-md) 0;
  padding-left: var(--space-md);
  border-left: 1px solid var(--hairline);
  color: var(--ink-soft);
}

.prose code {
  font-size: 0.875em;
  background: var(--raised);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 1px 5px;
}

.prose pre {
  background: var(--raised);
  border: 1px solid var(--hairline);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  overflow-x: auto;
  font-size: 0.9375rem;
  line-height: 1.6;
}

.prose pre code {
  background: none;
  border: 0;
  padding: 0;
}

.prose hr {
  border: 0;
  border-top: 1px solid var(--hairline);
  margin: var(--space-lg) 0;
}

/* ---------- Comparisons ---------- */
.comparison {
  padding: var(--space-md) 0;
}

.comparison + .comparison {
  border-top: 1px solid var(--hairline);
}

.comparison p.lede {
  color: var(--ink-soft);
  margin-top: var(--space-xs);
  max-width: var(--measure);
}

.versus {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-md);
  margin-top: var(--space-md);
}

.versus .tech + .tech {
  border-left: 1px solid var(--hairline);
  padding-left: var(--space-md);
}

.versus h3 {
  font-size: 1.125rem;
}

.versus ul {
  list-style: none;
  margin: var(--space-xs) 0 0;
  padding: 0;
  font-size: 0.9375rem;
}

.versus li {
  margin-top: 6px;
  color: var(--ink-soft);
  padding-left: 1.1em;
  position: relative;
}

.versus .pros li::before {
  content: "+";
  position: absolute;
  left: 0;
  color: var(--primary);
  font-weight: 600;
}

.versus .cons li::before {
  content: "−";
  position: absolute;
  left: 0;
  color: var(--ink-faint);
  font-weight: 600;
}

/* ---------- Utility ---------- */
.skip-link {
  position: absolute;
  top: -48px;
  left: var(--space-md);
  z-index: 10;
  background: var(--ink);
  color: var(--surface);
  padding: var(--space-xs) var(--space-sm);
  border-radius: 0 0 var(--radius-sm) 0;
  text-decoration: none;
}

.skip-link:focus {
  top: 0;
}

/* Post and comparison rules anchor to the text measure */
.post-list,
.comparison {
  max-width: var(--measure);
}

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  :root {
    --space-xl: 48px;
  }

  .site-header .page {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-xs);
  }

  .site-nav {
    gap: var(--space-sm);
  }

  .hero {
    flex-direction: column;
    align-items: flex-start;
  }

  .versus {
    grid-template-columns: 1fr;
  }

  .versus .tech + .tech {
    border-left: 0;
    border-top: 1px solid var(--hairline);
    padding-left: 0;
    padding-top: var(--space-md);
  }
}
