/* Polices auto-hébergées (SIL Open Font License) : aucune requête vers un tiers. */
@font-face {
  font-family: "Bricolage Grotesque";
  src: url("fonts/bricolage-grotesque.woff2") format("woff2");
  font-weight: 500 800;
  font-display: swap;
}
@font-face {
  font-family: "Figtree";
  src: url("fonts/figtree.woff2") format("woff2");
  font-weight: 400 700;
  font-display: swap;
}

/* Palette tirée de l'app : vert Bora (travail), ambre (pause), sarcelle profonde (fond sombre). */
:root {
  --paper: #f2faf6;
  --surface: #ffffff;
  --ink: #072a30;
  --ink-soft: #3f5d61;
  --green: #0b9e78;
  --green-text: #087a5d;
  --mint: #6ff5c3;
  --amber: #e88a00;
  --amber-text: #a85f00;
  --line: #cfe6dd;

  --display: "Bricolage Grotesque", ui-rounded, system-ui, sans-serif;
  --body: "Figtree", system-ui, -apple-system, sans-serif;

  --gutter: clamp(16px, 5vw, 48px);
  --max: 1120px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #062227;
    --surface: #0b3138;
    --ink: #e6f6f0;
    --ink-soft: #9dbdb6;
    --green: #6ff5c3;
    --green-text: #6ff5c3;
    --amber: #ffa41b;
    --amber-text: #ffb547;
    --line: #164a51;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 18px/1.6 var(--body);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--green-text); text-underline-offset: 3px; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; border-radius: 6px; }

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.num { font-variant-numeric: tabular-nums; }

/* ——— Barre du haut ——— */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 20px;
  padding-bottom: 20px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font: 700 22px/1 var(--display);
}
.brand img { width: 36px; height: 36px; border-radius: 9px; }
.topbar nav { display: flex; gap: 20px; font-weight: 500; }
.topbar nav a { color: var(--ink-soft); text-decoration: none; }
.topbar nav a:hover { color: var(--ink); }

/* ——— Ouverture ——— */
.hero {
  display: grid;
  grid-template-columns: 1fr 1.05fr;
  gap: clamp(32px, 6vw, 80px);
  align-items: center;
  padding-top: clamp(24px, 6vw, 72px);
  padding-bottom: clamp(48px, 8vw, 104px);
}
.hero h1 {
  font: 800 clamp(44px, 7vw, 84px)/0.98 var(--display);
  letter-spacing: -0.03em;
  margin: 0 0 24px;
}
.hero .lede {
  font-size: clamp(18px, 2vw, 21px);
  color: var(--ink-soft);
  max-width: 30em;
  margin: 0 0 32px;
}

/* Badge officiel : on ne modifie ni ses couleurs ni ses proportions (règles Apple). */
.store { display: inline-block; line-height: 0; border-radius: 9px; }
.store img { display: block; height: 52px; width: auto; }
.store-note { margin: 12px 0 0; font-size: 15px; color: var(--ink-soft); }

