/* ====================================================
   Rust pour Pascalien — feuille de style
   Responsive, thème clair/sombre, blocs code côte à côte
   ==================================================== */

:root {
  --c-bg:          #0f1419;
  --c-bg-elev:     #161c23;
  --c-bg-soft:     #1a212a;
  --c-text:        #d7dee5;
  --c-text-dim:    #99a3ad;
  --c-text-muted:  #6b7682;
  --c-accent:      #ce422b;     /* rouge Rust */
  --c-accent-soft: #ce422b22;
  --c-accent-hov:  #e3593f;
  --c-pascal:      #5b8bf0;     /* bleu Delphi */
  --c-border:      #283038;
  --c-border-soft: #1f262e;
  --c-code-bg:     #0b0f14;
  --c-callout-bg:  #1d2734;
  --c-callout-bd:  #2c4156;

  --sidebar-w:     260px;
  --topbar-h:      56px;

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;

  --shadow: 0 2px 8px rgba(0,0,0,.35);
}

:root[data-theme="light"] {
  --c-bg:          #faf8f5;
  --c-bg-elev:     #ffffff;
  --c-bg-soft:     #f0ece6;
  --c-text:        #1f2933;
  --c-text-dim:    #4a5560;
  --c-text-muted:  #7b8590;
  --c-accent:      #ce422b;
  --c-accent-soft: #ce422b15;
  --c-accent-hov:  #b3361f;
  --c-pascal:      #2b59c3;
  --c-border:      #d7d2c8;
  --c-border-soft: #e8e3d8;
  --c-code-bg:     #f3efe7;
  --c-callout-bg:  #fff8e6;
  --c-callout-bd:  #f0d98a;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ===================== TOP BAR ===================== */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--topbar-h);
  background: var(--c-bg-elev);
  border-bottom: 1px solid var(--c-border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  z-index: 100;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 1.05rem;
}
.brand .logo { font-size: 1.4rem; }
.brand-text em {
  color: var(--c-accent);
  font-style: normal;
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.icon-btn {
  background: transparent;
  border: 1px solid var(--c-border);
  color: var(--c-text);
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 1rem;
  transition: background .15s ease;
}
.icon-btn:hover { background: var(--c-bg-soft); }

.menu-toggle {
  display: none;
  background: transparent;
  border: 1px solid var(--c-border);
  width: 36px; height: 36px;
  border-radius: var(--r-sm);
  cursor: pointer;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
  padding: 0;
}
.menu-toggle span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--c-text);
  border-radius: 2px;
}

/* ===================== LAYOUT ===================== */
.layout {
  display: flex;
  padding-top: var(--topbar-h);
  min-height: 100vh;
}

/* ===================== SIDEBAR ===================== */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--c-bg-elev);
  border-right: 1px solid var(--c-border);
  height: calc(100vh - var(--topbar-h));
  overflow-y: auto;
  position: sticky;
  top: var(--topbar-h);
  padding: 16px 0;
}

.sidebar nav { padding: 0 12px; }

.nav-group-title {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--c-text-muted);
  margin: 18px 12px 6px;
}
.nav-group-title:first-child { margin-top: 6px; }

.nav-link {
  display: block;
  padding: 7px 12px;
  color: var(--c-text-dim);
  text-decoration: none;
  border-radius: var(--r-sm);
  font-size: .92rem;
  border-left: 2px solid transparent;
  transition: all .12s ease;
}
.nav-link:hover {
  background: var(--c-bg-soft);
  color: var(--c-text);
}
.nav-link.active {
  background: var(--c-accent-soft);
  color: var(--c-accent);
  border-left-color: var(--c-accent);
  font-weight: 600;
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: var(--topbar-h) 0 0 0;
  background: rgba(0,0,0,.5);
  z-index: 50;
}
.sidebar-overlay.show { display: block; }

/* ===================== CONTENT ===================== */
.content {
  flex: 1;
  min-width: 0;
  padding: 32px 48px 80px;
  max-width: 1100px;
}

section {
  padding-top: 32px;
  margin-bottom: 32px;
  scroll-margin-top: calc(var(--topbar-h) + 16px);
  border-bottom: 1px dashed var(--c-border-soft);
}
section:last-of-type { border-bottom: none; }

h1, h2, h3 {
  color: var(--c-text);
  line-height: 1.25;
}
h1 {
  font-size: 2.2rem;
  margin: 0 0 12px;
}
h2 {
  font-size: 1.6rem;
  margin: 0 0 18px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--c-accent);
  display: inline-block;
}
h3 {
  font-size: 1.15rem;
  margin: 28px 0 10px;
  color: var(--c-accent);
}

p { margin: 0 0 14px; }
.lead {
  font-size: 1.1rem;
  color: var(--c-text-dim);
}

