/* ==========================================================================
   Trinôme — jeton de conception
   Fond kraft/crème, encre quasi noire, un seul accent brun, vert et bleu
   encre très discrets. Aucune ombre portée, coins peu arrondis, aucune
   animation superflue. Le repère de couleur "signature" est le filet rouge
   de marge du papier séyès, seul élément un peu affirmé de la page.
   ========================================================================== */

:root{
  --kraft: #ece1c8;
  --kraft-deep: #e2d4b4;
  --kraft-deeper: #e8dfca;
  --ink: #2a231d;
  --ink-soft: #6e6151;
  --ink-faint: #948765;
  --brun: #6b4023;
  --brun-deep: #4c2d17;
  --encre: #34445c;
  --vert: #4b5c40;
  --marge: rgba(150, 62, 52, 0.4);
  --border: rgba(42, 35, 27, 0.15);
  --border-strong: rgba(42, 35, 27, 0.27);
  --hover: rgba(42, 35, 27, 0.055);
  --focus: rgba(52, 68, 92, 0.45);
  --radius: 3px;
  --serif: 'IBM Plex Serif', Georgia, 'Times New Roman', serif;
  --sans: 'IBM Plex Sans', -apple-system, 'Segoe UI', sans-serif;
}



*, *::before, *::after{ box-sizing:border-box; }
html,body{ margin:0; padding:0; }

body{
  background-color: var(--kraft);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100vh;
  position: relative;
}


body::before{
  content:"";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .5;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 0.045 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

a{ color: inherit; }
button{ font-family: inherit; }

::selection{ background: var(--brun); color: var(--kraft); }

/* focus visible discret mais net, partout par défaut */
:focus-visible{ outline: 2px solid var(--encre); outline-offset: 2px; }

.toolbar{
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--kraft-deep);
  border-bottom: 1px solid var(--border-strong);
}

.toolbar-inner{
  max-width: 1040px;
  margin: 0 auto;
  padding: .95rem 1.5rem .35rem;
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

.brand{
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: var(--ink);
  line-height: 1.15;
  flex-shrink: 0;
}
.brand-mark{
  font-family: var(--serif);
  font-style: italic;
  font-weight: 600;
  font-size: 1.55rem;
  letter-spacing: .01em;
  padding-bottom: .5rem;
}
.brand-sub{
  font-family: var(--sans);
  font-size: .62rem;
  text-transform: uppercase;
  letter-spacing: .13em;
  color: var(--ink-soft);
  margin-top: .1rem;
}

.search-wrap{
  position: relative;
  flex: 1 1 auto;
  max-width: 460px;
}
.search-wrap svg{
  position: absolute;
  left: .65rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-faint);
  pointer-events: none;
}
#search{
  width: 100%;
  padding: .5rem 2.1rem .5rem 2.1rem;
  font-family: var(--sans);
  font-size: .92rem;
  color: var(--ink);
  background: var(--kraft);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  transition: border-color .12s ease, box-shadow .12s ease;
}
#search::placeholder{ color: var(--ink-faint); }
#search:focus{
  outline: none;
  border-color: var(--encre);
  box-shadow: 0 0 0 3px var(--focus);
}
.search-hint{
  position: absolute;
  right: .5rem;
  top: 50%;
  transform: translateY(-50%);
  font-family: var(--sans);
  font-size: .68rem;
  color: var(--ink-faint);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: .05rem .32rem;
  background: var(--kraft);
}

.upload-link, .about-link{
  margin-left: auto;
  flex-shrink: 0;
  font-family: var(--sans);
  font-size: .82rem;
  color: var(--brun);
  text-decoration: none;
  white-space: nowrap;
  border-bottom: 1px solid transparent;
  padding-bottom: 1px;
  transition: border-color .12s ease;
}
.upload-link:hover, .about-link:hover{
  border-bottom-color: var(--brun);
}

.filters{
  max-width: 1040px;
  margin: 0 auto;
  padding: .55rem 1.5rem .8rem;
  display: flex;
  align-items: center;
  gap: 1.3rem;
  flex-wrap: wrap;
}
.filter-group{
  display: flex;
  align-items: center;
  gap: .35rem;
  flex-wrap: wrap;
}
.filter-label{
  font-family: var(--sans);
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--ink-faint);
  margin-right: .1rem;
  white-space: nowrap;
}
.chip{
  font-family: var(--sans);
  font-size: .78rem;
  line-height: 1;
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid var(--border-strong);
  border-radius: 2px;
  padding: .34rem .6rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color .12s ease, color .12s ease, border-color .12s ease;
}
.chip:hover{ background: var(--hover); color: var(--ink); }
.chip.is-active{
  background: var(--brun);
  border-color: var(--brun);
  color: var(--kraft);
}
.chip-reset{
  font-size: .76rem;
  color: var(--encre);
  background: none;
  border: none;
  text-decoration: underline;
  cursor: pointer;
  padding: .34rem .2rem;
  margin-left: .1rem;
}
.chip-reset:hover{ color: var(--brun-deep); }

@media (max-width: 640px){
  .filters{
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: .7rem;
  }
  .filters::-webkit-scrollbar{ display:none; }
  .filter-group{ flex-shrink: 0; }
}

/* ==========================================================================
   Contenu principal
   ========================================================================== */

main{
  position: relative;
  z-index: 1;
}