/* ——— Le ticket du jour : calculateur interactif ——— */
.ticket {
  background: #072a30;
  color: #e6f6f0;
  border-radius: 28px;
  padding: clamp(22px, 3.5vw, 36px);
  box-shadow: 0 30px 60px -30px rgba(7, 42, 48, .55);
  --t-soft: #9dbdb6;
  --t-line: #1d5059;
}
@media (prefers-color-scheme: dark) {
  .ticket { background: #0e3b43; box-shadow: none; border: 1px solid #1d5059; }
}
.ticket-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  color: var(--t-soft);
  font-size: 15px;
}
.ticket-head .phase { color: #6ff5c3; font-weight: 600; }

.departure {
  font: 800 clamp(72px, 13vw, 132px)/0.9 var(--display);
  letter-spacing: -0.04em;
  margin: 10px 0 6px;
  color: #6ff5c3;
}
.delay {
  min-height: 1.6em;
  margin: 0 0 22px;
  color: var(--t-soft);
  font-size: 16px;
}
.delay.late { color: #ffb547; }

/* Frise de la journée */
.day {
  position: relative;
  height: 46px;
  border-radius: 12px;
  background: #0b9e78;
  overflow: hidden;
}
.day .pause {
  position: absolute;
  top: 0;
  bottom: 0;
  background: #ffa41b;
  transition: left .35s ease, width .35s ease;
}
.day .pause.extra {
  background: repeating-linear-gradient(-45deg, #ffa41b 0 6px, #ffc061 6px 12px);
}
.ticks {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 13px;
  color: var(--t-soft);
}
.legend {
  display: flex;
  gap: 18px;
  margin: 14px 0 0;
  font-size: 14px;
  color: var(--t-soft);
}
.legend span::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 6px;
  background: #0b9e78;
}
.legend .l-pause::before { background: #ffa41b; }

.controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--t-line);
}
.controls label { display: block; font-size: 14px; color: var(--t-soft); }
/* Les trois champs partagent exactement la même boîte : même hauteur, même largeur, même chevron. */
.controls input[type="time"],
.controls select {
  -webkit-appearance: none;
  appearance: none;
  display: block;
  width: 100%;
  min-width: 0;
  height: 48px;
  margin: 6px 0 0;
  padding: 0 34px 0 12px;
  border-radius: 10px;
  border: 1px solid var(--t-line);
  background: #0a353c url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%239dbdb6' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 12px center / 12px 8px;
  color: #e6f6f0;
  font: 600 18px/46px var(--body);
  font-variant-numeric: tabular-nums;
  text-align: left;
  color-scheme: dark;
  cursor: pointer;
}
/* Champ d'heure : on tape l'heure au clavier, donc une petite horloge à la place du chevron des listes. */
.controls input[type="time"] {
  position: relative;
  cursor: text;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='12' cy='12' r='9' fill='none' stroke='%239dbdb6' stroke-width='2'/%3E%3Cpath d='M12 7v5l3 2' fill='none' stroke='%239dbdb6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-size: 16px 16px;
  background-position: right 10px center;
}
/* L'icône native (Chrome) devient une zone invisible posée sur notre horloge : un clic dessus ouvre le sélecteur. */
.controls input[type="time"]::-webkit-calendar-picker-indicator {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 36px;
  height: auto;
  margin: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
}
.controls input[type="time"]::-webkit-date-and-time-value { text-align: left; margin: 0; }
.controls input[type="time"]::-webkit-datetime-edit { padding: 0; line-height: 46px; }
.controls .wide { grid-column: 1 / -1; }
.controls input[type="range"] {
  display: block;
  width: 100%;
  margin: 8px 0 0;
  padding: 0;
  border: 0;
  background: transparent;
  accent-color: #ffa41b;
  height: 28px;
}
.range-row { display: flex; justify-content: space-between; }
.range-row output { color: #e6f6f0; font-weight: 600; }

/* ——— La règle ——— */
.rule {
  border-top: 1px solid var(--line);
  padding-top: clamp(48px, 7vw, 88px);
  padding-bottom: clamp(48px, 7vw, 88px);
}
.rule h2, .features h2, .help h2 {
  font: 700 clamp(30px, 4vw, 44px)/1.1 var(--display);
  letter-spacing: -0.02em;
  margin: 0 0 16px;
}
.equation {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 8px 18px;
  margin: 36px 0 28px;
  font: 700 clamp(30px, 5.2vw, 60px)/1 var(--display);
  letter-spacing: -0.02em;
}
.equation .term { display: flex; flex-direction: column; gap: 10px; }
.equation .term small {
  font: 500 15px/1.2 var(--body);
  letter-spacing: 0;
  color: var(--ink-soft);
}
.equation .op { color: var(--ink-soft); font-weight: 500; padding-bottom: 2px; }
.equation .t-pause { color: var(--amber-text); }
.equation .t-result { color: var(--green-text); }
.rule p { max-width: 40em; color: var(--ink-soft); margin: 0; }

/* ——— Fonctionnalités ——— */
.features {
  border-top: 1px solid var(--line);
  padding-top: clamp(48px, 7vw, 88px);
  padding-bottom: clamp(48px, 7vw, 88px);
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 40px;
}
.features .intro p { color: var(--ink-soft); margin: 0; }
.feature-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 36px 40px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.feature-list svg {
  width: 28px;
  height: 28px;
  stroke: var(--green-text);
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.feature-list h3 { font: 700 21px/1.25 var(--display); margin: 10px 0 6px; }
.feature-list p { margin: 0; color: var(--ink-soft); font-size: 17px; }

/* ——— Aide ——— */
.help {
  border-top: 1px solid var(--line);
  padding-top: clamp(48px, 7vw, 88px);
  padding-bottom: clamp(48px, 7vw, 88px);
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 40px;
}
.help .intro p { color: var(--ink-soft); margin: 0 0 20px; }
.contact {
  display: inline-block;
  background: var(--green);
  color: var(--paper);
  font-weight: 600;
  text-decoration: none;
  padding: 12px 20px;
  border-radius: 12px;
}
.contact:hover { text-decoration: none; filter: brightness(1.08); }
.help .hint { font-size: 15px; margin-top: 16px; }

.faq details { border-bottom: 1px solid var(--line); }
.faq details:first-child { border-top: 1px solid var(--line); }
.faq summary {
  list-style: none;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 0;
  font: 600 19px/1.35 var(--display);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: "+";
  font: 500 26px/1 var(--body);
  color: var(--green-text);
  transition: transform .2s ease;
}
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin: 0 0 20px; color: var(--ink-soft); max-width: 38em; }

/* ——— Pied de page ——— */
.footer {
  border-top: 1px solid var(--line);
  padding-top: 28px;
  padding-bottom: 40px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px 24px;
  font-size: 15px;
  color: var(--ink-soft);
}
.footer nav { display: flex; gap: 20px; }

/* ——— Page de texte (confidentialité) ——— */
.doc {
  max-width: 720px;
  padding-top: clamp(24px, 5vw, 64px);
  padding-bottom: clamp(48px, 7vw, 88px);
}
.doc h1 {
  font: 800 clamp(40px, 6vw, 64px)/1.02 var(--display);
  letter-spacing: -0.03em;
  margin: 0 0 12px;
}
.doc .updated { color: var(--ink-soft); margin: 0 0 36px; }
.doc .summary {
  background: var(--surface);
  border-left: 5px solid var(--green);
  border-radius: 4px 16px 16px 4px;
  padding: 22px 26px;
  font-size: 20px;
  line-height: 1.5;
  margin: 0 0 16px;
}
.doc h2 { font: 700 25px/1.25 var(--display); margin: 44px 0 10px; }
.doc p, .doc li { color: var(--ink-soft); }
.doc strong { color: var(--ink); }
.doc ul { padding-left: 22px; }
.doc li { margin: 6px 0; }

/* ——— Responsive ——— */
@media (max-width: 900px) {
  .hero, .features, .help { grid-template-columns: 1fr; }
  .hero { gap: 40px; }
}
@media (max-width: 560px) {
  body { font-size: 17px; }
  .topbar nav { gap: 14px; font-size: 15px; }
  .topbar nav .optional { display: none; }
  .feature-list { grid-template-columns: 1fr; gap: 28px; }
  .controls { gap: 8px; }
  .controls input[type="time"],
  .controls select { font-size: 16px; padding: 0 26px 0 10px; background-position: right 9px center; }
  .controls input[type="time"] { background-size: 14px 14px; background-position: right 8px center; }
  .equation { font-size: clamp(20px, 6.4vw, 30px); gap: 6px 8px; flex-wrap: nowrap; }
  .equation .term small { font-size: 13px; }
  .equation .op { padding-bottom: 0; }
}
