@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wdth,wght@12..96,75..100,400..800&family=IBM+Plex+Mono:wght@400;500;600&family=IBM+Plex+Sans:wght@400;500;600&display=swap');

:root {
  --ink: #14161f;
  --ink-sink: #0e1017;
  --ink-raise: #1c1f2b;
  --ink-hover: #242836;
  --line: #2b3040;
  --paper: #e9e7e2;
  --muted: #868da1;
  --gold: #e0a949;
  --gold-dim: #7a5f2a;
  --red: #d4685f;
  --display: 'Bricolage Grotesque', system-ui, sans-serif;
  --body: 'IBM Plex Sans', system-ui, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --gutter: 88px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ------------------------------------------------------------------ entete */

.top {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: baseline;
  gap: 24px;
  padding: 14px 22px;
  background: rgba(20, 22, 31, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.brand {
  font-family: var(--display);
  font-weight: 800;
  font-size: 17px;
  font-stretch: 88%;
  letter-spacing: -0.01em;
  text-decoration: none;
  white-space: nowrap;
}
.brand em { font-style: normal; color: var(--gold); }

.top nav { display: flex; gap: 18px; margin-left: auto; }

.top nav a {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  padding-bottom: 2px;
  border-bottom: 1px solid transparent;
}
.top nav a:hover { color: var(--paper); }
.top nav a[aria-current='page'] { color: var(--gold); border-bottom-color: var(--gold); }

/* ------------------------------------------------------------------ layout */

.wrap { max-width: 1180px; margin: 0 auto; padding: 26px 22px 90px; }
.wrap--narrow { max-width: 700px; }

.page-head { margin-bottom: 26px; }

h1 {
  font-family: var(--display);
  font-size: clamp(28px, 6vw, 44px);
  font-weight: 700;
  font-stretch: 82%;
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin: 0 0 6px;
}

.lede { color: var(--muted); margin: 0; max-width: 56ch; }

h2 {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 34px 0 12px;
}

/* ------------------------------------------- colonne des annees + etageres */

.shelf {
  display: grid;
  grid-template-columns: var(--gutter) 1fr;
  gap: 0 22px;
  border-top: 1px solid var(--line);
  padding: 22px 0 30px;
}

.shelf__year {
  position: sticky;
  top: 74px;
  align-self: start;
  font-family: var(--mono);
  text-align: right;
}
.shelf__year b {
  display: block;
  font-family: var(--display);
  font-size: 34px;
  font-weight: 700;
  font-stretch: 78%;
  line-height: 1;
  letter-spacing: -0.03em;
}
.shelf__year span {
  display: block;
  margin-top: 5px;
  font-size: 11px;
  color: var(--muted);
  letter-spacing: 0.02em;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(124px, 1fr));
  gap: 20px 16px;
}

/* ----------------------------------------------------------------- vignette */

.tile { position: relative; cursor: pointer; }

.tile__art {
  position: relative;
  aspect-ratio: 3 / 4;
  border-radius: 4px;
  overflow: hidden;
  background: var(--ink-raise);
  border: 1px solid var(--line);
  transition: transform 0.18s ease, border-color 0.18s ease;
}
.tile:hover .tile__art { transform: translateY(-3px); border-color: var(--gold-dim); }

.tile__art img { width: 100%; height: 100%; object-fit: cover; display: block; }

.tile__art .noart {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 10px;
  font-family: var(--display);
  font-weight: 700;
  font-stretch: 80%;
  font-size: 15px;
  text-align: center;
  color: var(--muted);
}

.tile__hours {
  position: absolute;
  left: 0;
  bottom: 0;
  padding: 3px 7px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  background: rgba(14, 16, 23, 0.88);
  border-top-right-radius: 4px;
}

.tile__crown {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--ink-sink);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 600;
  display: grid;
  place-items: center;
}

.tile__title {
  margin-top: 7px;
  font-size: 12.5px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.tile__meta { font-family: var(--mono); font-size: 10.5px; color: var(--muted); margin-top: 2px; }

.tile[data-status='abandonne'] .tile__art img { filter: grayscale(0.75) brightness(0.72); }
.tile[data-status='a_jouer'] .tile__art img { opacity: 0.5; }
.tile[data-status='en_cours'] .tile__art { border-color: var(--gold-dim); }

/* ------------------------------------------------------------------ champs */

label { display: block; font-family: var(--mono); font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }

input[type='text'], input[type='number'], input[type='password'], input[type='search'], select, textarea {
  width: 100%;
  padding: 11px 13px;
  background: var(--ink-sink);
  color: var(--paper);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: var(--body);
  font-size: 15px;
}
textarea { resize: vertical; min-height: 72px; }
input:focus, select:focus, textarea:focus { border-color: var(--gold); outline: none; }
input::placeholder { color: #5c6274; }

.field { margin-bottom: 18px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

input[type='range'] { width: 100%; accent-color: var(--gold); height: 26px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 11px 18px;
  background: var(--gold);
  color: var(--ink-sink);
  border: 1px solid var(--gold);
  border-radius: 4px;
  font-family: var(--body);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.08); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

.btn--ghost { background: transparent; color: var(--paper); border-color: var(--line); }
.btn--ghost:hover { background: var(--ink-hover); }
.btn--danger { background: transparent; color: var(--red); border-color: var(--red); }
.btn--small { padding: 7px 12px; font-size: 13px; }

/* --------------------------------------------------------- resultats ajout */

.results { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }

.result {
  display: grid;
  grid-template-columns: 46px 1fr auto;
  gap: 13px;
  align-items: center;
  padding: 9px;
  background: var(--ink-raise);
  border: 1px solid transparent;
  border-radius: 5px;
  cursor: pointer;
  text-align: left;
  color: inherit;
  font: inherit;
  width: 100%;
}
.result:hover { border-color: var(--gold-dim); background: var(--ink-hover); }
.result img { width: 46px; height: 61px; object-fit: cover; border-radius: 3px; display: block; }
.result .ph { width: 46px; height: 61px; border-radius: 3px; background: var(--ink-sink); }
.result strong { display: block; font-weight: 500; font-size: 14.5px; }
.result small { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.result span.pick { font-family: var(--mono); font-size: 11px; color: var(--gold); }

/* --------------------------------------------------------- fiche selection */

.chosen {
  display: grid;
  grid-template-columns: 96px 1fr;
  gap: 16px;
  padding: 14px;
  background: var(--ink-raise);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: 5px;
  margin-bottom: 24px;
}
.chosen img { width: 96px; border-radius: 3px; display: block; }
.chosen h3 { font-family: var(--display); font-size: 20px; font-stretch: 84%; margin: 0 0 4px; }
.chosen dl { display: grid; grid-template-columns: auto 1fr; gap: 2px 12px; margin: 8px 0 0; font-size: 13px; }
.chosen dt { font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); align-self: center; }
.chosen dd { margin: 0; }

/* ------------------------------------------------------------ statistiques */

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(148px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.kpi { background: var(--ink); padding: 16px 15px; }
.kpi b { display: block; font-family: var(--display); font-size: 30px; font-weight: 700; font-stretch: 80%; line-height: 1; letter-spacing: -0.02em; }
.kpi b em { font-style: normal; font-size: 15px; color: var(--muted); margin-left: 3px; }
.kpi span { display: block; margin-top: 7px; font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.kpi--gold b { color: var(--gold); }

.bars { display: flex; flex-direction: column; gap: 7px; }
.bar { display: grid; grid-template-columns: 130px 1fr 62px; gap: 12px; align-items: center; font-size: 13px; }
.bar__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar__track { height: 15px; background: var(--ink-raise); border-radius: 2px; overflow: hidden; }
.bar__fill { height: 100%; background: var(--gold-dim); border-radius: 2px; }
.bar__val { font-family: var(--mono); font-size: 11.5px; color: var(--muted); text-align: right; }

.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 6px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); cursor: pointer; user-select: none; position: sticky; top: 0; background: var(--ink-raise); }
th:hover { color: var(--paper); }
tbody tr:hover { background: var(--ink-raise); }
td.num { font-family: var(--mono); text-align: right; }
tr:last-child td { border-bottom: none; }

/* ------------------------------------------------------ barre de recherche */

.filters { display: flex; flex-wrap: wrap; gap: 10px; margin: 0 0 24px; }
.filters input, .filters select { width: auto; flex: 1 1 150px; min-width: 130px; padding: 9px 12px; font-size: 14px; }

/* ------------------------------------------------------------------ modale */

.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 18px; background: rgba(10, 11, 16, 0.82); }
.modal[hidden] { display: none; }
.modal__panel { width: 100%; max-width: 470px; max-height: 88vh; overflow-y: auto; background: var(--ink); border: 1px solid var(--line); border-radius: 8px; padding: 22px; }
.modal__panel h3 { font-family: var(--display); font-size: 22px; font-stretch: 84%; margin: 0 0 16px; }
.modal__actions { display: flex; gap: 10px; margin-top: 20px; }
.modal__actions .btn { flex: 1; justify-content: center; }

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

.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 60; padding: 11px 18px; background: var(--paper); color: var(--ink-sink); border-radius: 5px; font-weight: 500; font-size: 14px; box-shadow: 0 8px 26px rgba(0,0,0,0.45); }
.toast--bad { background: var(--red); color: #fff; }

.empty { padding: 54px 22px; text-align: center; border: 1px dashed var(--line); border-radius: 7px; }
.empty p { color: var(--muted); margin: 0 0 16px; }

.note { font-family: var(--mono); font-size: 11.5px; color: var(--muted); }
.mono { font-family: var(--mono); }
.stack { display: flex; flex-wrap: wrap; gap: 10px; }

/* ---------------------------------------------------------------- connexion */

.gate { min-height: 100dvh; display: grid; place-items: center; padding: 22px; }
.gate form { width: 100%; max-width: 320px; }
.gate h1 { font-size: 30px; margin-bottom: 22px; }

/* ------------------------------------------------------------------ mobile */

@media (max-width: 720px) {
  :root { --gutter: 0px; }
  .wrap { padding: 20px 14px 80px; }
  .shelf { grid-template-columns: 1fr; gap: 12px; }
  .shelf__year { position: sticky; top: 62px; z-index: 10; text-align: left; display: flex; align-items: baseline; gap: 10px; padding: 6px 0; background: var(--ink); }
  .shelf__year b { font-size: 24px; }
  .shelf__year span { margin-top: 0; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 15px 11px; }
  .row { grid-template-columns: 1fr; }
  .bar { grid-template-columns: 96px 1fr 52px; }
  .top { padding: 11px 14px; gap: 12px; }
  .top nav { gap: 13px; }
  .chosen { grid-template-columns: 72px 1fr; }
  .chosen img { width: 72px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
