/* ============================================================
   Docker From The Root — "Container Blueprint" Design System
   نظام تصميم مشتقّ من جوّ الموضوع: أنظمة، عزل، تشريح، مخطّط هندسي.
   ============================================================ */

:root {
  /* surfaces — cold deep navy (blueprint / deep ocean) */
  --bg-void:     #04070d;
  --bg-deep:     #070c16;
  --bg-panel:    #0b1320;
  --bg-elevated: #101b2c;
  --bg-code:     #060a12;

  /* borders / lines — blueprint blue-grey */
  --line:        #1a2942;
  --line-strong: #2b3f60;
  --line-faint:  #111c2e;

  /* text — cool off-white */
  --fg:        #cfdcef;
  --fg-muted:  #8497b3;
  --fg-dim:    #566681;
  --fg-faint:  #3a475d;

  /* accents — cyan dominant + indigo secondary + semantic */
  --accent:     #35c5f0;   /* blueprint cyan — links, active, emphasis */
  --accent-dim: #15677f;
  --ink:        #8a9bff;   /* indigo — secondary headings, em */
  --ink-dim:    #3c47a0;
  --amber:      #f0a52e;   /* WHY / warn */
  --amber-dim:  #8a5d12;
  --red:        #ff5470;   /* danger / escape / kill */
  --red-dim:    #8a2435;
  --violet:     #b98aff;   /* code keywords */
  --green:      #4fd6a0;   /* code strings / ok */

  /* type */
  --mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, monospace;
  --ar:   "IBM Plex Sans Arabic", "Tajawal", "Noto Sans Arabic", system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg-void);
  color: var(--fg);
  font-family: var(--ar);
  font-size: 16px;
  line-height: 1.78;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* blueprint grid + radial depth */
body {
  background-image:
    linear-gradient(rgba(53,197,240,0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(53,197,240,0.022) 1px, transparent 1px),
    radial-gradient(ellipse at 15% 0%, rgba(53,197,240,0.05) 0%, transparent 45%),
    radial-gradient(ellipse at 85% 90%, rgba(138,155,255,0.045) 0%, transparent 50%);
  background-size: 44px 44px, 44px 44px, 100% 100%, 100% 100%;
  background-attachment: fixed;
  min-height: 100vh;
}

::selection { background: var(--accent); color: var(--bg-void); }

a { color: var(--accent); text-decoration: none; border-bottom: 1px dashed var(--accent-dim); }
a:hover { color: var(--ink); border-color: var(--ink); }

/* ============================================================ LAYOUT */

.shell { display: grid; grid-template-columns: 320px 1fr; min-height: 100vh; }

.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 24px;
  padding: 10px 28px;
  background: var(--bg-void);
  border-bottom: 1px solid var(--line);
  font-family: var(--mono); font-size: 11px;
  letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--fg-dim);
}
.topbar .brand { color: var(--accent); font-weight: 700; display: flex; align-items: center; gap: 8px; }
.topbar .brand::before {
  content: "▤"; color: var(--accent); animation: blink 2s steps(2, end) infinite;
}
.topbar .meta { display: flex; gap: 18px; flex-wrap: wrap; }
.topbar .meta b { color: var(--ink); font-weight: 500; }
.topbar .spacer { flex: 1; }
.topbar .status { color: var(--accent); display: flex; align-items: center; gap: 6px; }
.topbar .status::before {
  content: ""; width: 8px; height: 8px;
  background: var(--accent); border-radius: 50%;
  box-shadow: 0 0 8px var(--accent);
  animation: pulse 2.2s ease-in-out infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.25; } }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.4; transform: scale(0.7); } }

