/* Kosmy — catalogue d'applications libres */
:root {
  --bg: #0d0c0a;
  --panel: #15130f;
  --paper: #f1ede4;
  --text-2: #c9c3b6;
  --mute: #8f897c;
  --line: rgba(241, 237, 228, .12);
  --signal: #c5f04a;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --top-h: 69px;
  /* marge latérale : généreuse, et le contenu reste centré sur 1440px sur les grands écrans */
  --gutter: max(clamp(20px, 6vw, 96px), calc((100vw - 1440px) / 2));
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--paper);
  font: 400 16px/1.6 "Inter Tight", system-ui, sans-serif;
  overflow-x: hidden; -webkit-font-smoothing: antialiased;
}
/* grain */
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: 50; opacity: .07; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
a { color: inherit; text-decoration: none; }
img { display: block; }
h1, h2, p { margin: 0; }
::selection { background: var(--signal); color: var(--bg); }

.serif { font-family: "Instrument Serif", Georgia, serif; font-weight: 400; letter-spacing: -.01em; }
.mono { font-family: "JetBrains Mono", ui-monospace, monospace; letter-spacing: .04em; text-transform: uppercase; }
em { font-style: italic; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes rise { from { transform: translateY(105%); } to { transform: none; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes float { 0%, 100% { transform: translateY(0) rotate(-4deg); } 50% { transform: translateY(-14px) rotate(-2deg); } }
@keyframes blink { 50% { opacity: .25; } }
@keyframes pop { from { opacity: 0; transform: scale(.5); } to { opacity: 1; transform: none; } }
@keyframes draw { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
@keyframes show { from { opacity: 0; } to { opacity: 1; } }
@keyframes sunIn { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }

.fade { animation: fadeUp .8s var(--ease) both; animation-delay: var(--d, 0s); }

/* ---------- Barre du haut ---------- */
.top {
  position: sticky; top: 0; z-index: 20; height: var(--top-h);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 0 var(--gutter); border-bottom: 1px solid var(--line);
  background: rgba(13, 12, 10, .82); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand .serif { font-size: 28px; line-height: 1; }
.brand .mark { display: block; width: 34px; height: 34px; border-radius: 9px; overflow: hidden; background: #000; box-shadow: 0 0 0 1px var(--line); }
.brand .mark img { width: 100%; height: 100%; transform: scale(1.3); transition: transform .8s var(--ease); }
.brand:hover .mark img { transform: scale(1.3) rotate(-12deg); }
.nav { display: flex; gap: 40px; font-size: 12px; color: var(--mute); }
.nav a { transition: color .2s; }
.nav a:hover { color: var(--paper); }
.status { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--mute); }
.top-end { display: flex; align-items: center; gap: 24px; }
.lang { display: flex; padding: 3px; border: 1px solid var(--line); border-radius: 999px; }
.lang-btn {
  font: inherit; font-size: 11px; letter-spacing: .06em; color: var(--mute); background: none; border: 0; cursor: pointer;
  padding: 5px 10px; border-radius: 999px; transition: color .25s, background .25s;
}
.lang-btn:hover { color: var(--paper); }
.lang-btn[aria-pressed="true"] { background: var(--signal); color: var(--bg); }
.lang-btn:focus-visible { outline: 2px solid var(--signal); outline-offset: 2px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--signal); animation: blink 1.6s steps(2) infinite; }

/* ---------- Hero plein écran ---------- */
.hero {
  min-height: calc(100vh - var(--top-h)); min-height: calc(100svh - var(--top-h));
  display: grid; grid-template-columns: 7fr 5fr; align-items: center; gap: 40px;
  padding: clamp(24px, 4vh, 40px) var(--gutter);
  overflow-x: clip; /* les calques d'orbite tournés dépassent en diagonale */
}
.kicker { font-size: 12px; color: var(--mute); margin-bottom: clamp(20px, 4vh, 40px); }
h1 { font-size: clamp(56px, min(8.6vw, 13vh), 132px); line-height: .9; }
h1 .line { display: block; }
.word { display: inline-block; overflow: hidden; vertical-align: bottom; padding-bottom: .06em; margin-bottom: -.06em; margin-right: .22em; }
.word > span { display: inline-block; animation: rise .9s var(--ease) both; }
.word .accent { font-style: italic; color: var(--signal); }
.hero-foot { margin-top: clamp(24px, 4vh, 40px); display: grid; gap: clamp(28px, 5vh, 48px); }
.hero-foot p { font-size: 17px; line-height: 1.6; color: var(--text-2); max-width: 52ch; }
.actions { display: flex; align-items: center; gap: 24px; }
.btn {
  display: inline-flex; align-items: center; gap: 12px; padding: 16px 24px; border-radius: 999px;
  background: var(--paper); color: var(--bg); font-weight: 600; font-size: 15px; white-space: nowrap;
  transition: transform .3s var(--ease), background .3s;
}
.btn:hover { transform: translateY(-3px) rotate(-1.5deg); background: var(--signal); }
.link {
  font-weight: 500; font-size: 15px; padding-bottom: 4px; white-space: nowrap;
  background: linear-gradient(currentColor, currentColor) left bottom / 100% 1px no-repeat; transition: background-size .4s;
}
.link:hover { background-size: 0 1px; background-position: right bottom; }

/* ---------- Système orbital ---------- */
.system-wrap { display: flex; justify-content: center; }
.system { position: relative; width: min(600px, 100%); aspect-ratio: 1; container-type: inline-size; }
.rings { position: absolute; inset: 0; width: 100%; height: 100%; }
.rings .draw { stroke-dasharray: 100; animation: draw 2.4s var(--ease) both; }
.rings .fadein { animation: show 1.6s ease both; }
.sun {
  position: absolute; left: 50%; top: 50%; width: 22.2%; aspect-ratio: 1; translate: -50% -50%;
  display: grid; place-items: center; border-radius: 50%; overflow: hidden; background: #000;
  box-shadow: 0 0 0 1px rgba(241, 237, 228, .22), 0 0 60px -10px rgba(197, 240, 74, .35);
  animation: sunIn 1s var(--ease) .2s both;
}
.sun img { width: 100%; height: 100%; transform: scale(1.32); }
/* Les calques d'orbite couvrent tout le système : ils ne doivent pas capter la souris */
.layer, .orbit { position: absolute; inset: 0; pointer-events: none; }
.orbit { animation: spin linear infinite; }
.anchor { position: absolute; left: 50%; translate: -50% -50%; }
.sat { display: block; position: relative; pointer-events: auto; animation: spin linear infinite reverse; }
.system:hover .orbit, .system:hover .sat { animation-play-state: paused; }
.sat .logo { width: clamp(30px, 9cqw, 54px); height: clamp(30px, 9cqw, 54px); border-radius: 27%; }
.sat:hover .logo, .sat:focus-visible .logo { transform: scale(1.25); box-shadow: 0 0 0 2px var(--c); }
/* Le calque survolé passe devant les autres : son logo et son nom ne sont jamais masqués */
.layer:has(.sat:hover), .layer:has(.sat:focus-visible) { z-index: 10; }
.tip {
  position: absolute; left: 50%; top: 100%; margin-top: 8px; translate: -50% 0; white-space: nowrap;
  font-size: 11px; padding: 3px 8px; border-radius: 4px; background: var(--c); color: var(--ink);
  opacity: 0; transform: translateY(4px); transition: opacity .25s, transform .25s; pointer-events: none;
}
.sat:hover .tip, .sat:focus-visible .tip { opacity: 1; transform: none; }

/* ---------- Tuile de logo ---------- */
.logo {
  --c: #fff; display: inline-grid; place-items: center; overflow: hidden; flex: none;
  background: #16140f; box-shadow: 0 0 0 1px rgba(241, 237, 228, .14);
  transition: transform .6s var(--ease), box-shadow .4s;
}
.logo img { width: 100%; height: 100%; object-fit: cover; }
/* Logos transparents : posés sur une tuile colorée, avec une marge */
.logo.tiled img { width: 72%; height: 72%; object-fit: contain; }

/* ---------- Index ---------- */
.index { padding: 120px var(--gutter) 64px; }
.index-head { display: grid; grid-template-columns: 7fr 5fr; gap: 32px; align-items: end; margin-bottom: 56px; }
.index-head h2 { font-size: clamp(52px, 6vw, 84px); line-height: .95; }
.index-head h2 em { color: var(--mute); }
.index-head p { font-size: 16px; line-height: 1.6; color: var(--text-2); }
.rows { border-bottom: 1px solid var(--line); }
.row {
  position: relative; isolation: isolate; border-top: 1px solid var(--line);
  display: grid; grid-template-columns: 120px 80px minmax(0, 1fr) minmax(0, 1.4fr) 290px; align-items: center; gap: 8px 24px;
  padding: 24px 12px; transition: color .35s;
}
.row::before {
  content: ""; position: absolute; inset: 0; z-index: -1; background: var(--c);
  transform: scaleY(0); transform-origin: bottom; transition: transform .55s cubic-bezier(.7, 0, .2, 1);
}
.row:hover, .row:focus-visible { color: var(--ink); outline: none; }
.row:hover::before, .row:focus-visible::before { transform: scaleY(1); }
.row .num { font-size: 12px; line-height: 1.4; color: var(--mute); }
.row .num small { display: block; font-size: 10px; margin-top: 4px; }
.row .logo { width: 60px; height: 60px; border-radius: 16px; }
.row:hover .logo { transform: rotate(-10deg) scale(1.12); }
.row .name { font-size: clamp(40px, 4vw, 56px); line-height: 1; transition: letter-spacing .5s var(--ease); }
.row:hover .name { font-style: italic; letter-spacing: .01em; }
.row .line1 { display: block; font-size: 17px; font-weight: 500; }
.row .line2 { display: block; font-size: 13px; margin-top: 4px; color: var(--mute); }
.row:hover .num, .row:hover .line2 { color: inherit; opacity: .75; }
.row .end { display: flex; align-items: center; gap: 16px; justify-self: end; }
.tags { display: flex; gap: 8px; }
.tag { border: 1px solid currentColor; border-radius: 999px; padding: 3px 10px; font-size: 11px; opacity: .8; }
.arrow { font-size: 28px; line-height: 1; transition: transform .45s var(--ease); }
.row:hover .arrow { transform: translate(6px, -6px); }

/* ---------- Android ---------- */
.android {
  margin: 64px var(--gutter); border-radius: 32px; overflow: hidden;
  display: grid; grid-template-columns: 1fr 1fr; background: var(--panel); border: 1px solid var(--line);
}
.android-copy { position: relative; padding: clamp(32px, 4vw, 56px); }
.stamp { position: absolute; right: 32px; top: 32px; animation: spin 18s linear infinite; }
.android .label { font-size: 12px; color: var(--signal); margin-bottom: 24px; }
.android h2 { font-size: clamp(52px, 5.6vw, 80px); line-height: .95; max-width: 12ch; }
.android .lead { margin-top: 24px; font-size: 17px; line-height: 1.6; color: var(--text-2); max-width: 44ch; }
.apks { margin-top: 40px; border-bottom: 1px solid var(--line); }
.apk {
  display: flex; align-items: center; gap: 20px; padding: 20px 0; border-top: 1px solid var(--line);
  transition: padding .4s var(--ease), background .3s;
}
.apk:hover { padding-left: 18px; background: rgba(241, 237, 228, .04); }
.apk .logo { width: 48px; height: 48px; border-radius: 13px; }
.apk .t { flex: 1; }
.apk .t .serif { display: block; font-size: 30px; line-height: 1; }
.apk .t .mono { display: block; font-size: 11px; margin-top: 4px; color: var(--mute); }
.android-more { display: inline-block; margin-top: 22px; font-size: 12px; color: var(--signal); background: linear-gradient(currentColor, currentColor) left bottom / 100% 1px no-repeat; padding-bottom: 3px; transition: background-size .4s; }
.android-more:hover { background-size: 0 1px; background-position: right bottom; }
.apk .dl { font-size: 12px; color: var(--signal); white-space: nowrap; }

.phone-stage {
  display: flex; align-items: center; justify-content: center; padding: 40px; min-height: 560px;
  background: radial-gradient(circle at 50% 55%, rgba(197, 240, 74, .12), transparent 60%);
}
.phone {
  width: 270px; height: 550px; border-radius: 44px; padding: 14px; background: var(--bg);
  border: 1.5px solid rgba(241, 237, 228, .3); animation: float 7s ease-in-out infinite;
}
.screen { height: 100%; border-radius: 32px; padding: 20px; display: flex; flex-direction: column; background: var(--paper); color: var(--bg); }
.speaker { margin: 0 auto 20px; width: 64px; height: 6px; border-radius: 999px; background: var(--bg); }
.phone-head { display: flex; align-items: center; justify-content: space-between; }
.phone-head .serif { font-size: 32px; line-height: 1; }
.phone-logo { width: 30px; height: 30px; border-radius: 8px; object-fit: cover; }
.phone-sub { font-size: 9px; color: #6f695d; margin: 8px 0 20px; }
.phone-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px 12px; }
.phone-app { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 10px; font-weight: 500; opacity: 0; }
.phone-app .logo { width: 58px; height: 58px; border-radius: 15px; }
.android.in .phone-app { animation: pop .6s var(--ease) both; animation-delay: calc(.3s + var(--i) * 90ms); }
.phone-bar { margin-top: auto; border-radius: 16px; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; background: var(--bg); color: var(--paper); font-size: 12px; font-weight: 500; }
.phone-bar .badge { font-size: 10px; padding: 4px 8px; border-radius: 999px; background: var(--signal); color: var(--bg); }

/* ---------- Pied de page ---------- */
.foot { padding: 64px var(--gutter) 0; border-top: 1px solid var(--line); overflow: hidden; }
.foot-line { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px; font-size: 12px; color: var(--mute); }
.foot-line { align-items: center; }
.foot-line .link { font-size: 12px; color: var(--paper); }
.credit { display: inline-flex; align-items: center; gap: 10px; transition: color .3s; }
.credit strong { font-weight: 500; color: var(--paper); transition: color .3s; }
.credit:hover, .credit:hover strong { color: var(--signal); }
.credit-logo { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: #fde3da; transition: transform .5s var(--ease); }
.credit-logo img { width: 72%; height: 72%; object-fit: contain; }
.credit:hover .credit-logo { transform: rotate(-12deg) scale(1.1); }
.giant {
  margin-top: 24px; padding-bottom: 32px; text-align: center; line-height: 1.1; font-size: min(26vw, 380px); white-space: nowrap;
  color: transparent; -webkit-text-stroke: 1px rgba(241, 237, 228, .22); user-select: none;
  transition: -webkit-text-stroke-color .6s;
}
.giant:hover { -webkit-text-stroke-color: var(--signal); }

/* ---------- Apparitions au défilement ---------- */
.reveal { opacity: 0; transform: translateY(30px); transition: opacity .9s var(--ease), transform .9s var(--ease); transition-delay: var(--d, 0s); }
.reveal.in { opacity: 1; transform: none; }
.row.pre { opacity: 0; transform: translateX(-24px); }
.row.in { opacity: 1; transform: none; transition: color .35s, opacity .8s var(--ease), transform .8s var(--ease); transition-delay: 0s, var(--d), var(--d); }

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .row { grid-template-columns: 110px 72px minmax(0, 1fr) auto; }
  .row .desc { grid-column: 3 / 5; }
  .row .end { grid-column: 4; grid-row: 1; }
  .tags { display: none; }
}
@media (max-width: 960px) {
  .nav { display: none; }
  .hero { grid-template-columns: 1fr; gap: 24px; align-content: center; padding-top: 24px; }
  .system-wrap { order: -1; }
  .system { width: min(420px, 100%); }
  .hero-foot { grid-template-columns: 1fr; }
  .index-head { grid-template-columns: 1fr; }
  .android { grid-template-columns: 1fr; }
  .stamp { width: 96px; height: 96px; right: 20px; top: 20px; }
}
@media (max-width: 620px) {
  .status { display: none; }
  .kicker { margin-bottom: 24px; }
  .actions { flex-wrap: wrap; gap: 16px; }
  .row { grid-template-columns: 48px 1fr auto; gap: 12px 16px; padding: 20px 4px; }
  .row .num { display: none; }
  .row .logo { width: 48px; height: 48px; border-radius: 13px; }
  .row .desc { grid-column: 1 / -1; }
  .row .end { grid-column: 3; grid-row: 1; }
  .row .name { font-size: 40px; }
  .apk .dl { font-size: 11px; }
  .phone-stage { min-height: 0; padding: 32px 16px 48px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .reveal, .row.pre, .phone-app { opacity: 1; transform: none; }
}
