/* ============================================================
   FINA 30290 — Prep Exam Final
   Design system inspiré de Stripe (cf. DESIGN.md)
   ============================================================ */

:root {
  /* Primary */
  --purple:         #533afd;
  --purple-hover:   #4434d4;
  --purple-deep:    #2e2b8c;
  --purple-mid:     #665efd;
  --purple-light:   #b9b9f9;
  --purple-soft:    #d6d9fc;

  /* Brand */
  --brand-dark:     #1c1e54;
  --dark-navy:      #0d253d;

  /* Text */
  --heading:        #061b31;
  --label:          #273951;
  --body:           #64748d;

  /* Surfaces */
  --white:          #ffffff;
  --surface-alt:    #f6f9fc;
  --border:         #e5edf5;
  --border-purple:  #b9b9f9;
  --border-magenta: #ffd7ef;

  /* Accents */
  --success:        #15be53;
  --success-text:   #108c3d;
  --lemon:          #9b6829;
  --ruby:           #ea2261;
  --magenta:        #f96bee;
  --magenta-light:  #ffd7ef;

  /* Danger (not in stripe palette — using ruby family) */
  --danger:         #d81e49;
  --danger-bg:      rgba(234, 34, 97, 0.08);

  /* Shadows */
  --shadow-ambient:  rgba(23,23,23,0.06) 0px 3px 6px;
  --shadow-standard: rgba(23,23,23,0.08) 0px 15px 35px 0px;
  --shadow-elevated: rgba(50,50,93,0.25) 0px 30px 45px -30px, rgba(0,0,0,0.1) 0px 18px 36px -18px;
  --shadow-deep:     rgba(3,3,39,0.25) 0px 14px 21px -14px, rgba(0,0,0,0.1) 0px 8px 17px -8px;

  /* Radius scale */
  --r-xs: 4px;
  --r-sm: 5px;
  --r-md: 6px;
  --r-lg: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 16px; }

body {
  font-family: 'sohne-var', 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-feature-settings: "ss01";
  font-weight: 300;
  background: var(--white);
  color: var(--body);
  line-height: 1.40;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--purple);
  text-decoration: none;
  font-weight: 400;
}
a:hover { color: var(--purple-hover); text-decoration: underline; }

/* ---------- Typography ---------- */
h1 {
  font-size: 2.00rem;         /* 32px */
  font-weight: 300;
  line-height: 1.10;
  letter-spacing: -0.64px;
  color: var(--heading);
  margin-bottom: 8px;
}
h2 {
  font-size: 1.63rem;         /* 26px */
  font-weight: 300;
  line-height: 1.12;
  letter-spacing: -0.26px;
  color: var(--heading);
  margin: 20px 0 10px;
}
h3 {
  font-size: 1.38rem;         /* 22px */
  font-weight: 300;
  line-height: 1.10;
  letter-spacing: -0.22px;
  color: var(--heading);
  margin: 14px 0 8px;
}
h4 {
  font-size: 1.00rem;
  font-weight: 400;
  color: var(--heading);
  margin: 10px 0 6px;
}

p {
  font-size: 1.00rem;
  font-weight: 300;
  color: var(--body);
  margin-bottom: 10px;
}

.display-hero {
  font-size: 3.50rem;          /* 56px */
  font-weight: 300;
  line-height: 1.03;
  letter-spacing: -1.4px;
  color: var(--heading);
}

.subtitle {
  font-size: 1.13rem;         /* 18px */
  font-weight: 300;
  line-height: 1.40;
  color: var(--body);
  margin-bottom: 24px;
}

.caption {
  font-size: 0.81rem;
  font-weight: 400;
  color: var(--body);
}

.label-text {
  font-size: 0.88rem;
  font-weight: 400;
  color: var(--label);
}

.num, .tnum, td.num, th.num {
  font-feature-settings: "tnum";
  font-variant-numeric: tabular-nums;
}