/* sidebar */
.sidebar {
  position: sticky; top: 39px;
  height: calc(100vh - 39px); overflow-y: auto;
  background: var(--bg-deep);
  border-left: 1px solid var(--line);
  padding: 28px 22px 60px;
  font-family: var(--mono); font-size: 13px;
}
.sidebar .sb-title {
  font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--fg-dim); margin: 22px 0 8px;
  display: flex; align-items: center; gap: 8px;
}
.sidebar .sb-title::before {
  content: ""; display: inline-block; width: 6px; height: 6px;
  background: var(--accent); transform: rotate(45deg);
}
.sidebar .sb-title:first-child { margin-top: 0; }
.sidebar a {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 7px 10px; border: none; border-radius: 0;
  color: var(--fg-muted); border-right: 2px solid transparent;
  font-size: 13px; line-height: 1.5; margin-bottom: 1px; transition: all 0.12s;
}
.sidebar a:hover { background: var(--bg-elevated); color: var(--fg); border-right-color: var(--accent-dim); }
.sidebar a.active { background: var(--bg-elevated); color: var(--accent); border-right-color: var(--accent); }
.sidebar a .num { color: var(--fg-dim); font-size: 11px; flex-shrink: 0; min-width: 22px; }
.sidebar a.active .num { color: var(--accent); }
.sidebar .cheat {
  font-family: var(--mono); font-size: 11px; color: var(--fg-dim);
  padding: 4px 10px; line-height: 1.95;
}
.sidebar .cheat b { color: var(--accent); font-weight: 500; }
.sidebar .cheat i { color: var(--amber); font-style: normal; }
.sidebar .cheat u { color: var(--ink); text-decoration: none; }

/* main */
.main { padding: 56px 64px 120px; max-width: 1100px; width: 100%; }

/* ============================================================ TYPE */

h1, h2, h3, h4 { font-family: var(--ar); font-weight: 700; color: var(--fg); line-height: 1.3; text-wrap: balance; }

h1 { font-size: clamp(34px, 4vw, 52px); margin: 0 0 12px; letter-spacing: -0.01em; }
h1 .accent { color: var(--accent); }

h2 {
  font-size: 30px; margin: 64px 0 18px; padding-bottom: 14px;
  border-bottom: 1px solid var(--line); position: relative;
}
h2::before {
  content: attr(data-num); display: inline-block;
  font-family: var(--mono); font-size: 13px; color: var(--accent);
  margin-left: 14px; padding: 2px 8px;
  background: rgba(53,197,240,0.06); border: 1px solid var(--accent-dim);
  letter-spacing: 0.05em; vertical-align: middle;
}
h3 { font-size: 22px; margin: 40px 0 12px; color: var(--ink); }
h3::before { content: "// "; font-family: var(--mono); color: var(--fg-dim); font-weight: 400; }
h4 { font-size: 17px; margin: 28px 0 10px; color: var(--amber); font-family: var(--mono); font-weight: 500; letter-spacing: 0.02em; }

p { margin: 0 0 16px; text-wrap: pretty; }
strong, b { color: var(--fg); font-weight: 700; }
em { color: var(--ink); font-style: normal; font-weight: 500; }

ul, ol { padding-right: 22px; margin: 0 0 18px; }
li { margin-bottom: 8px; }
li::marker { color: var(--accent); }

code, .en { font-family: var(--mono); direction: ltr; unicode-bidi: isolate; }
code {
  background: var(--bg-elevated); color: var(--accent);
  padding: 1px 6px; font-size: 0.86em; border: 1px solid var(--line); border-radius: 2px;
}

/* ============================================================ HERO */

