/* links.lndev.me
   L'écran d'accueil de LN. Le fond suit le ciel de Douala à l'heure réelle (assets/js/app.js) ;
   tout le reste reste sobre : vraies icônes, verre, typographie Archivo. */

@font-face {
  font-family: 'Archivo';
  src: url('../fonts/archivo.woff2') format('woff2-variations'), url('../fonts/archivo.woff2') format('woff2');
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Ciel : valeurs de départ (fin d'après-midi), remplacées en direct par app.js */
  --sky-top: #24508f;
  --sky-mid: #5f75a6;
  --sky-low: #b27c62;
  --glow: rgba(255, 196, 120, 0.55);
  --night: 0;
  --sun-x: 88vw;
  --sun-y: 34vh;

  /* Texte posé sur le ciel */
  --ink: #ffffff;
  --ink-soft: rgba(255, 255, 255, 0.92);
  --ink-faint: rgba(255, 255, 255, 0.62);
  --shadow-text: 0 1px 2px rgba(4, 8, 24, 0.45), 0 0 12px rgba(4, 8, 24, 0.18);

  /* Verre (dock, langue, boutons du quiz) */
  --glass: rgba(255, 255, 255, 0.16);
  --glass-strong: rgba(255, 255, 255, 0.24);
  --glass-edge: rgba(255, 255, 255, 0.26);

  /* Fiches d'app (clair par défaut) */
  --sheet-bg: #f6f6f8;
  --sheet-ink: #15161c;
  --sheet-muted: #5c5f6e;
  --sheet-row: #ffffff;
  --sheet-line: rgba(21, 22, 28, 0.09);
  --sheet-primary: #15161c;
  --sheet-on-primary: #ffffff;

  /* Marques reprises des projets */
  --qea-violet: #4b3cb8;
  --qea-deep: #34278f;
  --qea-yellow: #f5b700;
  --qea-good: #22c55e;
  --qea-bad: #ff5a6e;
  --board-dark: #2e4a2b;
  --board-light: #3a5a35;
  --board-ivory: #eeeed2;

  --col: min(100vw - 32px, 420px);
  --icon: clamp(54px, 15vw, 64px);
  --radius-icon: 23%;
  --radius-widget: 24px;
  --focus: #ffe58a;

  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --sheet-bg: #1b1c22;
    --sheet-ink: #f2f3f7;
    --sheet-muted: #a4a7b6;
    --sheet-row: #24262e;
    --sheet-line: rgba(242, 243, 247, 0.08);
    --sheet-primary: #f2f3f7;
    --sheet-on-primary: #15161c;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  font-family: 'Archivo', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--sky-top);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

img,
svg {
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
}

h1,
h2,
p {
  margin: 0;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

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

/* ------------------------------------------------------------------ */
/* Ciel                                                                */
/* ------------------------------------------------------------------ */

.sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background:
    radial-gradient(110vmax 60vmax at var(--sun-x) var(--sun-y), var(--glow), transparent 55%),
    linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 58%, var(--sky-low) 100%);
}

.stars {
  position: absolute;
  inset: 0 0 30% 0;
  background: url('../img/stars.svg') center top / cover no-repeat;
  opacity: var(--night);
}

.moon {
  --size: 92px;
  position: absolute;
  left: 89vw;
  top: 14vh;
  width: var(--size);
  height: var(--size);
  margin: calc(var(--size) / -2) 0 0 calc(var(--size) / -2);
  border-radius: 50%;
  background: radial-gradient(circle, #f1eee4 0 32%, rgba(220, 225, 255, 0.16) 34%, transparent 70%);
  opacity: clamp(0, calc(var(--night) * 2 - 1), 1);
}

/* L'ombre qui dessine le croissant */
.moon::after {
  content: '';
  position: absolute;
  inset: 31%;
  border-radius: 50%;
  box-shadow: inset 7px -3px 0 0 rgba(12, 20, 50, 0.9);
}

/* Assombrit le bas pour que les noms d'apps restent lisibles à toute heure */
.scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(6, 12, 34, 0.2) 0%, rgba(6, 12, 34, 0.08) 24%, rgba(6, 12, 34, 0.12) 48%, rgba(6, 12, 34, 0.45) 100%);
}

/* ------------------------------------------------------------------ */
/* Écran                                                               */
/* ------------------------------------------------------------------ */