code, .mono {
  font-family: 'SourceCodePro', 'SF Mono', Menlo, Consolas, monospace;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 2.00;
}

/* ---------- Layout ---------- */
.container { max-width: 1080px; margin: 0 auto; padding: 0 24px; }

header.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 14px 0;
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.site-header .container {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "brand nav"
    "brand search";
  column-gap: 24px;
  row-gap: 8px;
}
.site-header .brand {
  grid-area: brand;
  font-weight: 600;
  font-size: 1.00rem;
  color: var(--heading);
  letter-spacing: -0.2px;
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  gap: 2px;
  padding-top: 4px;
}
.site-header .brand small {
  font-weight: 300;
  color: var(--body);
  font-size: 0.81rem;
  margin-left: 0;
}
.site-header nav {
  grid-area: nav;
  justify-self: end;
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  align-items: center;
}
.site-header nav a {
  color: var(--heading);
  padding: 6px 12px;
  border-radius: var(--r-md);
  font-size: 0.88rem;
  font-weight: 400;
}
.site-header nav a:hover {
  background: rgba(83, 58, 253, 0.05);
  text-decoration: none;
}
.site-header nav a.active {
  color: var(--purple);
  background: rgba(83, 58, 253, 0.08);
}

main { padding: 36px 0 80px; }

/* ---------- Buttons ---------- */
button {
  font-family: inherit;
  font-feature-settings: "ss01";
  font-size: 1.00rem;
  font-weight: 400;
  line-height: 1.00;
  padding: 8px 16px;
  border-radius: var(--r-xs);
  border: 1px solid var(--border);
  background: var(--white);
  color: var(--heading);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
button:hover:not(:disabled) {
  background: var(--surface-alt);
  border-color: var(--border-purple);
}
button:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 2px;
}
button:disabled { opacity: 0.5; cursor: not-allowed; }

button.primary {
  background: var(--purple);
  color: var(--white);
  border-color: var(--purple);
}
button.primary:hover:not(:disabled) {
  background: var(--purple-hover);
  border-color: var(--purple-hover);
}

button.ghost {
  background: transparent;
  color: var(--purple);
  border: 1px solid var(--border-purple);
}
button.ghost:hover:not(:disabled) {
  background: rgba(83, 58, 253, 0.05);
}

button.danger {
  background: var(--danger);
  color: var(--white);
  border-color: var(--danger);
}
button.danger:hover:not(:disabled) { background: #b01038; border-color: #b01038; }

button.small {
  font-size: 0.88rem;
  padding: 6px 12px;
}

/* ---------- Inputs ---------- */
input, select, textarea {
  font-family: inherit;
  font-feature-settings: "ss01";
  font-size: 1.00rem;
  font-weight: 300;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  background: var(--white);
  color: var(--heading);
  width: 100%;
  line-height: 1.40;
}
input[type="number"] { font-feature-settings: "tnum"; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(83, 58, 253, 0.15);
}

label {
  display: block;
  font-size: 0.88rem;
  font-weight: 400;
  color: var(--label);
  margin-bottom: 4px;
}

/* ---------- Cards ---------- */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 20px 22px;
  box-shadow: var(--shadow-standard);
  margin-bottom: 16px;
}
.card.featured {
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-elevated);
}
.card.flat {
  box-shadow: none;
}
.card-title {
  font-size: 1.38rem;
  font-weight: 300;
  letter-spacing: -0.22px;
  color: var(--heading);
  margin-bottom: 10px;
}
.card-subtitle {
  font-size: 0.88rem;
  color: var(--body);
  margin-bottom: 12px;
}

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.flex { display: flex; gap: 10px; align-items: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.flex-col { display: flex; flex-direction: column; gap: 10px; }

.stack > * + * { margin-top: 12px; }

.muted { color: var(--body); font-size: 0.88rem; }
.small { font-size: 0.81rem; }
.big-num {
  font-size: 2.00rem;
  font-weight: 300;
  line-height: 1.10;
  letter-spacing: -0.64px;
  color: var(--heading);
  font-feature-settings: "tnum";
}

/* ---------- Badges ---------- */
.badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: var(--r-xs);
  font-size: 0.625rem;
  font-weight: 400;
  background: var(--white);
  color: var(--body);
  border: 1px solid var(--border);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.badge.primary {
  background: rgba(83, 58, 253, 0.08);
  color: var(--purple);
  border-color: var(--border-purple);
}
.badge.success {
  background: rgba(21, 190, 83, 0.2);
  color: var(--success-text);
  border-color: rgba(21, 190, 83, 0.4);
}
.badge.warning {
  background: rgba(155, 104, 41, 0.08);
  color: var(--lemon);
  border-color: rgba(155, 104, 41, 0.3);
}
.badge.danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: rgba(234, 34, 97, 0.3);
}
.badge.magenta {
  background: var(--magenta-light);
  color: #ba2b78;
  border-color: var(--border-magenta);
}

