/* Palette et typo reprises de l'app (tailwind.config.js, assets/images) : encre brun-noir,
   taupe, gris neutres, Poppins. Pas de crème en surface : il reste réservé à la mascotte. */
/* Poppins auto-hébergée (OFL, copiée de @expo-google-fonts/poppins) : pas de requête vers
   Google, donc pas d'IP de visiteur transmise à un tiers. */
@font-face {
  font-family: Poppins;
  font-weight: 400;
  font-style: normal;
  font-display: swap;
  src: url("fonts/poppins-400.ttf") format("truetype");
}

@font-face {
  font-family: Poppins;
  font-weight: 600;
  font-style: normal;
  font-display: swap;
  src: url("fonts/poppins-600.ttf") format("truetype");
}

@font-face {
  font-family: Poppins;
  font-weight: 700;
  font-style: normal;
  font-display: swap;
  src: url("fonts/poppins-700.ttf") format("truetype");
}

:root {
  color-scheme: light;
  --ink: #271416;
  --muted: #75696a;
  --faint: #a39798;
  --line: #ededed;
  --surface: #f5f5f5;
  --canvas: #f4f1f1;
  --cream: #f2eee3;
  --highlight: #fff1e3;
  /* Ciel du visuel App Store (assets/images/mockups/Header.png), fondu vers le blanc plutôt que vers
     son crème ; pastille de rang du classement (orange-50 / orange-900). */
  --sky: #fecdb2;
  --sky-end: #ffffff;
  --rank-bg: #fff7ed;
  --rank-ink: #7c2d12;
  --muted-on-sky: #5f4a4b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: Poppins, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.7;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Le décor de l'app derrière la carte des pages secondaires. Dans l'app, la WebView force
   `body { background: transparent }` (shared/ui/web-page.tsx), ce qui le retire aussi. */
body:not(.home) {
  background: #f6f6f6 url("images/decor-desktop.jpg") center / cover no-repeat fixed;
}

@media (max-width: 767px) {
  body:not(.home) {
    background: #f7f6f4 url("images/decor-mobile.jpg") center top / 100% auto no-repeat;
  }
}

::selection {
  background: var(--highlight);
  color: var(--ink);
}

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

.page {
  max-width: 720px;
  margin: 40px auto;
  padding: 36px 40px 40px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow:
    0 1px 2px rgb(39 20 22 / 0.04),
    0 12px 32px -12px rgb(39 20 22 / 0.1);
}

@media (max-width: 767px) {
  .page {
    margin: 16px;
    padding: 24px 20px 32px;
  }
}

.brand {
  display: inline-flex;
  border-radius: 6px;
}

.brand img {
  display: block;
  width: auto;
  height: 30px;
}

h1,
h2,
h3 {
  text-wrap: balance;
}

h1 {
  margin: 40px 0 8px;
  font-size: 34px;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.025em;
}

h2 {
  margin: 44px 0 8px;
  font-size: 21px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.015em;
}

h3 {
  margin: 28px 0 4px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.45;
}

p,
ul {
  margin: 0 0 16px;
  text-wrap: pretty;
}

ul {
  padding-left: 22px;
}

li {
  margin-bottom: 6px;
}

li::marker {
  color: var(--faint);
}

strong {
  font-weight: 600;
}

a {
  color: var(--ink);
  text-decoration-line: underline;
  text-decoration-color: var(--faint);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 3px;
  transition: text-decoration-color 140ms ease-out;
}

a:hover {
  text-decoration-color: var(--ink);
}

.lead {
  color: var(--muted);
  font-size: 18px;
  line-height: 1.6;
}

.updated {
  color: var(--muted);
  font-size: 14px;
}

.card {
  margin: 24px 0;
  padding: 20px;
  border-radius: 16px;
  background: var(--surface);
}

.card p:last-child {
  margin-bottom: 0;
}

.button {
  display: inline-block;
  padding: 12px 22px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--cream);
  font-weight: 600;
  text-decoration: none;
  transition: transform 140ms ease-out;
}

.button:active {
  transform: scale(0.97);
}

.table-wrap {
  overflow-x: auto;
  margin: 0 0 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-weight: 600;
}

footer {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  margin-bottom: 8px;
}

footer a {
  color: var(--muted);
  text-decoration-color: transparent;
}

footer a:hover {
  color: var(--ink);
  text-decoration-color: var(--faint);
}

.inviter {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 32px;
  color: var(--muted);
}

.inviter p {
  margin: 0;
}

.inviter strong {
  color: var(--ink);
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 999px;
  object-fit: cover;
}

[hidden] {
  display: none !important;
}

/* FAQ */

.lead + .faq-section {
  margin-top: 36px;
  border-top: 1px solid var(--line);
}

.faq-section {
  border-bottom: 1px solid var(--line);
}

