/* ==========================================================================
   Ihsen Apps — site principal (ihsenapps.com)
   Même socle que les sites d'apps : papier, encre, serif, aucune requête tierce.
   Chaque app garde son propre CSS sous /<app>/assets/css/.
   ========================================================================== */

/* ---- Fonts (self-hosted) -------------------------------------------------- */
@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 200 900;
  font-display: swap;
  src: url("../fonts/source-serif-4-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Source Serif 4";
  font-style: italic;
  font-weight: 200 900;
  font-display: swap;
  src: url("../fonts/source-serif-4-italic-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+2000-206F, U+20AC, U+2122, U+2212, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Amiri";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/amiri-arabic.woff2") format("woff2");
  unicode-range: U+0600-06FF, U+0750-077F, U+FB50-FDFF, U+FE70-FEFF;
}

/* ---- Tokens ----------------------------------------------------------------- */
:root {
  --surface: #f7f4ee;
  --surface-alt: #fffdf9;
  --card: #ffffff;
  --ink: #1f2328;
  --ink-muted: #5d6268;
  --accent: #1f4b5c;
  --accent-dark: #163846;
  --divider: #e4ddd0;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --arabic: "Amiri", "Noto Naskh Arabic", serif;
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s6: 24px; --s8: 32px;
  --s12: 48px; --s16: 64px; --s24: 96px;
  --measure: 64ch;
  --radius: 14px;
}

/* ---- Reset minimal ------------------------------------------------------------ */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
img, svg { display: block; max-width: 100%; height: auto; }

/* ---- Base ---------------------------------------------------------------------- */
html { scroll-behavior: smooth; }
body {
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.65;
  color: var(--ink);
  background: var(--surface);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.2; font-weight: 600; text-wrap: balance; }
h1 { font-size: clamp(2rem, 5vw, 3.25rem); }
h2 { font-size: clamp(1.5rem, 3.5vw, 2rem); }
h3 { font-size: 1.5rem; }
p { max-width: var(--measure); }
a { color: var(--accent); text-underline-offset: 3px; }
a:hover { color: var(--accent-dark); }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; border-radius: 2px; }
::selection { background: var(--accent); color: #fff; }

.wrap { max-width: 1080px; margin-inline: auto; padding-inline: var(--s6); }

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 100;
  background: var(--accent); color: #fff; padding: var(--s3) var(--s4);
}
.skip-link:focus { left: 0; color: #fff; }

/* ---- Header ------------------------------------------------------------------------ */
.site-header { border-bottom: 1px solid var(--divider); }
.site-header .wrap {
  display: flex; align-items: center; gap: var(--s4); flex-wrap: wrap;
  min-height: 72px; padding-block: var(--s3);
}
/* MEDIA: logo — le mot-symbole texte sera remplacé par le logo Ihsen Apps */
.brand {
  display: inline-flex; align-items: baseline; gap: var(--s3);
  margin-right: auto; min-height: 44px; align-self: center;
  color: var(--ink); text-decoration: none; font-weight: 600; font-size: 1.375rem;
  letter-spacing: 0.01em;
}
.brand .ar { font-family: var(--arabic); font-weight: 400; color: var(--accent); font-size: 1.5rem; }
.lang-switch {
  display: inline-flex; gap: var(--s1); padding: var(--s1);
  border: 1px solid var(--divider); border-radius: 999px;
}
.lang-switch a, .lang-switch span {
  min-width: 44px; min-height: 36px; border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
  text-decoration: none; font-size: 0.9375rem;
}
.lang-switch span[aria-current] { background: var(--accent); color: #fff; }
.lang-switch a { color: var(--ink-muted); }
.lang-switch a:hover { background: var(--divider); color: var(--ink); }

/* ---- Hero ---------------------------------------------------------------------------- */
.hero { padding-block: var(--s16) var(--s12); }
.hero .wrap > * + * { margin-top: var(--s6); }
.hero .kicker { font-family: var(--arabic); font-size: 1.75rem; color: var(--accent); line-height: 1.4; }
.hero .lede { font-size: 1.25rem; color: var(--ink-muted); }

/* ---- Apps ------------------------------------------------------------------------------ */
.apps { padding-block: var(--s8) var(--s24); }
.apps h2 { margin-bottom: var(--s8); }
.app-grid {
  list-style: none; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr));
  gap: var(--s6);
}
.app-card {
  position: relative;
  display: grid; grid-template-columns: 72px 1fr; gap: var(--s4) var(--s6);
  align-content: start;
  padding: var(--s8);
  background: var(--card);
  border: 1px solid var(--divider);
  border-radius: calc(var(--radius) + 6px);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}