/* ---------- Tables ---------- */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0;
  font-size: 0.88rem;
}
th, td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
th {
  font-weight: 400;
  color: var(--label);
  background: var(--surface-alt);
}
td { color: var(--body); }
tr:hover td { background: var(--surface-alt); }
td.num, th.num {
  text-align: right;
  font-feature-settings: "tnum";
}

/* ---------- Progress ---------- */
.progress {
  width: 100%;
  height: 6px;
  background: var(--surface-alt);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: var(--purple);
  transition: width 0.3s;
}
.progress-bar.success { background: var(--success); }
.progress-bar.warning { background: var(--lemon); }
.progress-bar.danger { background: var(--danger); }

/* ---------- Alerts ---------- */
.alert {
  padding: 14px 16px;
  border-radius: var(--r-md);
  border-left: 3px solid var(--purple);
  background: rgba(83, 58, 253, 0.04);
  margin: 12px 0;
  font-size: 0.94rem;
}
.alert.success { border-color: var(--success); background: rgba(21, 190, 83, 0.05); }
.alert.warning { border-color: var(--lemon); background: rgba(155, 104, 41, 0.05); }
.alert.danger  { border-color: var(--danger); background: var(--danger-bg); }

/* ---------- Formula ---------- */
.formula {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 18px;
  margin: 10px 0;
  font-family: 'Cambria Math', 'Times New Roman', serif;
  font-size: 1.05rem;
  text-align: center;
  color: var(--heading);
}
/* Tooltips dans les formules : plus subtils, pas de sous-ligne dashed */
.formula .tooltip {
  border-bottom: none;
  background: rgba(83, 58, 253, 0.06);
  padding: 0 3px;
  border-radius: 2px;
  color: var(--heading);
  cursor: help;
  transition: background 0.12s;
}
.formula .tooltip:hover, .formula .tooltip:focus {
  background: rgba(83, 58, 253, 0.18);
}
.formula .label {
  display: block;
  font-size: 0.75rem;
  color: var(--body);
  font-family: inherit;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 6px;
}

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.tab {
  padding: 10px 16px;
  border: none;
  background: transparent;
  color: var(--body);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  border-radius: 0;
  font-weight: 400;
  font-size: 0.94rem;
}
.tab.active {
  color: var(--purple);
  border-bottom-color: var(--purple);
}
.tab:hover:not(.active) {
  background: var(--surface-alt);
  border-color: transparent;
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; }
.field-inline { display: flex; gap: 10px; align-items: center; }
.field-inline label { margin-bottom: 0; flex: 0 0 180px; font-size: 0.88rem; }
.field-suffix { display: flex; align-items: center; gap: 6px; }
.field-suffix input { flex: 1; }
.field-suffix .suffix { color: var(--body); font-size: 0.88rem; white-space: nowrap; }

.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: auto; }
.checkbox-row label { margin-bottom: 0; cursor: pointer; }