.screen {
  position: relative;
  z-index: 1;
  width: var(--col);
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-top: max(14px, env(safe-area-inset-top));
}

.status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 40px;
}

.mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin-left: -6px;
  border-radius: 10px;
}

.mark svg {
  height: 20px;
  width: auto;
  fill: var(--ink);
  filter: drop-shadow(0 1px 2px rgba(4, 8, 24, 0.35));
}

.lang {
  display: flex;
  padding: 3px;
  border-radius: 999px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  backdrop-filter: blur(18px) saturate(1.4);
  box-shadow: inset 0 0 0 1px var(--glass-edge);
}

.lang button {
  min-width: 40px;
  height: 28px;
  padding: 0 10px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  cursor: pointer;
}

.lang button[aria-pressed='true'] {
  background: var(--ink);
  color: #13203f;
}

/* ------------------------------------------------------------------ */
/* Écran verrouillé : date, heure de Douala, identité                  */
/* ------------------------------------------------------------------ */

.lock {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 18px 0 30px;
  text-shadow: var(--shadow-text);
}

.date {
  font-size: 17px;
  font-weight: 560;
  font-stretch: 100%;
  color: var(--ink-soft);
}

.date::first-letter {
  text-transform: uppercase;
}

.clock {
  margin: 2px 0 14px;
  font-size: clamp(96px, 33vw, 138px);
  line-height: 0.92;
  font-weight: 640;
  font-stretch: 62%;
  letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
  color: var(--ink);
  text-shadow: 0 2px 24px rgba(4, 8, 24, 0.22);
}

.who {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.85), 0 2px 10px rgba(4, 8, 24, 0.35);
}

h1 {
  font-size: 23px;
  line-height: 1.2;
  font-weight: 680;
  font-stretch: 100%;
  letter-spacing: -0.01em;
}

.bio {
  max-width: 31ch;
  margin-top: 8px;
  font-size: 15.5px;
  line-height: 1.45;
  color: var(--ink-soft);
  text-wrap: balance;
}

/* ------------------------------------------------------------------ */
/* Grille de l'écran d'accueil                                         */
/* ------------------------------------------------------------------ */

.home {
  /* laisse la place au dock fixé en bas */
  padding-bottom: calc(100px + env(safe-area-inset-bottom));
}

/* Une seule grille de 4 colonnes, comme un téléphone : les icônes prennent une case,
   le widget échecs 2 × 2, le quiz toute la largeur. Le navigateur comble les trous. */
.board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-auto-flow: row dense;
  align-items: start;
  column-gap: 8px;
  row-gap: 20px;
}

.organize [data-group] [data-id] {
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-user-drag: none;
}

.organize [data-group] [data-id] img {
  -webkit-user-drag: none;
  pointer-events: none;
}

.app {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  min-width: 0;
  border-radius: 18px;
}

.app:focus-visible {
  outline-offset: 2px;
}

.icon {
  position: relative;
  display: block;
  width: var(--icon);
  height: var(--icon);
  border-radius: var(--radius-icon);
  overflow: hidden;
  background: #fff;
  box-shadow: 0 1px 1px rgba(4, 8, 24, 0.12), 0 6px 16px -6px rgba(4, 8, 24, 0.45);
  transition: transform 160ms ease, filter 160ms ease;
}

.icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Reflet discret en haut de chaque icône, comme une vitre */
.icon::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.18);
  pointer-events: none;
}

.app:active .icon {
  transform: scale(0.9);
  filter: brightness(0.85);
}

.label {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  line-height: 1.2;
  font-weight: 560;
  font-stretch: 96%;
  color: var(--ink);
  text-shadow: var(--shadow-text);
}

/* ------------------------------------------------------------------ */
/* Widgets                                                             */
/* ------------------------------------------------------------------ */

.widget {
  border-radius: var(--radius-widget);
  box-shadow: 0 1px 1px rgba(4, 8, 24, 0.12), 0 14px 30px -14px rgba(4, 8, 24, 0.55);
}

/* Quiz et Anecdotes : les couleurs de la chaîne */
.qea {
  grid-column: span 4;
  padding: 16px 16px 16px;
  background:
    radial-gradient(140% 90% at 100% 0%, rgba(130, 112, 240, 0.45), transparent 60%),
    var(--qea-violet);
  color: #fff;
}