.content-wrap{
  max-width: 900px;
  margin: 0 auto;
  padding: 2.1rem 1.75rem 5rem 3.1rem;
  position: relative;
}

/* filet de marge façon papier séyès — signature discrète mais assumée */
.content-wrap::before{
  content:"";
  position: absolute;
  top: 0;
  bottom: 0;
  left: 2.15rem;
  width: 1px;
  background: var(--marge);
}

@media (max-width: 640px){
  .content-wrap{ padding: 1.5rem 1.15rem 4rem 1.15rem; }
  .content-wrap::before{ display: none; }
}

.status{
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink-soft);
  padding: .75rem 0;
}

.demo-note{
  font-family: var(--sans);
  font-style: italic;
  font-size: .8rem;
  color: var(--ink-soft);
  background: var(--kraft-deep);
  border-left: 2px solid var(--encre);
  padding: .5rem .85rem;
  margin: 0 0 1.75rem;
}

.empty-state{
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink-soft);
  text-align: center;
  padding: 3rem 1rem;
}
.empty-state a{
  font-family: var(--sans);
  font-style: normal;
  font-size: .82rem;
  color: var(--encre);
  text-decoration: underline;
  cursor: pointer;
}

/* --- groupes par matière --- */

.subject-group{ margin-bottom: .25rem; }

.subject-header{
  margin: 2.3rem 0 .45rem;
  border-bottom: 1px solid var(--border-strong);
  padding-bottom: .5rem;
}
.subject-group:first-of-type .subject-header{ margin-top: .25rem; }

.subject-toggle{
  display: flex;
  align-items: baseline;
  gap: .55rem;
  width: 100%;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
  color: inherit;
}
.subject-toggle .chevron{
  flex-shrink: 0;
  color: var(--ink-faint);
  transition: transform .15s ease;
  transform-origin: 50% 50%;
  align-self: center;
}
.subject-group.is-collapsed .chevron{ transform: rotate(-90deg); }

.subject-name{
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.18rem;
  color: var(--ink);
}
.subject-toggle:hover .subject-name{ color: var(--brun); }

.subject-count{
  font-family: var(--sans);
  font-size: .72rem;
  color: var(--ink-faint);
  border: 1px solid var(--border);
  border-radius: 2px;
  padding: .04rem .4rem;
}

.subject-list{ list-style: none; margin: 0; padding: 0; }
.subject-group.is-collapsed .subject-list{ display: none; }

/* --- lignes de documents --- */

.doc-row{
  display: flex;
  align-items: baseline;
  gap: .7rem;
  padding: .3rem .4rem;
  text-decoration: none;
  color: inherit;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background-color .12s ease, box-shadow .12s ease;
}
.doc-row:last-child{ border-bottom: none; }
.doc-row:hover,
.doc-row:focus-visible{
  background: var(--hover);
  box-shadow: inset 3px 0 0 0 var(--brun);
  outline: none;
}

.doc-icon{
  flex-shrink: 0;
  align-self: center;
  color: var(--ink-faint);
  transition: color .12s ease;
}
.doc-row:hover .doc-icon,
.doc-row:focus-visible .doc-icon{ color: var(--brun); }

.doc-title{
  font-family: var(--serif);
  font-size: .98rem;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.doc-meta{
  margin-left: auto;
  flex-shrink: 0;
  display: flex;
  align-items: baseline;
  gap: .55rem;
  font-family: var(--sans);
  font-size: .78rem;
  color: var(--ink-soft);
  white-space: nowrap;
}
.meta-secondary{ color: var(--ink-faint); }
.meta-sep{ color: var(--border-strong); }
.stars{
  color: var(--brun);
  letter-spacing: .04em;
  font-size: .74rem;
}
.dl-count{
  display: inline-flex;
  align-items: center;
  gap: .2rem;
  color: var(--ink-faint);
}
.dl-count svg{ flex-shrink: 0; }

@media (max-width: 640px){
  .doc-row{ flex-wrap: wrap; padding: .65rem .3rem; }
  .doc-title{ white-space: normal; flex: 1 1 100%; order: 1; }
  .doc-icon{ order: 0; }
  .doc-meta{
    margin-left: 1.55rem;
    flex-basis: 100%;
    order: 2;
    white-space: normal;
    flex-wrap: wrap;
    row-gap: .15rem;
    font-size: .74rem;
  }
}

/* --- pied de page --- */

.footer{
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.75rem 3rem 3.1rem;
  text-align: center;
}
#doc-count{
  font-family: var(--serif);
  font-style: italic;
  font-size: .82rem;
  color: var(--ink-faint);
}
@media (max-width: 640px){
  .footer{ padding: 0 1.15rem 3rem; }
}

/* --- notification discrète (mode démonstration) --- */

.toast{
  position: fixed;
  left: 50%;
  bottom: 1.4rem;
  transform: translateX(-50%) translateY(10px);
  background: var(--ink);
  color: var(--kraft);
  font-family: var(--sans);
  font-size: .8rem;
  padding: .55rem 1rem;
  border-radius: 2px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease, transform .18s ease;
  z-index: 30;
  max-width: 90vw;
}
.toast.is-visible{
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (prefers-reduced-motion: reduce){
  *{ transition: none !important; animation: none !important; }
}
.doc-author {
  font-weight: 500;
  color: var(--text-secondary);
}