/* Pedal. Its own styles; nothing here is shared with bouchey.dev.
   Menus are paper and ink like the rest of the site. The riding display is built to be
   read from a bike a few metres from a TV: few numbers, large, on dark glass. */
:root {
  --paper: #F6F3ED; --ink: #1F1D1A; --muted: #5B564E; --rule: #D8D2C6; --accent: #9A4527;
  --serif: "Alegreya", Georgia, serif;
  --sans: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --glass: rgba(24, 22, 19, 0.72);
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 17px/1.5 var(--sans); }
[hidden] { display: none !important; }
#world { position: fixed; inset: 0; width: 100%; height: 100%; display: none; }
body.riding { background: #000; overflow: hidden; }
body.riding #world { display: block; }
body.riding #menu { display: none; }

/* ---------- menus ---------- */
#menu { max-width: 46rem; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }
.masthead { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; border-bottom: 2px solid var(--ink); padding-bottom: .4rem; }
h1 { font: 700 2.6rem/1 var(--serif); margin: 0; letter-spacing: -.01em; }
h2 { font: 700 1.5rem/1.2 var(--serif); margin: 2rem 0 .5rem; }
.who { margin: 0; color: var(--muted); }
.who button { margin-left: .5rem; }
p { margin: .5rem 0; }
.muted, .foot { color: var(--muted); font-size: .92rem; }
.foot { margin-top: 3rem; border-top: 1px solid var(--rule); padding-top: .75rem; }
a { color: var(--accent); }
.label { font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }

button, .btn { font: 600 1rem var(--sans); min-height: 44px; padding: .5rem 1rem; border: 1.5px solid var(--ink); background: transparent; color: var(--ink); border-radius: 3px; cursor: pointer; }
button:hover { background: rgba(31, 29, 26, .06); }
button.strong { background: var(--ink); color: var(--paper); }
button.strong:hover { background: #000; }
button.go { background: var(--accent); border-color: var(--accent); color: #fff; }
button.link { border: 0; min-height: 0; padding: 0; color: var(--accent); text-decoration: underline; font-weight: 400; }
button:disabled { opacity: .45; cursor: not-allowed; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.tabs { display: flex; gap: 1.25rem; border-bottom: 1px solid var(--rule); margin: 1rem 0 0; overflow-x: auto; }
.tabs button { border: 0; border-bottom: 3px solid transparent; border-radius: 0; padding: .5rem 0; white-space: nowrap; }
.tabs button[aria-selected="true"] { border-bottom-color: var(--accent); color: var(--accent); }
.tabs button:hover { background: none; color: var(--accent); }

.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; gap: 1rem; align-items: center; justify-content: space-between; padding: .9rem 0; border-bottom: 1px solid var(--rule); }
.list h3 { font: 700 1.2rem/1.2 var(--serif); margin: 0; }
.list p { margin: .15rem 0 0; color: var(--muted); font-size: .95rem; }
.list .facts { font-variant-numeric: tabular-nums; color: var(--ink); font-size: .9rem; }
.list .acts { display: flex; gap: .5rem; flex: none; flex-wrap: wrap; justify-content: flex-end; }
.spark { display: block; width: 100%; max-width: 22rem; height: 34px; margin-top: .35rem; }

.riders { display: flex; flex-wrap: wrap; gap: .75rem; margin: 1rem 0; }
.riders button { min-width: 9rem; min-height: 5rem; font: 700 1.4rem var(--serif); }

.sensors { margin: 1rem 0 0; border: 1px solid var(--rule); border-radius: 3px; }
.sensors > div { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .6rem .9rem; }
.sensors > div + div { border-top: 1px solid var(--rule); }
.dot { display: inline-block; width: .7em; height: .7em; border-radius: 50%; background: var(--rule); margin-right: .5em; }
.dot.on { background: #3f8a4f; } .dot.wait { background: #d9a431; }
.sensors details { width: 100%; font-size: .9rem; color: var(--muted); }
.sensors summary { cursor: pointer; min-height: 32px; }
.sensors pre { margin: .4rem 0 0; font: 400 .8rem/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap; color: var(--ink); }

form.sheet { display: grid; gap: .9rem; max-width: 26rem; margin-top: 1rem; }
form.sheet label { display: grid; gap: .25rem; font-weight: 600; font-size: .95rem; }
form.sheet label small { font-weight: 400; color: var(--muted); }
input, select { font: 400 1.05rem var(--sans); min-height: 44px; padding: .4rem .6rem; border: 1.5px solid var(--ink); border-radius: 3px; background: #fff; color: var(--ink); width: 100%; }
input[type="checkbox"] { width: 1.3rem; min-height: 1.3rem; height: 1.3rem; accent-color: var(--accent); }
input[type="range"] { padding: 0; border: 0; accent-color: var(--accent); background: none; }
label.check { display: flex !important; align-items: center; gap: .6rem; font-weight: 400 !important; }
.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }
.error { color: #a12a1b; font-weight: 600; }

.numbers { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: 0; border-top: 1px solid var(--rule); margin: 1rem 0; }
.numbers div { padding: .7rem 0; border-bottom: 1px solid var(--rule); }
.numbers b { display: block; font: 700 1.7rem/1.1 var(--sans); font-variant-numeric: tabular-nums; }
.numbers span { color: var(--muted); font-size: .85rem; }

/* ---------- riding display ---------- */
#hud { position: fixed; inset: 0; display: flex; flex-direction: column; justify-content: space-between; padding: 1.6vh 1.4vw; color: #fff; pointer-events: none; font-variant-numeric: tabular-nums; }
#hud button { pointer-events: auto; color: #fff; border-color: rgba(255, 255, 255, .7); background: var(--glass); font-size: max(1rem, 1.1vw); }
#hud button.strong { background: var(--accent); border-color: var(--accent); }
.hud-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 1vw; }
.panel { background: var(--glass); border-radius: .6vw; padding: 1vh 1.2vw; }
.panel.main { display: flex; gap: 2.4vw; padding: 1vh 2vw 1.2vh; }
.panel.side { min-width: 15vw; display: grid; gap: .6vh; }
.panel.side.right { text-align: right; }
.big { text-align: center; min-width: 11vw; position: relative; }
.big b { display: block; font: 700 6.4vw/1 var(--sans); letter-spacing: -.02em; }
.big span, .stat span, .grade span { font-size: max(.8rem, 1.15vw); opacity: .8; text-transform: uppercase; letter-spacing: .06em; }
.big i { display: block; font-style: normal; font-weight: 600; font-size: max(.9rem, 1.5vw); margin-top: .3vh; }
#zone-box { border-bottom: .7vh solid var(--zone, #8d9aa3); padding-bottom: .4vh; }
.stat b { font: 700 2.6vw/1.05 var(--sans); margin-right: .4vw; }
#h-step-box b, #h-next-box b { font-size: 1.8vw; display: block; margin: 0; }
.grade b { font: 700 4.6vw/1 var(--sans); }
.grade.up b { color: #ffb38f; } .grade.down b { color: #a9d8ff; }
#banner { align-self: center; background: var(--glass); border-radius: .6vw; padding: 1.4vh 2.4vw; font: 700 max(1.4rem, 2.6vw) var(--serif); text-align: center; }
.hud-bottom { display: grid; gap: 1vh; }
#strip { width: 100%; height: 11vh; background: var(--glass); border-radius: .6vw; display: block; }
.controls { display: flex; gap: .6vw; justify-content: flex-end; align-items: center; flex-wrap: wrap; transition: opacity .4s; }
.controls.idle { opacity: 0; }
#chips { margin-right: auto; display: flex; gap: .6vw; flex-wrap: wrap; }
.chip { background: var(--glass); border-radius: 99px; padding: .3rem .8rem; font-size: max(.8rem, 1vw); }
.chip.off { background: rgba(161, 42, 27, .9); }

#toast { position: fixed; left: 50%; bottom: 2rem; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: .7rem 1.1rem; border-radius: 3px; max-width: 90vw; z-index: 5; }

@media (max-width: 700px) {
  .list > li { flex-direction: column; align-items: stretch; }
  .list .acts { justify-content: flex-start; }
  .panel.side { min-width: 0; }
  .hud-top { flex-wrap: wrap; }
  .panel.main { order: -1; width: 100%; justify-content: space-around; }
  .big b { font-size: 13vw; } .stat b { font-size: 6vw; } .grade b { font-size: 9vw; }
  #h-step-box b, #h-next-box b { font-size: 4.5vw; }
}
@media (prefers-reduced-motion: reduce) { .controls { transition: none; } }