.hero { padding: 80px 64px 56px; border-bottom: 1px solid var(--line); position: relative; overflow: hidden; }
.hero::before {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(rgba(53,197,240,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(53,197,240,0.03) 1px, transparent 1px),
    radial-gradient(circle at 18% 30%, rgba(53,197,240,0.10) 0%, transparent 42%),
    radial-gradient(circle at 82% 75%, rgba(138,155,255,0.08) 0%, transparent 45%);
  background-size: 28px 28px, 28px 28px, 100% 100%, 100% 100%;
  pointer-events: none;
}
.hero > * { position: relative; }

.hero-meta { display: flex; gap: 14px; margin-bottom: 24px; font-family: var(--mono); font-size: 12px; color: var(--fg-dim); letter-spacing: 0.06em; text-transform: uppercase; flex-wrap: wrap; }
.hero-meta .tag { padding: 4px 10px; border: 1px solid var(--line); background: var(--bg-panel); color: var(--fg-muted); }
.hero-meta .tag.live { color: var(--accent); border-color: var(--accent-dim); }
.hero-meta .tag.cls  { color: var(--amber); border-color: var(--amber-dim); }

.hero h1 { font-size: clamp(38px, 5vw, 70px); font-weight: 800; line-height: 1.06; margin: 0 0 16px; }
.hero h1 .accent { color: var(--accent); }
.hero .lede { font-size: 20px; color: var(--fg-muted); max-width: 800px; line-height: 1.7; }
/* lede outside hero (region pages) */
.main > .lede, .lede { font-size: 19px; color: var(--fg-muted); max-width: 820px; line-height: 1.7; margin-bottom: 22px; }

/* schematic registration corner ticks on hero */
.hero .ticks::before, .hero .ticks::after {
  content: ""; position: absolute; width: 22px; height: 22px; pointer-events: none;
}
.hero .ticks::before { top: 18px; left: 18px; border-top: 1px solid var(--accent-dim); border-right: 1px solid var(--accent-dim); }
.hero .ticks::after  { bottom: 18px; right: 18px; border-bottom: 1px solid var(--accent-dim); border-left: 1px solid var(--accent-dim); }

/* ============================================================ PANELS / CALLOUTS */

.panel { background: var(--bg-panel); border: 1px solid var(--line); padding: 22px 26px; margin: 22px 0; position: relative; }
.panel.bracket::before, .panel.bracket::after { content: ""; position: absolute; width: 14px; height: 14px; border: 1px solid var(--accent); }
.panel.bracket::before { top: -1px; right: -1px; border-bottom: none; border-left: none; }
.panel.bracket::after  { bottom: -1px; left: -1px; border-top: none; border-right: none; }

.callout {
  margin: 24px 0; padding: 16px 22px;
  background: var(--bg-panel);
  border-right: 3px solid var(--accent);
  border-left: 1px solid var(--line); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
  position: relative;
}
.callout.warn   { border-right-color: var(--amber); }
.callout.danger { border-right-color: var(--red); }
.callout.info   { border-right-color: var(--ink); }
.callout .label {
  font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 6px; display: flex; align-items: center; gap: 8px;
}
.callout.warn .label   { color: var(--amber); }
.callout.danger .label { color: var(--red); }
.callout.info .label   { color: var(--ink); }
.callout p:last-child { margin-bottom: 0; }
.callout.why { border-right-color: var(--amber); background: linear-gradient(90deg, rgba(240,165,46,0.05), transparent 60%); }
.callout.why .label { color: var(--amber); }

/* ============================================================ TABLES */

table { width: 100%; border-collapse: collapse; margin: 22px 0; font-size: 14px; background: var(--bg-panel); border: 1px solid var(--line); }
th {
  background: var(--bg-elevated); color: var(--accent);
  font-family: var(--mono); font-size: 12px; font-weight: 500;
  letter-spacing: 0.04em; text-transform: uppercase; text-align: right;
  padding: 12px 16px; border-bottom: 1px solid var(--line-strong);
}
td { padding: 11px 16px; border-bottom: 1px solid var(--line-faint); vertical-align: top; color: var(--fg-muted); }
td:first-child { color: var(--fg); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: rgba(53,197,240,0.025); }
table code { font-size: 0.84em; }

/* ============================================================ CODE / TERMINAL */

pre { background: var(--bg-code); border: 1px solid var(--line); padding: 0; margin: 22px 0; overflow: hidden; font-family: var(--mono); font-size: 13.5px; line-height: 1.65; position: relative; }
pre .term-head {
  display: flex; align-items: center; gap: 10px; padding: 8px 14px;
  background: var(--bg-elevated); border-bottom: 1px solid var(--line);
  font-size: 11px; color: var(--fg-dim); letter-spacing: 0.08em; text-transform: uppercase;
}
pre .term-head::before { content: "● ● ●"; color: var(--fg-faint); letter-spacing: 2px; font-size: 8px; }
pre .term-head .tt { color: var(--accent); margin-right: auto; }
pre code { display: block; padding: 18px 20px; background: transparent; border: none; color: var(--fg); white-space: pre; overflow-x: auto; direction: ltr; text-align: left; }
pre code .pmt { color: var(--accent); }
pre code .cmt { color: var(--fg-dim); font-style: italic; }
pre code .kw  { color: var(--violet); }
pre code .str { color: var(--green); }
pre code .num { color: var(--ink); }
pre code .fn  { color: var(--amber); }

/* ============================================================ ASCII / FIGURE */

.ascii { font-family: var(--mono); font-size: 12px; line-height: 1.55; white-space: pre; background: var(--bg-code); border: 1px solid var(--line); padding: 18px 22px; margin: 22px 0; color: var(--fg-muted); overflow-x: auto; direction: ltr; text-align: left; }
.ascii .hl  { color: var(--accent); }
.ascii .hl2 { color: var(--ink); }
.ascii .hl3 { color: var(--amber); }
.ascii .hl4 { color: var(--red); }

figure { margin: 28px 0; background: var(--bg-panel); border: 1px solid var(--line); padding: 0; overflow: hidden; }
figure .fig-head { padding: 10px 18px; background: var(--bg-elevated); border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: 11px; color: var(--fg-dim); letter-spacing: 0.08em; text-transform: uppercase; display: flex; align-items: center; gap: 10px; }
figure .fig-head .id { color: var(--accent); }
figure .fig-body { padding: 26px 24px; display: flex; justify-content: center; }
figure figcaption { padding: 10px 18px; border-top: 1px solid var(--line); background: var(--bg-deep); font-size: 13px; color: var(--fg-muted); text-align: center; }

/* ============================================================ STATS */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin: 24px 0; }
.stat { border: 1px solid var(--line); background: var(--bg-panel); padding: 18px; position: relative; }
.stat::before { content: ""; position: absolute; top: -1px; right: -1px; width: 10px; height: 10px; border-top: 1px solid var(--accent); border-right: 1px solid var(--accent); }
.stat .v { font-family: var(--mono); font-size: 30px; color: var(--accent); font-weight: 700; line-height: 1; }
.stat .k { font-family: var(--mono); font-size: 11px; color: var(--fg-dim); text-transform: uppercase; letter-spacing: 0.1em; margin-top: 8px; }

