/* ============================================================
   L'Archiviste — Mix B (Terminal éditorial)
   Auto light/dark via prefers-color-scheme
   ============================================================ */

/* ---------- Tokens ---------- */
:root {
  /* Dark by default — Mix B est né sombre */
  --bg:           #0d0d0f;
  --bg-elev:      #131316;
  --bg-overlay:   rgba(13, 13, 15, 0.78);
  --border:      #2a2a2e;
  --border-soft: #1f1f22;
  --text:        #f5f5f0;
  --text-muted:  #9a9a96;
  --text-dim:    #6b6b6b;
  --accent:      #f0a500;
  --accent-soft: rgba(240, 165, 0, 0.12);

  --font-mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --font-serif: "Fraunces", Georgia, "Times New Roman", serif;
  --font-sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  --max-content: 1100px;
  --pad-x-desktop: 48px;
  --pad-x-mobile: 24px;

  --radius: 4px;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg:          #faf8f3;
    --bg-elev:     #f3efe5;
    --bg-overlay:  rgba(250, 248, 243, 0.82);
    --border:      #e5e0d5;
    --border-soft: #efeae0;
    --text:        #1a1a1a;
    --text-muted:  #4a4a4a;
    --text-dim:    #8a8a8a;
    --accent:      #b8680a;     /* ambre légèrement assombri pour AA */
    --accent-soft: rgba(184, 104, 10, 0.10);
  }
}

/* ---------- Reset minimal ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

/* ---------- Layout helpers ---------- */
.wrap { max-width: var(--max-content); margin: 0 auto; padding: 0 var(--pad-x-desktop); }
.divider { border-top: 0.5px solid var(--border); }

/* ---------- Header / Nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  background: var(--bg-overlay);
  border-bottom: 0.5px solid var(--border);
}
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px var(--pad-x-desktop);
  max-width: var(--max-content);
  margin: 0 auto;
}
.brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 400;
  letter-spacing: -0.2px;
  color: var(--text);
}
.brand .prompt {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
}
.nav-links {
  display: flex;
  gap: 28px;
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-muted);
}
.nav-links a:hover { color: var(--text); }
.nav-links a.cta { color: var(--accent); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  padding: 112px var(--pad-x-desktop) 96px;
  overflow: hidden;
}
.hero-bg {
  position: absolute;
  inset: 0;
  background-image: url("../img/header.jpg");
  background-size: cover;
  background-position: center;
  opacity: 0.18;
  z-index: 0;
}
@media (prefers-color-scheme: light) {
  .hero-bg { opacity: 0.10; filter: grayscale(0.3); }
}
.hero-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, transparent 0%, var(--bg) 95%);
}
.hero-inner {
  position: relative;
  z-index: 1;
  max-width: 820px;
  margin: 0 auto;
}
.shell-line {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 36px;
}
.hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(36px, 6vw, 60px);
  font-weight: 400;
  line-height: 1.05;
  letter-spacing: -1.5px;
  color: var(--text);
  margin: 0 0 32px;
}
.hero h1 .cursor {
  font-family: var(--font-mono);
  color: var(--accent);
  font-weight: 400;
  animation: blink 1.1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }
.hero p.lede {
  font-size: 17px;
  color: var(--text-muted);
  line-height: 1.7;
  margin: 0;
  max-width: 540px;
}
.hero-actions {
  margin-top: 40px;
  display: flex;
  gap: 16px;
  align-items: center;
  flex-wrap: wrap;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 12px 20px;
  border-radius: var(--radius);
  border: 0.5px solid var(--accent);
  color: var(--accent);
  background: transparent;
  transition: background 0.15s, transform 0.05s;
}
.btn:hover { background: var(--accent-soft); }
.btn:active { transform: scale(0.98); }
.btn.ghost {
  border: 0;
  color: var(--text-muted);
  border-bottom: 0.5px solid var(--border);
  border-radius: 0;
  padding: 4px 0;
}
.btn.ghost:hover { background: transparent; color: var(--text); }

/* ---------- Sections ---------- */
section { padding: 64px var(--pad-x-desktop) 80px; }
.section-marker {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 48px;
  max-width: var(--max-content);
  margin-left: auto;
  margin-right: auto;
}

