/*
 * Stats PESTO -- stylesheet.
 * Base copied from /Users/eartigau/GitHubProjects/themes_outils/theme.css
 * (eartigau's shared tool design system, see DESIGN_SYSTEM.md there),
 * with additions at the bottom for the bilingual FR/EN toggle and the
 * scripts table on this specific page.
 */

:root {
  --bg: #08111f;
  --bg2: #111f36;
  --card: rgba(14, 24, 42, 0.82);
  --text: #e8eef8;
  --muted: #a8b4ca;
  --accent: #62c2ff;
  --line: rgba(200, 220, 255, 0.16);
}

* {
  box-sizing: border-box;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

body {
  margin: 0;
  color: var(--text);
  background: radial-gradient(1200px 600px at 8% 0%, #14325f 0%, var(--bg) 45%),
              linear-gradient(160deg, #0a1424 0%, var(--bg2) 100%);
  font-family: "Space Grotesk", sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

.bg-orb {
  position: fixed;
  border-radius: 999px;
  filter: blur(50px);
  opacity: 0.25;
  z-index: -1;
}

.orb-a {
  width: 320px;
  height: 320px;
  background: #26a1ff; /* shared blue, kept across all tools */
  top: -60px;
  left: -80px;
}

.orb-b {
  width: 420px;
  height: 420px;
  background: #6ce2ad;
  right: -140px;
  bottom: -140px;
}

/* -- Banner --------------------------------------------------------- */

.site-banner {
  background: linear-gradient(135deg, #0d1a2e 0%, #1c3a5e 100%);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35);
  position: relative;
}

.site-banner-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.site-banner-text {
  flex: 1;
  min-width: 0;
}

.site-banner-text h2 {
  margin: 0;
  font-size: 1.05rem;
  color: #fff;
}

.site-banner-text p {
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: rgba(232, 238, 248, 0.7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.home-link {
  display: inline-block;
  flex-shrink: 0;
  font-size: 0.78rem;
  font-weight: 700;
  color: rgba(232, 238, 248, 0.85);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(232, 238, 248, 0.25);
  background: rgba(255, 255, 255, 0.06);
}

.home-link:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.5);
  text-decoration: none;
}

/* -- Hero ------------------------------------------------------------ */

.hero {
  max-width: 1180px;
  margin: 0 auto;
  padding: 44px 20px 22px;
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.78rem;
  font-weight: 700;
}

h1 {
  margin: 8px 0 10px;
  font-size: clamp(2.2rem, 4.5vw, 4rem);
  line-height: 1;
}

.subtitle {
  margin: 0;
  max-width: 70ch;
  color: var(--muted);
  font-size: 1rem;
}

/* -- Layout / cards --------------------------------------------------- */

.layout {
  max-width: 1180px;
  margin: 0 auto;
  padding: 8px 20px 28px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  backdrop-filter: blur(8px);
}

.span-2 {
  grid-column: span 2;
}

.span-3 {
  grid-column: span 3;
}

h2 {
  margin: 0 0 10px;
  font-size: 1.08rem;
}

.hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.feature-list {
  margin: 0;
  padding-left: 18px;
}

.feature-list li {
  margin: 0 0 8px;
  color: #d3dff2;
}

/* -- Code blocks -------------------------------------------------------- */

.codeblock {
  margin: 0;
  padding: 12px;
  border-radius: 10px;
  background: rgba(4, 8, 16, 0.9);
  border: 1px solid rgba(130, 180, 240, 0.25);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.87rem;
  line-height: 1.45;
  white-space: pre;
  overflow-x: auto;
}

/* -- Images, galleries, lightbox --------------------------------------- */

.image-frame {
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(3, 8, 15, 0.8);
  overflow: hidden;
}

img {
  display: block;
  width: 100%;
  height: auto;
}

.image-frame img,
.gallery-item img,
.lecture-figure img {
  cursor: zoom-in;
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.image-frame img:hover,
.gallery-item img:hover,
.lecture-figure img:hover {
  opacity: 0.88;
}

.gallery-grid {
  display: grid;
  gap: 10px;
}

.gallery-item {
  margin: 0;
  border: 1px solid rgba(143, 176, 220, 0.2);
  border-radius: 10px;
  overflow: hidden;
  background: rgba(6, 13, 24, 0.72);
}

.lecture-figure {
  margin: 0;
}

.lecture-figure img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid rgba(143, 176, 220, 0.2);
  background: rgba(6, 13, 24, 0.72);
}

.lecture-figure figcaption {
  margin-top: 7px;
  color: #a9c0df;
  font-size: 0.86rem;
  max-width: 95ch;
}

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 40px 20px;
  background: rgba(4, 8, 16, 0.92);
  backdrop-filter: blur(4px);
  cursor: zoom-out;
}

.lightbox[hidden] {
  display: none;
}

.lightbox-figure {
  margin: 0;
  max-width: min(92vw, 1200px);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  cursor: default;
}

.lightbox-figure img {
  max-width: 100%;
  max-height: 76vh;
  width: auto;
  height: auto;
  border-radius: 10px;
  border: 1px solid rgba(143, 176, 220, 0.3);
  cursor: default;
}

.lightbox-figure figcaption {
  color: #d9e6fa;
  font-size: 0.9rem;
  text-align: center;
  max-width: 80ch;
}

.lightbox-close {
  position: fixed;
  top: 18px;
  right: 24px;
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(14, 24, 42, 0.9);
  color: var(--text);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.lightbox-close:hover {
  background: rgba(24, 38, 62, 0.95);
}

/* -- Stat tiles ----------------------------------------------------------- */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.stat {
  border: 1px solid rgba(143, 176, 220, 0.2);
  border-radius: 10px;
  padding: 10px;
  background: rgba(6, 13, 24, 0.72);
}

.stat .label {
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 4px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.stat .value {
  font-size: 0.98rem;
  font-family: "IBM Plex Mono", monospace;
}

/* -- Footer ----------------------------------------------------------------- */

.footer {
  max-width: 1180px;
  margin: 0 auto;
  padding: 6px 20px 24px;
  color: var(--muted);
  font-size: 0.82rem;
}

/* -- Responsive --------------------------------------------------------- */

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr 1fr;
  }

  .span-2 {
    grid-column: span 2;
  }

  .span-3 {
    grid-column: span 2;
  }
}

@media (max-width: 720px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .span-2 {
    grid-column: span 1;
  }

  .span-3 {
    grid-column: span 1;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .gallery-grid {
    grid-template-columns: 1fr !important;
  }

  .site-banner-text p {
    display: none;
  }
}

/* =====================================================================
   Stats-PESTO-specific additions (not part of the shared base theme.css)
   ===================================================================== */

/* -- Bilingual toggle ----------------------------------------------------
   Convention used throughout index.html: any element carrying a `lang`
   attribute of "fr" or "en" is a language-specific block. The <html>
   element's `data-lang` attribute (set by static/main.js) picks which one
   is visible. Elements with no `lang` attribute (headings that happen to
   be identical in both languages, code, numbers) are always shown. */
html[data-lang="fr"] [lang="en"] {
  display: none;
}

html[data-lang="en"] [lang="fr"] {
  display: none;
}

.lang-switch {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.lang-btn {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.76rem;
  font-weight: 500;
  color: rgba(232, 238, 248, 0.7);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(232, 238, 248, 0.25);
  border-radius: 999px;
  padding: 5px 11px;
  cursor: pointer;
}

.lang-btn:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.5);
}

.lang-btn.active {
  color: #08111f;
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 700;
}

/* -- Scripts table --------------------------------------------------- */

.code-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.code-table td {
  padding: 8px 10px;
  border-top: 1px solid var(--line);
  vertical-align: top;
}

.code-table tr:first-child td {
  border-top: none;
}

.code-table td:first-child {
  font-family: "IBM Plex Mono", monospace;
  color: var(--accent);
  white-space: nowrap;
  width: 1%;
}

.code-table td:not(:first-child) {
  color: #d3dff2;
}
