/* devlogged — base: tokens, reset, typography, shared components */

:root {
  /* Spacing scale (4px base) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;

  /* Type */
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-md: 1rem;
  --text-lg: 1.25rem;
  --text-xl: 1.5rem;
  --text-2xl: 2rem;
  --text-3xl: 2.75rem;
  --leading: 1.6;

  --radius: 6px;
  --measure: 68ch;
  --duration: 150ms;

  /* Light theme (default) — one accent, everything else grey */
  --bg: #ffffff;
  --bg-subtle: #f5f5f4;
  --bg-muted: #e9e9e7;
  --border: #d6d6d3;
  --border-strong: #8a8a87; /* 3.5:1 — UI component contrast */
  --text: #1c1c1b;
  --text-muted: #555553; /* 7.4:1 on --bg */
  --accent: #b23c08;      /* 5.9:1 on --bg */
  --accent-hover: #8f3006;
  --on-accent: #ffffff;
  --danger: #b3261e;      /* kept in grey family usage; only for destructive text */
  --focus: #b23c08;

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141413;
    --bg-subtle: #1c1c1b;
    --bg-muted: #262625;
    --border: #383836;
    --border-strong: #6e6e6a; /* 3.6:1 */
    --text: #ececea;
    --text-muted: #a8a8a4; /* 7.6:1 on --bg */
    --accent: #f08a4b;     /* 7.2:1 on --bg */
    --accent-hover: #f6a571;
    --on-accent: #141413;
    --danger: #f2817a;
    --focus: #f08a4b;
  }
}

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--text-md);
  line-height: var(--leading);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
p, h1, h2, h3, h4, h5, h6, li { overflow-wrap: break-word; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
[hidden] { display: none !important; }

/* Typography */
h1, h2, h3, h4 { line-height: 1.2; font-weight: 650; letter-spacing: -0.01em; }
h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }
code, kbd, pre { font-family: var(--font-mono); font-size: 0.9em; }
kbd {
  display: inline-block;
  padding: 0 var(--space-1);
  border: 1px solid var(--border-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  font-size: var(--text-xs);
  line-height: 1.5;
}

a { color: var(--accent); text-underline-offset: 0.2em; }
a:hover { color: var(--accent-hover); }

/* Focus — always visible for keyboard users */
:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: 2px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: var(--space-2);
  top: -100px;
  padding: var(--space-2) var(--space-3);
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  z-index: 100;
}
.skip-link:focus { top: var(--space-2); }

/* Layout */
.container {
  width: 100%;
  max-width: 1080px;
  margin-inline: auto;
  padding-inline: var(--space-4);
}
@media (min-width: 640px) {
  .container { padding-inline: var(--space-5); }
}

/* Header + wordmark */
.site-header {
  border-bottom: 1px solid var(--border);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  min-height: 56px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text);
  text-decoration: none;
}
.brand:hover { color: var(--text); }
.brand img { width: 24px; height: 24px; }
.wordmark {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: var(--text-md);
  letter-spacing: -0.03em;
}
.wordmark::after {
  /* the trailing "entry" dot, in accent */
  content: ".";
  color: var(--accent);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 40px;
  padding: var(--space-2) var(--space-4);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: var(--text-sm);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--duration), border-color var(--duration), color var(--duration);
}
.btn:hover { background: var(--bg-subtle); color: var(--text); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--on-accent);
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--on-accent);
}
.btn-ghost { border-color: transparent; background: transparent; }
.btn-danger { color: var(--danger); }
.btn-danger:hover { color: var(--danger); border-color: var(--danger); }
.btn-lg { min-height: 48px; padding-inline: var(--space-5); font-size: var(--text-md); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* Form fields */
.field { display: grid; gap: var(--space-2); }
.field label, .label {
  font-size: var(--text-sm);
  font-weight: 600;
}
.hint { font-size: var(--text-sm); color: var(--text-muted); }
.input, .textarea, .select {
  width: 100%;
  min-height: 40px;
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  transition: border-color var(--duration);
}
.input:hover, .textarea:hover, .select:hover { border-color: var(--text-muted); }
.input:focus-visible, .textarea:focus-visible, .select:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 0;
  border-color: var(--focus);
}
.textarea {
  min-height: 280px;
  resize: vertical;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.6;
}
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--danger); }
.field-error {
  font-size: var(--text-sm);
  color: var(--danger);
}

/* Tags */
.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 var(--space-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-subtle);
  color: var(--text-muted);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  text-decoration: none;
}
a.tag:hover { color: var(--text); border-color: var(--border-strong); }
.tag::before { content: "#"; opacity: 0.6; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Headings focused by the router for screen readers don't need a ring */
[tabindex="-1"]:focus { outline: none; }
