/* =============================================================================
   MyRoyConsultants — Vitrine
   Direction « Blueprint / génie civil » : grille de plan, lueur cuivre, lignes
   de contour. Tokens repris du design system « Modern Civic » (rc_inspection +
   rc_reservation). Voir ../rc_roy/docs/visual_identity.md.
   ========================================================================== */

/* ----------------------------------------------------------------------------
   01 · TOKENS
   ------------------------------------------------------------------------- */
:root {
  /* Marque — bleu corporate */
  --rc-50:  #f0f5fb;  --rc-100: #d9e7f1;  --rc-200: #b5cee2;  --rc-300: #82a8c8;
  --rc-400: #4a7ba8;  --rc-500: #1f5689;  --rc-600: #0a4475;  --rc-700: #003764;
  --rc-800: #002a4d;  --rc-900: #001f3a;  --rc-950: #001124;

  /* Accent — cuivre / terre */
  --copper-300: #d2a484;  --copper-400: #b88670;
  --copper-500: #9b6b54;  --copper-600: #7a5440;

  /* Sémantique — verts/ambres foncés : ≥ 4.5:1 sur leurs fonds de badge (WCAG AA)
     (#16a34a sur #dcfce7 ne faisait que 3.0:1 ; #b45309 sur #fef3c7, 4.5:1 tout juste) */
  --success: #166534;  --warning: #92400e;  --danger: #b91c1c;  --info: #2563eb;

  /* Ink / surfaces */
  --ink-900: #0f172a;  --ink-600: #475569;  --ink-500: #64748b;
  --border: #e2e8f0;   --surface-app: #fafbfc;  --surface-card: #ffffff;

  /* Typographie */
  --font-display: "Plus Jakarta Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-body: "Inter Tight", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", "Cascadia Code", monospace;

  --radius: 0.875rem;   /* 14px */
  --radius-sm: 0.625rem;

  /* Élévation 3 niveaux */
  --shadow-elev-1: 0 1px 2px rgb(15 23 42 / 0.04), 0 8px 24px -14px rgb(15 23 42 / 0.20);
  --shadow-elev-2: 0 6px 14px -6px rgb(15 23 42 / 0.12), 0 18px 40px -16px rgb(15 23 42 / 0.30);
  --shadow-elev-3: 0 24px 60px -18px rgb(0 31 58 / 0.55);

  --ease-spring: cubic-bezier(0.22, 0.84, 0.30, 1);
  --ease-smooth: cubic-bezier(0.25, 1, 0.50, 1);

  --maxw: 1140px;
  --gutter: clamp(1.1rem, 4vw, 2.5rem);
}

/* ----------------------------------------------------------------------------
   02 · BASE
   ------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

/* color-scheme: light — empêche l'assombrissement forcé (Chrome Android
   auto-dark) de repeindre les surfaces tant qu'un vrai thème sombre n'existe pas. */
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; color-scheme: light; }

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink-900);
  background: var(--surface-app);
  font-feature-settings: "kern", "liga", "calt", "cv11", "ss01";
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3 {
  font-family: var(--font-display);
  margin: 0;
  color: var(--rc-700);
  letter-spacing: -0.018em;
  text-wrap: balance;
}

p { margin: 0; }
a { color: var(--rc-600); text-decoration: none; }
a:hover { color: var(--rc-700); }
img, svg { display: block; max-width: 100%; }

/* Cibles tactiles + suppression du délai 300ms (ui-ux: touch & interaction) */
a, button, .btn {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Outline transparent (et non none) : en mode forced-colors / Contraste élevé
   Windows, les box-shadow sont supprimés mais l'outline transparent est repeint
   en couleur système — l'indicateur de focus reste visible. */
:focus-visible {
  outline: 2px solid transparent;
  box-shadow: 0 0 0 2px var(--surface-card), 0 0 0 4px var(--rc-700);
  border-radius: var(--radius-sm);
}

::selection { background: var(--copper-300); color: var(--rc-950); }

/* ----------------------------------------------------------------------------
   03 · LAYOUT
   ------------------------------------------------------------------------- */
.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }

