/* =========================================================
   CCNA Interactive — Shared Stylesheet
   Theme: GitHub-dark base + Cisco cyan accent  |  RTL Arabic
   ========================================================= */

:root {
  /* Surfaces */
  --bg:          #0d1117;
  --surface:     #161b22;
  --surface-2:   #1c2128;
  --border:      #30363d;
  --border-soft: #21262d;

  /* Accents */
  --cyan:        #00bceb;   /* Cisco */
  --cyan-deep:   #049fd9;
  --green:       #3fb950;   /* secure / done */
  --red:         #f85149;   /* attack / violation */
  --amber:       #d29922;   /* restrict / warning */

  /* Text */
  --text:  #e6edf3;
  --muted: #8b949e;
  --dim:   #767f8a;

  /* System */
  --radius:  14px;
  --radius-s: 9px;
  --maxw: 1080px;
  --shadow: 0 8px 30px rgba(1, 4, 9, .5);
  --ease: cubic-bezier(.22, 1, .36, 1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "IBM Plex Sans Arabic", system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* subtle grid glow behind everything */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(900px 500px at 80% -10%, rgba(0,188,235,.10), transparent 60%),
    radial-gradient(700px 500px at 0% 10%, rgba(4,159,217,.07), transparent 55%);
  pointer-events: none;
}

a { color: inherit; text-decoration: none; }

code, pre, .mono { font-family: "IBM Plex Mono", ui-monospace, monospace; direction: ltr; }

.wrap { max-width: var(--maxw); margin-inline: auto; padding-inline: 22px; }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(13,17,23,.72);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-soft);
}
.topbar .inner {
  max-width: var(--maxw); margin-inline: auto;
  padding: 12px 22px;
  display: flex; align-items: center; gap: 14px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.brand .logo { width: 30px; height: 30px; }
.brand b { color: var(--cyan); }
.topbar nav { margin-inline-start: auto; display: flex; gap: 6px; }
.topbar nav a {
  padding: 7px 13px; border-radius: 999px; color: var(--muted);
  font-size: .9rem; transition: .2s var(--ease);
}
.topbar nav a:hover { color: var(--text); background: var(--surface-2); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 20px; border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text);
  font-family: inherit; font-size: .95rem; font-weight: 600;
  cursor: pointer; transition: .22s var(--ease);
}
.btn:hover { border-color: var(--cyan); transform: translateY(-2px); }
.btn.primary {
  background: linear-gradient(180deg, var(--cyan), var(--cyan-deep));
  border-color: transparent; color: #04121a;
}
.btn.primary:hover { box-shadow: 0 6px 22px rgba(0,188,235,.35); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* ---------- Hero ---------- */
.hero { padding: 74px 0 26px; text-align: center; }
.eyebrow {
  display: inline-block; font-family: "IBM Plex Mono", monospace;
  font-size: .78rem; letter-spacing: 2px; color: var(--cyan);
  border: 1px solid var(--border); border-radius: 999px;
  padding: 5px 14px; margin-bottom: 20px; direction: ltr;
}
.hero h1 {
  font-size: clamp(2rem, 6vw, 3.4rem); line-height: 1.25;
  font-weight: 700; margin: 0 0 16px;
}
.hero h1 .hl { color: var(--cyan); }
.hero p.lead { color: var(--muted); font-size: 1.12rem; max-width: 640px; margin: 0 auto 26px; }
.hero .cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ---------- Progress rail ---------- */
.progress-card {
  margin: 40px auto; max-width: 620px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px 22px;
}
.progress-card .row { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.progress-card .row b { font-size: 1.4rem; color: var(--cyan); font-family: "IBM Plex Mono", monospace; }
.bar { height: 10px; background: var(--surface-2); border-radius: 999px; overflow: hidden; border: 1px solid var(--border-soft); }
.bar > span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan-deep), var(--green)); transition: width .6s var(--ease); }
.progress-list { display: flex; flex-wrap: wrap; gap: 14px 22px; margin-top: 16px; color: var(--muted); font-size: .92rem; }
.progress-list span::before { content: "○ "; color: var(--dim); }
.progress-list span.done { color: var(--green); }
.progress-list span.done::before { content: "✓ "; color: var(--green); }

