/* La Cote de Torn — vitrine de prêteur sur gages, la nuit, sous les lampadaires au sodium. */
:root {
  --asphalt: #1c1f27;   /* fond */
  --kerb: #262a34;      /* surfaces */
  --kerb-line: #363b48; /* filets */
  --paper: #ece6d6;     /* texte */
  --dust: #a19d8f;      /* texte secondaire */
  --sodium: #f0a63a;    /* actions et événements du calendrier */
  --up: #63c9a3;
  --down: #ee7470;

  --display: "Big Shoulders Display", "Arial Narrow", sans-serif;
  --text: "Barlow", system-ui, sans-serif;
  --measure: 68ch;
  --gutter: clamp(16px, 4vw, 40px);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--asphalt);
  color: var(--paper);
  font: 400 1.0625rem/1.55 var(--text);
  font-variant-numeric: tabular-nums;
}

a { color: var(--paper); text-decoration-color: var(--sodium); text-underline-offset: .2em; text-decoration-thickness: 1px; }
a:hover { color: var(--sodium); }

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

h1, h2, h3 { font-family: var(--display); font-weight: 800; line-height: 1.05; margin: 0 0 .5em; letter-spacing: .01em; }
h1 { font-size: clamp(2.2rem, 6vw, 3.4rem); }
h2 { font-size: 1.75rem; }
h3 { font-size: 1.3rem; font-weight: 600; }

p { margin: 0 0 1em; max-width: var(--measure); }