/* ============================================================ MODULE GRID */

.modgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; margin: 28px 0; }
.modcard { display: block; background: var(--bg-panel); border: 1px solid var(--line); padding: 24px; color: var(--fg); position: relative; transition: all 0.15s ease; overflow: hidden; }
.modcard:hover { border-color: var(--accent-dim); background: var(--bg-elevated); transform: translateY(-2px); }
.modcard::before { content: ""; position: absolute; top: 0; right: 0; width: 64px; height: 64px; background: linear-gradient(225deg, var(--accent-dim) 0%, transparent 55%); opacity: 0.18; }
.modcard .mc-num { font-family: var(--mono); font-size: 11px; color: var(--accent); letter-spacing: 0.15em; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; }
.modcard .mc-num::after { content: ""; flex: 1; border-top: 1px dashed var(--line-strong); }
.modcard .mc-title { font-size: 21px; font-weight: 700; margin: 0 0 6px; color: var(--fg); line-height: 1.3; }
.modcard .mc-sub { font-size: 12.5px; color: var(--accent); font-family: var(--mono); margin-bottom: 12px; }
.modcard .mc-desc { font-size: 14px; color: var(--fg-muted); line-height: 1.65; margin-bottom: 16px; }
.modcard .mc-foot { display: flex; justify-content: space-between; align-items: center; font-family: var(--mono); font-size: 11px; color: var(--fg-dim); text-transform: uppercase; letter-spacing: 0.08em; padding-top: 14px; border-top: 1px solid var(--line); }
.modcard .mc-foot .open { color: var(--accent); }
.modcard:hover .mc-foot .open::after { content: " ←"; }
/* locked */
.modcard.locked { opacity: 0.55; pointer-events: none; }
.modcard.locked .mc-num { color: var(--fg-dim); }
.modcard.locked::before { background: linear-gradient(225deg, var(--fg-faint) 0%, transparent 55%); }
.modcard.locked .mc-foot .lock { color: var(--fg-dim); }