/* ---------- Section titles ---------- */
.section { padding: 54px 0; }
.section-head { margin-bottom: 30px; }
.section-head .kicker { font-family: "IBM Plex Mono", monospace; color: var(--cyan); font-size: .8rem; letter-spacing: 1.5px; direction: ltr; }
.section-head h2 { font-size: clamp(1.5rem, 4vw, 2.1rem); margin: 8px 0 6px; }
.section-head p { color: var(--muted); margin: 0; }

/* ---------- Roadmap / topology ---------- */
.topo {
  position: relative; margin-top: 20px;
  height: 420px;
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    repeating-linear-gradient(0deg, transparent 0 39px, rgba(48,54,61,.35) 39px 40px),
    repeating-linear-gradient(90deg, transparent 0 39px, rgba(48,54,61,.35) 39px 40px);
  overflow: hidden;
}
.topo svg.links { position: absolute; inset: 0; width: 100%; height: 100%; }
.topo .node {
  position: absolute; transform: translate(50%, -50%); /* RTL-safe centering via right */
  width: 190px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--radius-s); padding: 14px 16px;
  transition: .25s var(--ease); cursor: pointer;
}
.topo .node:hover { border-color: var(--cyan); transform: translate(50%, calc(-50% - 4px)); box-shadow: var(--shadow); }
.topo .node .ic { font-size: 1.35rem; }
.topo .node h3 { margin: 6px 0 2px; font-size: 1.02rem; }
.topo .node small { color: var(--muted); font-size: .8rem; }
.topo .node.core { background: linear-gradient(180deg, #10222b, #0f1a20); border-color: var(--cyan-deep); width: 210px; }
.topo .node.core h3 { color: var(--cyan); }
.topo .node.locked { opacity: .72; cursor: default; }
.topo .node.locked:hover { border-color: var(--border); transform: translate(50%, -50%); box-shadow: none; }
.topo .node .flag { display: inline-block; margin-top: 8px; font-family: "IBM Plex Mono", monospace; font-size: .68rem; padding: 2px 8px; border-radius: 999px; direction: ltr; }
.flag.ready { background: rgba(63,185,80,.14); color: var(--green); }
.flag.soon  { background: rgba(139,148,158,.14); color: var(--muted); }
.flag.done  { background: rgba(0,188,235,.14); color: var(--cyan); }

/* mobile: stack the topology as a list */
.topo-list { display: none; flex-direction: column; gap: 12px; margin-top: 20px; }
.topo-list .node { position: static; transform: none; width: auto; }

/* ---------- Content page ---------- */
.doc { max-width: 820px; margin-inline: auto; }
.block {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 26px 28px; margin-bottom: 20px;
}
.block > h3 {
  display: flex; align-items: center; gap: 10px;
  margin: 0 0 12px; font-size: 1.2rem;
}
.block > h3 .step {
  font-family: "IBM Plex Mono", monospace; font-size: .8rem; color: var(--cyan);
  border: 1px solid var(--border); border-radius: 8px; padding: 2px 8px; direction: ltr;
}
.block p { margin: 0 0 12px; }
.block p:last-child { margin-bottom: 0; }
.block ul { margin: 0; padding-inline-start: 22px; }
.block li { margin-bottom: 8px; }
.lead-line { color: var(--muted); }

.callout { border-inline-start: 3px solid var(--cyan); background: var(--surface-2); border-radius: 8px; padding: 14px 16px; margin: 6px 0; }
.callout.warn { border-inline-start-color: var(--red); }
.callout.tip  { border-inline-start-color: var(--green); }

/* code block */
.code {
  position: relative; background: #0b0f14; border: 1px solid var(--border);
  border-radius: 10px; margin: 12px 0; overflow: hidden;
}
.code .code-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 12px; border-bottom: 1px solid var(--border-soft);
  font-family: "IBM Plex Mono", monospace; font-size: .72rem; color: var(--muted); direction: ltr;
}
.code pre { margin: 0; padding: 14px 16px; overflow-x: auto; font-size: .86rem; line-height: 1.7; color: #cdd9e5; }
.code .cmt { color: var(--dim); }
.code .cmd { color: var(--cyan); }
.copy-btn { background: transparent; border: 1px solid var(--border); color: var(--muted); border-radius: 6px; padding: 3px 9px; font-size: .7rem; cursor: pointer; font-family: inherit; }
.copy-btn:hover { color: var(--cyan); border-color: var(--cyan); }

/* comparison table */
table.cmp { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: .92rem; }
table.cmp th, table.cmp td { border: 1px solid var(--border); padding: 10px 12px; text-align: start; }
table.cmp th { background: var(--surface-2); color: var(--cyan); font-weight: 600; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-inline-end: 6px; vertical-align: middle; }
.dot.g { background: var(--green); } .dot.r { background: var(--red); } .dot.a { background: var(--amber); }

/* timeline */
.timeline { position: relative; padding-inline-start: 24px; margin-top: 6px; }
.timeline::before { content: ""; position: absolute; inset-inline-start: 6px; top: 4px; bottom: 4px; width: 2px; background: var(--border); }
.timeline .tl { position: relative; margin-bottom: 18px; }
.timeline .tl::before { content: ""; position: absolute; inset-inline-start: -22px; top: 6px; width: 12px; height: 12px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 0 4px rgba(0,188,235,.15); }
.timeline .tl b { display: block; color: var(--cyan); font-size: .85rem; font-family: "IBM Plex Mono", monospace; direction: ltr; }

/* faq */
details.faq { border: 1px solid var(--border); border-radius: 10px; padding: 4px 16px; margin-bottom: 10px; background: var(--surface-2); }
details.faq summary { cursor: pointer; padding: 12px 0; font-weight: 600; list-style: none; }
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::before { content: "＋"; color: var(--cyan); margin-inline-end: 10px; }
details.faq[open] summary::before { content: "－"; }
details.faq p { color: var(--muted); padding-bottom: 12px; margin: 0; }

/* ---------- Interactive simulator (port security) ---------- */
.sim { display: grid; grid-template-columns: 1.15fr .85fr; gap: 20px; }
.sim .stage { background: #0b0f14; border: 1px solid var(--border); border-radius: 12px; padding: 20px; min-height: 260px; }
.switch { display: flex; align-items: center; gap: 12px; justify-content: center; padding: 16px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; }
.switch .label { font-family: "IBM Plex Mono", monospace; font-size: .7rem; color: var(--muted); direction: ltr; }
.ports { display: flex; gap: 8px; }
.port { width: 34px; height: 26px; border-radius: 5px; background: #10151c; border: 1px solid var(--border); display: grid; place-items: center; font-size: .6rem; color: var(--dim); font-family: "IBM Plex Mono", monospace; transition: .25s var(--ease); }
.port.active { border-color: var(--green); box-shadow: 0 0 0 3px rgba(63,185,80,.18); color: var(--green); }
.port.err { border-color: var(--red); box-shadow: 0 0 0 3px rgba(248,81,73,.2); color: var(--red); animation: shake .3s; }
@keyframes shake { 0%,100%{transform:translateX(0)} 25%{transform:translateX(-3px)} 75%{transform:translateX(3px)} }

.devices { margin-top: 18px; display: flex; flex-direction: column; gap: 8px; }
.dev { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); font-size: .86rem; }
.dev .mac { font-family: "IBM Plex Mono", monospace; color: var(--muted); font-size: .78rem; direction: ltr; margin-inline-start: auto; }
.dev.ok { border-color: rgba(63,185,80,.4); }
.dev.bad { border-color: rgba(248,81,73,.4); }

.sim .panel { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px; }
.sim .panel h4 { margin: 0 0 12px; font-size: .95rem; }
.mode-pick { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.mode-pick label { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; font-size: .88rem; transition: .2s var(--ease); }
.mode-pick label:hover { border-color: var(--cyan); }
.mode-pick input { accent-color: var(--cyan); }
.mode-pick label.sel { border-color: var(--cyan); background: var(--surface-2); }
.stat-row { display: flex; justify-content: space-between; padding: 7px 0; border-top: 1px solid var(--border-soft); font-size: .86rem; }
.stat-row span:last-child { font-family: "IBM Plex Mono", monospace; direction: ltr; }
.state-up { color: var(--green); } .state-err { color: var(--red); }
.log { margin-top: 12px; background: #0b0f14; border: 1px solid var(--border-soft); border-radius: 8px; padding: 10px 12px; font-family: "IBM Plex Mono", monospace; font-size: .74rem; color: var(--muted); min-height: 64px; direction: ltr; text-align: left; line-height: 1.6; }
.sim-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

/* achievement toast */
.toast {
  position: fixed; inset-inline-end: 20px; bottom: 20px; z-index: 100;
  background: var(--surface); border: 1px solid var(--cyan);
  border-radius: 12px; padding: 14px 18px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 12px;
  transform: translateY(140%); transition: transform .45s var(--ease);
}
.toast.show { transform: translateY(0); }
.toast .medal { font-size: 1.6rem; }
.toast b { color: var(--cyan); }
.toast small { display: block; color: var(--muted); }

/* footer */
footer { border-top: 1px solid var(--border-soft); padding: 30px 0; color: var(--dim); font-size: .85rem; text-align: center; }
footer a { color: var(--muted); }

/* reveal on scroll */
.reveal { opacity: 0; transform: translateY(18px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.reveal.in { opacity: 1; transform: none; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .sim { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .topo { display: none; }
  .topo-list { display: flex; }
  .topbar nav { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .reveal { opacity: 1; transform: none; }
}

/* ---------- Extra components (DHCP / STP simulators) ---------- */
.port.trust { border-color: var(--cyan); color: var(--cyan); box-shadow: 0 0 0 3px rgba(0,188,235,.15); }
.port.block { border-color: var(--red); color: var(--red); }
.port.wide  { width: auto; padding: 4px 10px; }

.toggle-btn.on { border-color: var(--green); color: var(--green); }
.toggle-btn.on::before { content: "● "; color: var(--green); }
.toggle-btn::before { content: "○ "; color: var(--dim); }

.pill-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.pill { font-size: .72rem; padding: 4px 11px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); direction: ltr; }
.pill.t { border-color: var(--cyan); color: var(--cyan); }
.pill.u { border-color: var(--amber); color: var(--amber); }

.mini-table { width: 100%; border-collapse: collapse; font-size: .76rem; margin-top: 12px; }
.mini-table th, .mini-table td { border: 1px solid var(--border); padding: 6px 9px; text-align: start; font-family: "IBM Plex Mono", monospace; direction: ltr; }
.mini-table th { background: var(--surface-2); color: var(--cyan); font-size: .68rem; letter-spacing: .5px; }
.mini-table td.empty { color: var(--dim); text-align: center; font-family: "IBM Plex Sans Arabic", sans-serif; direction: rtl; }
.mini-table tr.drop td { color: var(--red); }

/* ---------- Footer credit / contact ---------- */
footer .wrap { display: flex; flex-direction: column; gap: 14px; }
.footer-nav { color: var(--muted); font-size: .85rem; }
.footer-nav a { color: var(--muted); transition: color .2s var(--ease); }
.footer-nav a:hover { color: var(--cyan); }

.footer-credit {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  flex-wrap: wrap; padding-top: 14px; border-top: 1px solid var(--border-soft);
}
.credit-line { color: var(--muted); font-size: .85rem; }
.credit-line b { color: var(--cyan); font-weight: 700; }
.credit-links { display: flex; gap: 8px; }
.icon-btn {
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--border); color: var(--muted);
  transition: .2s var(--ease);
}
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn:hover { color: var(--cyan); border-color: var(--cyan); transform: translateY(-2px); }
.credit-copy { color: var(--dim); font-size: .78rem; width: 100%; text-align: center; }
