/* PimsWork - base.css : reset, typographie, app shell */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  min-height: 100vh; min-height: 100dvh;
  background: var(--bg); color: var(--text);
  font-family: var(--font-sans); font-size: var(--text-md);
  line-height: var(--leading-normal);
  -webkit-font-smoothing: antialiased;
}
img, svg, video { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
ul[role="list"], ol[role="list"] { list-style: none; padding: 0; }
a { color: var(--text); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
::selection { background: var(--text); color: var(--bg); }

:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: var(--radius-sm); }
:focus:not(:focus-visible) { outline: none; }

/* Typographie */
h1, h2, h3, h4 { line-height: var(--leading-tight); font-weight: var(--weight-semibold); letter-spacing: -0.01em; }
h1 { font-size: var(--text-2xl); }
h2 { font-size: var(--text-xl); }
h3 { font-size: var(--text-lg); }
h4 { font-size: var(--text-md); }
p + p { margin-top: var(--space-3); }
small, .text-sm { font-size: var(--text-sm); }
.text-muted { color: var(--text-muted); }
.text-xs { font-size: var(--text-xs); }
.text-mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
code { font-family: var(--font-mono); font-size: 0.9em; background: var(--surface-2); padding: 0.1em 0.35em; border-radius: var(--radius-sm); }
hr { border: 0; border-top: 1px solid var(--border); margin: var(--space-5) 0; }

.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;
}
.skip-link {
  position: absolute; left: var(--space-3); top: -100px; z-index: var(--z-toast);
  background: var(--primary); color: var(--on-primary); padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-md); text-decoration: none;
}
.skip-link:focus { top: var(--space-3); }

/* ---------- App shell (mobile-first) ----------
   <body><div class="app">
     <nav class="app__nav"> ... </nav>
     <main class="app__main"><div class="app__content"> ... </div></main>
   </div></body> */
.app { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }

/* Mobile : barre du bas */
.app__nav {
  padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right);
  position: fixed; inset: auto 0 0 0; z-index: var(--z-nav);
  display: flex; justify-content: space-around; align-items: stretch;
  height: calc(var(--bottombar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--border);
}
.app__brand { display: none; font-weight: var(--weight-semibold); font-size: var(--text-lg); letter-spacing: -0.02em; }
.app__nav-list { display: contents; list-style: none; padding: 0; }
.app__nav-footer { display: none; }

.nav-item {
  flex: 1; min-width: var(--tap); min-height: var(--tap);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  padding: var(--space-1); color: var(--text-muted); text-decoration: none;
  font-size: var(--text-xs); font-weight: var(--weight-medium);
  transition: color var(--dur-fast) var(--ease), background var(--dur-fast) var(--ease);
}
.nav-item__icon { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.nav-item:hover { color: var(--text); }
.nav-item[aria-current="page"], .nav-item--active { color: var(--text); font-weight: var(--weight-semibold); }
.nav-item[aria-current="page"] .nav-item__icon { stroke-width: 2.25; }

.app__main { flex: 1; min-width: 0; padding-bottom: calc(var(--bottombar-h) + env(safe-area-inset-bottom) + var(--space-4)); }
.app__content { width: 100%; max-width: var(--content-max); margin-inline: auto; padding: var(--space-5) max(var(--space-4), env(safe-area-inset-right)) var(--space-5) max(var(--space-4), env(safe-area-inset-left)); }
.app__header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-5); }
.stack > * + * { margin-top: var(--space-4); }
.stack--sm > * + * { margin-top: var(--space-2); }
.row { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.row--between { justify-content: space-between; }

@media (min-width: 640px) {
  .app__content { padding: var(--space-6) var(--space-5); }
}

/* Desktop : sidebar */
@media (min-width: 1024px) {
  .app { flex-direction: row; }
  .app__nav {
    position: sticky; inset: 0 auto auto 0; align-self: flex-start;
    flex-direction: column; justify-content: flex-start; gap: var(--space-4);
    width: var(--sidebar-w); height: 100vh; height: 100dvh; flex-shrink: 0;
    padding: var(--space-5) var(--space-3); border-top: 0; border-right: 1px solid var(--border);
  }
  .app__brand { display: block; padding: 0 var(--space-3) var(--space-3); }
  .app__nav-list { display: flex; flex-direction: column; gap: var(--space-1); }
  .app__nav-footer { display: block; margin-top: auto; }
  .nav-item {
    flex: none; flex-direction: row; justify-content: flex-start; gap: var(--space-3);
    padding: var(--space-2) var(--space-3); border-radius: var(--radius-md);
    font-size: var(--text-sm);
  }
  .nav-item:hover { background: var(--surface-hover); }
  .nav-item[aria-current="page"], .nav-item--active { background: var(--surface-2); }
  .app__main { padding-bottom: 0; }
  .app__content { padding: var(--space-7) var(--space-6); }
}

@media (max-height: 500px) and (orientation: landscape) and (max-width: 1023px) {
  :root { --bottombar-h: 48px; }
  .nav-item { flex-direction: row; gap: var(--space-2); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important; animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important; scroll-behavior: auto !important;
  }
}