.qea-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.qea-head img {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.9);
}

.qea-head h2 {
  font-size: 15px;
  line-height: 1.25;
  font-weight: 700;
  color: var(--qea-yellow);
}

.qea-head p {
  font-size: 12.5px;
  line-height: 1.3;
  color: rgba(255, 255, 255, 0.78);
}

.qea-body {
  margin-top: 14px;
}

.qea-q {
  font-size: 17px;
  line-height: 1.32;
  font-weight: 620;
  text-wrap: pretty;
}

.qea-q a {
  text-decoration: underline;
}

.qea-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.qea-options button {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 0;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.13);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
  font-size: 14.5px;
  line-height: 1.25;
  font-weight: 560;
  text-align: left;
  color: #fff;
  cursor: pointer;
  transition: background-color 160ms ease, transform 120ms ease;
}

.qea-options button:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.2);
}

.qea-options button:active:not(:disabled) {
  transform: scale(0.97);
}

.qea-options button:disabled {
  cursor: default;
}

.qea-options button.is-right {
  background: var(--qea-good);
  box-shadow: none;
  color: #052e16;
}

.qea-options button.is-wrong {
  background: var(--qea-bad);
  box-shadow: none;
  color: #3b0610;
}

.qea-options button.is-dim {
  opacity: 0.55;
}

.qea-result {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.16);
}

.qea-verdict {
  font-size: 15px;
  font-weight: 700;
  color: var(--qea-yellow);
}

.qea-fact {
  margin-top: 4px;
  font-size: 14.5px;
  line-height: 1.45;
  color: rgba(255, 255, 255, 0.9);
}

.qea-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.qea-actions > * {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
}

.qea-next {
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
}

.qea-watch {
  background: var(--qea-yellow);
  color: #1d1647;
}

.chess {
  grid-column: span 2;
  grid-row: span 2;
  position: relative;
  display: flex;
  flex-direction: column;
  align-self: stretch;
  min-height: 150px;
  padding: 14px;
  overflow: hidden;
  color: var(--board-ivory);
  background-color: var(--board-dark);
  /* Un échiquier en filigrane */
  background-image:
    linear-gradient(45deg, var(--board-light) 25%, transparent 25%, transparent 75%, var(--board-light) 75%),
    linear-gradient(45deg, var(--board-light) 25%, transparent 25%, transparent 75%, var(--board-light) 75%);
  background-size: 28px 28px;
  background-position: 0 0, 14px 14px;
}

.chess::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, rgba(46, 74, 43, 0.15) 0%, rgba(30, 50, 28, 0.92) 62%);
}

.chess > * {
  position: relative;
}

.piece {
  width: 34px;
  height: 34px;
  fill: none;
  stroke: var(--board-ivory);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chess-title {
  margin-top: auto;
  font-size: 13px;
  font-weight: 600;
  color: rgba(238, 238, 210, 0.75);
}

.chess-handle {
  font-size: 17px;
  line-height: 1.2;
  font-weight: 700;
}

.chess-stats {
  display: flex;
  gap: 12px;
  margin-top: 6px;
  min-height: 34px;
  align-items: flex-end;
}

.chess-stat {
  display: flex;
  flex-direction: column;
  font-size: 11.5px;
  line-height: 1.2;
  color: rgba(238, 238, 210, 0.75);
}

.chess-stat strong {
  font-size: 19px;
  font-weight: 700;
  font-stretch: 80%;
  font-variant-numeric: tabular-nums;
  color: var(--board-ivory);
}

.chess-invite {
  font-size: 14px;
  font-weight: 560;
  color: rgba(238, 238, 210, 0.9);
}

.chess:active {
  transform: scale(0.98);
}

.editing .chess:active {
  transform: none;
}

/* ------------------------------------------------------------------ */
/* Dock des réseaux                                                    */
/* ------------------------------------------------------------------ */

.dock {
  position: fixed;
  left: 50%;
  bottom: max(14px, env(safe-area-inset-bottom));
  z-index: 3;
  display: flex;
  justify-content: space-between;
  width: var(--col);
  padding: 10px 12px;
  border-radius: 30px;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.14);
  -webkit-backdrop-filter: blur(22px) saturate(1.6);
  backdrop-filter: blur(22px) saturate(1.6);
  box-shadow: inset 0 0 0 1px var(--glass-edge);
}

