/* =========================================================
   DEFSQUARE DESIGN SYSTEM
   Reusable visual language for slides, decks and documents.
   ========================================================= */

/* ---------- Design tokens ---------- */
:root {
  /* ---- Brand palette (from defsquare brand sheet) ---- */

  /* Primary — Bleu (#172741) */
  --defsquare-primary:        #172741;
  --defsquare-primary-50:     #418ced;
  --defsquare-primary-100:    #3573c3;
  --defsquare-primary-200:    #2a5a98;
  --defsquare-primary-300:    #1e416e;
  --defsquare-primary-400:    #272B3D;
  --defsquare-primary-500:    #172741;
  --defsquare-primary-600:    #122843;
  --defsquare-primary-700:    #070f19;

  /* Accent — Rouge (#F65E5E) */
  --defsquare-accent:         #F65E5E;
  --defsquare-accent-50:      #cb4e4e;
  --defsquare-accent-100:     #a13e3e;
  --defsquare-accent-200:     #762d2d;
  --defsquare-accent-300:     #4c1d1d;
  --defsquare-accent-400:     #210d0d;
  /* Accent — Rose variant */
  --defsquare-accent-rose-100:#e94b73;
  --defsquare-accent-rose-200:#bf3d5e;
  --defsquare-accent-rose-300:#942f49;
  --defsquare-accent-rose-400:#6a2234;
  --defsquare-accent-rose-500:#3f141f;
  --defsquare-accent-rose-600:#15070a;

  /* Secondary — Beige (#E2CA9E) */
  --defsquare-secondary:      #E2CA9E;
  --defsquare-secondary-50:   #EDE2CF;
  --defsquare-secondary-100:  #b7a480;
  --defsquare-secondary-200:  #8d7e63;
  --defsquare-secondary-300:  #625845;
  --defsquare-secondary-400:  #383227;
  --defsquare-secondary-500:  #0d0c09;

  /* Neutral — (#9fb1d6) */
  --defsquare-neutral:        #9fb1d6;

  /* Complementary tones */
  --defsquare-comp-green:     #3dbf9e;
  --defsquare-comp-blue:      #9eb6e2;

  /* ---- Aliases used by components ---- */
  --defsquare-coral:          var(--defsquare-accent);
  --defsquare-coral-soft:     var(--defsquare-accent-50);
  --defsquare-navy:           var(--defsquare-primary);
  --defsquare-navy-deep:      var(--defsquare-primary-700);
  --defsquare-navy-soft:      var(--defsquare-primary-300);

  /* Neutral surfaces */
  --defsquare-bg:             #ececec;
  --defsquare-surface:        #ffffff;
  --defsquare-ink:            var(--defsquare-primary);
  --defsquare-ink-soft:       #2d2d2d;
  --defsquare-muted:          #555555;
  --defsquare-border:         rgba(23, 39, 65, 0.28);

  /* Syntax (dark code theme) */
  --defsquare-code-bg: var(--defsquare-primary);
  --defsquare-code-fg: #d6deea;
  --defsquare-code-comment: #6a8caf;
  --defsquare-code-annotation: #5fb3ff;
  --defsquare-code-keyword: #ff7b72;
  --defsquare-code-type: #ffd479;
  --defsquare-code-string: #ff9a6b;
  --defsquare-code-method: #a5d6a7;
  --defsquare-code-builder: #ffd479;
  --defsquare-code-number: #ff9a6b;
  --defsquare-code-constant: #ff7b72;

  /* Typography */
  --defsquare-font-serif: "EB Garamond", "Source Serif Pro", Georgia, serif;
  --defsquare-font-sans: "IBM Plex Sans Condensed", "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --defsquare-font-mono: "JetBrains Mono", "Fira Code", "SF Mono", Menlo, Consolas, monospace;

  /* Radius & shadow */
  --defsquare-radius-card: 14px;
  --defsquare-radius-card-lg: 20px;
  --defsquare-shadow-card: 0 6px 20px rgba(15, 36, 56, 0.08), 0 2px 6px rgba(15, 36, 56, 0.05);
  --defsquare-shadow-card-lg: 0 12px 32px rgba(15, 36, 56, 0.12), 0 4px 10px rgba(15, 36, 56, 0.06);
}

