/* Base full-screen "static" canvas (no page scroll) */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden; /* no page scroll */
  font-family: 'IBMPlexMono', monospace; color: #fff;
  background: linear-gradient(135deg, #392A3D 0%, #151A1D 100%);
}

/* 2-column layout: left = filter tile, right = tiles pane (3x2 area) */
.screen { height: 100vh; width: 100vw; padding: 14px; }
.layout {
  height: 100%;
  display: grid;
  grid-template-columns: 1fr 3fr;
  grid-template-rows: 1fr 1fr;
  gap: 14px;
  grid-template-areas:
    "filters tiles"
    "filters tiles";
}

/* Base tile styling */
.tile {
  position: relative;
  border-radius: 18px;
  background: radial-gradient(100% 100% at 0% 0%, rgba(255,255,255,.08) 0%, rgba(255,255,255,.02) 100%);
  border: 1px solid rgba(255,255,255,.15);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.tile--filters { grid-area: filters; padding: 18px; backdrop-filter: blur(6px); }
.filters__header h1 { margin: 0; font-size: 22px; letter-spacing: .5px; }
.filters__header small { color: #d7c7d9; }
.filters__list { display: grid; grid-template-columns: 1fr; gap: 10px; margin-top: 16px; }
.chip {
  --ring: #e85aff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.18);
  background: rgba(255,255,255,.06);
  color: #fff; cursor: pointer; font-weight: 600;
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease;
}
.chip:hover { transform: translateY(-1px); background: rgba(255,255,255,.1); }
.chip.is-active { box-shadow: 0 0 0 3px var(--ring) inset; }
.chip__label { text-transform: uppercase; letter-spacing: .08em; font-size: 12px; }
.chip__count { font-variant-numeric: tabular-nums; opacity: .9; }

.filters__footer { margin-top: auto; font-size: 12px; color: #d7c7d9; opacity: .9; }

/* Tiles scroll pane */
.tiles {
  grid-area: tiles;
  height: 100%;
  overflow: auto; /* scroll only inside here */
  padding-right: 4px; /* room for scrollbar */
  --tile: 320px; /* FIXED tile size; change here to resize all squares */
  display: grid;
  grid-auto-flow: row;
  grid-template-columns: repeat(auto-fill, minmax(var(--tile), var(--tile)));
  justify-content: start;
  gap: 14px;
  align-content: start;
  scroll-behavior: smooth;
}

.tiles::-webkit-scrollbar { width: 8px; }
.tiles::-webkit-scrollbar-thumb { background: rgba(255,255,255,.2); border-radius: 8px; }
.tiles { scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.25) transparent; }

.project { isolation: isolate; position: relative; width: 100%; height: var(--tile); }
.project__media {
  position: absolute; inset: 0; z-index: 0;
  background-size: cover; background-position: center;
  filter: saturate(1.06) contrast(1.02);
  transition: transform .35s ease;
}
.project:hover .project__media { transform: scale(1.05); }
.project::after {
  content:""; position:absolute; inset:0; z-index:0;
  background: linear-gradient(to top, rgba(0,0,0,.55), rgba(0,0,0,.0) 50%);
}
.project__meta {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 20px 15px 15px 15px;
  z-index: 4;
  
  background: linear-gradient(
    to top, 
    rgba(0, 0, 0, 0.85) 0%,
    rgba(0, 0, 0, 0.5) 60%,
    rgba(0, 0, 0, 0) 100% 
  );
  
  backdrop-filter: blur(2px); 
}

.project__meta h3 {
  margin: 0 0 5px 0;
  font-size: 1.1rem;
  text-shadow: 0 2px 4px rgba(0,0,0,0.5); /* Ombre portée sur le texte pour plus de punch */
}
.tag { font-size: 12px; color: #a8f6ff; }

/* Demo backgrounds (replace with your images) */
.project__media--1 { background-image: radial-gradient(circle at 30% 20%, #6b4df4, transparent 40%), radial-gradient(circle at 80% 10%, #ff7ad9, transparent 45%), radial-gradient(circle at 70% 80%, #00d2ff, transparent 45%), radial-gradient(circle at 10% 90%, #ffc36b, transparent 40%); }
.project__media--2 { background-image: radial-gradient(circle at 30% 30%, #00131e, transparent 55%), linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%); }
.project__media--3 { background-image: radial-gradient(circle at 60% 40%, #9be7ff 0%, #53c9ff 40%, transparent 60%), radial-gradient(circle at 20% 80%, #ffd1ff 0%, #ff97e6 40%, transparent 60%), linear-gradient(135deg, #3b2667, #bc78ec); }
.project__media--4 { background-image: linear-gradient(135deg, #ffecd2 0%, #fcb69f 100%); }
.project__media--5 { background-image: linear-gradient(135deg, #1e3c72 0%, #2a5298 100%); }
.project__media--6 { background-image: linear-gradient(135deg, #00c6ff 0%, #0072ff 100%); }
.project__media--7 { background-image: linear-gradient(135deg, #f857a6 0%, #ff5858 100%); }

/* CSS filtering: hide non-matching projects completely */
.tiles[data-filter="favorite"] .project:not([data-cat~="favorite"]),
.tiles[data-filter="contest"] .project:not([data-cat~="contest"]),
.tiles[data-filter="bot"] .project:not([data-cat~="bot"]),
.tiles[data-filter="collectibles"] .project:not([data-cat~="collectibles"]),
.tiles[data-filter="internship"] .project:not([data-cat~="internship"]),
.tiles[data-filter="ai"] .project:not([data-cat~="ai"]),
.tiles[data-filter="game"] .project:not([data-cat~="game"]),
.tiles[data-filter="rest"] .project:not([data-cat~="rest"]) {
  display: none;
}

:root { --tile: 320px; }
@media (max-width: 1400px) { .tiles { --tile: 300px; } }
@media (max-width: 1200px) { .tiles { --tile: 280px; } }
@media (max-width: 1000px) { .tiles { --tile: 260px; } }
@media (max-width: 900px)  { .tiles { --tile: 240px; } }
@media (max-width: 700px)  { .tiles { --tile: 220px; } }
/* Responsive fallbacks */
@media (max-width: 1100px) {
  .layout { grid-template-columns: 1.2fr 2.8fr; }
}
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: auto 1fr;
    grid-template-areas: "filters" "tiles"; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 580px) {
  .tiles { grid-template-columns: 1fr; }
  .filters__list { grid-template-columns: 1fr 1fr; }
}


/* make whole tile clickable */
.project { position: relative; }
.project__link { position: absolute; inset: 0; z-index: 3; }
.project__link:focus { outline: none; box-shadow: 0 0 0 3px #e85aff inset; border-radius: 18px; }

/* Integrated back button inside sidebar */
.back-wrapper {
  margin-bottom: 1.5rem;
}

.back-internal {
  display: inline-block;
  padding: 8px 14px;
  border-radius: 10px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  transition: background 0.2s ease, transform 0.15s ease;
}

.tag.date-tag {
  background: rgba(232, 90, 255, 0.15); /* Une légère teinte violette pour la distinguer */
  border-color: #e85aff;
  font-weight: 600;
}

.back-internal:hover {
  background: rgba(255,255,255,0.1);
  transform: translateX(-3px);
}

.tag.date-tag {
  padding: 2px 8px;
  border-radius: 6px;
  font-weight: 600;
  border: 1px solid;
}

/* --- PALETTE CHROMATIQUE PAR ANNÉE (2018 - 2027) --- */

.project[data-date^="2027"] .date-tag {
  background: rgba(255, 0, 127, 0.15);
  color: #ff007f;
  border-color: rgba(255, 0, 127, 0.4);
}
.project[data-date^="2026"] .date-tag {
  background: rgba(157, 0, 255, 0.15);
  color: #bc61ff;
  border-color: rgba(157, 0, 255, 0.4);
}
.project[data-date^="2025"] .date-tag {
  background: rgba(90, 94, 255, 0.15);
  color: #8c90ff;
  border-color: rgba(90, 94, 255, 0.4);
}
.project[data-date^="2024"] .date-tag {
  background: rgba(0, 212, 255, 0.15);
  color: #00d4ff;
  border-color: rgba(0, 212, 255, 0.4);
}
.project[data-date^="2023"] .date-tag {
  background: rgba(0, 255, 157, 0.12);
  color: #00ffa2;
  border-color: rgba(0, 255, 157, 0.3);
}
.project[data-date^="2022"] .date-tag {
  background: rgba(238, 255, 0, 0.1);
  color: #e6ff00;
  border-color: rgba(238, 255, 0, 0.3);
}
.project[data-date^="2021"] .date-tag {
  background: rgba(255, 132, 0, 0.12);
  color: #ff9100;
  border-color: rgba(255, 132, 0, 0.3);
}
.project[data-date^="2020"] .date-tag {
  background: rgba(255, 68, 68, 0.12);
  color: #ff5555;
  border-color: rgba(255, 68, 68, 0.3);
}
.project[data-date^="2019"] .date-tag {
  background: rgba(255, 157, 194, 0.1);
  color: #ff9dc2;
  border-color: rgba(255, 157, 194, 0.3);
}
.project[data-date^="2018"] .date-tag {
  background: rgba(255, 255, 255, 0.08);
  color: #d1d1d1;
  border-color: rgba(255, 255, 255, 0.2);
}
