/* =========================================================
   Senari Mémo — Surfaces & règles d’urbanisme
   Inspiration: plans d’architecte, papier crème, encre anthracite.
   ========================================================= */

:root {
  /* Light — papier d'architecte */
  --paper:        #f4efe4;   /* crème */
  --paper-2:      #ece5d4;   /* crème plus chaud */
  --paper-3:      #faf6ec;
  --ink:          #20211f;   /* anthracite */
  --ink-2:        #4b4c47;   /* gris encre */
  --ink-3:        #7a7b75;
  --rule:         #cdc6b3;
  --accent:       #2f7d76;   /* bleu-vert Senari */
  --accent-2:     #1f5e58;
  --accent-soft:  #d8e7e4;
  --alert:        #b8553a;   /* terracotta, ALERTES uniquement */
  --alert-soft:   #f1d9cf;

  --radius: 4px;
  --radius-lg: 6px;
  --shadow-sm: 0 1px 0 rgba(32,33,31,0.04);
  --shadow:    0 8px 24px rgba(32,33,31,0.06);

  --maxw: 1180px;
  --gutter: clamp(20px, 4vw, 56px);

  --font-display: 'Cabinet Grotesk', 'Times New Roman', Georgia, serif;
  --font-body:    'Satoshi', 'Helvetica Neue', system-ui, sans-serif;
  --font-mono:    'JetBrains Mono', ui-monospace, monospace;
}

[data-theme="dark"] {
  --paper:        #16181a;
  --paper-2:      #1d2023;
  --paper-3:      #20242a;
  --ink:          #ebe7dc;
  --ink-2:        #b9b5a9;
  --ink-3:        #8a877d;
  --rule:         #2e3236;
  --accent:       #6ab1a8;
  --accent-2:     #92c8c0;
  --accent-soft:  #1f3633;
  --alert:        #d68a6a;
  --alert-soft:   #3a221a;
  --shadow:       0 12px 28px rgba(0,0,0,0.4);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}

html, body { margin: 0; padding: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "ss01","cv01";
}

/* Subtle grid-paper background */
body::before {
  content: "";
  position: fixed; inset: 0;
  background-image:
    linear-gradient(var(--rule) 1px, transparent 1px),
    linear-gradient(90deg, var(--rule) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.08;
  pointer-events: none;
  z-index: -1;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-2); text-decoration: underline; text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 3px;
}

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
.wrapfoo { max-width: 1200px; margin: 0 auto; padding: 0 var(--gutter); }

.skip-link {
  position: absolute; left: -1000px; top: 0;
  background: var(--ink); color: var(--paper); padding: 10px 14px; z-index: 100;
  border-radius: 0 0 var(--radius) 0;
}
.skip-link:focus { left: 0; }

/* =========================
   HEADER
   ========================= */
.site-header {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--paper) 88%, transparent);
  backdrop-filter: saturate(140%) blur(8px);
  -webkit-backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--rule);
}
.header-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 24px;
  padding-block: 14px;
}
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand .logo { color: var(--accent); width: 30px; height: 30px; }
.brand-text { display: flex; flex-direction: column; line-height: 1; }
.brand-name { font-family: var(--font-display); font-weight: 700; font-size: 18px; letter-spacing: -0.01em; }
.brand-tag  { font-size: 11px; color: var(--ink-3); margin-top: 4px; letter-spacing: 0.04em; text-transform: uppercase; }

.primary-nav {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px;
  font-size: 14px;
}
.primary-nav a {
  color: var(--ink-2); padding: 6px 2px; border-bottom: 1px solid transparent;
}
.primary-nav a:hover { color: var(--ink); text-decoration: none; border-bottom-color: var(--ink); }
.primary-nav a.is-active { color: var(--ink); border-bottom-color: var(--accent); }

