/* Greyscale chassis. Layout = original working theme.
   Pixel (Silkscreen) = chrome only. Body = JetBrains, normal case. */

:root,
.dark {
  color-scheme: dark;

  --font-sans: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --font-mono: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace;
  --font-heading: "Silkscreen", "JetBrains Mono", ui-monospace, monospace;
  --font-pixel: "Silkscreen", "JetBrains Mono", ui-monospace, monospace;
  --font-inter: var(--font-sans);
  --default-font-family: var(--font-sans);
  --default-mono-font-family: var(--font-mono);
  --radius: 0;

  --ot-amber: #c8c8c8;
  --ot-amber-hot: #f0f0f0;
  --ot-amber-dim: #6a6a6a;
  --ot-chassis: #121212;
  --ot-panel: #1a1a1a;
  --ot-bezel: #2e2e2e;
  --ot-ink: #e6e6e6;
  --ot-mute: #8e8e8e;

  --background: #121212;
  --foreground: #e6e6e6;
  --card: #1a1a1a;
  --card-foreground: #e6e6e6;
  --popover: #1a1a1a;
  --popover-foreground: #e6e6e6;
  --primary: #d4d4d4;
  --primary-foreground: #121212;
  --secondary: #2e2e2e;
  --secondary-foreground: #e6e6e6;
  --muted: #222;
  --muted-foreground: #8e8e8e;
  --accent: #252525;
  --accent-foreground: #d4d4d4;
  --destructive: #b0b0b0;
  --border: #3a3a3a;
  --input: #2e2e2e;
  --ring: #d4d4d4;
  --sidebar: #0e0e0e;
  --sidebar-foreground: #e6e6e6;
  --sidebar-primary: #d4d4d4;
  --sidebar-primary-foreground: #121212;
  --sidebar-accent: #1c1c1c;
  --sidebar-accent-foreground: #f0f0f0;
  --sidebar-border: #2e2e2e;
  --sidebar-ring: #d4d4d4;
  --surface: #1a1a1a;
  --surface-foreground: #c8c8c8;
  --code: #0e0e0e;
  --code-foreground: #d4d4d4;
  --code-highlight: #222;
  --selection: #d4d4d4;
  --selection-foreground: #121212;
}

html {
  background: var(--ot-chassis);
}

body {
  background: var(--ot-chassis) !important;
  color: var(--foreground);
}

*,
*::before,
*::after {
  border-radius: 0 !important;
}

a {
  color: var(--ot-amber);
  text-underline-offset: 0.18em;
  transition: color 120ms ease;
}
a:hover {
  color: var(--ot-amber-hot);
}
a:focus-visible {
  outline: 2px solid var(--ot-amber);
  outline-offset: 2px;
}

header a[href] .size-8 svg,
header a[href] span.size-8 svg {
  width: 1.35rem;
  height: 1.35rem;
  shape-rendering: crispEdges;
}
header a[href]:hover {
  color: var(--ot-amber-hot);
}

/* Body: readable mono, normal case — NEVER Silkscreen paragraphs */
body,
.font-sans,
article .typography,
article .typography p,
article .typography li,
article .typography td {
  font-family: var(--font-mono) !important;
  font-feature-settings: "liga" 0, "calt" 1;
  text-transform: none !important;
  letter-spacing: normal !important;
  transform: none !important;
  -webkit-font-smoothing: antialiased;
}

/* Pixel titles only */
h1, h2, h3, h4,
#page-header h1,
header a[href] h1 {
  font-family: var(--font-pixel) !important;
  font-weight: 400 !important;
  letter-spacing: 0.04em !important;
  text-transform: uppercase !important;
  text-shadow: none !important;
  color: var(--foreground) !important;
  transform: none !important;
  -webkit-font-smoothing: none;
  line-height: 1.35 !important;
}
h1, #page-header h1 {
  font-size: 1.5rem !important;
  color: #f0f0f0 !important;
}
h2 {
  font-size: 1.05rem !important;
  border-bottom: 1px solid var(--ot-bezel);
  padding-bottom: 0.35rem;
}
h3, h4 {
  font-size: 0.9rem !important;
  color: #c8c8c8 !important;
}

header a[href] h1 {
  font-size: 0.75rem !important;
  margin: 0 !important;
}

/* Sidebar: pixel labels. 0.9rem Silkscreen is wide — keep titles on one
   line and give the rail room (theme default --sidebar-menu-width is too
   tight; COMPLEX OSCILLATOR / PERSISTENT BUFFERS were wrapping). */
.group\/sidebar-wrapper {
  --sidebar-menu-width: 17rem;
}
@media (min-width: 1024px) {
  .group\/sidebar-wrapper {
    --sidebar-width: 17.5rem;
  }
}
[data-slot="sidebar"] a,
[data-slot="sidebar"] [data-sidebar="menu-button"] {
  font-family: var(--font-pixel) !important;
  font-size: 0.9rem !important;
  font-weight: 400 !important;
  letter-spacing: 0.02em !important;
  text-transform: uppercase !important;
  white-space: nowrap !important;
  -webkit-font-smoothing: none;
  color: #b0b0b0 !important;
  text-decoration: none !important;
}
[data-slot="sidebar"] a:hover,
[data-slot="sidebar"] [data-sidebar="menu-button"]:hover {
  color: #f0f0f0 !important;
}
[data-slot="sidebar"] a[aria-current="page"],
[data-slot="sidebar"] [data-sidebar="menu-button"][data-active="true"],
[aria-current="page"],
.active {
  color: #f0f0f0 !important;
}
[data-slot="sidebar"] [data-sidebar="group-label"] {
  font-family: var(--font-pixel) !important;
  font-size: 0.75rem !important;
  letter-spacing: 0.08em !important;
  text-transform: uppercase !important;
  color: #6a6a6a !important;
  -webkit-font-smoothing: none;
}