.faq-section summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 0;
  cursor: pointer;
  list-style: none;
  -webkit-tap-highlight-color: transparent;
}

.faq-section summary::-webkit-details-marker {
  display: none;
}

.faq-section summary h2 {
  margin: 0;
  transition: color 140ms ease-out;
}

.faq-section summary:hover h2 {
  color: var(--muted);
}

.faq-section summary::after {
  content: "";
  flex: none;
  width: 20px;
  height: 20px;
  background: var(--muted);
  -webkit-mask:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 7.5l5 5 5-5'/%3E%3C/svg%3E")
    center / contain no-repeat;
  mask:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 7.5l5 5 5-5'/%3E%3C/svg%3E")
    center / contain no-repeat;
  transition: transform 140ms ease-out;
}

.faq-section[open] summary::after {
  transform: rotate(180deg);
}

.faq-section > h3:first-of-type {
  margin-top: 0;
}

.faq-section > p:last-child {
  margin-bottom: 28px;
}

.faq-section + .updated {
  margin-top: 32px;
}

/* Accueil */

.home {
  background: var(--sky-end);
}

.home-nav {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 24px 0;
}

.home-nav-link {
  padding: 8px 16px;
  border-radius: 999px;
  background: rgb(255 255 255 / 0.6);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background-color 140ms ease-out;
}

.home-nav-link:hover {
  background: #ffffff;
}

.hero {
  margin-top: -78px;
  padding: 118px 24px 0;
  /* Le décor de l'app (arbres, nuages, collines), fondu vers le blanc de la section suivante. */
  background:
    linear-gradient(180deg, rgb(255 255 255 / 0) 88%, var(--sky-end) 100%),
    url("images/decor-desktop.jpg") center bottom / cover no-repeat;
  text-align: center;
  overflow: hidden;
}

.hero h1 {
  margin: 0 auto;
  font-size: clamp(46px, 5.2vw, 72px);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.035em;
}

.hero-lead {
  max-width: 30ch;
  margin: 20px auto 30px;
  color: var(--muted-on-sky);
  font-size: clamp(18px, 1.7vw, 22px);
  line-height: 1.5;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.hero-lead strong {
  color: var(--ink);
  font-weight: 600;
}

.store-button {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 15px 26px 15px 22px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--cream);
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  box-shadow: 0 10px 24px -10px rgb(39 20 22 / 0.45);
  transition:
    transform 140ms ease-out,
    box-shadow 140ms ease-out;
}

.store-button svg {
  width: 19px;
  height: 19px;
  margin-top: -3px;
  fill: currentColor;
}

.store-button:hover {
  box-shadow: 0 14px 28px -10px rgb(39 20 22 / 0.55);
}

.store-button:active {
  transform: scale(0.97);
}

/* La scène : le téléphone fondu au ras du sol, la mascotte qui arrive à droite. */

.stage {
  --phone-w: clamp(250px, 27vw, 340px);
  position: relative;
  width: min(100%, 760px);
  height: calc(var(--phone-w) * 1.62);
  margin: 44px auto 0;
}

.phone {
  position: absolute;
  top: 0;
  left: 50%;
  width: var(--phone-w);
  aspect-ratio: 1206 / 2622;
  padding: calc(var(--phone-w) * 0.032);
  border-radius: calc(var(--phone-w) * 0.17);
  background: var(--ink);
  box-shadow:
    0 2px 4px rgb(39 20 22 / 0.08),
    0 40px 80px -30px rgb(39 20 22 / 0.45);
  transform: translateX(-50%);
  /* Fondu au ras de la scène (hauteur 1,62 × largeur) : le téléphone s'enfonce dans la page. */
  -webkit-mask-image: linear-gradient(180deg, #000 50%, transparent 73%);
  mask-image: linear-gradient(180deg, #000 50%, transparent 73%);
  animation: phone-rise 900ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

.phone img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: calc(var(--phone-w) * 0.14);
}

.phone::before {
  content: "";
  position: absolute;
  top: calc(var(--phone-w) * 0.06);
  left: 50%;
  width: 30%;
  height: calc(var(--phone-w) * 0.085);
  border-radius: 999px;
  background: #000000;
  transform: translateX(-50%);
}

.rank-toast {
  position: absolute;
  z-index: 1;
  top: 58%;
  right: calc(50% + var(--phone-w) * 0.36);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 10px 10px;
  border-radius: 999px;
  background: #ffffff;
  box-shadow:
    0 1px 2px rgb(39 20 22 / 0.06),
    0 16px 32px -14px rgb(39 20 22 / 0.3);
  text-align: left;
  white-space: nowrap;
  animation: toast-in 500ms cubic-bezier(0.16, 1, 0.3, 1) 700ms both;
}

.rank-roll {
  display: inline-flex;
  flex-direction: column;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--rank-bg);
  color: var(--rank-ink);
  font-weight: 600;
  line-height: 28px;
}

.rank-roll span {
  animation: rank-up 650ms cubic-bezier(0.65, 0, 0.35, 1) 1500ms both;
}

.rank-toast-text {
  font-size: 14px;
  font-weight: 600;
}

.stage-mascot {
  position: absolute;
  z-index: 2;
  bottom: 2%;
  left: calc(50% + var(--phone-w) * 0.46);
  width: clamp(110px, 12vw, 160px);
  height: auto;
  animation: mascot-walk 1100ms cubic-bezier(0.16, 1, 0.3, 1) 250ms both;
}

@keyframes phone-rise {
  from {
    opacity: 0;
    transform: translate(-50%, 48px);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }
}

@keyframes rank-up {
  to {
    transform: translateY(-100%);
  }
}

@keyframes mascot-walk {
  from {
    opacity: 0;
    transform: translateX(56px);
  }
}

/* La semaine, comme un trajet en pointillés : on y lit des pas. */

.week {
  max-width: 1120px;
  margin: 0 auto;
  padding: 72px 24px 96px;
}

.week h2,
.closing h2 {
  margin: 0;
  font-size: clamp(30px, 3.6vw, 44px);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.03em;
  text-align: center;
}

.week-track {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 32px;
  margin: 56px 0 0;
  padding: 0;
  list-style: none;
}

.week-track li {
  position: relative;
  margin: 0;
  padding-top: 32px;
}

.week-track li::before {
  content: "";
  position: absolute;
  top: 5px;
  left: 0;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--ink);
}