/* ---------- Services ---------- */
.service {
  display: grid;
  grid-template-columns: 80px 1fr 1fr;
  gap: 32px;
  align-items: center;
  max-width: var(--max-content);
  margin: 0 auto 64px;
}
.service:last-child { margin-bottom: 0; }
/* Alternate: image on the other side for even services */
.service.flip { direction: rtl; }
.service.flip > * { direction: ltr; }
.service-meta .idx {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--accent);
}
.service-meta .path {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 8px;
}
.service-body h2 {
  font-family: var(--font-serif);
  font-size: clamp(24px, 3.5vw, 30px);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.5px;
  color: var(--text);
  margin: 0 0 16px;
}
.service-body p {
  font-size: 16px;
  color: var(--text-muted);
  line-height: 1.7;
  margin: 0;
}
.service-img {
  border-radius: var(--radius);
  border: 0.5px solid var(--border);
  filter: grayscale(0.4);
  transition: filter 0.4s;
  width: 100%;
  height: 220px;
  object-fit: cover;
}
.service-img:hover { filter: grayscale(0); }

/* ---------- Contact ---------- */
.contact {
  background: var(--bg-elev);
  border-top: 0.5px solid var(--border);
  border-bottom: 0.5px solid var(--border);
}
.contact-inner { max-width: 580px; margin: 0 auto; }
.contact h2 {
  font-family: var(--font-serif);
  font-size: clamp(28px, 4.5vw, 36px);
  font-weight: 400;
  line-height: 1.2;
  letter-spacing: -0.8px;
  color: var(--text);
  margin: 0 0 40px;
}

/* Form */
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.field { margin-bottom: 20px; }
.field label {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  margin-bottom: 8px;
  letter-spacing: 0.3px;
}
.field input, .field textarea {
  width: 100%;
  background: transparent;
  border: 0;
  border-bottom: 0.5px solid var(--border);
  padding: 8px 0;
  font: inherit;
  font-size: 15px;
  color: var(--text);
  border-radius: 0;
  transition: border-color 0.15s;
}
.field input:focus, .field textarea:focus {
  outline: 0;
  border-bottom-color: var(--accent);
}
.field textarea { resize: vertical; min-height: 100px; font-family: inherit; }

.form-status {
  font-family: var(--font-mono);
  font-size: 12px;
  margin-top: 16px;
  min-height: 18px;
}
.form-status.ok { color: var(--accent); }
.form-status.err { color: #d85a30; }

/* ---------- Footer ---------- */
.site-footer {
  padding: 18px var(--pad-x-desktop);
  border-top: 0.5px solid var(--border);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
}
.site-footer .wrap {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding: 0;
}
.site-footer a:hover { color: var(--text); }

/* ---------- Pages légales ---------- */
.legal {
  max-width: 760px;
  margin: 0 auto;
  padding: 80px var(--pad-x-desktop);
}
.legal h1 {
  font-family: var(--font-serif);
  font-size: clamp(32px, 5vw, 44px);
  font-weight: 400;
  letter-spacing: -1px;
  margin: 0 0 16px;
  color: var(--text);
}
.legal h2 {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 400;
  margin: 48px 0 12px;
  color: var(--text);
}
.legal p, .legal li { color: var(--text-muted); }
.legal a { color: var(--accent); border-bottom: 0.5px solid currentColor; }
.legal .updated {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 48px;
}

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
  .nav, section, .hero { padding-left: var(--pad-x-mobile); padding-right: var(--pad-x-mobile); }
  .nav-links { gap: 16px; font-size: 12px; }
  .hero { padding-top: 80px; padding-bottom: 64px; }
  .service { grid-template-columns: 1fr; gap: 16px; }
  .service.flip { direction: ltr; }
  .service-meta { display: flex; align-items: baseline; gap: 12px; }
  .service-meta .path { margin-top: 0; }
  .service-img { height: 180px; }
  .form-row { grid-template-columns: 1fr; gap: 0; }
  .site-footer { padding: 18px var(--pad-x-mobile); }
}

/* ---------- Accessibility ---------- */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}
