/* ============================================
   BASE.CSS — Reset, typographie, éléments de base
   Fondations visuelles du site EBR Ingénierie
   ============================================ */

/* ---- Police Inter Variable (auto-hébergée) ---- */
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/fonts/inter-var.woff2') format('woff2');
}

/* ---- Reset moderne ---- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  -moz-text-size-adjust: 100%;
  text-size-adjust: 100%;
  tab-size: 4;
  line-height: 1.15;
}

body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.7;
  color: var(--c-text);
  background-color: var(--c-bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizelegibility;
  overflow-x: hidden;
  min-height: 100vh;
}

/* Suppression des marges par défaut */
h1,
h2,
h3,
h4,
h5,
h6,
p,
ul,
ol,
dl,
figure,
blockquote,
pre {
  margin: 0;
}

/* Images responsives */
img,
picture,
video,
canvas,
svg {
  display: block;
  max-width: 100%;
  height: auto;
}

/* Formulaires : héritage de la police */
input,
button,
textarea,
select {
  font: inherit;
  color: inherit;
}

/* Suppression du style par défaut des listes */
ul,
ol {
  list-style: none;
}

/* Tables */
table {
  border-collapse: collapse;
  border-spacing: 0;
}

/* Éléments interactifs */
a {
  text-decoration: none;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: none;
}

/* ---- Typographie — Titres ---- */
h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 700;
  line-height: 1.2;
  color: var(--c-night);
  letter-spacing: -0.02em;
}

h1 {
  font-size: clamp(2.25rem, 5vw, 3.5rem);
  line-height: 1.1;
  margin-bottom: var(--gap-lg);
}

h2 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  margin-bottom: var(--gap-md);
}

h3 {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  margin-bottom: var(--gap-sm);
}

h4 {
  font-size: 1.25rem;
  margin-bottom: var(--gap-sm);
}

h5 {
  font-size: 1.125rem;
  margin-bottom: var(--gap-xs);
}

h6 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: var(--gap-xs);
}

/* ---- Paragraphes et texte courant ---- */
p {
  margin-bottom: var(--gap-md);
  max-width: 72ch;
}

p:last-child {
  margin-bottom: 0;
}

strong,
b {
  font-weight: 700;
}

small {
  font-size: 0.875rem;
}

blockquote {
  border-left: 4px solid var(--c-primary);
  padding: var(--gap-md) var(--gap-lg);
  margin: var(--gap-lg) 0;
  background: var(--c-light-bg);
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-style: italic;
  color: var(--c-muted);
}

code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--c-light-bg);
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

pre {
  font-family: var(--font-mono);
  font-size: 0.875rem;
  background: var(--c-night);
  color: var(--c-white);
  padding: var(--gap-lg);
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: var(--gap-lg) 0;
}

pre code {
  background: none;
  padding: 0;
  color: inherit;
}

hr {
  border: none;
  border-top: 1px solid var(--c-border);
  margin: var(--gap-xl) 0;
}

/* ---- Liens ---- */
.link,
article a,
.prose a {
  color: var(--c-primary);
  text-decoration: none;
  transition:
    color var(--dur-fast) var(--ease),
    text-decoration var(--dur-fast) var(--ease);
}

.link:hover,
article a:hover,
.prose a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.link:focus-visible,
article a:focus-visible,
.prose a:focus-visible {
  outline: 2px solid var(--c-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* ---- Boutons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--gap-sm);
  padding: 12px 28px;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1;
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  cursor: pointer;
  transition:
    background-color var(--dur-fast) var(--ease),
    color var(--dur-fast) var(--ease),
    border-color var(--dur-fast) var(--ease),
    box-shadow var(--dur-fast) var(--ease),
    transform var(--dur-fast) var(--ease);
  white-space: nowrap;
  text-decoration: none;
}

.btn:focus-visible {
  outline: 2px solid var(--c-primary);
  outline-offset: 2px;
}