a {
  color: var(--c-accent);
  text-decoration: none;
  border-bottom: 1px dashed var(--c-accent);
}
a:hover { color: var(--c-accent-hov); border-bottom-style: solid; }

ul.bullets, ol.bullets {
  padding-left: 22px;
  margin: 0 0 14px;
}
ul.bullets li, ol.bullets li { margin-bottom: 6px; }

code {
  background: var(--c-bg-soft);
  color: var(--c-accent);
  padding: 1px 6px;
  border-radius: 4px;
  font-family: "JetBrains Mono", "Fira Code", Consolas, Menlo, monospace;
  font-size: .9em;
  border: 1px solid var(--c-border-soft);
}
pre code {
  background: transparent;
  color: inherit;
  border: none;
  padding: 0;
  font-size: .88rem;
}
pre {
  background: var(--c-code-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  overflow-x: auto;
  margin: 0 0 16px;
}

/* ===================== HERO ===================== */
.hero {
  border-bottom: none;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin: 22px 0 28px;
}
.card {
  background: var(--c-bg-elev);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  padding: 16px;
  transition: transform .15s ease, border-color .15s ease;
}
.card:hover {
  transform: translateY(-2px);
  border-color: var(--c-accent);
}
.card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
  color: var(--c-text);
}
.card p {
  margin: 0;
  color: var(--c-text-dim);
  font-size: .92rem;
}

/* ===================== DUAL CODE (Pascal/Rust) ===================== */
.dual {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 0 0 18px;
}
.code-block {
  background: var(--c-code-bg);
  border: 1px solid var(--c-border);
  border-radius: var(--r-md);
  overflow: hidden;
}
.code-block pre {
  margin: 0;
  border: none;
  border-radius: 0;
  background: transparent;
}
.code-head {
  background: var(--c-bg-soft);
  border-bottom: 1px solid var(--c-border);
  padding: 6px 14px;
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--c-text-dim);
}
/* Couleur d'accent dans l'en-tête, selon le langage */
.code-block:nth-child(1) .code-head {
  color: var(--c-pascal);
  border-bottom-color: var(--c-pascal);
}
.code-block:nth-child(2) .code-head {
  color: var(--c-accent);
  border-bottom-color: var(--c-accent);
}

/* ===================== CALLOUT ===================== */
.callout {
  background: var(--c-callout-bg);
  border: 1px solid var(--c-callout-bd);
  border-left: 4px solid var(--c-accent);
  border-radius: var(--r-md);
  padding: 14px 18px;
  margin: 18px 0;
  color: var(--c-text);
}
.callout strong { color: var(--c-accent); }
.callout pre { margin-top: 8px; }

/* ===================== TABLES ===================== */
.table-wrap {
  overflow-x: auto;
  margin: 0 0 18px;
  border-radius: var(--r-md);
  border: 1px solid var(--c-border);
}
table.compare {
  width: 100%;
  border-collapse: collapse;
  font-size: .9rem;
}
table.compare th,
table.compare td {
  padding: 9px 12px;
  text-align: left;
  border-bottom: 1px solid var(--c-border-soft);
  vertical-align: top;
}
table.compare th {
  background: var(--c-bg-soft);
  color: var(--c-text);
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 1;
}
table.compare tr:last-child td { border-bottom: none; }
table.compare tr:hover td { background: var(--c-bg-soft); }
table.compare td:first-child { font-weight: 600; color: var(--c-text); }

/* ===================== FOOTER ===================== */
.site-footer {
  margin-top: 48px;
  padding-top: 20px;
  border-top: 1px solid var(--c-border);
  color: var(--c-text-muted);
  font-size: .85rem;
}
.closing {
  margin-top: 24px;
  font-size: 1.05rem;
  color: var(--c-text);
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 900px) {
  .dual { grid-template-columns: 1fr; }
  .content { padding: 24px 20px 60px; }
  h1 { font-size: 1.8rem; }
  h2 { font-size: 1.35rem; }
}

@media (max-width: 768px) {
  .menu-toggle { display: flex; }
  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    transform: translateX(-100%);
    transition: transform .25s ease;
    z-index: 60;
    box-shadow: var(--shadow);
  }
  .sidebar.open { transform: translateX(0); }
  .content {
    padding: 20px 16px 50px;
    width: 100%;
  }
}

@media (max-width: 480px) {
  .brand-text { display: none; }
  .content { padding: 16px 12px 40px; }
  pre { font-size: .8rem; padding: 10px 12px; }
  .nav-group-title { margin-left: 4px; }
}

/* ===================== SCROLLBAR (Webkit) ===================== */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--c-bg); }
::-webkit-scrollbar-thumb {
  background: var(--c-border);
  border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover { background: var(--c-text-muted); }

/* Petit ajustement highlight.js pour s'intégrer au thème */
.hljs { background: transparent !important; padding: 0 !important; }