.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.muted { color: var(--dust); }
.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--dust); }
.r { text-align: right; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.skip { position: absolute; left: -999px; top: 0; background: var(--sodium); color: var(--asphalt); padding: .5em 1em; }
.skip:focus { left: var(--gutter); }

/* En-tête et pied de page */
.site-head, main, .site-foot { max-width: 1040px; margin: 0 auto; padding-inline: var(--gutter); }

.site-head {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: .5rem 1.5rem;
  padding-block: 1.25rem;
  border-bottom: 1px solid var(--kerb-line);
}
.brand { font-family: var(--display); font-weight: 800; font-size: 1.6rem; text-decoration: none; letter-spacing: .02em; }
.brand-mark { color: var(--sodium); margin-right: .1em; }
.site-head nav { display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem 1.25rem; }
.site-head nav a { text-decoration: none; color: var(--dust); }
.site-head nav a:hover, .site-head nav a[aria-current] { color: var(--paper); }
.site-head nav a[aria-current] { box-shadow: inset 0 -2px 0 var(--sodium); }
.who { color: var(--dust); }

main { padding-block: 2rem 3rem; }

.site-foot { padding-block: 1.5rem 2.5rem; border-top: 1px solid var(--kerb-line); color: var(--dust); font-size: .9rem; }
.site-foot p { margin-bottom: .4em; }

/* Boutons et champs */
button, input { font: inherit; color: inherit; }
button {
  background: var(--sodium); color: var(--asphalt); border: 0; border-radius: 3px;
  padding: .6em 1.1em; font-weight: 600; cursor: pointer;
}
button:hover { background: #f6bb63; }
button.secondary { background: transparent; color: var(--paper); box-shadow: inset 0 0 0 1px var(--kerb-line); }
button.secondary:hover { box-shadow: inset 0 0 0 1px var(--sodium); background: transparent; }
button.link { background: none; padding: 0; color: var(--dust); font-weight: 400; text-decoration: underline; text-decoration-color: var(--kerb-line); text-underline-offset: .2em; }
button.link:hover { color: var(--paper); text-decoration-color: var(--sodium); }
button.danger { background: var(--down); }
form.inline { display: inline; margin: 0; }

input[type="search"], input[type="text"], input[type="password"] {
  width: 100%; min-width: 0;
  background: var(--kerb); border: 1px solid var(--kerb-line); border-radius: 3px;
  padding: .6em .8em;
}
input:focus { border-color: var(--sodium); outline: none; }
input::placeholder { color: #6f6c63; }
label { display: block; margin-bottom: .35em; color: var(--dust); }

/* Accueil : la recherche est le titre */
.hero { padding-block: 1rem 2.5rem; }
.hero-title { font-size: clamp(3rem, 11vw, 6.5rem); margin: 0 0 .15em; line-height: .9; }
.hero-title label { display: inline; color: var(--paper); margin: 0; }
.search { display: flex; gap: .6rem; align-items: stretch; max-width: 760px; }
.search .combo { flex: 1; position: relative; }
.search input {
  font-family: var(--display); font-weight: 600; font-size: clamp(1.6rem, 5vw, 2.6rem); line-height: 1.1;
  padding: .3em 1.4em .3em .45em; border-width: 0 0 2px; border-radius: 0; background: transparent; border-color: var(--sodium);
}
.search input::-webkit-search-cancel-button { display: none; }
.qmark { position: absolute; right: .3em; top: 50%; transform: translateY(-50%); font-family: var(--display); font-weight: 800; font-size: clamp(1.8rem, 5vw, 2.8rem); color: var(--sodium); pointer-events: none; }
.hero-note { color: var(--dust); margin-top: 1rem; }

.combo { position: relative; }
.suggest {
  position: absolute; z-index: 10; left: 0; right: 0; top: calc(100% + 4px);
  margin: 0; padding: .25rem 0; list-style: none;
  background: var(--kerb); border: 1px solid var(--kerb-line); border-radius: 3px;
  box-shadow: 0 12px 30px rgba(8, 9, 14, .55);
  max-height: 22rem; overflow-y: auto;
}
.suggest li { display: flex; justify-content: space-between; gap: 1rem; padding: .5rem .8rem; cursor: pointer; font-family: var(--text); font-size: 1rem; }
.suggest li .muted { font-size: .9rem; }
.suggest li[aria-selected="true"], .suggest li:hover { background: #313643; }
.suggest li[aria-selected="true"] { box-shadow: inset 3px 0 0 var(--sodium); }

/* Blocs de contenu */
.block { margin-block: 2.5rem; }
.block > h2 { padding-bottom: .3rem; border-bottom: 1px solid var(--kerb-line); }
.fineprint { color: var(--dust); font-size: .9rem; }

/* Hausses et baisses */
.movers-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 1rem 3rem; }
.mover-list { list-style: none; margin: 0; padding: 0; }
.mover-list li {
  display: grid; grid-template-columns: 1fr auto 4.6em; gap: .75rem; align-items: baseline;
  padding: .45rem 0; border-bottom: 1px dashed var(--kerb-line);
}
.mover-list a { text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mover-list a:hover { text-decoration: underline; }
.mover-list .price { color: var(--dust); }
.mover-list .delta { text-align: right; font-weight: 600; }

.results { list-style: none; padding: 0; margin: 0; }
.results li { display: flex; flex-wrap: wrap; gap: .25rem 1rem; padding: .45rem 0; border-bottom: 1px dashed var(--kerb-line); }
.results .num { margin-left: auto; }

/* Page d'un objet : l'étiquette de prix */
.item-head { display: flex; align-items: center; gap: 1.25rem; }
.item-img { width: 100px; height: 50px; object-fit: contain; }
.item-name { margin-bottom: .1em; }
.item-head p { margin: 0; }

.tag-row { display: flex; flex-wrap: wrap; align-items: center; gap: 1.25rem 2.5rem; margin-block: 1.75rem 1rem; }
.price-tag {
  position: relative; display: inline-flex; flex-direction: column;
  padding: .7rem 1.5rem .8rem 2.6rem;
  background: var(--paper); color: var(--asphalt);
  clip-path: polygon(1.4rem 0, 100% 0, 100% 100%, 1.4rem 100%, 0 50%);
}
.price-tag::before { /* l'œillet de l'étiquette */
  content: ""; position: absolute; left: 1.05rem; top: 50%; width: .6rem; height: .6rem; margin-top: -.3rem;
  border-radius: 50%; background: var(--asphalt);
}
.tag-label { font-size: .85rem; font-weight: 600; color: #5b5747; }
.tag-value { font-family: var(--display); font-weight: 800; font-size: clamp(2.6rem, 9vw, 4.4rem); line-height: .95; }

.changes { display: flex; gap: 2rem; margin: 0; }
.changes dt { color: var(--dust); font-size: .9rem; }
.changes dd { margin: 0; font-family: var(--display); font-weight: 600; font-size: 1.9rem; line-height: 1.1; }
.fav-form { margin: 0; }
.fav-hint { margin: 0; color: var(--dust); }

.chart-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: .5rem 1rem; border-bottom: 1px solid var(--kerb-line); margin-bottom: 1rem; }
.chart-head h2 { margin: 0; padding-bottom: .3rem; }
.periods { display: flex; gap: .25rem; }
.periods a { padding: .25rem .6rem; text-decoration: none; color: var(--dust); border-radius: 3px; }
.periods a:hover { color: var(--paper); }
.periods a[aria-current] { color: var(--asphalt); background: var(--paper); font-weight: 600; }

.stats { display: flex; flex-wrap: wrap; gap: .5rem 2.5rem; margin: 0 0 1rem; }
.stats dt { color: var(--dust); font-size: .9rem; }
.stats dd { margin: 0; font-size: 1.25rem; font-weight: 600; }

.chart { margin: 0; }
.chart-box { position: relative; height: clamp(240px, 45vw, 380px); }
.chart-box.short { height: clamp(160px, 28vw, 220px); }
.chart figcaption { font-size: .9rem; margin-top: .5rem; }

.events { list-style: none; padding: 0; margin: 0; }
.events li { display: grid; grid-template-columns: minmax(10rem, 14rem) 1fr; gap: 0 1rem; padding: .5rem 0 .5rem .9rem; border-left: 3px solid var(--sodium); margin-bottom: .5rem; }
.events .ev-when { color: var(--sodium); }
.events .ev-title { font-weight: 600; }
.events .muted { grid-column: 2; font-size: .95rem; }

/* Tableaux */
.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { padding: .55rem .75rem .55rem 0; text-align: left; border-bottom: 1px solid var(--kerb-line); vertical-align: baseline; }
thead th { color: var(--dust); font-weight: 500; font-size: .9rem; }
tbody th { font-weight: 500; }
th.r, td.r { text-align: right; padding-right: 0; padding-left: .75rem; }

/* Connexion */
.login-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 2rem 3.5rem; align-items: start; }
.login-form { display: grid; gap: .6rem; max-width: 26rem; margin-bottom: 1rem; }
.login-form label { margin: 0; }
.login-form input { font-family: ui-monospace, "Cascadia Mono", Menlo, monospace; letter-spacing: .08em; }
.login-form button { justify-self: start; }
.tos { background: var(--kerb); padding: 1.25rem 1.5rem; border-radius: 3px; }
.tos h2 { font-size: 1.5rem; }
.tos-table th { width: 38%; font-weight: 600; }
.tos-table th span, .tos-table td span { display: block; color: var(--dust); font-weight: 400; font-size: .92rem; margin-top: .15rem; }
.tos-table tbody th { font-size: .95rem; }
.tos-table tr:last-child th, .tos-table tr:last-child td { border-bottom: 0; }

.notice { padding: .7rem 1rem; border-left: 3px solid var(--up); background: var(--kerb); }
.notice.warn { border-color: var(--sodium); }
.notice.error { border-color: var(--down); }

details summary { cursor: pointer; color: var(--dust); }
details[open] summary { margin-bottom: .75rem; }

/* Administration */
.counts { display: flex; flex-wrap: wrap; gap: .25rem 1.75rem; list-style: none; padding: 0; color: var(--dust); }
.counts .num { color: var(--paper); font-weight: 600; }
.track-form { display: grid; grid-template-columns: 1fr auto; gap: .6rem; max-width: 36rem; margin-bottom: 1.25rem; }
.track-form label { grid-column: 1 / -1; margin: 0; }
.tracked { list-style: none; padding: 0; margin: 0; }
.tracked li { display: flex; flex-wrap: wrap; gap: .25rem 1rem; align-items: baseline; padding: .4rem 0; border-bottom: 1px dashed var(--kerb-line); }
.tracked form { margin-left: auto; }
.runs .msg { color: var(--dust); font-size: .9rem; min-width: 14rem; }
.st-ok { color: var(--up); }
.st-partial, .st-running { color: var(--sodium); }
.st-error { color: var(--down); }

@media (max-width: 560px) {
  body { font-size: 1rem; }
  .search { flex-direction: column; }
  .search button { align-self: flex-start; }
  .events li { grid-template-columns: 1fr; }
  .events .muted { grid-column: 1; }
  .item-img { width: 72px; height: 36px; }
  .tag-row { gap: 1rem 1.5rem; }
}

@media (prefers-reduced-motion: no-preference) {
  .price-tag { animation: swing 900ms cubic-bezier(.3, 1.6, .5, 1) both; transform-origin: 1.35rem 50%; }
  @keyframes swing { from { transform: rotate(-7deg); } to { transform: rotate(0); } }
}
