:root {
  /* Univers unique, clair et chaud : rose poudré, orange pêche, bordeaux pour l'encre et les titres.
     Mise en page : bandeau + grandes cartes semestre, puis grilles de matières, puis listes de documents. */
  --paper: #FFF4EF;
  --peach: #FFD9BF;
  --orange: #F07F3C;
  --rose: #F49AB2;
  --rose-soft: #FDE1E8;
  --bordeaux: #6B1430;
  --ink: #3B1521;
  --muted: #8A5A66;
  --line: rgba(107, 20, 48, 0.14);
  --font-display: "Bricolage Grotesque", "Trebuchet MS", system-ui, sans-serif;
  --font-body: "Nunito Sans", "Segoe UI", system-ui, sans-serif;
  --font-hand: "Caveat", "Comic Sans MS", cursive;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
#sketches {
  position: fixed; inset: 0; width: 100%; height: 100%;
  pointer-events: none; z-index: 0; opacity: 0.22;
}
.app { position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column; }
h1, h2, h3 { font-family: var(--font-display); color: var(--bordeaux); text-wrap: balance; margin: 0; line-height: 1.1; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 3px; border-radius: 8px; }

/* ---------- Écran mot de passe ---------- */
.gate {
  flex: 1; display: grid; place-items: center; padding: 32px 16px;
}
.gate-card {
  width: min(440px, 100%);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(6px);
  border: 2px solid var(--bordeaux);
  border-radius: 28px;
  padding: 36px 32px 28px;
  box-shadow: 8px 8px 0 var(--rose);
  display: flex; flex-direction: column; gap: 18px;
}
.logo { display: flex; align-items: center; gap: 12px; }
.logo svg { flex: none; }
.logo-name { font-family: var(--font-display); font-weight: 800; font-size: 28px; color: var(--bordeaux); letter-spacing: -0.02em; line-height: 1; }
.logo-pun { font-size: 13px; font-weight: 700; color: var(--orange); line-height: 1.2; margin-top: 6px; letter-spacing: .02em; }
.linkbtn { background: none; border: 0; padding: 4px; color: var(--bordeaux); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; align-self: center; }
.gate-card h2 { font-size: 24px; font-weight: 800; }
.field textarea { font: inherit; padding: 12px 16px; border-radius: 14px; border: 2px solid var(--line); background: #fff; color: var(--ink); resize: vertical; min-height: 80px; }
.field textarea:focus { border-color: var(--orange); outline: none; }
.sent { display: flex; flex-direction: column; gap: 10px; background: var(--rose-soft); border-radius: 16px; padding: 16px; }
.sent strong { color: var(--bordeaux); font-family: var(--font-display); font-size: 19px; }
.sent small { color: var(--muted); }
.gate-card p { margin: 0; color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 700; font-size: 14px; color: var(--bordeaux); }
.field input {
  font: inherit; padding: 13px 16px; border-radius: 14px;
  border: 2px solid var(--line); background: #fff; color: var(--ink);
}
.field input:focus { border-color: var(--orange); outline: none; }
.btn {
  border: 0; border-radius: 14px; padding: 13px 18px; font-weight: 700;
  background: var(--bordeaux); color: #fff;
  transition: transform .15s ease, background .15s ease;
}
.btn:hover { background: #8A1C3F; transform: translateY(-1px); }
.error { color: #B3261E; font-weight: 600; font-size: 14px; min-height: 1.4em; }
.demo-hint { font-size: 13px; background: var(--rose-soft); border-radius: 10px; padding: 8px 12px; color: var(--bordeaux); }

/* ---------- En-tête ---------- */
header.top {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding: 18px clamp(16px, 4vw, 48px);
  border-bottom: 2px solid var(--line);
  background: rgba(255, 244, 239, 0.85); backdrop-filter: blur(6px);
  position: sticky; top: 0; z-index: 5;
}
.logo-link { all: unset; cursor: pointer; display: flex; align-items: center; gap: 10px; }
.logo-link .logo-name { font-size: 22px; }
.search { position: relative; flex: 1 1 260px; max-width: 380px; }
.search input {
  width: 100%; font: inherit; padding: 10px 14px 10px 40px; border-radius: 999px;
  border: 2px solid var(--line); background: #fff; color: var(--ink);
}
.search input:focus { border-color: var(--orange); outline: none; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); }
.ghost { background: transparent; border: 2px solid var(--bordeaux); color: var(--bordeaux); border-radius: 999px; padding: 8px 16px; font-weight: 700; }
.ghost:hover { background: var(--bordeaux); color: #fff; }

main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 28px clamp(16px, 4vw, 48px) 56px; display: flex; flex-direction: column; gap: 28px; }

.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 14px; color: var(--muted); }
.crumbs a { color: var(--bordeaux); font-weight: 700; text-decoration: none; }
.crumbs a:hover { text-decoration: underline; }

/* ---------- Accueil ---------- */
.hello { display: flex; flex-direction: column; gap: 8px; }
.kicker { font-size: 14px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--orange); }
.hello h1 { font-size: clamp(32px, 5vw, 52px); font-weight: 800; letter-spacing: -0.02em; }
.hello p { margin: 0; max-width: 62ch; color: var(--muted); font-size: 17px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.chip { font-size: 13px; font-weight: 700; padding: 5px 12px; border-radius: 999px; background: #fff; border: 2px solid var(--line); color: var(--bordeaux); }

.semesters { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 22px; }
.sem-card {
  all: unset; cursor: pointer; position: relative; overflow: hidden;
  border-radius: 30px; padding: 28px; min-height: 250px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 18px;
  color: #fff; border: 2px solid var(--bordeaux);
  box-shadow: 8px 8px 0 var(--bordeaux);
  transition: transform .18s ease, box-shadow .18s ease;
}
.sem-card:hover { transform: translate(-3px, -3px); box-shadow: 11px 11px 0 var(--bordeaux); }
.sem-card:focus-visible { outline: 3px solid var(--orange); outline-offset: 5px; }
.sem-card.s1 { background: linear-gradient(135deg, var(--orange) 0%, var(--rose) 100%); }
.sem-card.s2 { background: linear-gradient(135deg, var(--rose) 0%, var(--bordeaux) 100%); }
.sem-num { font-family: var(--font-display); font-weight: 800; font-size: 120px; line-height: .8; letter-spacing: -0.05em; opacity: .95; }
.sem-card h2 { color: #fff; font-size: 28px; }
.sem-card ul { margin: 8px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 2px; font-size: 14px; opacity: .95; }
.sem-card .go { position: absolute; top: 24px; right: 24px; width: 48px; height: 48px; border-radius: 50%; background: #fff; color: var(--bordeaux); display: grid; place-items: center; }

/* ---------- Grille des matières ---------- */
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.section-head h1 { font-size: clamp(30px, 4.4vw, 46px); font-weight: 800; }
.section-head .count { font-weight: 800; font-size: 15px; color: var(--orange); }
.subjects { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; }
.subj {
  all: unset; cursor: pointer; display: flex; flex-direction: column; gap: 14px;
  background: #fff; border: 2px solid var(--bordeaux); border-radius: 24px; padding: 20px;
  box-shadow: 5px 5px 0 var(--c, var(--rose));
  transition: transform .15s ease, box-shadow .15s ease;
}
.subj:hover { transform: translate(-2px, -2px); box-shadow: 7px 7px 0 var(--c, var(--rose)); }
.subj:focus-visible { outline: 3px solid var(--orange); outline-offset: 4px; }
.mono {
  width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800; font-size: 24px; color: #fff;
  background: var(--g);
}
.subj h3 { font-size: 19px; font-weight: 700; }
.subj .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; }
.tag { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--rose-soft); color: var(--bordeaux); }
.tag.o { background: var(--peach); }

/* ---------- Page matière ---------- */
.subj-hero {
  border-radius: 30px; padding: 28px; border: 2px solid var(--bordeaux);
  background: var(--g); color: #fff; display: flex; gap: 20px; align-items: center; flex-wrap: wrap;
  box-shadow: 8px 8px 0 var(--bordeaux);
}
.subj-hero .mono { width: 84px; height: 84px; font-size: 32px; background: rgba(255,255,255,.22); border: 2px solid rgba(255,255,255,.7); }
.subj-hero h1 { color: #fff; font-size: clamp(26px, 3.8vw, 40px); font-weight: 800; }
.subj-hero p { margin: 6px 0 0; opacity: .95; }
.tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.tab {
  border: 2px solid var(--bordeaux); background: #fff; color: var(--bordeaux);
  padding: 9px 16px; border-radius: 999px; font-weight: 700; display: inline-flex; gap: 8px; align-items: center;
}
.tab .n { font-size: 12px; background: var(--rose-soft); border-radius: 999px; padding: 1px 8px; }
.tab[aria-selected="true"] { background: var(--bordeaux); color: #fff; }
.tab[aria-selected="true"] .n { background: var(--orange); color: #fff; }

.files { display: flex; flex-direction: column; gap: 10px; }
.file {
  display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center;
  background: rgba(255,255,255,.92); border: 2px solid var(--line); border-radius: 18px; padding: 12px 14px;
}
.file:hover { border-color: var(--rose); }
.ficon {
  width: 44px; height: 52px; border-radius: 8px 16px 8px 8px; background: var(--peach);
  display: grid; place-items: center; font-size: 11px; font-weight: 800; color: var(--bordeaux); letter-spacing: .04em;
  border: 2px solid var(--bordeaux);
}
.fname { font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.fsub { font-size: 13px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.fbtns { display: flex; gap: 8px; }
.fbtn { border: 2px solid var(--bordeaux); background: #fff; color: var(--bordeaux); border-radius: 12px; padding: 7px 12px; font-weight: 700; font-size: 14px; }
.fbtn.main { background: var(--orange); border-color: var(--orange); color: #fff; }
.fbtn:hover { filter: brightness(.95); }
.example { font-size: 11px; font-weight: 800; color: var(--orange); text-transform: uppercase; letter-spacing: .06em; }
.empty { padding: 28px; text-align: center; border: 2px dashed var(--line); border-radius: 18px; color: var(--muted); font-weight: 600; }

.note {
  font-family: var(--font-hand); font-size: 22px; color: var(--bordeaux); line-height: 1.2;
  background: var(--rose-soft); border-radius: 18px; padding: 14px 18px; transform: rotate(-0.6deg); max-width: 640px;
}

footer { text-align: center; padding: 22px 16px 30px; color: var(--muted); font-size: 14px; }
footer span { font-family: var(--font-display); font-weight: 700; font-size: 18px; color: var(--bordeaux); }

.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0;
  background: var(--bordeaux); color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 600;
  transition: opacity .2s ease, transform .2s ease; z-index: 20; max-width: calc(100% - 32px); text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

.req-fields { display: flex; flex-direction: column; gap: 14px; }
[hidden] { display: none !important; }

@media (max-width: 560px) {
  .file { grid-template-columns: auto 1fr; }
  .fbtns { grid-column: 1 / -1; }
  .fbtn { flex: 1; }
  .sem-num { font-size: 96px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
a.fbtn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
a.linkbtn { display: inline-block; }
.group { font-size: 17px; font-weight: 700; color: var(--bordeaux); margin: 10px 0 0; padding-left: 4px; }
.group:first-child { margin-top: 0; }