/* ============================================================ PAGER */

.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin: 60px 0 0; border-top: 1px solid var(--line); padding-top: 28px; }
.pager a { display: block; padding: 18px 22px; background: var(--bg-panel); border: 1px solid var(--line); color: var(--fg); border-radius: 0; transition: all 0.15s; }
.pager a:hover { border-color: var(--accent-dim); background: var(--bg-elevated); }
.pager .label { font-family: var(--mono); font-size: 11px; color: var(--fg-dim); letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 6px; }
.pager .title { font-size: 15px; color: var(--accent); }
.pager .next { text-align: left; }
.pager .next .label::before { content: "→ "; }
.pager .prev .label::after  { content: " ←"; }
.pager .seed .title { color: var(--ink); }

/* ============================================================ BOX (puzzles) */

.box { margin: 28px 0; border: 1px solid var(--line); background: var(--bg-panel); padding: 24px 26px 22px; position: relative; }
.box::before { content: attr(data-label); position: absolute; top: -10px; right: 20px; background: var(--bg-void); padding: 0 10px; font-family: var(--mono); font-size: 11px; color: var(--accent); letter-spacing: 0.15em; text-transform: uppercase; }
.box.amber::before { color: var(--amber); }
.box.amber { border-color: var(--amber-dim); }
.box.red::before { color: var(--red); }
.box.red { border-color: var(--red-dim); }
.box > :last-child { margin-bottom: 0; }
.box .q-lead { color: var(--fg); font-weight: 700; }

/* ============================================================ BADGES */

.badge { display: inline-block; padding: 2px 8px; font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; border: 1px solid var(--line-strong); color: var(--fg-muted); background: var(--bg-elevated); vertical-align: middle; direction: ltr; }
.badge.ok   { color: var(--accent); border-color: var(--accent-dim); }
.badge.bad  { color: var(--red); border-color: var(--red-dim); }
.badge.warn { color: var(--amber); border-color: var(--amber-dim); }
.badge.info { color: var(--ink); border-color: var(--ink-dim); }

/* ============================================================ TOC */

.toc { background: var(--bg-panel); border: 1px solid var(--line); padding: 18px 26px; margin: 24px 0 32px; font-size: 14px; }
.toc .toc-h { font-family: var(--mono); font-size: 11px; color: var(--fg-dim); letter-spacing: 0.15em; text-transform: uppercase; margin-bottom: 10px; }
.toc ol { padding-right: 18px; margin: 0; }
.toc a { color: var(--fg-muted); border: none; }
.toc a:hover { color: var(--accent); }

/* lens row (namespace lenses visual, index) */
.lensrow { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 24px 0; }
.lens { border: 1px solid var(--line); background: var(--bg-panel); padding: 16px; text-align: center; position: relative; }
.lens .q { font-family: var(--mono); font-size: 12px; color: var(--amber); margin-bottom: 6px; }
.lens .p { font-family: var(--mono); font-size: 14px; color: var(--accent); font-weight: 700; }
.lens .r { font-size: 12px; color: var(--fg-dim); margin-top: 4px; }

/* ============================================================ FOOTER */

.foot { border-top: 1px solid var(--line); margin-top: 60px; padding: 28px 64px; font-family: var(--mono); font-size: 11px; color: var(--fg-dim); letter-spacing: 0.08em; text-transform: uppercase; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 16px; background: var(--bg-void); }
.foot .sig { color: var(--accent); }
/* full-bleed footer inside padded main — responsive (no fixed negative margin) */
.foot.bleed { margin-left: -64px; margin-right: -64px; }
@media (max-width: 1000px) { .foot.bleed { margin-left: -22px; margin-right: -22px; } }

/* ============================================================ RESPONSIVE */

@media (max-width: 1000px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: relative; height: auto; top: 0; border-left: none; border-bottom: 1px solid var(--line); }
  .main { padding: 40px 22px 80px; }
  .hero { padding: 56px 22px 40px; }
  .foot { padding: 28px 22px; }
  h2 { font-size: 25px; }
}
