/* Shared theme for TunnelCrib documentation pages (security/, use-cases/,
   comparisons/, guides/, legal-notice.html). Dark by default, with an
   optional light theme toggled via [data-theme="light"] on <html>,
   mirroring the tond-admin dashboard's theming approach. */

:root {
  color-scheme: dark;
  font-family: system-ui, sans-serif;

  --bg: #101112;
  --fg: #ededed;
  --fg-strong: #fff;
  --line: #37393b;
  --th-bg: #202224;
  --accent: #b7e36b;
  --code-bg: #1a1c1d;
  --muted: #9ca7a3;
  --callout-bg: #171a17;
  --callout-warn-border: #e3b76b;
  --callout-warn-bg: #1a1815;
  --toc-border: #3a4a33;
  --toc-hover-bg: #1c2418;
}

:root[data-theme="light"] {
  color-scheme: light;

  --bg: #f4f6f3;
  --fg: #1b1f1c;
  --fg-strong: #05070a;
  --line: #d3dbd2;
  --th-bg: #e7ece2;
  --accent: #4f7f16;
  --code-bg: #eaf0e5;
  --muted: #4d574f;
  --callout-bg: #eef4e6;
  --callout-warn-border: #a1670a;
  --callout-warn-bg: #f7ecd9;
  --toc-border: #b9d19a;
  --toc-hover-bg: #e2edd5;
}

body { max-width: 900px; margin: 3rem auto; padding: 0 1.5rem; background: var(--bg); color: var(--fg); line-height: 1.6; }
body.wide { max-width: 1100px; line-height: 1.55; }
body.wide table { margin: 1.5rem 0 2rem; }
body.wide th, body.wide td { padding: .8rem; font-size: 1rem; }
h1, h2, h3 { color: var(--fg-strong); }
h2 { margin-top: 2.5rem; }
table { width: 100%; border-collapse: collapse; margin: 1.25rem 0 2rem; }
th, td { padding: .7rem; border: 1px solid var(--line); text-align: left; vertical-align: top; font-size: .95rem; }
th { background: var(--th-bg); }
strong { color: var(--accent); }
code { background: var(--code-bg); padding: .1rem .35rem; border-radius: 3px; font-size: .92em; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
pre { background: var(--code-bg); padding: 1rem; border-radius: 6px; overflow-x: auto; }
header, footer { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1.25rem 0; border-bottom: 1px solid var(--line); }
footer { margin-top: 3rem; border-top: 1px solid var(--line); border-bottom: 0; color: var(--muted); font-size: .9rem; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; text-decoration: none; }
.brand-logo { width: 150px; height: 44px; object-fit: cover; object-position: center; }
nav { display: flex; align-items: center; gap: 1.25rem; }
nav a { color: var(--muted); text-decoration: none; }
nav a:hover { color: var(--fg-strong); }
.eyebrow { color: var(--accent); text-transform: uppercase; letter-spacing: .08em; font-size: .8rem; font-weight: 600; margin-bottom: .25rem; }
.callout { border-left: 3px solid var(--accent); background: var(--callout-bg); padding: 1rem 1.25rem; margin: 1.5rem 0; border-radius: 0 6px 6px 0; }
.callout.warn { border-left-color: var(--callout-warn-border); background: var(--callout-warn-bg); }
.reviewed, .updated { color: var(--muted); font-size: .9rem; margin-top: 2rem; }
.updated { font-size: .85rem; margin-top: 0; }
.toc { display: flex; flex-wrap: wrap; gap: .6rem 1rem; padding: 0; list-style: none; margin: 1.25rem 0 2rem; }
.toc a { color: var(--accent); text-decoration: none; border: 1px solid var(--toc-border); background: var(--callout-bg); padding: .5rem .9rem; border-radius: 6px; font-size: .9rem; display: inline-flex; align-items: center; gap: .45rem; transition: border-color .15s ease, background-color .15s ease; }
.toc a::after { content: "\2192"; opacity: .65; transition: transform .15s ease, opacity .15s ease; }
.toc a:hover { border-color: var(--accent); background: var(--toc-hover-bg); }
.toc a:hover::after { transform: translateX(3px); opacity: 1; }
ul { padding-left: 1.25rem; }
li { margin: .35rem 0; }
.video-list { display: grid; gap: 1.5rem; padding: 0; margin: 1.5rem 0 2.5rem; list-style: none; }
.video-list li { margin: 0; padding: 1rem; border: 1px solid var(--line); border-radius: 6px; background: var(--callout-bg); }
.video-list h3 { margin: 0 0 .8rem; font-size: 1.05rem; }
.video-list video { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: contain; border-radius: 4px; background: #000; }

/* Theme toggle button (sun/moon), matching tond-admin's pattern. */
.theme-toggle { display: inline-flex; align-items: center; justify-content: center; width: 2.1rem; height: 2.1rem; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: var(--fg); cursor: pointer; padding: 0; }
.theme-toggle:hover { border-color: var(--accent); }
.theme-toggle .icon-dark, .theme-toggle .icon-light { display: none; }
:root:not([data-theme="light"]) .theme-toggle .icon-dark { display: inline; }
:root[data-theme="light"] .theme-toggle .icon-light { display: inline; }
.theme-toggle svg { width: 1.05rem; height: 1.05rem; }

@media (max-width: 520px) { header, footer { align-items: flex-start; flex-direction: column; } }
