/* EQUINOX — charte du Domaine des Hugaux */
@font-face { font-family: 'Open Sans'; font-weight: 400; font-display: swap; src: url('/fonts/open-sans-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Open Sans'; font-weight: 600; font-display: swap; src: url('/fonts/open-sans-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Open Sans'; font-weight: 700; font-display: swap; src: url('/fonts/open-sans-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-weight: 500; font-display: swap; src: url('/fonts/barlow-condensed-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-weight: 600; font-display: swap; src: url('/fonts/barlow-condensed-latin-600-normal.woff2') format('woff2'); }
/* Polices du Domaine : à déposer dans public/fonts/ (voir README). Sans ces fichiers, des polices de secours s'affichent. */
@font-face { font-family: 'Kolgimba'; font-display: swap; src: url('/fonts/kolgimba.woff2') format('woff2'); }
@font-face { font-family: 'Rose Blue'; font-display: swap; src: url('/fonts/rose-blue.woff2') format('woff2'); }

:root {
  --orange: #FF7244;
  --orange-ink: #B8431D;   /* orange foncé : texte et liens lisibles sur fond clair */
  --sage: #89AC76;
  --sage-ink: #3F6330;
  --teal: #719D8D;
  --teal-ink: #2F5F50;
  --beige: #EDE4D3;
  --beige-light: #F7F2E9;
  --ink: #262626;
  --muted: #5E5A52;
  --line: #D9CFBB;
  --danger: #A32A1A;
  --radius: 12px;
  --font-title: 'Kolgimba', Georgia, 'Times New Roman', serif;
  --font-sub: 'Rose Blue', Georgia, serif;
  --font-nav: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --font-body: 'Open Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --nav-h: 62px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--beige-light); color: var(--ink); font: 400 16px/1.5 var(--font-body); }
h1, h2, h3 { font-family: var(--font-title); font-weight: 400; line-height: 1.2; margin: 0 0 .5em; }
h1 { font-size: 1.9rem; } h2 { font-size: 1.4rem; } h3 { font-size: 1.15rem; }
a { color: var(--orange-ink); }
img { max-width: 100%; }
.boot { padding: 2rem; text-align: center; color: var(--muted); }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.sub { font-family: var(--font-sub); font-size: 1.1rem; color: var(--teal-ink); }

/* --- Ossature --- */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar { background: var(--beige); border-bottom: 3px solid var(--orange); padding: .5rem 1rem; display: flex; align-items: center; gap: .75rem; padding-top: calc(.5rem + env(safe-area-inset-top)); }
.topbar img { width: 40px; height: 40px; border-radius: 50%; }
.topbar .brand { font-family: var(--font-title); font-size: 1.35rem; letter-spacing: .02em; }
.topbar .who { margin-left: auto; font-size: .85rem; color: var(--muted); }
.main { flex: 1; width: 100%; max-width: 960px; margin: 0 auto; padding: 1rem 1rem calc(var(--nav-h) + 1.5rem + env(safe-area-inset-bottom)); }
.nav { position: fixed; left: 0; right: 0; bottom: 0; background: var(--beige); border-top: 3px solid var(--orange); display: flex; padding-bottom: env(safe-area-inset-bottom); z-index: 20; }
.nav a { flex: 1; min-height: var(--nav-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--ink); font: 600 1rem var(--font-nav); text-transform: uppercase; letter-spacing: .06em; }
.nav a .ico { font-size: 1.3rem; line-height: 1; }
.nav a[aria-current="page"] { background: var(--orange); }
@media (min-width: 800px) {
  .nav { position: static; border-top: 0; border-bottom: 1px solid var(--line); padding: 0 1rem; justify-content: center; gap: .5rem; }
  .nav a { flex: 0 0 auto; flex-direction: row; min-height: 46px; padding: 0 1.25rem; gap: .5rem; }
  .main { padding-bottom: 3rem; }
  .shell { display: block; }
}

/* --- Éléments --- */
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
.card > :last-child { margin-bottom: 0; }
.card > p:first-child { margin-top: 0; }
.grid { display: grid; gap: .75rem; }
.grid.cols { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.row { display: flex; gap: .75rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: .75rem; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-bottom: .75rem; }
.page-head h1 { margin: 0; }
.back { display: inline-block; margin-bottom: .5rem; font: 600 1rem var(--font-nav); text-transform: uppercase; letter-spacing: .06em; text-decoration: none; }
.badge { display: inline-block; padding: .1rem .6rem; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--beige); color: var(--ink); }
.badge.sage { background: #DCE8D4; color: var(--sage-ink); }
.badge.teal { background: #D6E6E0; color: var(--teal-ink); }
.badge.off { background: #E4E0D8; color: var(--muted); }
.badge.warn { background: #FBD9CB; color: var(--orange-ink); }

/* Boutons : texte foncé sur fond coloré (contraste) */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 44px; padding: .5rem 1.1rem; border: 2px solid var(--ink); border-radius: 999px; background: var(--orange); color: var(--ink); font: 700 1rem var(--font-body); cursor: pointer; text-decoration: none; }
.btn:hover { filter: brightness(.96); }
.btn.secondary { background: #fff; }
.btn.sage { background: var(--sage); }
.btn.danger { background: #fff; border-color: var(--danger); color: var(--danger); }
.btn.small { min-height: 36px; padding: .25rem .8rem; font-size: .9rem; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--teal-ink); outline-offset: 2px; }

/* Formulaires */
label { display: block; font-weight: 600; margin-bottom: .2rem; }
.field { margin-bottom: .9rem; }
input, select, textarea { width: 100%; min-height: 44px; padding: .5rem .7rem; border: 2px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); font: inherit; }
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); outline: none; box-shadow: 0 0 0 3px #D6E6E0; }
input[type="checkbox"] { width: 22px; min-height: 22px; height: 22px; accent-color: var(--teal-ink); }
.check { display: flex; align-items: center; gap: .6rem; font-weight: 400; }
.field-row { display: grid; gap: .75rem; grid-template-columns: 1fr; }
@media (min-width: 600px) { .field-row { grid-template-columns: 1fr 1fr; } }
.hint { font-size: .85rem; color: var(--muted); margin-top: .2rem; }

.error { background: #FBE3DC; border: 1px solid var(--danger); color: var(--danger); padding: .6rem .8rem; border-radius: 10px; margin-bottom: .9rem; font-weight: 600; }
.notice { background: #EAF1E4; border: 1px solid var(--sage); padding: .6rem .8rem; border-radius: 10px; margin-bottom: .9rem; }

/* Chevaux */
.horse-card { display: flex; gap: .85rem; align-items: center; text-decoration: none; color: inherit; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: .7rem; min-height: 84px; }
.horse-card:hover { border-color: var(--orange); }
.horse-card h3 { margin: 0 0 .15rem; }
.avatar { flex: 0 0 64px; width: 64px; height: 64px; border-radius: 50%; background: var(--beige); object-fit: cover; display: flex; align-items: center; justify-content: center; font-size: 1.8rem; border: 2px solid var(--beige); }
.avatar.big { flex-basis: 120px; width: 120px; height: 120px; font-size: 3.4rem; }
.horse-head { display: flex; gap: 1rem; align-items: center; margin-bottom: 1rem; }
.tools { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tools .search { flex: 1 1 200px; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; margin: 0; }
dl.facts dt { font-weight: 600; color: var(--muted); }
dl.facts dd { margin: 0; white-space: pre-wrap; }
.infobox h3 { font-family: var(--font-nav); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; color: var(--teal-ink); font-size: 1.05rem; margin-bottom: .2rem; }
.infobox p { margin: 0 0 .8rem; white-space: pre-wrap; }
.alert-box { border-left: 6px solid var(--orange); }

/* Listes de gestion */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: .6rem; padding: .6rem 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1 1 160px; min-width: 0; }
.actions { display: flex; gap: .4rem; flex-wrap: nowrap; margin-left: auto; }
.btn.small { min-width: 40px; }
.list li.inactive .grow { color: var(--muted); }
.history li { display: block; }
.history .when { font-size: .8rem; color: var(--muted); }

/* Boîte de dialogue */
dialog { border: 3px solid var(--ink); border-radius: var(--radius); padding: 1.25rem; max-width: min(520px, 92vw); width: 100%; background: var(--beige-light); color: var(--ink); }
dialog::backdrop { background: rgba(38,38,38,.55); }
.temp-pw { font: 700 1.5rem ui-monospace, Menlo, Consolas, monospace; letter-spacing: .06em; background: #fff; border: 2px dashed var(--teal); padding: .6rem; text-align: center; border-radius: 10px; user-select: all; }

/* Connexion */
.login { max-width: 420px; margin: 0 auto; padding: 2rem 1rem; text-align: center; }
.login img.logo { width: 150px; height: 150px; border-radius: 50%; margin-bottom: .5rem; }
.login form { text-align: left; }
.login .btn { width: 100%; }

/* Bandeau de mise à jour */
.update-bar { position: fixed; left: 0; right: 0; top: 0; z-index: 50; background: var(--teal); color: var(--ink); padding: .6rem 1rem; display: flex; gap: .75rem; align-items: center; justify-content: center; font-weight: 600; padding-top: calc(.6rem + env(safe-area-inset-top)); }
.toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--nav-h) + 1rem + env(safe-area-inset-bottom)); background: var(--ink); color: #fff; padding: .6rem 1.1rem; border-radius: 999px; z-index: 60; font-weight: 600; max-width: 90vw; }
@media (min-width: 800px) { .toast { bottom: 1.5rem; } }
.version { text-align: center; color: var(--muted); font-size: .8rem; margin-top: 2rem; }
@media (prefers-reduced-motion: no-preference) { .btn, .horse-card { transition: filter .15s, border-color .15s; } }