.week-track li::after {
  content: "";
  position: absolute;
  top: 10px;
  left: 22px;
  right: -22px;
  border-top: 2px dotted var(--faint);
}

.week-track li:last-child::after {
  display: none;
}

.week-day {
  display: inline-block;
  margin-bottom: 10px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--rank-bg);
  color: var(--rank-ink);
  font-size: 13px;
  font-weight: 600;
}

.week-track h3 {
  margin: 0 0 6px;
  font-size: 19px;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.week-track p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

.origin {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 24px 112px;
}

.origin p {
  max-width: 30ch;
  margin: 0 auto;
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.02em;
  text-align: center;
  text-wrap: balance;
}

.origin span {
  color: var(--muted);
}

.closing {
  padding: 0 24px 96px;
  background: linear-gradient(180deg, var(--sky-end) 0%, #fee3d3 60%, var(--sky) 100%);
  text-align: center;
}

.closing-mascots {
  display: block;
  width: clamp(150px, 16vw, 210px);
  height: auto;
  margin: 0 auto 28px;
}

.closing .store-button {
  margin-top: 32px;
}

.home-footer {
  margin: 0;
  border: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  padding: 24px max(24px, calc((100% - 1072px) / 2)) 32px;
  background: var(--sky);
  color: var(--rank-ink);
  font-size: 14px;
}

.home-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
}

.home-footer a {
  color: var(--rank-ink);
  text-decoration-color: transparent;
}

.home-footer a:hover {
  color: var(--ink);
  text-decoration-color: currentColor;
}

@media (max-width: 860px) {
  .week-track {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    row-gap: 40px;
  }

  .week-track li:nth-child(2)::after {
    display: none;
  }
}

@media (max-width: 560px) {
  .hero {
    padding-top: 112px;
    background-image:
      linear-gradient(180deg, rgb(255 255 255 / 0) 88%, var(--sky-end) 100%),
      url("images/decor-mobile.jpg");
  }

  .stage {
    --phone-w: 240px;
    height: 400px;
    margin-top: 44px;
  }

  .rank-toast {
    top: auto;
    right: 50%;
    bottom: 36%;
    transform: translateX(50%);
    animation-name: toast-in-centered;
  }

  .stage-mascot {
    left: calc(50% + 110px);
    bottom: -2%;
    width: 72px;
  }

  .week {
    padding-top: 48px;
  }

  .week-track {
    grid-template-columns: 1fr;
    gap: 0;
    margin-top: 40px;
  }

  .week-track li {
    padding: 0 0 32px 32px;
  }

  .week-track li::before {
    top: 7px;
  }

  .week-track li::after,
  .week-track li:nth-child(2)::after {
    display: block;
    top: 26px;
    bottom: 2px;
    left: 5px;
    right: auto;
    border-top: 0;
    border-left: 2px dotted var(--faint);
  }

  .week-track li:last-child {
    padding-bottom: 0;
  }

  .home-footer {
    flex-direction: column;
    align-items: flex-start;
  }
}

@keyframes toast-in-centered {
  from {
    opacity: 0;
    transform: translate(50%, 10px) scale(0.96);
  }
}

@media (prefers-reduced-motion: reduce) {
  .phone,
  .rank-toast,
  .stage-mascot {
    animation: none;
  }

  .rank-roll span {
    animation-duration: 1ms;
    animation-delay: 0ms;
  }
}
