/*
 * The user guide's own stylesheet.
 *
 * Light by default with a dark toggle, like the console (src/styles.css) and Kolayz Bilge; it also
 * prints as a clean document. The brand's flame gradient is the only decoration it borrows.
 */

:root {
  --flame-start: #f59e0b;
  --flame-end: #e11d48;

  --page: #f4f5f7;
  --sheet: #ffffff;
  --ink: #111827;
  --muted: #6b7280;
  --line: #e5e8ee;
  --soft: #fafbfd;
  --link: #b91c1c;
  --note: #f4f7fb;
  --note-line: #9cc0e4;

  color-scheme: light;
}

:root[data-theme='dark'] {
  --page: #17153c;
  --sheet: #1e1b4b;
  --ink: #f8fafc;
  --muted: #b7b3d8;
  --line: #3f3a7a;
  --soft: #241f57;
  --link: #fbbf24;
  --note: #241f57;
  --note-line: #6d67b5;

  color-scheme: dark;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 16px/1.65 system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

.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;
}

.skip-link {
  position: absolute;
  left: -999px;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
  z-index: 10;
  background: var(--sheet);
  padding: 0.6rem 1rem;
  border-radius: 8px;
}

/* ---------- header ---------- */

header.bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 0.7rem 1.5rem;
  background: var(--sheet);
  border-bottom: 1px solid var(--line);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  text-decoration: none;
  color: var(--ink);
}

.brand img { width: 22px; height: 22px; }
.brand .company { color: var(--muted); font-weight: 500; }

.pill {
  background: linear-gradient(135deg, var(--flame-start), var(--flame-end));
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  line-height: 1.5;
}

.controls {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.controls select,
.controls button,
.search input {
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.35rem 0.6rem;
}

.controls button { cursor: pointer; }
.controls button:hover { border-color: var(--muted); }

.back {
  font-size: 14px;
  color: var(--link);
  text-decoration: none;
}

/* ---------- toolbar ---------- */

.toolbar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
  padding: 0.7rem 1.5rem;
  background: var(--soft);
  border-bottom: 1px solid var(--line);
}

.search { flex: 1 1 320px; }
.search input { width: 100%; }

.audience {
  display: inline-flex;
  gap: 0.35rem;
}

.audience button {
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--sheet);
  color: var(--muted);
}

/* Flat amber, matching the console's buttons (src/styles.css). White text does not clear contrast
   on amber the way it did on the gradient's rose end, so the pressed pill takes the dark ink. */
.audience button[aria-pressed='true'] {
  background: var(--flame-start);
  border-color: transparent;
  color: #1b1533;
  font-weight: 600;
}

/* ---------- layout ---------- */

.layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 2.5rem;
  max-width: 1240px;
  margin: 0 auto;
  padding: 2rem 1.5rem 6rem;
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; gap: 1rem; }
  nav.toc { position: static; max-height: none; }
}

nav.toc {
  position: sticky;
  top: 5.5rem;
  align-self: start;
  max-height: calc(100vh - 8rem);
  overflow-y: auto;
  font-size: 14px;
}

nav.toc h2 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin: 0 0 0.6rem;
}

nav.toc ol {
  list-style: none;
  margin: 0;
  padding: 0;
}

nav.toc a {
  display: block;
  padding: 0.3rem 0.6rem;
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
  border-left: 2px solid transparent;
}

nav.toc a:hover { color: var(--ink); }

nav.toc a[aria-current='true'] {
  color: var(--ink);
  font-weight: 600;
  border-left-color: var(--flame-end);
  background: var(--soft);
}

/* ---------- sections ---------- */

.intro {
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.5rem;
}

.intro h1 { margin: 0 0 0.4rem; font-size: 30px; letter-spacing: -0.02em; }
.intro p { margin: 0.4rem 0 0; color: var(--muted); }

section.doc {
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.25rem;
  scroll-margin-top: 6rem;
}

section.doc > h2 {
  margin: 0 0 0.75rem;
  font-size: 22px;
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.badge {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 8px;
}

.anchor {
  font-size: 14px;
  color: var(--muted);
  text-decoration: none;
  opacity: 0;
}

section.doc:hover .anchor { opacity: 1; }

section.doc p, section.doc li { color: var(--ink); }
section.doc h3 { font-size: 16px; margin: 1.6rem 0 0.4rem; }

section.doc code {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

section.doc pre {
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 1rem 1.1rem;
  overflow-x: auto;
}

section.doc pre code { background: none; border: none; padding: 0; }

section.doc table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2rem 0;
  font-size: 14.5px;
}

section.doc th {
  text-align: left;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
  padding: 8px 10px;
  border-bottom: 1.5px solid var(--line);
}

section.doc td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

.note, .warning {
  margin: 1.2rem 0;
  padding: 0.85rem 1.1rem;
  border-radius: 0 10px 10px 0;
  background: var(--note);
  border-left: 4px solid var(--note-line);
}

.warning { border-left-color: var(--flame-end); }
.note p, .warning p { margin: 0.3rem 0; }

figure.shot {
  margin: 1.5rem 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: var(--soft);
}

figure.shot img {
  display: block;
  width: 100%;
  height: auto;
  cursor: zoom-in;
}

figure.shot figcaption {
  padding: 0.6rem 1rem;
  font-size: 13px;
  color: var(--muted);
  border-top: 1px solid var(--line);
}

.no-results {
  background: var(--sheet);
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 2rem;
  color: var(--muted);
  text-align: center;
}

footer.foot {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 1.5rem 3rem;
  color: var(--muted);
  font-size: 13px;
}

/* ---------- lightbox ---------- */

dialog.lightbox {
  border: none;
  padding: 0;
  background: transparent;
  max-width: 96vw;
  max-height: 96vh;
}

dialog.lightbox::backdrop { background: rgba(10, 8, 30, 0.85); }
dialog.lightbox img { max-width: 96vw; max-height: 88vh; border-radius: 10px; display: block; }

dialog.lightbox figcaption {
  color: #e8e6f5;
  font-size: 13px;
  padding: 0.6rem 0.2rem;
}

/* ---------- print ---------- */

@media print {
  header.bar, .toolbar, nav.toc, .anchor { display: none; }
  body { background: #fff; }
  .layout { display: block; max-width: none; padding: 0; }
  section.doc, .intro { border: none; border-radius: 0; padding: 0; margin: 0 0 1.5rem; }
  section.doc { break-inside: avoid; }
  figure.shot, section.doc table { break-inside: avoid; }
}