.dock a {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 14px;
  transition: background-color 160ms ease, transform 120ms ease;
}

.dock a:hover {
  background: var(--glass-strong);
}

.dock a:active {
  transform: scale(0.9);
}

.dock svg {
  width: 24px;
  height: 24px;
  fill: var(--ink);
  filter: drop-shadow(0 1px 1px rgba(4, 8, 24, 0.3));
}

/* ------------------------------------------------------------------ */
/* Fiche d'app                                                         */
/* ------------------------------------------------------------------ */

.sheet {
  width: 100%;
  max-width: 460px;
  max-height: none;
  margin: auto auto 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--sheet-ink);
  overflow: visible;
}

.sheet::backdrop {
  background: rgba(4, 8, 24, 0.5);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.sheet-panel {
  position: relative;
  padding: 10px 20px max(24px, env(safe-area-inset-bottom));
  border-radius: 28px 28px 0 0;
  background: var(--sheet-bg);
  box-shadow: 0 -10px 40px rgba(4, 8, 24, 0.3);
  touch-action: pan-y;
}

.sheet-grip {
  width: 38px;
  height: 5px;
  margin: 0 auto 14px;
  border-radius: 3px;
  background: var(--sheet-line);
  background: color-mix(in srgb, var(--sheet-ink) 18%, transparent);
}

.sheet-close {
  position: absolute;
  top: 16px;
  right: 14px;
  height: 32px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  background: var(--sheet-line);
  font-size: 14px;
  font-weight: 600;
  color: var(--sheet-ink);
  cursor: pointer;
}

.sheet-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-right: 80px;
}

.icon-lg {
  --icon: 72px;
  flex: none;
}

.sheet-head h2 {
  font-size: 24px;
  line-height: 1.15;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.sheet-head p {
  margin-top: 2px;
  font-size: 14px;
  color: var(--sheet-muted);
}

.sheet-desc {
  margin-top: 16px;
  font-size: 16px;
  line-height: 1.55;
  max-width: 60ch;
  text-wrap: pretty;
}

.sheet-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 20px 0 0;
  padding: 0;
  list-style: none;
}

.sheet-links a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 0 16px;
  border-radius: 14px;
  background: var(--sheet-row);
  box-shadow: inset 0 0 0 1px var(--sheet-line);
  font-size: 16px;
  font-weight: 600;
}

.sheet-links a span:first-child {
  flex: none;
  white-space: nowrap;
}

