/* Integration Ninja — design system.
   Warm, rounded and friendly. Two themes; every colour is a variable so dark
   mode is a single block of overrides rather than scattered exceptions. */

:root {
  --page: #fff8f3;
  --surface: #ffffff;
  --surface-alt: #fdeee6;
  --text: #2b211c;
  --text-soft: #6e5b51;
  --text-muted: #9a857a;
  --border: #f0ddd1;
  --border-strong: #e3c6b5;
  --accent: #d85a30;
  --accent-ink: #4a1b0c;
  --accent-wash: #faece7;
  --accent-hover: #b8441f;
  --ring: rgba(216, 90, 48, 0.35);

  --mark-bg: #ffe6a8;
  --mark-ink: #412402;

  --font-display: 'Outfit', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', sans-serif;
  --font-mono: ui-monospace, 'Cascadia Mono', Consolas, 'Courier New', monospace;

  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 20px;
  --measure: 68ch;
  --shell: 860px;
}

[data-theme='dark'] {
  --page: #171310;
  --surface: #201a16;
  --surface-alt: #2b221c;
  --text: #f5eae3;
  --text-soft: #c3ada1;
  --text-muted: #9a857a;
  --border: #382c25;
  --border-strong: #4d3d33;
  --accent: #f0997b;
  --accent-ink: #f5c4b3;
  --accent-wash: #33211a;
  --accent-hover: #f5c4b3;
  --ring: rgba(240, 153, 123, 0.4);

  --mark-bg: #7a5410;
  --mark-ink: #fbe8c2;
}

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

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

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.7;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 600;
  line-height: 1.25;
  color: var(--text);
  margin: 0;
}

a {
  color: var(--accent);
  text-decoration-color: var(--border-strong);
  text-underline-offset: 3px;
}

a:hover { color: var(--accent-hover); }

img { max-width: 100%; height: auto; }

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

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 var(--radius) 0;
  z-index: 10;
}

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

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

.shell {
  width: 100%;
  max-width: var(--shell);
  margin: 0 auto;
  padding: 0 20px;
}

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

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

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.brand__mark {
  width: 42px;
  height: 42px;
  flex: none;
  border-radius: var(--radius-sm);
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  transition: transform 0.18s ease;
}

.brand:hover .brand__mark { transform: rotate(-6deg) scale(1.04); }

.brand__title {
  display: block;
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.brand__tagline {
  display: block;
  font-size: 13px;
  color: var(--text-soft);
  line-height: 1.4;
}

.theme-toggle {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--accent);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease;
}

.theme-toggle:hover {
  background: var(--surface-alt);
  transform: scale(1.06);
}

.theme-toggle:active { transform: scale(0.96); }

/* ---------- Cards ---------- */

.feed {
  display: grid;
  gap: 16px;
  padding: 28px 0 8px;
  margin: 0;
  list-style: none;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  transition: transform 0.16s ease, border-color 0.16s ease;
}

.card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
}

.card__title {
  font-size: 21px;
  margin: 4px 0 0;
}

.card__title a { text-decoration: none; color: var(--text); }
.card__title a:hover { color: var(--accent); }

.card__summary {
  color: var(--text-soft);
  font-size: 15px;
  margin: 8px 0 14px;
}

.meta {
  font-size: 12.5px;
  color: var(--text-muted);
  letter-spacing: 0.01em;
}

.pill {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--accent-wash);
  color: var(--accent-ink);
  text-decoration: none;
  margin: 0 6px 6px 0;
}

a.pill:hover { background: var(--accent); color: #fff; }

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

.article { padding: 32px 0 8px; }

.article__header { margin-bottom: 26px; }

.article__title {
  font-size: 34px;
  letter-spacing: -0.02em;
  margin: 8px 0 10px;
}

.article__summary {
  font-size: 18px;
  color: var(--text-soft);
  margin: 0 0 14px;
}

.back-link {
  display: inline-block;
  font-size: 14px;
  margin-bottom: 20px;
  text-decoration: none;
}

.prose {
  max-width: var(--measure);
  font-size: 17px;
}

.prose h2 { font-size: 25px; margin: 2em 0 0.5em; }
.prose h3 { font-size: 20px; margin: 1.6em 0 0.4em; }
.prose p { margin: 0 0 1.15em; }
.prose ul, .prose ol { margin: 0 0 1.15em; padding-left: 1.4em; }
.prose li { margin-bottom: 0.4em; }
.prose strong { font-weight: 600; }

.prose blockquote {
  margin: 1.5em 0;
  padding: 14px 20px;
  background: var(--surface-alt);
  border-left: 4px solid var(--accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-soft);
}

.prose blockquote p:last-child { margin-bottom: 0; }

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

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 1.5em;
  font-size: 15px;
}

.prose th, .prose td {
  border: 1px solid var(--border);
  padding: 9px 12px;
  text-align: left;
}

.prose th { background: var(--surface-alt); font-weight: 600; }

/* ---------- States ---------- */

.state {
  text-align: center;
  padding: 56px 20px;
  color: var(--text-soft);
}

.state__emoji {
  font-size: 34px;
  line-height: 1;
  margin-bottom: 12px;
}

.state__title {
  font-family: var(--font-display);
  font-size: 21px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 6px;
}

.state__body { font-size: 15px; margin: 0 auto; max-width: 46ch; }

.state code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--surface-alt);
  border-radius: 6px;
  padding: 2px 6px;
}

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

.site-footer {
  margin-top: 56px;
  border-top: 1px solid var(--border);
  background: var(--surface-alt);
}

.site-footer__inner {
  padding: 24px 20px;
  font-size: 14px;
  color: var(--text-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  justify-content: space-between;
}

/* ---------- Small screens ---------- */

@media (max-width: 620px) {
  body { font-size: 16px; }
  .article__title { font-size: 27px; }
  .card__title { font-size: 19px; }
  .site-header__inner { padding: 14px 16px; }
  .brand__tagline { display: none; }
  .shell { padding: 0 16px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .card:hover, .brand:hover .brand__mark { transform: none; }
}