/* L'ancre tient compte de la topbar collante */
[id] { scroll-margin-top: 84px; }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--rc-700); color: #fff; padding: 0.6rem 1rem;
  border-radius: 0 0 var(--radius-sm) 0;
}
.skip-link:focus { left: 0; color: #fff; }

/* ----------------------------------------------------------------------------
   04 · TOPBAR
   ------------------------------------------------------------------------- */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgb(255 255 255 / 0.82);
  -webkit-backdrop-filter: saturate(180%) blur(10px); /* Safari ≤ 17 */
  backdrop-filter: saturate(180%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.topbar__inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; min-height: 64px; padding-block: 0.55rem;
}
.topbar__logo { display: inline-flex; }
.topbar__logo img { height: 38px; width: auto; }

.lang-switch {
  display: inline-flex; align-items: center; gap: 0.15rem;
  border: 1px solid var(--border); border-radius: 999px;
  padding: 0.2rem 0.35rem; background: var(--surface-card);
}
.lang-switch > svg { margin-right: 0.15rem; flex: none; }
.lang-switch button {
  font-family: var(--font-body); font-size: 0.78rem; font-weight: 700;
  letter-spacing: 0.03em; color: var(--ink-500);
  background: transparent; border: 0; border-radius: 999px;
  min-height: 44px; padding: 0 0.75rem; cursor: pointer; /* cible tactile 44px min */
  transition: color 160ms var(--ease-smooth), background 160ms var(--ease-smooth);
}
.lang-switch button:hover { color: var(--rc-700); }
.lang-switch button[aria-pressed="true"] { background: var(--rc-700); color: #fff; }

/* ----------------------------------------------------------------------------
   05 · HERO — atmosphère blueprint
   ------------------------------------------------------------------------- */
.hero {
  position: relative; overflow: hidden; overflow: clip; color: #fff;
  background:
    radial-gradient(1100px 520px at 82% -8%, rgb(155 107 84 / 0.30), transparent 58%),
    radial-gradient(900px 600px at 10% 110%, rgb(31 86 137 / 0.40), transparent 60%),
    linear-gradient(155deg, var(--rc-950) 0%, var(--rc-800) 52%, var(--rc-700) 100%);
}
/* Grille de plan, masquée en fondu vers le bas */
.hero__grid {
  position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(rgb(255 255 255 / 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgb(255 255 255 / 0.05) 1px, transparent 1px);
  background-size: 46px 46px;
  -webkit-mask-image: radial-gradient(90% 80% at 50% 0%, #000 25%, transparent 100%); /* Chrome < 120, Safari < 15.4 */
  mask-image: radial-gradient(90% 80% at 50% 0%, #000 25%, transparent 100%);
}
/* Lueur cuivre qui respire (coupée par prefers-reduced-motion) */
.hero__glow {
  position: absolute; width: 42vw; height: 42vw; max-width: 640px; max-height: 640px;
  top: -12%; right: -6%; border-radius: 50%; pointer-events: none;
  background: radial-gradient(circle, rgb(184 134 112 / 0.34), transparent 62%);
  filter: blur(8px); animation: breathe 11s var(--ease-smooth) infinite;
}
/* Lignes de contour topographiques (clin d'œil « Terrain ») */
.hero__contour {
  position: absolute; right: -4%; bottom: -28%; width: min(58vw, 760px);
  color: rgb(210 164 132 / 0.16); pointer-events: none;
}
.hero__inner {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2.5rem;
  padding-block: clamp(3.75rem, 8vw, 6.5rem);
}
.hero__eyebrow {
  display: inline-flex; align-items: center; gap: 0.6rem;
  font-family: var(--font-mono); font-size: 0.75rem; font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--copper-300); margin-bottom: 1.15rem;
}
.hero__eyebrow::before { content: ""; width: 30px; height: 1.5px; background: var(--copper-400); }
.hero h1 {
  color: #fff; font-size: clamp(2.1rem, 5.4vw, 3.5rem); line-height: 1.04;
  font-weight: 800; letter-spacing: -0.025em;
}
/* Repli : cuivre uni si background-clip:text n'est pas supporté
   (color:transparent sans le clip rendrait le texte invisible). */
.hero h1 .accent { color: var(--copper-300); }
@supports (background-clip: text) or (-webkit-background-clip: text) {
  .hero h1 .accent {
    color: transparent;
    background: linear-gradient(100deg, var(--copper-300), #e7c3a6);
    -webkit-background-clip: text; background-clip: text;
  }
}
.hero__lead {
  margin-top: 1.25rem; max-width: 48ch;
  font-size: clamp(1rem, 2.3vw, 1.2rem); color: rgb(255 255 255 / 0.84);
}
.hero__cta { margin-top: 2.1rem; display: flex; flex-wrap: wrap; gap: 0.75rem; }
.hero__meta {
  margin-top: 1.9rem; display: flex; flex-wrap: wrap; gap: 0.5rem 1.6rem;
  font-family: var(--font-mono); font-size: 0.75rem; letter-spacing: 0.04em;
  color: rgb(255 255 255 / 0.62);
}
.hero__meta span { display: inline-flex; align-items: center; gap: 0.45rem; }
.hero__meta span::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--copper-400); }

.hero__mark { width: clamp(120px, 16vw, 196px); filter: drop-shadow(0 18px 44px rgb(0 0 0 / 0.5)); }
.hero__mark img {
  width: 100%;
  /* height:auto obligatoire : sans lui, l'attribut height="153" du HTML reste
     appliqué pendant que width passe à 100% -> monogramme étiré (196x153) */
  height: auto;
  /* Knockout blanc du monogramme officiel (PNG bleu) sur fond sombre */
  filter: brightness(0) invert(1);
}
@media (max-width: 780px) {
  .hero__inner { grid-template-columns: 1fr; gap: 1.5rem; }
  .hero__mark { display: none; }
}

/* ----------------------------------------------------------------------------
   06 · BOUTONS
   ------------------------------------------------------------------------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 0.55rem;
  font-family: var(--font-body); font-size: 0.95rem; font-weight: 600; line-height: 1;
  min-height: 44px; padding: 0 1.2rem; border-radius: var(--radius-sm);
  border: 1px solid transparent; cursor: pointer;
  transition: background 180ms var(--ease-smooth), color 180ms var(--ease-smooth),
              border-color 180ms var(--ease-smooth), transform 180ms var(--ease-spring),
              box-shadow 180ms var(--ease-smooth);
}
.btn:active { transform: scale(0.97); }
.btn svg { width: 18px; height: 18px; transition: transform 220ms var(--ease-spring); }
.btn:hover svg { transform: translateX(3px); }

.btn--primary { background: var(--rc-700); color: #fff; box-shadow: 0 8px 20px -10px rgb(0 31 58 / 0.7); }
.btn--primary:hover { background: var(--rc-800); color: #fff; transform: translateY(-2px); box-shadow: 0 14px 30px -10px rgb(0 31 58 / 0.7); }
.btn--accent { background: var(--copper-500); color: #fff; box-shadow: 0 8px 22px -10px rgb(122 84 64 / 0.8); }
.btn--accent:hover { background: var(--copper-600); color: #fff; transform: translateY(-2px); }
.btn--ghost-light { background: rgb(255 255 255 / 0.08); color: #fff; border-color: rgb(255 255 255 / 0.24); }
.btn--ghost-light:hover { background: rgb(255 255 255 / 0.16); color: #fff; }
.btn--outline {
  background: var(--surface-card); color: var(--rc-700); border-color: var(--border);
}
.btn--outline:hover { background: var(--rc-50); color: var(--rc-800); border-color: var(--rc-300); }

/* Carte entièrement cliquable : l'::after du CTA couvre la carte.
   position:static + transform:none obligatoires sur le bouton, sinon il devient
   le containing block et l'overlay se réduit au bouton (flicker au survol). */
.app-card--link .app-card__foot .btn--primary { position: static; }
.app-card--link .app-card__foot .btn--primary::after {
  content: ""; position: absolute; inset: 0; z-index: 1;
}
.app-card--link .app-card__foot .btn--primary:hover,
.app-card--link .app-card__foot .btn--primary:active { transform: none; }

/* ----------------------------------------------------------------------------
   07 · SECTION APPLICATIONS
   ------------------------------------------------------------------------- */
.section { padding-block: clamp(3.25rem, 7vw, 5.5rem); }
.section--tight { padding-top: 0; }
.section__head { max-width: 62ch; margin-bottom: 2.5rem; }
.section__kicker {
  font-family: var(--font-mono); font-size: 0.75rem; font-weight: 600;
  letter-spacing: 0.16em; text-transform: uppercase; color: var(--copper-600);
}
.section__title { margin-top: 0.6rem; font-size: clamp(1.6rem, 3.6vw, 2.15rem); font-weight: 700; letter-spacing: -0.02em; }
.section__subtitle { margin-top: 0.7rem; color: var(--ink-600); font-size: 1.04rem; }

/* min(290px, 100%) : sous 290px de conteneur (viewport 320px), la piste se
   contracte au lieu de déborder horizontalement. */
.app-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(290px, 100%), 1fr)); gap: 1.35rem; }