/* ---------- QCM ---------- */
.question-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 22px 24px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-standard);
}
.options-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}
.option {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-xs);
  background: var(--white);
  cursor: pointer;
  text-align: left;
  width: 100%;
  display: flex;
  gap: 12px;
  transition: border-color 0.15s, background 0.15s;
  font-weight: 300;
  font-size: 0.94rem;
  color: var(--heading);
}
.option:hover:not(:disabled) {
  border-color: var(--border-purple);
  background: var(--surface-alt);
}
.option .letter {
  font-weight: 400;
  color: var(--purple);
  flex: 0 0 24px;
}
.option.selected {
  border-color: var(--purple);
  background: rgba(83, 58, 253, 0.04);
}
.option.correct {
  border-color: var(--success);
  background: rgba(21, 190, 83, 0.08);
}
.option.incorrect {
  border-color: var(--danger);
  background: var(--danger-bg);
}

.feedback {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: var(--r-md);
  background: var(--surface-alt);
  border-left: 3px solid var(--purple);
  display: none;
  font-size: 0.94rem;
}
.feedback.show { display: block; }
.feedback.correct { border-left-color: var(--success); background: rgba(21, 190, 83, 0.05); }
.feedback.incorrect { border-left-color: var(--danger); background: var(--danger-bg); }
.feedback strong { font-weight: 400; color: var(--heading); }

/* ---------- Step tutor ---------- */
.step {
  display: none;
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--white);
  margin-bottom: 14px;
  box-shadow: var(--shadow-standard);
}
.step.active { display: block; }
.step-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  background: var(--purple);
  color: var(--white);
  border-radius: var(--r-xs);
  font-weight: 400;
  font-size: 0.94rem;
}

.step-list {
  display: flex;
  gap: 4px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.step-bullet {
  padding: 6px 12px;
  border-radius: var(--r-xs);
  background: var(--white);
  color: var(--body);
  font-size: 0.81rem;
  font-weight: 400;
  cursor: pointer;
  border: 1px solid var(--border);
}
.step-bullet.active {
  background: var(--purple);
  color: var(--white);
  border-color: var(--purple);
}
.step-bullet.done {
  background: rgba(21, 190, 83, 0.1);
  color: var(--success-text);
  border-color: rgba(21, 190, 83, 0.3);
}

/* ---------- Timer ---------- */
.timer-sticky {
  position: sticky;
  top: 52px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  padding: 10px 0;
  z-index: 50;
  box-shadow: 0px 0 6px rgba(0,55,112,0.08);
}
.timer-display {
  font-family: 'SourceCodePro', 'SF Mono', Menlo, monospace;
  font-size: 1.38rem;
  font-weight: 500;
  color: var(--heading);
  font-feature-settings: "tnum";
}
.timer-display.warn { color: var(--lemon); }
.timer-display.danger { color: var(--danger); }

/* ---------- Dark brand section ---------- */
.dark-section {
  background: var(--brand-dark);
  color: var(--white);
  border-radius: var(--r-lg);
  padding: 28px 30px;
  margin: 24px 0;
}
.dark-section h2, .dark-section h3 { color: var(--white); }
.dark-section p { color: rgba(255, 255, 255, 0.75); }
.dark-section .card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--white);
  box-shadow: none;
}

/* ---------- Tooltips (glossary) ---------- */
.tooltip {
  position: relative;
  border-bottom: 1px dashed var(--purple-light);
  cursor: help;
  color: var(--purple-deep);
  font-weight: 400;
}
.tooltip:hover, .tooltip:focus {
  outline: none;
  background: rgba(83, 58, 253, 0.06);
  border-bottom-color: var(--purple);
}
.tooltip::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  background: var(--brand-dark);
  color: var(--white);
  padding: 10px 14px;
  border-radius: var(--r-md);
  width: max-content;
  max-width: 320px;
  font-size: 0.81rem;
  line-height: 1.45;
  font-weight: 300;
  letter-spacing: 0;
  text-align: left;
  white-space: normal;
  z-index: 200;
  pointer-events: none;
  box-shadow: var(--shadow-elevated);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s, transform 0.15s;
}
.tooltip::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--brand-dark);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.15s;
  pointer-events: none;
}
.tooltip:hover::after, .tooltip:focus::after,
.tooltip:hover::before, .tooltip:focus::before {
  opacity: 1;
  visibility: visible;
  transform: translateX(-50%) translateY(0);
}