/* ---------- Base reset & page ---------- */
*, *::before, *::after { box-sizing: border-box; }

body.defsquare-page {
  margin: 0;
  padding: 0;
  background: var(--defsquare-bg);
  font-family: var(--defsquare-font-sans);
  color: var(--defsquare-ink);
  -webkit-font-smoothing: antialiased;
}

/* ---------- Slide container ---------- */
.defsquare-slide {
  width: 1920px;
  height: 1080px;
  margin: 0 auto;
  padding: 20px 36px 28px;
  background: var(--defsquare-bg);
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ---------- Stage (responsive slide host) ----------
   The stage wraps a fixed 1920x1080 slide and scales it uniformly via
   the --defsquare-slide-scale CSS variable that defsquare-slide.js sets.
   Two modes are toggled with the body classes below.                    */
.defsquare-stage {
  position: relative;
  width: 100vw;
  display: flex;
  justify-content: center;
}

.defsquare-stage > .defsquare-slide,
.defsquare-stage > .defsquare-cover,
.defsquare-stage > .defsquare-section {
  flex: 0 0 auto;
  transform: scale(var(--defsquare-slide-scale, 1));
  transform-origin: top center;
}

/* Fit mode: full-viewport, anchored to the top, no scroll. Letterboxes
   when the viewport aspect ratio differs from 16:9 — any extra vertical
   space falls below the slide so the title is never pushed down.        */
.defsquare-page--fit { overflow: hidden; }
.defsquare-page--fit .defsquare-stage {
  position: fixed;
  inset: 0;
  align-items: flex-start;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}

/* Width mode: slide always fills viewport width; body scrolls vertically
   if the scaled slide is taller than the viewport.                      */
.defsquare-page--width { min-height: 100vh; }
.defsquare-page--width .defsquare-stage {
  align-items: flex-start;
  /* explicit height (1080 * scale) written by defsquare-slide.js */
}

/* ---------- Slide number (injected by defsquare-slide.js from slides.js) ---------- */
.defsquare-slide-number {
  position: absolute;
  bottom: 22px;
  right: 36px;
  font-family: var(--defsquare-font-mono);
  font-size: 15px;
  color: var(--defsquare-muted);
  letter-spacing: 0.02em;
  z-index: 5;
}
.defsquare-cover .defsquare-slide-number,
.defsquare-section .defsquare-slide-number {
  color: rgba(255, 255, 255, 0.55);
}

/* ---------- Title bar (hero card) ---------- */
.defsquare-title-bar {
  background: var(--defsquare-surface);
  border: 1px solid var(--defsquare-border);
  border-radius: var(--defsquare-radius-card-lg);
  box-shadow: var(--defsquare-shadow-card-lg);
  padding: 10px;
}

.defsquare-title-bar__inner {
  background: linear-gradient(45deg,
    var(--defsquare-primary-700) 0%,
    var(--defsquare-primary) 50%,
    var(--defsquare-primary-300) 100%);
  border-radius: 12px;
  padding: 18px 56px;
  text-align: center;
}

.defsquare-title {
  font-family: var(--defsquare-font-serif);
  font-weight: 700;
  font-size: 60px;
  line-height: 1.08;
  color: var(--defsquare-surface);
  margin: 0;
  letter-spacing: 0.5px;
}

.defsquare-title__accent {
  color: var(--defsquare-coral);
}

/* ---------- Card ---------- */
.defsquare-card {
  background: var(--defsquare-surface);
  border: 1px solid var(--defsquare-border);
  border-radius: var(--defsquare-radius-card);
  box-shadow: var(--defsquare-shadow-card);
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.defsquare-card--dark {
  background: var(--defsquare-code-bg);
  color: var(--defsquare-code-fg);
}

.defsquare-card__title {
  font-family: var(--defsquare-font-sans);
  font-weight: 800;
  font-size: 34px;
  line-height: 1.2;
  color: var(--defsquare-ink);
  margin: 0 0 4px 0;
  letter-spacing: -0.2px;
}

.defsquare-card__body {
  font-size: 22px;
  line-height: 1.28;
  color: var(--defsquare-ink-soft);
  overflow-wrap: anywhere;
}

.defsquare-card__body ol,
.defsquare-card__body ul {
  padding-left: 22px;
  margin: 4px 0;
}

.defsquare-card__body ol > li {
  font-weight: 700;
  margin-bottom: 6px;
}

.defsquare-card__body ol > li > ul {
  font-weight: 400;
  list-style: none;
  padding-left: 0;
  margin-top: 4px;
}

.defsquare-card__body ol > li > ul > li {
  position: relative;
  padding-left: 16px;
  margin-bottom: 2px;
}

.defsquare-card__body ol > li > ul > li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--defsquare-ink-soft);
}

