/* TRAX guide — standalone stylesheet.
   The app's `surface-*` / `primary-*` Tailwind classes resolve to `var(--p-*)` variables that
   PrimeVue emits at runtime, so they are unavailable here. The tokens below are the resolved
   values of the Aura preset configured in cmd/client/src/main.ts: primary = sky, secondary =
   amber, light surface = slate, dark surface = zinc. Dark mode is prefers-color-scheme only,
   matching PrimeVue's `darkModeSelector: 'system'`. */

:root {
  --surface-0: #ffffff;
  --surface-50: #f8fafc;
  --surface-100: #f1f5f9;
  --surface-200: #e2e8f0;
  --surface-300: #cbd5e1;
  --surface-500: #64748b;
  --surface-700: #334155;
  --surface-900: #0f172a;

  --primary: #0ea5e9;
  --primary-strong: #0284c7;
  --primary-soft: rgba(14, 165, 233, 0.1);
  --accent: #f59e0b;
  --accent-soft: rgba(245, 158, 11, 0.12);
  --cyan: #06b6d4;
  --cyan-soft: rgba(6, 182, 212, 0.12);
  --danger: #ef4444;

  --page: var(--surface-0);
  --card: var(--surface-0);
  --raised: var(--surface-50);
  --border: var(--surface-200);
  --text: var(--surface-900);
  --muted: var(--surface-500);
  --shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #09090b;
    --card: #18181b;
    --raised: #27272a;
    --border: #3f3f46;
    --text: #ffffff;
    --muted: #a1a1aa;

    --primary: #38bdf8;
    --primary-strong: #7dd3fc;
    --primary-soft: rgba(56, 189, 248, 0.12);
    --accent: #fbbf24;
    --accent-soft: rgba(251, 191, 36, 0.12);
    --cyan: #22d3ee;
    --cyan-soft: rgba(34, 211, 238, 0.12);
    --danger: #f87171;
    --shadow: 0 8px 25px rgba(0, 0, 0, 0.45);
  }
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 5rem;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-weight: 400;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  font-family: 'Michroma', system-ui, sans-serif;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
  color: var(--text);
}

h1 {
  font-size: 1.75rem;
  margin: 0 0 0.75rem;
}

h2 {
  font-size: 1.2rem;
  margin: 2.5rem 0 0.75rem;
}

h3 {
  font-size: 1rem;
  margin: 1.75rem 0 0.5rem;
}

p {
  margin: 0 0 1rem;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.15s ease;
}

a:hover {
  color: var(--primary-strong);
  text-decoration: underline;
}

a:focus-visible,
button:focus-visible,
[role='button']:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  border-radius: 4px;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.85em;
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 0.1em 0.4em;
}

/* ── Utilities ported from cmd/client/src/index.css ─────────────────────────── */

.border-fade {
  border: none;
  background-image: linear-gradient(to right, transparent, rgba(148, 163, 184, 0.3), transparent);
  height: 1px;
}

.card-hover {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card-hover:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.thin-scrollbar {
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.4) transparent;
}

.thin-scrollbar::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.thin-scrollbar::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.4);
  border-radius: 4px;
}

.thin-scrollbar::-webkit-scrollbar-track {
  background: transparent;
}

/* ── Top bar ────────────────────────────────────────────────────────────────── */

.guide-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.85rem 1.5rem;
  background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.guide-brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text);
  font-weight: 600;
}

.guide-brand:hover {
  color: var(--text);
  text-decoration: none;
}

.guide-brand svg {
  width: 2rem;
  height: 2rem;
  filter: drop-shadow(0 0 5px rgba(56, 189, 248, 0.3));
}