/* ---------- Theory page ---------- */
.toc {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px 20px;
  margin: 16px 0 28px;
}
.toc ul { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.toc li { margin: 0; }
.toc a {
  display: inline-block;
  padding: 4px 10px;
  border-radius: var(--r-xs);
  background: var(--white);
  border: 1px solid var(--border);
  font-size: 0.81rem;
  color: var(--heading);
  font-weight: 400;
}
.toc a:hover { background: rgba(83, 58, 253, 0.05); border-color: var(--border-purple); text-decoration: none; }

.theory-section {
  border-top: 1px solid var(--border);
  padding-top: 24px;
  margin-top: 32px;
  scroll-margin-top: 90px;
}
.theory-section:first-of-type { border-top: none; padding-top: 0; }

.theory-block {
  margin: 18px 0;
  padding: 16px 18px;
  border-left: 3px solid var(--purple);
  background: rgba(83, 58, 253, 0.03);
  border-radius: 0 var(--r-md) var(--r-md) 0;
}
.theory-block.example { border-left-color: var(--success); background: rgba(21, 190, 83, 0.04); }
.theory-block.warning { border-left-color: var(--lemon); background: rgba(155, 104, 41, 0.05); }
.theory-block .label-tag {
  display: inline-block;
  font-size: 0.625rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--purple);
  margin-bottom: 6px;
}
.theory-block.example .label-tag { color: var(--success-text); }
.theory-block.warning .label-tag { color: var(--lemon); }

/* ---------- Search ---------- */
.search-wrap {
  grid-area: search;
  justify-self: end;
  position: relative;
  min-width: 0;
  width: 340px;
  max-width: 100%;
}
.search-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 340px;
  max-width: 100%;
}
.search-input-wrap:focus-within {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px rgba(83, 58, 253, 0.12);
  background: var(--white);
}
.search-icon {
  position: absolute;
  left: 10px;
  color: var(--body);
  pointer-events: none;
}
#search-input {
  border: none;
  background: transparent;
  padding: 8px 44px 8px 34px;
  font-size: 0.88rem;
  font-weight: 400;
  color: var(--heading);
  width: 100%;
  border-radius: var(--r-md);
  height: 36px;
}
#search-input:focus {
  outline: none;
  box-shadow: none;
}
.search-kbd {
  position: absolute;
  right: 8px;
  font-family: 'SourceCodePro', 'SF Mono', monospace;
  font-size: 0.69rem;
  color: var(--body);
  background: var(--white);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 3px;
  pointer-events: none;
  opacity: 0.7;
}
.search-input-wrap:focus-within .search-kbd { opacity: 0; }

.search-results {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: auto;
  width: 420px;
  max-width: 100%;
  max-height: 60vh;
  overflow-y: auto;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-elevated);
  z-index: 150;
}
.search-empty {
  padding: 16px;
  color: var(--body);
  font-size: 0.88rem;
  text-align: center;
}
.search-result {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  transition: background 0.1s;
}
.search-result:last-child { border-bottom: none; }
.search-result-main { flex: 1 1 auto; min-width: 0; }