.header-actions { display: flex; align-items: center; gap: 8px; }
.icon-btn {
  background: transparent; border: 1px solid var(--rule); color: var(--ink);
  width: 38px; height: 38px; border-radius: var(--radius); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .2s ease, border-color .2s ease;
}
.icon-btn:hover { background: var(--paper-2); border-color: var(--ink-2); }
[data-theme="light"] .icon-btn .moon { display: none; }
[data-theme="dark"]  .icon-btn .sun  { display: none; }

/* =========================
   TYPOGRAPHY
   ========================= */
h1, h2, h3 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.08;
  color: var(--ink);
  margin: 0 0 0.4em;
}
h1 { font-size: clamp(32px, 5.4vw, 56px); }
h2 { font-size: clamp(26px, 3.4vw, 38px); letter-spacing: -0.015em; }
h3 { font-size: 17px; font-family: var(--font-body); font-weight: 700; letter-spacing: 0; margin-bottom: 6px; color: var(--ink); }

p { margin: 0 0 1em; }
.lede   { font-size: clamp(17px, 1.4vw, 19px); color: var(--ink-2); max-width: 60ch; }
.lede-sm{ font-size: 16px; color: var(--ink-2); max-width: 62ch; }

.eyebrow, .section-kicker, .card-kicker, .diagram-title, .foot-title {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 11px;
  color: var(--ink-3);
  margin: 0 0 14px;
}

/* =========================
   HERO
   ========================= */
.hero { padding: clamp(40px, 7vw, 88px) 0 clamp(40px, 6vw, 72px); }
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: clamp(28px, 4vw, 72px);
  align-items: end;
}
.hero-text h1 { margin-bottom: 24px; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 18px; border-radius: var(--radius);
  font-family: var(--font-body); font-weight: 500; font-size: 14px;
  letter-spacing: 0.01em; cursor: pointer; border: 1px solid transparent;
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.btn.primary { background: var(--ink); color: var(--paper); }
.btn.primary:hover { background: var(--accent); color: var(--paper); text-decoration: none; }
.btn.ghost { background: transparent; border-color: var(--ink); color: var(--ink); }
.btn.ghost:hover { background: var(--ink); color: var(--paper); text-decoration: none; }

.share-feedback {
  font-size: 13px; color: var(--accent-2); margin-top: 10px; min-height: 1.2em;
}

.hero-card {
  background: var(--paper-3);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 26px 26px 22px;
  position: relative;
  box-shadow: var(--shadow-sm);
}
.hero-card::before {
  content: ""; position: absolute; inset: 6px;
  border: 1px solid var(--rule); border-radius: 4px;
  pointer-events: none;
}
.repere-list { list-style: none; padding: 0; margin: 6px 0 14px; display: grid; gap: 10px; }
.repere-list li {
  display: grid; grid-template-columns: 110px 1fr; gap: 12px;
  padding-bottom: 10px; border-bottom: 1px dashed var(--rule);
  font-size: 14px;
}
.repere-list li:last-child { border-bottom: 0; }
.repere-list strong { color: var(--ink); font-family: var(--font-display); font-weight: 700; }
.repere-list span { color: var(--ink-2); }
.card-foot { font-size: 12px; color: var(--ink-3); margin: 6px 0 0; }

/* =========================
   SECTIONS
   ========================= */
.section {
  padding: clamp(48px, 7vw, 96px) 0;
  border-top: 1px solid var(--rule);
}
.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: clamp(28px, 4vw, 64px);
  align-items: start;
}
.overview-grid {
  list-style: none; padding: 0; margin: 0;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0;
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--paper-3);
  overflow: hidden;
}
.overview-grid li {
  padding: 22px 22px 26px;
  border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 14px;
  align-items: baseline;
}
.overview-grid li:nth-child(2n) { border-right: 0; }
.overview-grid li:nth-last-child(-n+2) { border-bottom: 0; }
.overview-grid .num {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 12px;
  letter-spacing: 0.1em;
  grid-row: 1 / 3;
}
.overview-grid .lbl {
  font-family: var(--font-display);
  font-weight: 700; font-size: 18px; color: var(--ink);
}
.overview-grid .hint { font-size: 13px; color: var(--ink-2); grid-column: 2; }