.defsquare-card__body .defsquare-lead {
  font-weight: 700;
  color: var(--defsquare-ink);
}

.defsquare-card__body p { margin: 4px 0; }

/* ---------- Code block ---------- */
.defsquare-code {
  background: var(--defsquare-code-bg);
  color: var(--defsquare-code-fg);
  border: 1px solid var(--defsquare-border);
  border-radius: var(--defsquare-radius-card);
  box-shadow: var(--defsquare-shadow-card);
  padding: 28px 32px;
  font-family: var(--defsquare-font-mono);
  font-size: 18px;
  line-height: 1.55;
  white-space: pre;
  overflow-x: auto;
  overflow-y: hidden;
  tab-size: 4;
  scrollbar-width: thin;
  scrollbar-color: var(--defsquare-navy-soft) transparent;
}

.defsquare-code::-webkit-scrollbar {
  height: 10px;
}

.defsquare-code::-webkit-scrollbar-track {
  background: transparent;
}

.defsquare-code::-webkit-scrollbar-thumb {
  background: var(--defsquare-navy-soft);
  border-radius: 6px;
}

.defsquare-code::-webkit-scrollbar-thumb:hover {
  background: var(--defsquare-coral);
}

/* Syntax tokens */
.defsquare-code .tk-annotation { color: var(--defsquare-code-annotation); }
.defsquare-code .tk-keyword    { color: var(--defsquare-code-keyword); }
.defsquare-code .tk-type       { color: var(--defsquare-code-type); }
.defsquare-code .tk-method     { color: var(--defsquare-code-method); }
.defsquare-code .tk-builder    { color: var(--defsquare-code-builder); }
.defsquare-code .tk-string     { color: var(--defsquare-code-string); }
.defsquare-code .tk-number     { color: var(--defsquare-code-number); }
.defsquare-code .tk-comment    { color: var(--defsquare-code-comment); font-style: italic; }
.defsquare-code .tk-const      { color: var(--defsquare-code-constant); }
.defsquare-code .tk-var        { color: var(--defsquare-code-fg); }
.defsquare-code .tk-punc       { color: #9fb3c8; }

/* ---------- Flow / step list ---------- */
.defsquare-flow {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  font-size: 22px;
  line-height: 1.22;
}

.defsquare-flow__step {
  display: block;
}

.defsquare-flow__arrow {
  color: var(--defsquare-ink-soft);
  font-size: 24px;
  margin: 2px 0 2px 6px;
}

.defsquare-flow__note {
  margin-top: 10px;
  font-size: 22px;
  font-style: italic;
  color: var(--defsquare-ink-soft);
}

/* ---------- Spec list (label : value) ---------- */
.defsquare-spec {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 22px;
  line-height: 1.28;
  color: var(--defsquare-ink-soft);
}

.defsquare-spec > li { margin-bottom: 2px; }

.defsquare-spec b {
  color: var(--defsquare-ink);
  font-weight: 700;
}

/* ---------- Logo ---------- */
.defsquare-logo {
  display: inline-flex;
  align-items: center;
  height: 40px;
}

.defsquare-logo img,
.defsquare-logo svg {
  height: 100%;
  width: auto;
  display: block;
}

/* ---------- Brand mark (inline [defsquare] text) ---------- */
.defsquare-brand-mark {
  font-family: var(--defsquare-font-sans);
  font-weight: 600;
  color: var(--defsquare-surface);
  display: inline-flex;
  align-items: baseline;
  letter-spacing: 0.5px;
  line-height: 1;
}

.defsquare-brand-mark::before,
.defsquare-brand-mark::after {
  color: var(--defsquare-coral);
  font-weight: 700;
}
.defsquare-brand-mark::before { content: "["; margin-right: 2px; }
.defsquare-brand-mark::after  { content: "]"; margin-left: 2px; }

.defsquare-brand-mark--on-light {
  color: var(--defsquare-ink);
}

/* ---------- Cover slide ---------- */
.defsquare-cover {
  width: 1920px;
  height: 1080px;
  margin: 0 auto;
  background: linear-gradient(45deg,
    var(--defsquare-primary-700) 0%,
    var(--defsquare-primary) 50%,
    var(--defsquare-primary-300) 100%);
  padding: 90px 140px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  color: var(--defsquare-surface);
  overflow: hidden;
}

.defsquare-cover__title {
  font-family: var(--defsquare-font-serif);
  font-weight: 700;
  font-size: 140px;
  line-height: 1.02;
  color: var(--defsquare-coral);
  margin: 0;
  letter-spacing: 0.5px;
}

.defsquare-cover__subtitle {
  font-family: var(--defsquare-font-serif);
  font-weight: 700;
  font-size: 96px;
  line-height: 1.05;
  color: var(--defsquare-surface);
  margin: 6px 0 0;
}

.defsquare-cover__divider {
  height: 2px;
  background: var(--defsquare-neutral);
  border: none;
  margin: 36px 0 44px;
  width: 100%;
}

.defsquare-cover__author {
  font-family: var(--defsquare-font-sans);
  font-weight: 500;
  font-size: 44px;
  color: var(--defsquare-surface);
  margin: 0 0 28px;
}

.defsquare-cover__brand {
  height: 60px;
  width: auto;
  display: block;
  align-self: flex-start;
  margin-right: auto;
}

/* ---------- Section divider (chapter intro) ---------- */
.defsquare-section {
  width: 1920px;
  height: 1080px;
  margin: 0 auto;
  background: linear-gradient(45deg,
    var(--defsquare-primary-700) 0%,
    var(--defsquare-primary) 50%,
    var(--defsquare-primary-300) 100%);
  padding: 120px 140px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  color: var(--defsquare-surface);
  overflow: hidden;
}

/* Oversized faint chapter numeral, decorative */
.defsquare-section__numeral {
  position: absolute;
  top: 50%;
  right: 96px;
  transform: translateY(-50%);
  font-family: var(--defsquare-font-serif);
  font-weight: 700;
  font-size: 620px;
  line-height: 1;
  color: rgba(255, 255, 255, 0.06);
  pointer-events: none;
  user-select: none;
}

.defsquare-section__eyebrow {
  font-family: var(--defsquare-font-sans);
  font-weight: 700;
  font-size: 34px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--defsquare-coral);
  margin: 0 0 22px;
  position: relative;
}

.defsquare-section__title {
  font-family: var(--defsquare-font-serif);
  font-weight: 700;
  font-size: 120px;
  line-height: 1.02;
  color: var(--defsquare-surface);
  margin: 0;
  letter-spacing: 0.5px;
  position: relative;
  max-width: 1400px;
}

.defsquare-section__title .defsquare-section__accent {
  color: var(--defsquare-coral);
}

.defsquare-section__rule {
  height: 4px;
  width: 160px;
  background: var(--defsquare-coral);
  border: none;
  margin: 40px 0 0;
  position: relative;
}

.defsquare-section__subtitle {
  font-family: var(--defsquare-font-sans);
  font-weight: 400;
  font-size: 40px;
  line-height: 1.25;
  color: var(--defsquare-neutral);
  margin: 34px 0 0;
  max-width: 1250px;
  position: relative;
}

.defsquare-section__brand {
  height: 48px;
  width: auto;
  display: block;
  align-self: flex-start;
  margin: 64px 0 0;
  position: relative;
}