/* Mobile menu (#bottom-sidebar): same Silkscreen chrome as desktop sidebar.
   Theme ships text-2xl + gap-12 here — override hard. Keep sizes with the
   desktop sidebar so phone and web read the same. */
#menu-button,
#menu-button span {
  font-family: "Silkscreen", "JetBrains Mono", ui-monospace, monospace !important;
  font-size: 0.9rem !important;
  font-weight: 400 !important;
  letter-spacing: 0.02em !important;
  text-transform: uppercase !important;
  -webkit-font-smoothing: none !important;
  line-height: 1.25 !important;
}
#menu-button span.sr-only {
  font-size: 0 !important;
}
#menu-button > span.flex {
  height: auto !important;
}

#bottom-sidebar,
#bottom-sidebar * {
  font-family: "Silkscreen", "JetBrains Mono", ui-monospace, monospace !important;
  -webkit-font-smoothing: none !important;
}

#bottom-sidebar .flex.flex-col.gap-12 {
  gap: 0.7rem !important;
  padding: 0.7rem 0.9rem !important;
}
#bottom-sidebar .flex.flex-col.gap-8 {
  gap: 0.5rem !important;
}
#bottom-sidebar .flex.flex-col.gap-4 {
  gap: 0.25rem !important;
}
#bottom-sidebar .flex.flex-col.gap-3 {
  gap: 0.1rem !important;
}

#bottom-sidebar .text-muted-foreground,
#bottom-sidebar div.text-sm,
#bottom-sidebar div.font-medium {
  font-size: 0.75rem !important;
  font-weight: 400 !important;
  letter-spacing: 0.06em !important;
  text-transform: uppercase !important;
  color: #6a6a6a !important;
  line-height: 1.3 !important;
  margin: 0.25rem 0 0.1rem !important;
}

#bottom-sidebar a,
#bottom-sidebar a.text-2xl,
#bottom-sidebar a.text-sm,
#bottom-sidebar a.font-medium {
  font-size: 0.9rem !important;
  font-weight: 400 !important;
  letter-spacing: 0.02em !important;
  text-transform: uppercase !important;
  white-space: nowrap !important;
  line-height: 1.3 !important;
  color: #b0b0b0 !important;
  text-decoration: none !important;
  padding: 0.15rem 0 !important;
}
/* Mobile drawer: don't clamp the link column to the desktop rail width. */
#bottom-sidebar .flex.flex-col.gap-3,
#bottom-sidebar .flex.flex-col.gap-4 {
  width: max-content !important;
  max-width: 100% !important;
}
#bottom-sidebar a:hover {
  color: #f0f0f0 !important;
}

article .typography > p > a[href="web-builder.md"] strong,
article .typography > p > a[href="./web-builder.md"] strong,
article .typography > p > a[href="web-builder.html"] strong {
  font-family: var(--font-pixel);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  -webkit-font-smoothing: none;
}

article .typography > p:has(> a[href*="web-builder"]) {
  margin: 1.35rem 0 1.1rem;
  font-size: 1.05rem;
}

article .typography p:has(> strong > a),
article .typography > p > strong:first-child {
  line-height: 1.7;
}
article .typography p > strong:has(> a) {
  color: var(--ot-ink);
}

.table-wrapper,
article table {
  border: 1px solid var(--ot-bezel) !important;
}
.table-wrapper th,
article th {
  background: #1c1c1c !important;
  color: #d4d4d4 !important;
  font-family: var(--font-pixel) !important;
  font-weight: 400 !important;
  font-size: 0.7rem !important;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  -webkit-font-smoothing: none;
}
.table-wrapper td,
article td {
  text-transform: none !important;
  font-family: var(--font-mono) !important;
}

pre, .highlight {
  border: 1px solid var(--ot-bezel) !important;
  background: #0e0e0e !important;
}
code {
  font-family: var(--font-mono) !important;
  text-transform: none !important;
}

.admonition,
details {
  border: 1px solid var(--ot-amber-dim) !important;
  background: #161616 !important;
}
.admonition-title,
details summary {
  font-family: var(--font-pixel) !important;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.75rem !important;
  -webkit-font-smoothing: none;
}

article .typography img {
  background: #0a0a0a !important;
  border: 1px solid var(--ot-bezel) !important;
  image-rendering: pixelated;
}
article .typography img[src$=".svg"] {
  filter: invert(1);
  image-rendering: auto;
}

::selection {
  background: var(--ot-amber);
  color: #121212;
}

@media (prefers-reduced-motion: reduce) {
  a { transition: none; }
}