/* CONCEPT — disposition asymétrique */
.concept-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-areas:
    "head head"
    "diagram body";
  gap: clamp(28px, 4vw, 56px);
  align-items: start;
}
.concept-head { grid-area: head; max-width: 720px; }
.diagram-card { grid-area: diagram; }
.concept-body { grid-area: body; display: grid; gap: 22px; }

/* Vary card sizing — asymétrie volontaire */
.section:nth-of-type(even) .concept-grid {
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
}
.section:nth-of-type(odd) .concept-grid {
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
}

.diagram-card {
  background: var(--paper-3);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}
.diagram { width: 100%; height: auto; display: block; margin: 8px 0 14px; }
.diagram text { font-family: var(--font-body); fill: var(--ink); }
.diagram .lbl     { font-size: 12px; font-weight: 500; }
.diagram .lbl-sm  { font-size: 10.5px; }
.diagram .muted   { fill: var(--ink-3); }
.diagram .accent  { fill: var(--accent-2); }

.legend {
  font-size: 12px; color: var(--ink-2);
  display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 0;
}
.sw {
  display: inline-block; width: 14px; height: 10px;
  vertical-align: middle; margin-right: 6px; border-radius: 2px;
}
.sw-hatch  { background:
  repeating-linear-gradient(45deg, var(--accent) 0 2px, transparent 2px 5px);
  border: 1px solid var(--accent);
}
.sw-line   { background: transparent; border: 1px dashed var(--accent); }
.sw-dashed { background: transparent; border: 1px dashed var(--ink-3); }
.sw-fill   { background: var(--accent-soft); border: 1px solid var(--accent); }
.sw-accent { background: var(--accent); border: 1px solid var(--accent-2); }
.sw-grey   { background: color-mix(in srgb, var(--ink-2) 25%, transparent); border: 1px solid var(--ink-3); }

/* CONCEPT body blocks */
.block { padding: 0; }
.block + .block { border-top: 1px solid var(--rule); padding-top: 22px; }
.bullet { padding-left: 1.1em; margin: 0; color: var(--ink-2); }
.bullet li { margin-bottom: 6px; }
.example { background: var(--paper-3); border: 1px solid var(--rule); padding: 18px 20px; border-radius: var(--radius-lg); }
.example + .block { border-top: 0; padding-top: 0; }
.example h3 { margin-bottom: 6px; }
.example p { margin: 0; color: var(--ink-2); }
.example strong { color: var(--ink); }

/* ALERT — terracotta only here */
.alert details {
  background: var(--alert-soft);
  border: 1px solid color-mix(in srgb, var(--alert) 50%, transparent);
  border-left: 3px solid var(--alert);
  border-radius: var(--radius-lg);
  padding: 0;
}
.alert summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 44px 14px 18px;
  font-weight: 600;
  color: var(--ink);
  display: flex; align-items: center; gap: 10px;
  position: relative;
}
.alert summary::-webkit-details-marker { display: none; }
.alert summary::after {
  content: "+";
  position: absolute; right: 18px; top: 50%; transform: translateY(-50%);
  font-family: var(--font-mono); color: var(--alert); font-size: 18px;
  transition: transform .2s ease;
}
.alert details[open] summary::after { content: "−"; }
.alert p {
  padding: 0 18px 16px; margin: 0; color: var(--ink-2); font-size: 14.5px;
}
.alert-pill {
  display: inline-block;
  background: var(--alert);
  color: #fffaf6;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  padding: 4px 8px;
  border-radius: 2px;
}

/* =========================
   SYNTHÈSE
   ========================= */