.sheet-links a span:last-child {
  min-width: 0;
  font-size: 13.5px;
  font-weight: 450;
  color: var(--sheet-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sheet-links a.is-primary {
  background: var(--sheet-primary);
  color: var(--sheet-on-primary);
  box-shadow: none;
}

.sheet-links a.is-primary span:last-child {
  color: inherit;
  opacity: 0.7;
}

.sheet-links a:active {
  transform: scale(0.985);
}

.sheet-links a:focus-visible,
.sheet-close:focus-visible {
  outline-color: #2563eb;
}

/* Ouverture de la fiche : elle monte depuis le bas */
.sheet[open] .sheet-panel {
  animation: sheet-in 320ms cubic-bezier(0.2, 0.9, 0.25, 1);
}

.sheet[open]::backdrop {
  animation: fade-in 240ms ease;
}

.sheet.is-closing .sheet-panel {
  animation: sheet-out 200ms ease-in forwards;
}

.sheet.is-closing::backdrop {
  animation: fade-out 200ms ease-in forwards;
}

@keyframes sheet-in {
  from {
    transform: translateY(100%);
  }
}

@keyframes sheet-out {
  to {
    transform: translateY(100%);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes fade-out {
  to {
    opacity: 0;
  }
}

/* Code promo d'une collab : un toucher le copie */
.sheet-code {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  margin-top: 18px;
  padding: 0 16px;
  border: 1.5px dashed color-mix(in srgb, var(--sheet-ink) 28%, transparent);
  border-radius: 14px;
  background: var(--sheet-row);
  color: var(--sheet-ink);
  text-align: left;
  cursor: pointer;
}

.sheet-code[hidden] {
  display: none;
}

.sheet-code-label {
  font-size: 13.5px;
  color: var(--sheet-muted);
}

.sheet-code-value {
  flex: 1;
  font-size: 19px;
  font-weight: 760;
  letter-spacing: 0.06em;
}

.sheet-code-copy {
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--sheet-line);
  font-size: 13.5px;
  font-weight: 650;
  line-height: 30px;
}

.sheet-code.is-copied .sheet-code-copy {
  background: #16a34a;
  color: #fff;
}

.sheet-code:active {
  transform: scale(0.985);
}

.sheet-code:focus-visible {
  outline-color: #2563eb;
}

/* ------------------------------------------------------------------ */
/* Dossier « Collabs » (deux collabs ou plus), comme sur iPhone        */
/* ------------------------------------------------------------------ */

/* La tuile : un carré de verre avec l'aperçu des icônes (jusqu'à 9) */
.icon.folder-icon {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-content: start;
  gap: 7%;
  padding: 13%;
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  backdrop-filter: blur(18px) saturate(1.4);
}

.icon.folder-icon img {
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  border-radius: 24%;
}

/* Le dossier ouvert : le titre au-dessus d'un grand panneau de verre */
.folder {
  width: 100%;
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  overflow: visible;
}

.folder[open] {
  display: grid;
  place-items: center;
}

.folder::backdrop {
  background: rgba(4, 8, 24, 0.32);
  -webkit-backdrop-filter: blur(26px) saturate(1.3);
  backdrop-filter: blur(26px) saturate(1.3);
}

.folder-wrap {
  width: min(100vw - 56px, 340px);
}

.folder-title {
  margin: 0 0 18px 10px;
  font-size: 30px;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-shadow: var(--shadow-text);
}

.folder-panel {
  padding: 22px 18px;
  border-radius: 38px;
  background: rgba(255, 255, 255, 0.18);
  -webkit-backdrop-filter: blur(30px) saturate(1.5);
  backdrop-filter: blur(30px) saturate(1.5);
  box-shadow: inset 0 0 0 1px var(--glass-edge), 0 20px 50px -20px rgba(4, 8, 24, 0.5);
}

.folder-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  justify-items: center;
  column-gap: 8px;
  row-gap: 20px;
}

.folder[open] .folder-wrap {
  animation: folder-in 300ms cubic-bezier(0.2, 0.9, 0.25, 1.1);
}

.folder[open]::backdrop {
  animation: fade-in 240ms ease;
}

.folder.is-closing .folder-wrap {
  animation: folder-out 190ms ease-in forwards;
}

.folder.is-closing::backdrop {
  animation: fade-out 190ms ease-in forwards;
}

@keyframes folder-in {
  from {
    opacity: 0;
    transform: scale(0.82);
  }
}

@keyframes folder-out {
  to {
    opacity: 0;
    transform: scale(0.86);
  }
}

/* ------------------------------------------------------------------ */
/* Réveil de l'écran : le seul mouvement au chargement                 */
/* ------------------------------------------------------------------ */

.js .screen,
.js .dock {
  animation: wake 700ms ease-out both;
}

.js .home .icon,
.js .home .widget {
  animation: unlock 520ms cubic-bezier(0.2, 0.9, 0.25, 1.15) both;
  animation-delay: calc(240ms + var(--i, 0) * 28ms);
}

@keyframes wake {
  from {
    opacity: 0;
  }
}

@keyframes unlock {
  from {
    opacity: 0;
    transform: scale(0.82);
  }
}

/* ------------------------------------------------------------------ */
/* Grands écrans                                                       */
/* ------------------------------------------------------------------ */

@media (min-width: 720px) {
  :root {
    --col: 440px;
    --icon: 68px;
  }

  .screen {
    padding-top: 28px;
  }

  .lock {
    padding: 34px 0 40px;
  }

  .sheet {
    margin: auto;
  }

  .moon {
    left: calc(50% + var(--col) / 2 + 120px);
    top: 20vh;
  }

  .sheet-panel {
    padding: 22px 24px 24px;
    border-radius: 28px;
  }

  .sheet-grip {
    display: none;
  }

  .sheet-close {
    top: 20px;
    right: 20px;
  }

  @keyframes sheet-in {
    from {
      opacity: 0;
      transform: translateY(16px) scale(0.98);
    }
  }

  @keyframes sheet-out {
    to {
      opacity: 0;
      transform: translateY(12px) scale(0.98);
    }
  }
}

/* ------------------------------------------------------------------ */
/* Mode organisation : appui long, les icônes tremblent et se déplacent */
/* ------------------------------------------------------------------ */

.edit-bar {
  display: flex;
  gap: 8px;
}

.edit-bar button {
  height: 34px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 650;
  cursor: pointer;
}

.edit-reset {
  background: var(--glass);
  -webkit-backdrop-filter: blur(18px) saturate(1.4);
  backdrop-filter: blur(18px) saturate(1.4);
  box-shadow: inset 0 0 0 1px var(--glass-edge);
  color: var(--ink);
}

.edit-done {
  background: var(--ink);
  color: #13203f;
}

.unlocked .home .icon,
.unlocked .home .widget {
  animation: none;
}

.editing [data-group] [data-id] {
  touch-action: none;
  cursor: grab;
}

.editing .home .app .icon,
.editing .dock a svg {
  animation: jiggle 260ms ease-in-out infinite alternate;
}

.editing .home .app:nth-child(even) .icon,
.editing .dock a:nth-child(even) svg {
  animation-duration: 290ms;
  animation-delay: -130ms;
  animation-direction: alternate-reverse;
}

.editing .home .widget {
  animation: jiggle-soft 300ms ease-in-out infinite alternate;
}

.editing .home .widget:nth-child(even) {
  animation-delay: -150ms;
  animation-direction: alternate-reverse;
}

.editing .app:active .icon,
.editing .dock a:active {
  transform: none;
  filter: none;
}

@keyframes jiggle-soft {
  from {
    transform: rotate(-0.6deg);
  }
  to {
    transform: rotate(0.6deg);
  }
}

@keyframes jiggle {
  from {
    transform: rotate(-2.2deg);
  }
  to {
    transform: rotate(2.2deg);
  }
}

/* La case laissée libre pendant le glissement */
.is-placeholder {
  opacity: 0;
}

/* L'icône soulevée qui suit le doigt */
.drag-ghost {
  position: fixed;
  z-index: 20;
  margin: 0;
  pointer-events: none;
  transform: scale(var(--lift, 1.12));
  transition: transform 120ms ease-out;
  will-change: transform;
}

.dragging .drag-ghost {
  transition: none;
}

.drag-ghost .icon {
  animation: none;
  box-shadow: 0 18px 34px -12px rgba(4, 8, 24, 0.6);
}

.drag-ghost .label {
  opacity: 0;
}

.drag-ghost.widget {
  --lift: 1.04;
  animation: none;
  box-shadow: 0 24px 50px -18px rgba(4, 8, 24, 0.7);
}

.drag-ghost.is-dock {
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--glass-strong);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.drag-ghost.is-dock svg {
  width: 24px;
  height: 24px;
  fill: var(--ink);
}

.drag-ghost.is-dropping {
  transition: transform 220ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.dragging,
.dragging * {
  cursor: grabbing !important;
}

/* Ordinateur : l'écran passe en paysage, l'heure à gauche et l'écran d'accueil à droite */
@media (min-width: 1024px) and (min-height: 640px) {
  :root {
    --wide: min(1040px, 100vw - 96px);
  }

  .screen {
    width: var(--wide);
    display: grid;
    grid-template-columns: 1fr var(--col);
    grid-template-rows: auto 1fr;
    column-gap: 72px;
  }

  .status {
    grid-column: 1 / -1;
  }

  .lock {
    align-self: center;
    padding: 0 0 110px;
  }

  .clock {
    font-size: 176px;
  }

  .bio {
    font-size: 17px;
  }

  .home {
    align-self: center;
    padding-top: 12px;
  }

  .dock {
    left: calc(50% + var(--wide) / 2 - var(--col));
    transform: none;
  }

  /* La lune au-dessus de l'heure, dans la colonne de gauche */
  .moon {
    left: calc(50% - 90px);
    top: 16vh;
  }
}

@media (hover: hover) {
  .app:hover .icon {
    transform: translateY(-2px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .editing .home .app .icon,
  .editing .home .widget,
  .editing .dock a svg {
    animation: none !important;
  }

  .editing .home .app .icon {
    outline: 2px dashed rgba(255, 255, 255, 0.7);
    outline-offset: 3px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-delay: 0ms !important;
    transition-duration: 1ms !important;
  }
}