.app-card:hover, .app-card:focus-within {
  border-color: var(--accent);
  box-shadow: 0 18px 40px -28px rgba(31, 35, 40, 0.45);
  transform: translateY(-2px);
}
.app-card img { width: 72px; height: 72px; border-radius: 16px; }
.app-card h3 a { color: var(--ink); text-decoration: none; }
/* Toute la carte est cliquable (lien étiré), les badges restent au-dessus */
.app-card h3 a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.app-card .ar { font-family: var(--arabic); color: var(--ink-muted); font-size: 1.25rem; line-height: 1.5; text-align: left; }
.app-card .body { grid-column: 1 / -1; color: var(--ink-muted); }
.app-card .body > * + * { margin-top: var(--s3); }
.app-card .more { color: var(--accent); font-weight: 600; }
.app-card .store-badges { grid-column: 1 / -1; position: relative; z-index: 1; }

.store-badges { display: flex; flex-wrap: wrap; gap: var(--s3); list-style: none; padding: 0; }
.badge-store {
  display: inline-flex; flex-direction: column; justify-content: center;
  min-height: 52px; min-width: 150px; padding: var(--s2) var(--s4);
  border: 1px solid var(--accent); border-radius: var(--radius);
  background: var(--accent); color: #fff; text-decoration: none; line-height: 1.3;
}
a.badge-store:hover, a.badge-store:focus-visible { background: var(--accent-dark); border-color: var(--accent-dark); color: #fff; }
.badge-store .store { font-weight: 600; font-size: 1rem; }
.badge-store .get { font-size: 0.8125rem; opacity: 0.85; }
.badge-store.soon { background: transparent; color: var(--ink-muted); border-style: dashed; border-color: var(--ink-muted); }

/* ---- Principes -------------------------------------------------------------------------- */
.values { padding-block: var(--s16); background: var(--surface-alt); border-block: 1px solid var(--divider); }
.values ul { list-style: none; padding: 0; display: grid; gap: var(--s8); grid-template-columns: repeat(3, 1fr); margin-top: var(--s8); }
.values strong { display: block; margin-bottom: var(--s1); }
.values li { color: var(--ink-muted); }
.values li strong { color: var(--ink); }
.values li::before {
  content: ""; display: block; width: 32px; height: 3px; margin-bottom: var(--s3);
  background: var(--accent); border-radius: 2px;
}

/* ---- Footer ----------------------------------------------------------------------------- */
.site-footer { padding-block: var(--s12); color: var(--ink-muted); font-size: 0.9375rem; }
.site-footer .wrap { display: grid; gap: var(--s6); }
.footer-nav { display: flex; flex-wrap: wrap; gap: var(--s4); align-items: center; list-style: none; padding: 0; }
.footer-nav a { color: var(--ink-muted); min-height: 44px; display: inline-flex; align-items: center; }
.footer-nav a:hover { color: var(--ink); }

/* ---- 404 --------------------------------------------------------------------------------- */
.error-page { min-height: 70vh; display: grid; place-content: center; text-align: center; gap: var(--s6); padding: var(--s8); }
.error-page p { margin-inline: auto; }

/* ---- Responsive -------------------------------------------------------------------------- */
@media (max-width: 860px) {
  .values ul { grid-template-columns: 1fr; gap: var(--s6); }
}
@media (max-width: 480px) {
  .wrap { padding-inline: var(--s4); }
  .app-card { padding: var(--s6); grid-template-columns: 56px 1fr; }
  .app-card img { width: 56px; height: 56px; border-radius: 13px; }
  .badge-store { min-width: 0; flex: 1 1 140px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .app-card { transition: none; }
  .app-card:hover, .app-card:focus-within { transform: none; }
}