.btn:active {
  transform: scale(0.97);
}

/* Bouton principal */
.btn-primary {
  background: var(--gradient-brand);
  color: var(--c-white);
  border-color: transparent;
}

.btn-primary:hover {
  background: var(--gradient-brand-dark);
  border-color: transparent;
  box-shadow: var(--shadow-md);
}

/* Bouton secondaire (contour) */
.btn-secondary {
  background-color: transparent;
  color: var(--c-primary);
  border-color: var(--c-primary);
}

.btn-secondary:hover {
  background-color: var(--c-primary);
  color: var(--c-white);
  box-shadow: var(--shadow-md);
}

/* Bouton accent */
.btn-accent {
  background-color: var(--c-accent);
  color: var(--c-night);
  border-color: var(--c-accent);
}

.btn-accent:hover {
  background-color: #2e8066;
  border-color: #2e8066;
  box-shadow: var(--shadow-md);
}

/* Bouton fantôme (texte seul) */
.btn-ghost {
  background: transparent;
  color: var(--c-text);
  border-color: transparent;
  padding: 8px 16px;
}

.btn-ghost:hover {
  background-color: var(--c-light-bg);
  color: var(--c-primary);
}

/* Tailles de bouton */
.btn-sm {
  padding: 8px 18px;
  font-size: 0.8125rem;
}

.btn-lg {
  padding: 16px 36px;
  font-size: 1.0625rem;
}

/* ---- Éléments de formulaire ---- */
.form-input,
input[type='text'],
input[type='email'],
input[type='tel'],
input[type='url'],
input[type='number'],
input[type='password'],
input[type='search'],
textarea,
select {
  width: 100%;
  padding: 12px 16px;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--c-text);
  background-color: var(--c-white);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  transition:
    border-color var(--dur-fast) var(--ease),
    box-shadow var(--dur-fast) var(--ease);
  appearance: none;
}

.form-input:focus,
input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3px rgb(30 58 95 / 18%);
}

.form-input::placeholder,
input::placeholder,
textarea::placeholder {
  color: var(--c-muted);
  opacity: 1;
}

textarea {
  resize: vertical;
  min-height: 120px;
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--c-night);
  margin-bottom: var(--gap-xs);
}

/* ---- Classes utilitaires ---- */

/* Conteneur centré */
.container {
  width: 100%;
  max-width: var(--max-w);
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--gap-lg);
  padding-right: var(--gap-lg);
}

/* Accessibilité : masqué visuellement, visible aux lecteurs d'écran */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border-width: 0;
}

/* Texte atténué */
.text-muted {
  color: var(--c-muted);
}

/* Texte accent */
.text-accent {
  color: var(--c-accent);
}

/* Texte principal */
.text-primary {
  color: var(--c-primary);
}

/* Texte en gras */
.text-bold {
  font-weight: 700;
}

/* Texte centré */
.text-center {
  text-align: center;
}

/* Texte en majuscules (ex. sous-titres de section) */
.text-upper {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  font-weight: 700;
}

/* Prose : conteneur de texte enrichi */
.prose {
  max-width: 72ch;
}

.prose p + p {
  margin-top: var(--gap-md);
}

.prose ul,
.prose ol {
  list-style: disc;
  padding-left: var(--gap-lg);
  margin-bottom: var(--gap-md);
}

.prose ol {
  list-style: decimal;
}

.prose li + li {
  margin-top: var(--gap-sm);
}

/* Sélection de texte */
::selection {
  background-color: var(--c-teal);
  color: var(--c-white);
}

/* Focus global pour l'accessibilité clavier */
:focus-visible {
  outline: 2px solid var(--c-primary);
  outline-offset: 2px;
}

/* Barre de défilement personnalisée (Webkit) */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--c-light-bg);
}

::-webkit-scrollbar-thumb {
  background: var(--c-muted);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--c-steel);
}
