/* Frugio — peau du site pour Chain (copiée par tools/import-chain.mjs, chargée après style.css).
   Mêmes jetons que nonogram/css/style.css : aplats --surface, traits pleins --stitch, rayon 6 px,
   fond papier uni, polices du site. Animations, particules et sons du jeu sont intacts. */
@font-face { font-family: "Zen Maru Gothic"; font-weight: 700; font-display: swap; src: url(/assets/fonts/zenmaru-700.woff2) format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 400; font-display: swap; src: url(/assets/fonts/atkinson-400.woff2) format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible"; font-weight: 700; font-display: swap; src: url(/assets/fonts/atkinson-700.woff2) format("woff2"); }

:root {
  --r-sm: 6px; --r-md: 6px; --r-lg: 6px;
  --surface: var(--cellTop);
  --stitch: 1.5px solid color-mix(in srgb, var(--ink) 22%, transparent);
  --stitch-strong: 1.5px solid color-mix(in srgb, var(--ink) 40%, transparent);
  --sh-1: none; --sh-2: none;
  --sh-3: 0 18px 44px -24px rgba(0, 0, 0, .45);
}
/* La base « aube » reprend exactement les jetons du site */
html[data-base='light'] body[data-world='aube'] {
  --surface: #faf7ef; --stitch: 1.5px solid #b8ae97; --stitch-strong: 1.5px solid #8fa3c2;
  --line: #d8d0bf; --dim: #5e729a; --gold: #a8660f; --red: #c2452f; --cold: #2f6f9f;
}
html[data-base='dark'] body[data-world='aube'] {
  --surface: #1f3150; --stitch: 1.5px solid #3a5178; --stitch-strong: 1.5px solid #5e729a;
  --line: #2b4066; --dim: #8fa3c2;
}
html, body { font-family: "Atkinson Hyperlegible", system-ui, sans-serif; }
.card h2, .btnBig, #objText b, #goalTarget { font-family: "Zen Maru Gothic", "Atkinson Hyperlegible", system-ui, sans-serif; }

/* Fond : papier uni, comme le jeu de nonogrammes — ni trame, ni halo, ni décor de monde.
   Intégré dans une page Frugio, le jeu est transparent : il ne fait qu'un avec la page. */
body::before, body::after, #bgGlow, #sideL, #sideR { display: none !important; }
html[data-base='light'] { background: #f2ede2; }
html[data-base='dark'] { background: #17263b; }
html.embedded, html.embedded body { background: transparent; }
/* Rien ne se peint avant que le jeu ait posé son thème (game.js : body.dataset.world) */
body:not([data-world]) { visibility: hidden; }
/* La molette et le doigt hors plateau font défiler la page autour (le jeu bloquait le relais) */
html.embedded, html.embedded body { overscroll-behavior: auto; }

/* Aplats à trait plein à la place des dégradés et du verre */
#tabs button, .iconBtn, #objBar, #tutBar, .modeCard, .btn2, .endNav .endHome {
  background: var(--surface); border: var(--stitch); box-shadow: none;
}
#tabs button.active, .modeCard:hover { border: 1.5px solid var(--accent); }
.btnGhost, .endModes button { background: transparent; border: var(--stitch-strong); }
#tutBar { border-radius: var(--r-sm); }
#boardCard { background: transparent; border: 0; box-shadow: none; padding: 0; }
#board { border-radius: 0; }
.card { background: var(--surface); border: var(--stitch); }
.overlay { -webkit-backdrop-filter: none; backdrop-filter: none; }
.btnBig { background: var(--accent); box-shadow: none; }
.cardClose { background: transparent; border: var(--stitch); border-radius: var(--r-sm); }
#dots .dot { background: var(--line); border-color: var(--line); }
@media (min-aspect-ratio: 6/5) {
  #goalBar { background: var(--surface); border: var(--stitch); box-shadow: none; }
}

/* Menu principal = l'accueil du jeu de nonogrammes : posé sur la page (plateau masqué),
   logo, une phrase, la grande carte « Jouer », les modes en cartes, boutons en contour. */
body:has(#menu:not([hidden])) #stage { visibility: hidden; }
#menu.overlay { background: transparent; }
html.embedded #menu.overlay { align-items: flex-start; }
#menu .card.menuCard {
  width: min(100% - 32px, 460px); background: none; border: 0; box-shadow: none;
  padding: 16px 0; gap: 14px; align-items: stretch;
}
/* Sur Frugio : ni logo du jeu ni phrase, le nom en titre (dans la page, c'est son h1) */
#menu .menuWm, #menu .menuVolume, #menu .menuPitch { display: none; }
#menu .menuHead { order: 0; }
#menu .menuHead::before {
  content: "Chain"; display: block; text-align: center; color: var(--ink);
  font: 700 clamp(32px, 10vw, 54px)/1.15 "Zen Maru Gothic", "Atkinson Hyperlegible", system-ui, sans-serif;
}
html.embedded #menu .menuHead { display: none; }
/* Dans la page, le cadre se règle sur la hauteur du menu (build-pages.mjs) : la carte garde
   sa taille naturelle au lieu des resserrages « écran court » du jeu. */
html.embedded #menu .card.menuCard { max-height: none; overflow: visible; }
html.embedded #menu .menuCard > * { flex-shrink: 0; }
html.embedded #menu .menuStats { display: flex; }
#menu .menuPlay {
  order: 2; align-items: flex-start; gap: 4px; padding: 18px; text-align: left;
  background: var(--surface); color: var(--ink); border: 1.5px solid var(--ink); border-radius: var(--r-md);
}
#menu .menuPlay .mcMain { font-size: 13px; letter-spacing: .09em; color: var(--accent); gap: 6px; }
#menu .menuPlay .mcMain .ic { width: 14px; height: 14px; }
#menu .menuPlay .mcSub { font-size: 20px; opacity: 1; letter-spacing: 0; font-family: "Atkinson Hyperlegible", system-ui, sans-serif; font-weight: 700; }
#menu .menuModes { order: 3; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
#menu .modeCard[data-mode='adventure'], #menu .mcGo { display: none; }
#menu .modeCard {
  display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  min-height: 0; padding: 16px; background: var(--surface); border: var(--stitch); box-shadow: none;
}
#menu .modeCard:hover { transform: none; border: 1.5px solid var(--accent); }
#menu .modeCard:active { transform: scale(.97); }
#menu .mcIcon { width: auto; height: auto; background: none; margin-bottom: 6px; }
#menu .mcIcon .ic { width: 26px; height: 26px; }
#menu .mcText b { display: block; font-size: 17px; letter-spacing: 0; text-transform: lowercase; }
#menu .mcText b::first-letter { text-transform: uppercase; }
#menu .mcText i { font-size: 13px; font-weight: 400; -webkit-line-clamp: 3; }
#menu .menuFoot { order: 4; justify-content: center; gap: 10px; }
#menu .menuFoot > button { flex: 0 1 auto; width: auto; min-height: 48px; padding: 8px 18px; font-size: 15px; color: var(--ink); }
#menu .menuStats { order: 5; font-size: 13px; font-weight: 400; }
#menu #menuClose { order: 6; align-self: center; }
@media (max-width: 479px) {
  #menu .menuModes { grid-template-columns: 1fr; gap: 10px; }
}