/* Items cliquables — visuellement actionables */
.search-result--link {
  cursor: pointer;
}
.search-result--link:hover, .search-result--link.active {
  background: rgba(83, 58, 253, 0.08);
  text-decoration: none;
}
.search-result--link:hover .search-result-arrow,
.search-result--link.active .search-result-arrow {
  opacity: 1;
  transform: translateX(2px);
  color: var(--purple);
}
.search-result-arrow {
  flex: 0 0 auto;
  font-size: 1.00rem;
  color: var(--body);
  opacity: 0.35;
  transition: opacity 0.15s, transform 0.15s, color 0.15s;
}

/* Items statiques (glossaire) — visuellement info-only */
.search-result--static {
  cursor: default;
  background: var(--surface-alt);
}
.search-result--static:hover { background: var(--surface-alt); }
.search-result--static .search-result-body {
  color: var(--heading);
  font-weight: 300;
}
.search-badge.search-badge--glossary {
  background: rgba(100, 116, 141, 0.1);
  color: var(--label);
}
.search-result-top {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 2px;
}
.search-badge {
  font-size: 0.63rem;
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--purple);
  background: rgba(83, 58, 253, 0.08);
  padding: 1px 6px;
  border-radius: 3px;
  flex: 0 0 auto;
  white-space: nowrap;
}
.search-result-title {
  font-size: 0.94rem;
  font-weight: 400;
  color: var(--heading);
}
.search-result-body {
  font-size: 0.81rem;
  color: var(--body);
  line-height: 1.4;
  font-weight: 300;
}

@media (max-width: 820px) {
  .site-header .container {
    grid-template-columns: 1fr;
    grid-template-areas:
      "brand"
      "nav"
      "search";
    row-gap: 10px;
  }
  .site-header nav { justify-self: start; }
  .search-wrap {
    justify-self: stretch;
    width: auto;
  }
  .search-results {
    left: 0;
    right: 0;
    width: auto;
    max-width: none;
  }
  .search-kbd { display: none; }
}

/* ---------- Notes widget ---------- */
#notes-widget {
  position: fixed;
  top: 50%;
  right: 20px;
  transform: translateY(-50%);
  z-index: 200;
  font-family: inherit;
}
#notes-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--white);
  color: var(--heading);
  border: 1px solid var(--border);
  border-radius: 999px;
  box-shadow: var(--shadow-elevated);
  font-size: 0.88rem;
  font-weight: 400;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, transform 0.12s;
}
#notes-toggle:hover {
  border-color: var(--purple);
  color: var(--purple);
  transform: translateY(-1px);
}
#notes-toggle.active {
  background: var(--purple);
  color: var(--white);
  border-color: var(--purple);
}
#notes-toggle .notes-icon { flex: 0 0 auto; display: block; }

#notes-panel {
  position: absolute;
  top: 50%;
  right: calc(100% + 10px);
  transform: translateY(-50%);
  width: min(400px, calc(100vw - 100px));
  height: min(400px, calc(100vh - 80px));
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-elevated);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.notes-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
  flex: 0 0 auto;
}
.notes-header strong {
  color: var(--heading);
  font-weight: 400;
  font-size: 0.94rem;
}
.notes-header .notes-sub {
  flex: 1 1 auto;
  font-size: 0.69rem;
  color: var(--body);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
#notes-close {
  background: transparent;
  border: none;
  color: var(--body);
  font-size: 1.25rem;
  line-height: 1;
  padding: 2px 8px;
  cursor: pointer;
  border-radius: var(--r-xs);
}
#notes-close:hover {
  background: rgba(0,0,0,0.05);
  color: var(--heading);
}
#notes-textarea {
  flex: 1 1 auto;
  border: none;
  border-radius: 0;
  padding: 12px 14px;
  font-family: 'SourceCodePro', 'SF Mono', Menlo, monospace;
  font-size: 0.81rem;
  font-weight: 500;
  line-height: 1.6;
  color: var(--heading);
  resize: none;
  width: 100%;
}
#notes-textarea:focus {
  outline: none;
  box-shadow: none;
  background: var(--white);
}
.notes-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  border-top: 1px solid var(--border);
  background: var(--surface-alt);
  flex: 0 0 auto;
}
.notes-count {
  font-size: 0.75rem;
  color: var(--body);
  font-feature-settings: "tnum";
}
.notes-clear {
  font-size: 0.75rem;
  padding: 4px 10px;
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(234, 34, 97, 0.25);
}
.notes-clear:hover:not(:disabled) {
  background: var(--danger-bg);
  border-color: var(--danger);
}