.guide-brand .tag {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 999px;
  padding: 0.15rem 0.55rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.btn:hover {
  border-color: var(--primary);
  color: var(--primary);
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #04141f;
  font-weight: 600;
}

.btn-primary:hover {
  background: var(--primary-strong);
  border-color: var(--primary-strong);
  color: #04141f;
  box-shadow: 0 0 20px rgba(14, 165, 233, 0.35);
}

/* ── Shell ──────────────────────────────────────────────────────────────────── */

.guide-shell {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 1.5rem 3rem;
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  gap: 2.5rem;
  align-items: start;
}

.guide-toc {
  position: sticky;
  top: 5rem;
  max-height: calc(100vh - 7rem);
  overflow-y: auto;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 1rem;
  padding: 1rem;
}

.guide-toc h2 {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0.75rem 0 0.4rem;
}

.guide-toc h2:first-child {
  margin-top: 0;
}

.guide-toc ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.guide-toc a {
  display: block;
  padding: 0.35rem 0.6rem;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.875rem;
  font-weight: 500;
}

.guide-toc a:hover {
  background: var(--raised);
  color: var(--text);
  text-decoration: none;
}

.guide-toc a[aria-current='page'] {
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 600;
}

.guide-main {
  min-width: 0;
}

.guide-lede {
  font-size: 1.05rem;
  color: var(--muted);
  margin-bottom: 2rem;
}

/* ── Content blocks ─────────────────────────────────────────────────────────── */

.card {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 1rem;
  padding: 1.25rem 1.4rem;
}

/* A literal label as it appears in the TRAX interface. */
.ui {
  display: inline-block;
  font-size: 0.85em;
  font-weight: 600;
  color: var(--text);
  background: var(--raised);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.05em 0.45em;
  white-space: nowrap;
}

.path {
  font-size: 0.85em;
  font-weight: 500;
  color: var(--muted);
}

.guide-steps {
  list-style: none;
  counter-reset: step;
  margin: 1.25rem 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.guide-steps > li {
  counter-increment: step;
  position: relative;
  padding-left: 3rem;
  min-height: 2rem;
}

.guide-steps > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: -0.1rem;
  width: 2rem;
  height: 2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
  font-size: 0.9rem;
}

.guide-steps > li > :last-child {
  margin-bottom: 0;
}

.callout {
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  background: var(--primary-soft);
  border-radius: 10px;
  padding: 0.9rem 1.1rem;
  margin: 1.25rem 0;
}

.callout > :last-child {
  margin-bottom: 0;
}

.callout strong:first-child {
  color: var(--primary);
}

.callout.tip {
  border-left-color: var(--cyan);
  background: var(--cyan-soft);
}

.callout.tip strong:first-child {
  color: var(--cyan);
}

.callout.warn {
  border-left-color: var(--accent);
  background: var(--accent-soft);
}

.callout.warn strong:first-child {
  color: var(--accent);
}

table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.25rem 0;
  font-size: 0.9rem;
}

.table-scroll {
  overflow-x: auto;
}

th,
td {
  text-align: left;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
}

ul.plain {
  padding-left: 1.15rem;
}

ul.plain li,
ol li {
  margin-bottom: 0.4rem;
}

/* Guide home tiles */
.tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr));
  gap: 1rem;
  margin: 1.5rem 0;
}

.tile {
  display: block;
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 1rem;
  padding: 1.1rem 1.2rem;
  color: var(--text);
}

.tile:hover {
  text-decoration: none;
  color: var(--text);
  border-color: var(--primary);
}

.tile-title {
  font-weight: 700;
  margin-bottom: 0.3rem;
}

.tile-desc {
  font-size: 0.875rem;
  color: var(--muted);
  line-height: 1.5;
}

/* ── Prev / next + footer ───────────────────────────────────────────────────── */

.guide-prevnext {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
}

.guide-prevnext span {
  color: var(--muted);
}

.guide-footer {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.5rem 2.5rem;
}

.guide-footer .links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  padding-top: 1.5rem;
  font-size: 0.875rem;
  color: var(--muted);
}

.guide-footer a {
  color: var(--muted);
}

.guide-footer a:hover {
  color: var(--primary);
  text-decoration: none;
}

/* ── Responsive ─────────────────────────────────────────────────────────────── */

@media (max-width: 900px) {
  .guide-shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 1.5rem;
    padding: 1.5rem 1rem 2.5rem;
  }

  .guide-toc {
    position: static;
    max-height: none;
  }

  .guide-nav {
    padding: 0.75rem 1rem;
  }

  .guide-footer {
    padding: 0 1rem 2rem;
  }

  h1 {
    font-size: 1.4rem;
  }
}