/* Onglets : la police du site est plus large que celle du jeu ; l'onglet s'élargit au
   texte au lieu de le rogner. Le HUD se mesure lui-même (iframe, zoom) : à l'étroit,
   « Settings » garde son icône seule et le logo passe au monogramme. */
#hud { container: hud / inline-size; }
@media (min-width: 700px) {
  #tabs button { width: auto; min-width: 58px; padding: 4px 8px; }
  .tabLbl { white-space: nowrap; }
}
@container hud (max-width: 640px) {
  .btnLbl { display: none; }
  .hudWm { display: none; }
  .hudWmS { display: block; }
}
/* Téléphone : le monogramme cède sa place aux libellés (le menu reste dans Réglages) */
@container hud (max-width: 440px) {
  .hudWmS { display: none; }
  .tabLbl { font-size: 9px; letter-spacing: -.2px; }
}
/* 320 px : la flèche de retour n'était pas dans le budget du jeu, on rogne gaps et cœurs */
@container hud (max-width: 340px) {
  #tabs { gap: 3px; }
  #tabs button { width: 40px; min-width: 40px; }
  #frugioBack, #btnOpts { min-width: 40px; padding: 0; }
  #hudRight { gap: 3px; }
  #hearts { gap: 1px; }
  #hearts .ic { width: 14px; height: 14px; }
}

/* Retour au site (lien injecté par import-chain.mjs dans le HUD) */
#frugioBack { text-decoration: none; color: var(--ink); flex: 0 0 auto; }

html[data-base='light'] body[data-world='aube'] .overlay { background: rgba(36, 54, 90, .32); }
/* Dans la page, le voile prend la couleur du papier : pas de rectangle gris autour du jeu */
html.embedded[data-base='light'] body[data-world='aube'] .overlay { background: rgba(242, 237, 226, .88); }
html.embedded[data-base='dark'] body[data-world='aube'] .overlay { background: rgba(23, 38, 59, .88); }
html[data-base='light'] body[data-world='aube'] .btnBig { color: #f2ede2; }
html[data-base='light'] body[data-world='aube'] .iconBtn:active,
html[data-base='light'] body[data-world='aube'] .btn2:active,
html[data-base='light'] body[data-world='aube'] .btnGhost:active { background: #e4dcc9; }