@media (max-width: 640px) {
  #notes-widget {
    top: auto;
    bottom: 14px;
    right: 14px;
    transform: none;
  }
  #notes-toggle .notes-label { display: none; }
  #notes-panel {
    height: 300px;
    width: min(340px, calc(100vw - 28px));
    top: auto;
    bottom: calc(100% + 10px);
    right: 0;
    transform: none;
  }
}

/* ---------- Calculator key sequences (sharp.html) ---------- */
.calc-sequence {
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 14px 16px;
  margin: 12px 0;
}
.calc-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font-size: 0.88rem;
  line-height: 1.5;
}
.calc-row .step-num {
  /* override du .step-num (style violet utilisé par le tuteur VAN) */
  flex: 0 0 24px;
  width: auto;
  height: auto;
  padding: 0;
  background: transparent;
  border-radius: 0;
  display: inline;
  font-size: 0.69rem;
  font-weight: 400;
  color: var(--body);
  font-feature-settings: "tnum";
}
.calc-keys {
  display: inline-flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
}
.calc-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  padding: 3px 8px;
  background: var(--white);
  color: var(--heading);
  border: 1px solid var(--border);
  border-bottom: 2px solid var(--border);
  border-radius: var(--r-xs);
  font-family: 'SourceCodePro', 'SF Mono', Menlo, monospace;
  font-size: 0.81rem;
  font-weight: 500;
  letter-spacing: -0.2px;
  white-space: nowrap;
  box-shadow: 0 1px 0 rgba(0,0,0,0.02);
}
.calc-key--2ndf {
  background: rgba(234, 34, 97, 0.06);
  color: var(--ruby);
  border-color: rgba(234, 34, 97, 0.25);
  border-bottom-color: rgba(234, 34, 97, 0.35);
}
.calc-key--op {
  background: rgba(83, 58, 253, 0.04);
  color: var(--purple);
  border-color: var(--border-purple);
  border-bottom-color: var(--purple-light);
}
.calc-arrow {
  color: var(--body);
  font-size: 0.75rem;
  margin: 0 2px;
}
.calc-display {
  flex: 1 1 auto;
  font-family: 'SourceCodePro', 'SF Mono', Menlo, monospace;
  font-size: 0.88rem;
  color: var(--heading);
  background: var(--dark-navy);
  color: #9df0b3;
  padding: 4px 10px;
  border-radius: var(--r-xs);
  font-feature-settings: "tnum";
  min-width: 120px;
  text-align: right;
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 18px 0 22px;
  margin-top: 60px;
}
.site-footer p {
  font-size: 0.69rem;
  color: var(--body);
  margin: 0;
  text-align: center;
  letter-spacing: 0.2px;
  opacity: 0.7;
}
.site-footer a { color: inherit; font-weight: 400; }
.site-footer a:hover { color: var(--purple); text-decoration: underline; }

/* ---------- Utility ---------- */
.hidden { display: none !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 20px; } .mt-4 { margin-top: 28px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 6px; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 20px; } .mb-4 { margin-bottom: 28px; }

@media (max-width: 640px) {
  html { font-size: 15px; }
  h1 { font-size: 1.75rem; letter-spacing: -0.4px; }
  h2 { font-size: 1.38rem; }
  h3 { font-size: 1.13rem; }
  .site-header .container { flex-direction: column; align-items: flex-start; }
  .site-header nav { gap: 0; }
  .field-inline { flex-direction: column; align-items: stretch; }
  .field-inline label { flex: none; }
  main { padding: 24px 0 60px; }
}