.synthese { background: var(--paper-3); border-top: 1px solid var(--rule); }
.table-card {
  margin: 28px 0 36px;
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  background: var(--paper);
  overflow-x: auto;
}
.memo-table { width: 100%; border-collapse: collapse; font-size: 14.5px; min-width: 640px; }
.memo-table th, .memo-table td {
  padding: 16px 20px; text-align: left; vertical-align: top;
  border-bottom: 1px solid var(--rule); color: var(--ink-2);
}
.memo-table th {
  font-family: var(--font-mono); font-weight: 500; font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-3);
  background: var(--paper-2);
}
.memo-table td:first-child { color: var(--ink); width: 22%; }
.memo-table td:last-child { color: var(--ink-3); width: 28%; }
.memo-table tr:last-child td { border-bottom: 0; }

.share-block {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) auto;
  gap: 24px;
  align-items: center;
  padding: 24px 26px;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: var(--radius-lg);
  position: relative;
}
.share-block::before {
  content: ""; position: absolute; inset: 6px;
  border: 1px solid var(--rule); border-radius: 4px;
  pointer-events: none;
}
.share-block h3 { margin-bottom: 4px; font-size: 18px; font-family: var(--font-display); }
.share-block p { margin: 0; color: var(--ink-2); }
.share-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.disclaimer {
  margin-top: 28px;
  padding: 16px 18px;
  border-left: 3px solid var(--ink-3);
  background: transparent;
  font-size: 13.5px;
  color: var(--ink-2);
  max-width: 760px;
}

/* =========================
   FOOTER
   ========================= */
.site-foot {
  border-top: 1px solid var(--rule);
  background: var(--paper-2);
  padding: 48px 0 28px;
  margin-top: 0;
  font-size: 14px;
  color: var(--ink-2);
}
.foot-grid {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: clamp(20px, 3vw, 48px);
  align-items: start;
}
.foot-brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-family: var(--font-display); font-weight: 700; }
.foot-brand svg { color: var(--accent); }
.foot-note { margin-top: 10px; color: var(--ink-3); max-width: 36ch; font-size: 13px; }
.foot-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.foot-list a { color: var(--ink-2); }
.foot-list a:hover { color: var(--ink); }
.foot-bottom {
  display: flex; justify-content: space-between; gap: 12px;
  border-top: 1px solid var(--rule);
  margin-top: 36px; padding-top: 18px;
  font-size: 12px; color: var(--ink-3); flex-wrap: wrap;
}
.schemas {
  display: grid; 
  grid-template-columns: 1fr 1fr;

}

/* =========================
   RESPONSIVE
   ========================= */
@media (max-width: 960px) {
  .header-row { grid-template-columns: auto auto; row-gap: 12px; }
  .primary-nav {
    grid-column: 1 / -1;
    justify-content: flex-start;
    gap: 4px 14px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
  }
  .primary-nav a { white-space: nowrap; }
  .hero-grid { grid-template-columns: 1fr; gap: 36px; }
  .two-col { grid-template-columns: 1fr; }
  .concept-grid,
  .section:nth-of-type(odd) .concept-grid,
  .section:nth-of-type(even) .concept-grid {
    grid-template-columns: 1fr;
    grid-template-areas:
      "head"
      "diagram"
      "body";
  }
  .overview-grid { grid-template-columns: 1fr; }
  .overview-grid li { border-right: 0; }
  .overview-grid li:nth-last-child(-n+2) { border-bottom: 1px solid var(--rule); }
  .overview-grid li:last-child { border-bottom: 0; }
  .share-block { grid-template-columns: 1fr; }
  .foot-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  body { font-size: 15.5px; }
  .repere-list li { grid-template-columns: 90px 1fr; font-size: 13.5px; }
  .memo-table th, .memo-table td { padding: 12px 14px; }
  .hero-card { padding: 22px; }
  .alert summary { padding: 12px 14px; padding-right: 36px; }
}

/* =========================
   PRINT
   ========================= */
@media print {
  body::before { display: none; }
  .site-header, .header-actions, .hero-actions, .share-block, .icon-btn { display: none !important; }
  .section { padding: 24px 0; page-break-inside: avoid; }
  .diagram-card, .example, .alert details { box-shadow: none; }
  a { color: var(--ink) !important; text-decoration: none; }
  body { background: #fff; color: #000; }
}
