/* Shipyard base.css — reset, design tokens, layout primitives.
 * Component-level styles live in components.css; page-scoped styles
 * live in pages.css. Spec 14 forbids external assets — keep everything
 * self-hosted and minimal.
 */

/* ---------- Design tokens ---------- */
:root {
  /* Greyscale */
  --gray-50:  #fafafa;
  --gray-100: #f4f4f5;
  --gray-200: #e4e4e7;
  --gray-300: #d4d4d8;
  --gray-400: #a1a1aa;
  --gray-500: #71717a;
  --gray-600: #52525b;
  --gray-700: #3f3f46;
  --gray-800: #27272a;
  --gray-900: #18181b;

  /* Brand */
  --brand-50:  #eff6ff;
  --brand-100: #dbeafe;
  --brand-200: #bfdbfe;
  --brand-500: #2563eb;
  --brand-600: #1d4ed8;
  --brand-700: #1e40af;

  /* Semantic */
  --success: #047857;
  --success-bg: #d1fae5;
  --warning: #b45309;
  --warning-bg: #fef3c7;
  --danger:  #b91c1c;
  --danger-bg: #fee2e2;
  --info:    #1d4ed8;
  --info-bg: #dbeafe;

  /* Surfaces */
  --bg: var(--gray-50);
  --surface: #ffffff;
  --surface-alt: var(--gray-100);
  --fg: var(--gray-900);
  --fg-muted: var(--gray-500);
  --border: var(--gray-200);
  --border-strong: var(--gray-300);
  --accent: var(--brand-500);
  --accent-fg: #ffffff;
  --focus: var(--brand-500);
  --error: var(--danger);

  /* Spacing scale */
  --s-1: 0.25rem;
  --s-2: 0.5rem;
  --s-3: 0.75rem;
  --s-4: 1rem;
  --s-5: 1.5rem;
  --s-6: 2rem;
  --s-7: 3rem;
  --s-8: 4rem;

  /* Radii */
  --radius-sm: 3px;
  --radius-md: 6px;
  --radius-lg: 10px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);

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

  /* Motion */
  --dur-fast:   120ms;
  --dur-normal: 200ms;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);

  /* Layout */
  --content-max: 72rem;
  --nav-h: 3.25rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: var(--gray-900);
    --surface: var(--gray-800);
    --surface-alt: #1f1f23;
    --fg: var(--gray-100);
    --fg-muted: var(--gray-400);
    --border: var(--gray-700);
    --border-strong: var(--gray-600);
    --accent: #60a5fa;
    --focus: #60a5fa;
    --success-bg: #064e3b;
    --warning-bg: #78350f;
    --danger-bg:  #7f1d1d;
    --info-bg:    #1e3a8a;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.5);
  }
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading);
  color: var(--fg);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  width: 100%;
}
#main {
  flex: 1;
  width: 100%;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0 0 var(--s-3); line-height: 1.25; }
h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }
p  { margin: 0 0 var(--s-4); }
a  { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, pre, kbd, samp { font-family: var(--font-mono); font-size: 0.95em; }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--s-5) 0; }

:where(button, a, input, select, textarea, summary):focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ---------- Layout primitives ---------- */
.skip {
  position: absolute;
  left: -10000px;
  top: auto;
  width: 1px;
  height: 1px;
  overflow: hidden;
}
.skip:focus {
  position: static;
  width: auto;
  height: auto;
  padding: var(--s-2) var(--s-3);
  background: var(--surface);
  border: 2px solid var(--focus);
  border-radius: var(--radius-sm);
}

.content {
  padding: var(--s-6) var(--s-5);
  max-width: var(--content-max);
  margin: 0 auto;
}

.muted { color: var(--fg-muted); }
.hint  { color: var(--fg-muted); font-size: var(--text-sm); }
.row   { display: flex; gap: var(--s-3); align-items: center; flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: var(--s-3); }
.grid  { display: grid; gap: var(--s-4); }

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