.app-card {
  position: relative; isolation: isolate; overflow: hidden;
  display: flex; flex-direction: column;
  background: var(--surface-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 1.6rem;
  box-shadow: var(--shadow-elev-1);
  transition: box-shadow 220ms var(--ease-smooth), transform 220ms var(--ease-spring),
              border-color 220ms var(--ease-smooth);
}
/* Liseré cuivre→bleu qui se révèle au survol */
.app-card::before {
  content: ""; position: absolute; inset-inline: 0; top: 0; height: 3px;
  background: linear-gradient(90deg, var(--copper-500), var(--rc-600));
  transform: scaleX(0); transform-origin: left; transition: transform 320ms var(--ease-spring);
}
/* Filigrane de grille interne, très discret */
.app-card::after {
  content: ""; position: absolute; inset: 0; z-index: -1; opacity: 0;
  background-image:
    linear-gradient(var(--rc-700) 1px, transparent 1px),
    linear-gradient(90deg, var(--rc-700) 1px, transparent 1px);
  background-size: 22px 22px;
  -webkit-mask-image: radial-gradient(120% 80% at 100% 0%, #000, transparent 60%);
  mask-image: radial-gradient(120% 80% at 100% 0%, #000, transparent 60%);
  transition: opacity 320ms var(--ease-smooth);
}
.app-card:hover { box-shadow: var(--shadow-elev-2); transform: translateY(-4px); border-color: var(--rc-200); }
.app-card:hover::before { transform: scaleX(1); }
.app-card:hover::after { opacity: 0.04; }
/* Pression sur une carte cliquable : le scale du bouton étiré étant neutralisé,
   c'est la carte qui répond */
.app-card--link:active { transform: translateY(-1px) scale(0.99); box-shadow: var(--shadow-elev-1); }

.app-card__top { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.2rem; }
.app-card__icon {
  display: grid; place-items: center; width: 54px; height: 54px; flex: none;
  border-radius: var(--radius-sm); color: var(--rc-700);
  background: linear-gradient(150deg, var(--rc-50), #fff);
  border: 1px solid var(--rc-100);
  box-shadow: inset 0 1px 0 #fff, 0 1px 2px rgb(15 23 42 / 0.04);
  transition: transform 260ms var(--ease-spring);
}
.app-card:hover .app-card__icon { transform: translateY(-2px) rotate(-3deg); }
.app-card__icon svg { width: 26px; height: 26px; }
.app-card__title { font-size: 1.26rem; font-weight: 700; letter-spacing: -0.012em; }
.app-card__desc { margin-top: 0.55rem; color: var(--ink-600); font-size: 0.97rem; flex: 1 1 auto; }
.app-card__foot { margin-top: 1.5rem; }
.app-card__foot .btn { width: 100%; }

/* Badge de statut */
.badge {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-family: var(--font-mono); font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.04em; text-transform: uppercase;
  padding: 0.34rem 0.65rem; border-radius: 999px; white-space: nowrap;
}
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge--online { color: var(--success); background: #dcfce7; }
.badge--online::before { box-shadow: 0 0 0 0 rgb(22 101 52 / 0.5); animation: pulse 2.4s var(--ease-smooth) infinite; }
.badge--soon { color: var(--warning); background: #fef3c7; }

/* ----------------------------------------------------------------------------
   08 · BANDEAU D'ACCÈS
   ------------------------------------------------------------------------- */
.notice {
  display: flex; align-items: flex-start; gap: 1.1rem;
  background: linear-gradient(120deg, var(--rc-50), #fff);
  border: 1px solid var(--rc-100); border-left: 4px solid var(--rc-700);
  border-radius: var(--radius); padding: 1.35rem 1.5rem;
}
.notice__icon { color: var(--rc-700); flex: none; margin-top: 1px; }
.notice__icon svg { width: 24px; height: 24px; }
.notice__title { font-family: var(--font-display); font-weight: 700; color: var(--rc-700); }
.notice__text { margin-top: 0.3rem; color: var(--ink-600); font-size: 0.96rem; }

/* ----------------------------------------------------------------------------
   09 · FOOTER
   ------------------------------------------------------------------------- */
.footer { border-top: 1px solid var(--border); background: var(--surface-card); }
.footer__inner {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: 1rem; padding-block: 1.85rem; color: var(--ink-500); font-size: 0.88rem;
}
.footer__brand { display: flex; align-items: center; gap: 0.6rem; }
.footer__brand img { height: 26px; width: auto; }
/* Souligné : le lien ne doit pas être distingué par la seule couleur (WCAG 1.4.1) */
.footer a { color: var(--ink-600); text-decoration: underline; text-underline-offset: 2px; }
.footer a:hover { color: var(--rc-700); }

/* ----------------------------------------------------------------------------
   10 · MOUVEMENT — entrée + révélation au défilement
   ------------------------------------------------------------------------- */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes markIn { from { opacity: 0; transform: translateY(18px) scale(0.94); } to { opacity: 1; transform: none; } }
@keyframes breathe { 0%, 100% { transform: scale(1); opacity: 0.85; } 50% { transform: scale(1.12); opacity: 1; } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgb(22 101 52 / 0.5); } 70% { box-shadow: 0 0 0 6px rgb(22 101 52 / 0); } 100% { box-shadow: 0 0 0 0 rgb(22 101 52 / 0); } }

/* Entrée échelonnée du hero (pas de styles inline -> nth-child, CSP stricte).
   Durées <= 400ms et cascade courte : le h1 est l'élément LCP, chaque ms de
   délai d'entrée retarde la métrique. */
.hero__copy > * { animation: rise 400ms var(--ease-smooth) backwards; }
.hero__eyebrow { animation-delay: 50ms; }
.hero h1 { animation-delay: 110ms; }
.hero__lead { animation-delay: 170ms; }
.hero__cta { animation-delay: 230ms; }
.hero__meta { animation-delay: 290ms; }
.hero__mark { animation: markIn 520ms var(--ease-spring) 200ms backwards; }

/* Révélation au défilement — gated par .js : sans JavaScript, tout reste visible */
.js .reveal { opacity: 0; transform: translateY(18px); transition: opacity 400ms var(--ease-smooth), transform 400ms var(--ease-spring); }
.js .reveal.is-visible { opacity: 1; transform: none; }
.js .app-grid .reveal:nth-child(2) { transition-delay: 60ms; }
.js .app-grid .reveal:nth-child(3) { transition-delay: 120ms; }

/* ----------------------------------------------------------------------------
   11 · IMPRESSION — sans les fonds, le hero serait blanc sur blanc
   ------------------------------------------------------------------------- */
@media print {
  .hero { background: none; color: var(--ink-900); }
  .hero h1, .hero h1 .accent { color: var(--rc-700); background: none; -webkit-background-clip: initial; background-clip: initial; }
  .hero__lead { color: var(--ink-600); }
  .hero__meta { color: var(--ink-500); }
  .hero__grid, .hero__glow, .hero__contour, .hero__mark,
  .hero__cta, .skip-link, .lang-switch { display: none; }
  .hero__mark img { filter: none; }
  .js .reveal { opacity: 1 !important; transform: none !important; }
  .app-card, .notice { box-shadow: none; break-inside: avoid; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  /* Les delays aussi : avec fill backwards, un delay non annulé laisse le
     contenu invisible (opacity 0) pendant jusqu'à ~470ms. */
  *, *::before, *::after {
    animation-duration: 0.001ms !important; animation-iteration-count: 1 !important;
    animation-delay: 0s !important;
    transition-duration: 0.001ms !important; transition-delay: 0s !important;
  }
  .js .reveal { opacity: 1; transform: none; }
  .app-card:hover, .app-card--link:active, .btn:hover { transform: none; }
  .hero__glow { animation: none; }
}
