/* ============================================
   ChatDashCat — Shared Design System
   Used by: landing page, report browser app
   ============================================ */

/* ── Reset ── */
*,*::before,*::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; tab-size: 4; }
body, h1, h2, h3, h4, p, figure, blockquote, dl, dd { margin: 0; }
ul[role='list'], ol[role='list'] { list-style: none; padding: 0; margin: 0; }
img, picture, svg { max-width: 100%; display: block; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; }

/* ── Tokens ── */
:root {
  --bg: #f7f6f2;
  --surface: #ffffff;
  --surface-2: #efede6;
  --ink: #161512;
  --ink-2: #4a4842;
  --ink-3: #807d74;
  --rule: #e6e3da;
  --primary: #01696f;
  --primary-ink: #f7f6f2;
  --primary-soft: rgba(1,105,111,.08);
  --primary-glow: rgba(1,105,111,.18);
  --accent-amber: #c97a1f;
  --accent-red: #b8442e;
  --accent-green: #4a7a3e;

  --serif: 'Instrument Serif', 'Georgia', 'Times New Roman', serif;
  --sans: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;

  --max: 1240px;
  --gutter: clamp(32px, 5vw, 72px);
  --radius: 14px;
  --radius-lg: 22px;

  --ease: cubic-bezier(.2,.8,.2,1);
  --dur: 600ms;
}

[data-theme='dark'] {
  --bg: #161512;
  --surface: #1f1d19;
  --surface-2: #25231e;
  --ink: #f1efe7;
  --ink-2: #c8c4b7;
  --ink-3: #8a8579;
  --rule: #2d2a23;
  --primary: #5fc8ce;
  --primary-ink: #0b1213;
  --primary-soft: rgba(95,200,206,.08);
  --primary-glow: rgba(95,200,206,.22);
  --accent-amber: #e8a45a;
  --accent-red: #d97a64;
  --accent-green: #88b576;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme]) { color-scheme: dark; }
}

/* ── Body ── */
body {
  font-family: var(--sans);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background-color .35s ease, color .35s ease;
  overflow-x: clip;
}

/* Paper grain */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: .35;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.05 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
[data-theme='dark'] body::before { mix-blend-mode: screen; opacity: .25; }

::selection { background: var(--primary); color: var(--primary-ink); }

/* ── Focus ── */
:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
  border-radius: 4px;
}

/* ── Skip link ── */
.skip {
  position: absolute;
  left: 12px; top: 12px;
  padding: 10px 14px;
  background: var(--ink);
  color: var(--bg);
  border-radius: 8px;
  transform: translateY(-130%);
  transition: transform .2s ease;
  z-index: 100;
  text-decoration: none;
  font-weight: 500;
}
.skip:focus { transform: translateY(0); }

/* ── Typography ── */
h1, h2, h3 {
  font-family: var(--serif);
  font-weight: 400;
  letter-spacing: -0.01em;
  line-height: 1.04;
  color: var(--ink);
}
h1 { font-size: clamp(2.3rem, 6.8vw, 6rem); }
h2 { font-size: clamp(2rem, 4.8vw, 3.6rem); }
h3 { font-size: clamp(1.2rem, 2vw, 1.5rem); font-family: var(--sans); font-weight: 500; }
.display-italic { font-style: italic; color: var(--primary); }
.display-italic-ink { font-style: italic; }

.lead {
  font-size: clamp(1.05rem, 1.4vw, 1.2rem);
  line-height: 1.55;
  color: var(--ink-2);
  max-width: 56ch;
}

/* ── Layout ── */
.wrap {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
  position: relative;
  z-index: 2;
}
section { position: relative; z-index: 2; }

/* ── Nav ── */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  background: color-mix(in oklab, var(--bg) 78%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color .25s ease, background-color .25s ease;
}
.nav.is-scrolled { border-bottom-color: var(--rule); }

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  gap: 32px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 500;
  letter-spacing: -0.01em;
  font-size: 17px;
}
.brand-mark {
  width: 32px; height: 32px;
  flex-shrink: 0;
}
.brand-mark img { width: 100%; height: 100%; object-fit: contain; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
}
.nav-links a:not(.btn) {
  text-decoration: none;
  color: var(--ink-2);
  font-size: 14px;
  padding: 8px 14px;
  border-radius: 8px;
  transition: color .15s ease, background-color .15s ease;
}
.nav-links a:not(.btn):hover { color: var(--ink); background: var(--surface-2); }

.icon-btn {
  width: 36px; height: 36px;
  border: 1px solid var(--rule);
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  display: grid; place-items: center;
  color: var(--ink-2);
  transition: color .15s ease, border-color .15s ease, background-color .15s ease;
}
.icon-btn:hover { color: var(--ink); border-color: var(--ink-3); }
.icon-btn svg { width: 16px; height: 16px; }
[data-theme='light'] .icon-btn .moon { display: block; }
[data-theme='light'] .icon-btn .sun { display: none; }
[data-theme='dark'] .icon-btn .moon { display: none; }
[data-theme='dark'] .icon-btn .sun { display: block; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .15s var(--ease), background-color .2s ease, color .2s ease, border-color .2s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary {
  background: var(--primary);
  color: var(--primary-ink);
}
.btn-primary:hover {
  background: color-mix(in oklab, var(--primary) 92%, var(--ink));
}
.btn-secondary {
  background: transparent;
  color: var(--ink);
  border-color: var(--rule);
}
.btn-secondary:hover { border-color: var(--ink-3); background: var(--surface-2); }

.btn-sm {
  padding: 6px 14px;
  font-size: 12.5px;
  gap: 6px;
}
.btn-sm svg { width: 12px; height: 12px; }

.btn .arrow { transition: transform .25s var(--ease); }
.btn:hover .arrow { transform: translateX(3px); }

@media (max-width: 720px) {
  .nav-links a:not(.btn):not(.brand) { display: none; }
}

/* ── Footer ── */
.foot {
  padding: 24px 0 48px;
  border-top: 1px solid var(--rule);
  text-align: center;
  font-size: 12.5px;
  color: var(--ink-3);
}
.foot em { font-family: var(--serif); font-style: italic; }
