/* ========= Portal (mellian.eu) ========= */
/* Palette + mode clair/sombre auto */
:root {
  --bg: #0f1115;
  --panel: #161a22;
  --text: #eef2ff;
  --muted: #93a1b0;
  --accent: #3b82f6;
  --accent-2: #f59e0b;
  --success: #0aa06e;
  --error: #ef4444;
  --border: #252b36;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .3);
  --focus: 0 0 0 3px rgba(59, 130, 246, .4);
}

/* Base / reset léger */
* { box-sizing: border-box }
html, body { height: 100% }
html { scroll-behavior: smooth }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Apple Color Emoji", "Segoe UI Emoji";
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg, video { max-width: 100%; height: auto }

/* Header collant */
.header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: linear-gradient(to bottom, rgba(0, 0, 0, .35), rgba(0, 0, 0, 0)), var(--bg);
  padding: env(safe-area-inset-top) 16px 12px 16px;
  backdrop-filter: saturate(180%) blur(6px);
  border-bottom: 1px solid var(--border);
}
.wrap-header {
  max-width: 980px;
  margin: 0 auto;
  padding: 0 16px;
}
.wrap-header h1 {
  font-size: clamp(20px, 3vw, 30px);
  margin: 0 auto;
  max-width: 420px;
}

/* Layout principal (Portail) */
.container {
  max-width: 980px;
  margin: 20px auto;
  padding: 0 16px;
}
.wrap {
  width: 100%;
  max-width: 420px;
  margin: 0 auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 22px;
  box-shadow: var(--shadow);
}

/* Titres & texte */
h1, h2, h3 { line-height: 1.2 }
h2 {
  margin: 0 0 18px;
  font-size: clamp(20px, 2.5vw, 24px);
  text-align: center;
}
p { margin: 0 0 12px; color: var(--muted) }

/* Formulaires */
label {
  display: block;
  margin: 14px 0 6px;
  font-size: 14px;
  color: var(--muted);
}
input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  font-size: 15px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  outline: 0;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: var(--focus);
}

/* Boutons */
button, .btn {
  display: inline-block;
  width: 100%;
  margin-top: 16px;
  padding: 11px 12px;
  font-size: 15px;
  border: 0;
  border-radius: 10px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  text-align: center;
  transition: transform .06s ease, filter .15s ease, background-color .15s ease;
  will-change: transform;
}
button:hover, .btn:hover { filter: brightness(1.05) }
button:active, .btn:active { transform: translateY(1px) }
button:focus-visible, .btn:focus-visible {
  outline: 0;
  box-shadow: var(--focus);
}
.btn--green { background: var(--success) }
.btn--alt { background: var(--accent-2) }
.btn--muted {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}

/* États / messages */
.error {
  color: var(--error);
  margin: 8px 0 0;
  font-size: 14px;
  text-align: center;
}
.muted { color: var(--muted) }
.hidden { display: none !important }

/* Liens */
a { color: var(--accent); text-decoration: none }
a:hover { filter: brightness(1.15) }

/* Cartes / utilitaires */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.center { text-align: center }
.mt-0 { margin-top: 0 }
.mt-1 { margin-top: 6px }
.mt-2 { margin-top: 12px }
.mt-3 { margin-top: 18px }
.mt-4 { margin-top: 24px }
.mb-0 { margin-bottom: 0 }
.mb-1 { margin-bottom: 6px }
.mb-2 { margin-bottom: 12px }
.mb-3 { margin-bottom: 18px }
.mb-4 { margin-bottom: 24px }

/* Accessibilité */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important }
}

/* Impression minimale */
@media print {
  .header { display: none }
  .wrap { box-shadow: none; border-color: #ccc }
  a:after { content: " (" attr(href) ")"; font-size: 12px }
}

/* ===========================================================
   Explorateur (/share) — styles spécifiques
   =========================================================== */

/* Header */
.header .wrap {
  max-width: 980px;
  margin: 0 auto;
  padding: 16px;
  background: transparent;
  border: 0;
  box-shadow: none;
}

/* Titre + barre actions/recherche */
.title h1 { font-size: clamp(18px, 2.6vw, 26px); margin: 0 0 8px 0 }
.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

/* Boutons pilules dans header */
.header .actions .btn {
  width: auto;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 14px;
  margin-top: 0;
}
.header .actions .btn:hover { border-color: var(--accent) }
.header .actions .btn:focus-visible { box-shadow: var(--focus) }

/* Barre de recherche */
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 12px;
  max-width: 520px;
}
.search input {
  flex: 1;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 16px;
  min-width: 140px;
}
.search input:focus-visible { box-shadow: none }

/* Zone de contenu */
.container--share {
  max-width: 980px;
  margin: 12px auto 40px;
  padding: 0 16px 32px;
}
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
}

/* Arborescence */
.tree { list-style: none; margin: 0; padding-left: 14px }
.tree > li { margin: 2px 0 }

details { padding-left: 0 }
summary {
  list-style: none;
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
  border-radius: 10px;
}
summary::-webkit-details-marker { display: none }
summary:hover { background: rgba(128, 128, 128, .08) }

.chevron {
  width: 10px;
  height: 10px;
  display: inline-block;
  transform: rotate(0deg);
  transition: transform .18s ease;
  border-right: 2px solid var(--accent-2);
  border-bottom: 2px solid var(--accent-2);
  margin-right: 2px;
  transform-origin: 40% 55%;
  rotate: -45deg;
}
details[open] > summary .chevron { transform: rotate(45deg) }

/* Dossiers */
.folder .name {
  font-weight: 600;
  color: var(--accent-2);
  overflow-wrap: anywhere;
  white-space: normal;
}

/* Métadonnées */
.meta {
  margin-left: auto;
  font-size: 12px;
  color: var(--muted);
  background: transparent;
  padding: 2px 6px;
  border-radius: 8px;
  border: 1px dashed var(--border);
}

/* Fichiers */
.file {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 6px;
  border-radius: 10px;
}
.file:hover { background: rgba(128, 128, 128, .06) }
.file .file-link {
  color: var(--accent);
  text-decoration: none;
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: normal;
}
.file .file-link:hover { text-decoration: underline }

/* Mobile */
@media (hover: none) {
  summary, .file { padding: 12px 8px }
}
