:root {
  --theme: 0;
  --theme-color: hsl(190, 45%, calc(70% * (1 - var(--theme)) + 35% * var(--theme)));
  --theme-color-contrast: hsl(from var(--theme-color) h s calc(100 - l));
  --theme-text-color: hsl(from var(--theme-color) h 0% calc(l * (1 - var(--theme)) + (100 - l) * var(--theme)));
  --theme-background: hsl(from var(--theme-color) h s calc(3 * (1 - var(--theme)) + 96 * var(--theme)));
  --theme-surface: hsl(from var(--theme-color) h s l / 0.1);
  --muted: hsl(from var(--theme-color) h 10% calc(50% * (1 - var(--theme)) + 60% * var(--theme)));
}

@font-face {     
  font-family: "MaPolice";     
  src: url("fonts/Kozifa.ttf") format("truetype"); 
} 

* { 
  box-sizing: border-box; 
  margin: 0; 
  padding: 0; 
}

html { 
  scroll-behavior: smooth; 
}

body {
  font: 16px 'Space Mono', monospace;
  background: var(--theme-background);
  color: var(--theme-text-color);
  line-height: 1.6;
  min-height: 100vh;
}

/* Header with logo and nav */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1000;
  background: var(--theme-background);
  border-bottom: 1px solid var(--theme-surface);
}

.site-logo {
  width: 45px;
  height: 45px;
  transition: transform 0.3s;
  flex-shrink: 0;
}

.site-logo:hover {
  transform: scale(1.1);
}

/* Navigation */
nav {
  display: flex;
  align-items: center;
}

nav ul {
  list-style: none;
  display: flex;
  gap: 25px;
  padding: 0;
  margin: 0;
  align-items: center;
}

nav a {
  color: var(--muted);
  text-decoration: none;
  transition: color 0.3s;
  font-size: 0.95rem;
  white-space: nowrap;
}

nav a:hover {
  color: var(--theme-color);
}

/* Hamburger menu (hidden on desktop) */
.menu-toggle {
  display: none;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 5px;
  z-index: 1001;
}

.menu-toggle span {
  width: 25px;
  height: 2px;
  background: var(--theme-text-color);
  transition: all 0.3s;
}

.menu-toggle.active span:nth-child(1) {
  transform: rotate(45deg) translate(7px, 7px);
}

.menu-toggle.active span:nth-child(2) {
  opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -7px);
}

/* Main content - PAGE ACCUEIL */
main {
  width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 80px 20px 60px;
}

/* Main title with glitch effect */
.main-title {
  font-size: clamp(3rem, 10vw, 10rem);
  font-weight: bold;
  text-align: center;
  margin-bottom: 40px;
  letter-spacing: 0.05em;
  position: relative;
  font-family: 'MaPolice', monospace;
  margin-top: -50px;
  line-height: 1.1;
}

.main-title::before,
.main-title::after {
  content: attr(data-text);
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 0;
  width: 100%;
  opacity: 0.8;
  text-align: center;
}

.main-title::before {
  color: var(--theme-color);
  animation: glitch1 2.5s infinite;
}

.main-title::after {
  color: var(--theme-color);
  animation: glitch2 3s infinite;
}

@keyframes glitch1 {
  0%, 100% { 
    clip-path: inset(0 0 0 0); 
    transform: translateX(-50%) translateY(0); 
  }
  10% { 
    clip-path: inset(10% 0 60% 0); 
    transform: translateX(calc(-50% - 2px)) translateY(0); 
  }
  20% { 
    clip-path: inset(80% 0 0 0); 
    transform: translateX(calc(-50% + 2px)) translateY(0); 
  }
  30% { 
    clip-path: inset(40% 0 40% 0); 
    transform: translateX(calc(-50% - 2px)) translateY(0); 
  }
  40% { 
    clip-path: inset(0 0 0 0); 
    transform: translateX(-50%) translateY(0); 
  }
}

@keyframes glitch2 {
  0%, 100% { 
    clip-path: inset(0 0 0 0); 
    transform: translateX(-50%) translateY(0); 
  }
  15% { 
    clip-path: inset(50% 0 30% 0); 
    transform: translateX(calc(-50% + 2px)) translateY(0); 
  }
  25% { 
    clip-path: inset(20% 0 70% 0); 
    transform: translateX(calc(-50% - 2px)) translateY(0); 
  }
  35% { 
    clip-path: inset(70% 0 10% 0); 
    transform: translateX(calc(-50% + 2px)) translateY(0); 
  }
  45% { 
    clip-path: inset(0 0 0 0); 
    transform: translateX(-50%) translateY(0); 
  }
}

/* Home page layout */
.home-layout {
  display: flex;
  gap: 60px;
  align-items: center;
  justify-content: center;
  max-width: 1600px;
  width: 100%;
  padding: 0 20px;
}

/* Hero section */
.hero {
  max-width: 600px;
  flex: 1 1 auto;
  min-width: 0;
}

h2 {
  font-size: 1.8rem;
  margin-bottom: 8px;
  font-weight: normal;
}

h3 {
  font-size: 1.3rem;
  color: var(--muted);
  margin-bottom: 25px;
  font-weight: normal;
}

.intro {
  font-size: 1rem;
  margin-bottom: 15px;
  line-height: 1.8;
}

.intro a {
  color: var(--theme-color);
  text-decoration: none;
  border-bottom: 1px dashed var(--theme-color);
  transition: all 0.3s;
}

.intro a:hover {
  background: var(--theme-color);
  color: var(--theme-background);
  padding: 0 3px;
}

/* Social links */
.social-links {
  display: flex;
  gap: 15px;
  flex-wrap: wrap;
  margin-top: 25px;
}

.social-links a {
  color: var(--theme-text-color);
  text-decoration: none;
  padding: 8px 16px;
  border: 1px solid var(--theme-color);
  border-radius: 6px;
  transition: all 0.3s;
  display: inline-block;
}

.social-links a:hover {
  background: var(--theme-color);
  color: var(--theme-background);
}

/* ASCII art - Responsive dynamique */
.ascii-sidebar {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 600px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ascii-art {
  font-size: clamp(5px, 0.6vw, 11px);
  line-height: 1;
  white-space: pre;
  color: var(--muted);
  font-family: monospace;
  overflow: visible;
  display: block;
}

/* Content pages (projets, contact, veille) */
main.content-page {
  padding: 100px 40px 80px;
  min-height: 100vh;
  display: block;
  justify-content: flex-start;
}

.page-container {
  max-width: 1200px;
  margin: 0 auto;
}

.page-header {
  margin-bottom: 60px;
}

.page-header h1 {
  font-size: 3.5rem;
  margin-bottom: 20px;
  font-weight: normal;
}

.page-header p {
  font-size: 1.1rem;
  color: var(--muted);
  max-width: 800px;
}

/* Filter section */
.filter-section {
  margin-bottom: 50px;
  padding-bottom: 40px;
  border-bottom: 2px solid var(--theme-surface);
}

.filter-section h3 {
  font-size: 1.3rem;
  margin-bottom: 20px;
  color: var(--theme-text-color);
}

.tags-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.filter-tag-btn {
  background: transparent;
  border: 1px solid var(--theme-color);
  border-radius: 6px;
  padding: 8px 16px;
  font-family: 'Space Mono', monospace;
  font-size: 0.95rem;
  color: var(--theme-color);
  cursor: pointer;
  transition: all 0.3s;
  white-space: nowrap;
}

.filter-tag-btn:hover {
  background: var(--theme-surface);
  transform: translateY(-2px);
}

.filter-tag-btn.active {
  background: var(--theme-color);
  color: var(--theme-background);
  font-weight: bold;
}

.reset-btn {
  background: transparent;
  border: 1px dashed var(--muted);
  border-radius: 6px;
  padding: 8px 16px;
  font-family: 'Space Mono', monospace;
  font-size: 0.95rem;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.3s;
}

.reset-btn:hover {
  color: var(--theme-color);
  border-color: var(--theme-color);
}

/* Projects list */
.projects-list {
  display: flex;
  flex-direction: column;
  gap: 50px;
}

.project-item {
  border-left: 3px solid var(--theme-color);
  padding-left: 30px;
}

.project-item h3 {
  font-size: 1.5rem;
  margin-bottom: 15px;
  color: var(--theme-text-color);
}

.project-item h3 a {
  color: var(--theme-text-color);
  text-decoration: none;
  transition: color 0.3s;
}

.project-item h3 a:hover {
  color: var(--theme-color);
}

.project-item p {
  margin-bottom: 20px;
  line-height: 1.8;
  font-size: 1.05rem;
}

.tags {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.tag {
  display: inline-block;
  border: 1px dashed var(--theme-color);
  border-radius: 4px;
  padding: 6px 14px;
  font-size: 0.9rem;
  color: var(--theme-color);
}

.project-link a {
  color: var(--theme-color);
  text-decoration: none;
  font-weight: bold;
  font-size: 1.05rem;
}

.project-link a:hover {
  text-decoration: underline;
}

.no-projects-msg {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  font-style: italic;
  font-size: 1.1rem;
  grid-column: 1 / -1;
}

/* Contact page */
.contact-info {
  display: flex;
  flex-direction: column;
  gap: 50px;
}

.contact-section {
  border-left: 3px solid var(--theme-color);
  padding-left: 30px;
}

.contact-section h3 {
  font-size: 1.5rem;
  margin-bottom: 20px;
  color: var(--theme-text-color);
}

.contact-section p {
  margin-bottom: 15px;
  line-height: 1.8;
  font-size: 1.05rem;
}

.contact-section a {
  color: var(--theme-color);
  text-decoration: none;
  border-bottom: 1px dashed var(--theme-color);
  transition: all 0.3s;
}

.contact-section a:hover {
  background: var(--theme-color);
  color: var(--theme-background);
  padding: 0 3px;
}

.social-links-vertical {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-start;
}

.social-links-vertical a {
  color: var(--theme-text-color);
  text-decoration: none;
  padding: 10px 20px;
  border: 1px solid var(--theme-color);
  border-radius: 6px;
  transition: all 0.3s;
  display: inline-block;
  font-size: 1.05rem;
}

.social-links-vertical a:hover {
  background: var(--theme-color);
  color: var(--theme-background);
}

.muted-text {
  color: var(--muted);
  font-size: 1rem;
  font-style: italic;
  margin-bottom: 15px;
}

.fingerprint code {
  background: var(--theme-surface);
  padding: 10px 15px;
  border-radius: 6px;
  display: inline-block;
  font-size: 0.95rem;
  border: 1px dashed var(--theme-color);
  word-break: break-all;
}

.pgp-details {
  margin-top: 20px;
  background: var(--theme-surface);
  border-radius: 8px;
  padding: 20px;
  border: 1px dashed var(--theme-color);
}

.pgp-details summary {
  cursor: pointer;
  color: var(--theme-color);
  user-select: none;
  font-size: 1.05rem;
}

.pgp-details summary:hover {
  text-decoration: underline;
}

.pgp-key {
  background: rgba(0, 0, 0, 0.25);
  padding: 20px;
  border-radius: 8px;
  overflow: auto;
  margin-top: 15px;
  font-size: 0.9rem;
  line-height: 1.4;
}

/* Theme toggle button */
#theme-toggle {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border: 1px solid var(--theme-color);
  border-radius: 50%;
  background: var(--theme-background);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  z-index: 100;
}

#theme-toggle:hover {
  background: var(--theme-color);
  transform: rotate(180deg);
}

#theme-toggle::before {
  content: '◐';
  font-size: 20px;
}

/* Blob follower */
#blob {
  --blob-size: 100px;
  background: var(--theme-surface);
  width: var(--blob-size);
  height: var(--blob-size);
  border-radius: 50%;
  position: fixed;
  top: 0;
  left: 0;
  z-index: -1;
  filter: blur(50px);
  transform: translate(-50%, -50%);
  transition: transform 0.5s cubic-bezier(.33, 1, .68, 1);
  pointer-events: none;
}

/* Footer */
footer {
  text-align: center;
  padding: 30px 20px;
  color: var(--muted);
  font-size: 14px;
}

/* Veille informatique */
.rss-controls {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 40px;
}

.refresh-btn {
  background: transparent;
  color: var(--theme-text-color);
  border: 1px solid var(--theme-color);
  padding: 10px 20px;
  border-radius: 6px;
  font-family: 'Space Mono', monospace;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s;
}

.refresh-btn:hover {
  background: var(--theme-color);
  color: var(--theme-background);
}

.loading {
  color: var(--muted);
  font-style: italic;
}

.veille-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 30px;
}

.veille-item {
  border: 1px solid var(--theme-color);
  border-radius: 8px;
  padding: 25px;
  transition: all 0.3s;
}

.veille-item:hover {
  background: var(--theme-surface);
  transform: translateY(-5px);
}

.veille-item h3 {
  font-size: 1.3rem;
  margin-bottom: 15px;
  color: var(--theme-text-color);
}

.veille-item .date {
  color: var(--theme-color);
  font-size: 0.9rem;
  margin-bottom: 15px;
}

.veille-item p {
  line-height: 1.8;
  margin-bottom: 15px;
}

.veille-item a {
  color: var(--theme-color);
  text-decoration: none;
  font-weight: bold;
}

.veille-item a:hover {
  text-decoration: underline;
}

/* Responsive pour écrans moyens/larges */
@media (max-width: 1400px) {
  .home-layout {
    gap: 40px;
    max-width: 1200px;
  }
  
  .ascii-art {
    font-size: clamp(5px, 0.7vw, 10px);
  }
  
  .ascii-sidebar {
    max-width: 500px;
  }
}

@media (max-width: 1200px) {
  .home-layout {
    gap: 30px;
    max-width: 1000px;
  }
  
  .hero {
    max-width: 500px;
  }
  
  .ascii-art {
    font-size: clamp(5px, 0.8vw, 9px);
  }
  
  .ascii-sidebar {
    max-width: 450px;
  }
}

@media (max-width: 1024px) {
  .home-layout {
    flex-direction: column;
    gap: 40px;
  }
  
  .hero {
    max-width: 600px;
  }
  
  .ascii-sidebar {
    max-width: 100%;
  }
  
  .ascii-art {
    font-size: 8px;
  }
}

/* Responsive Mobile */
@media (max-width: 768px) {
  /* Menu hamburger pour mobile */
  .menu-toggle {
    display: flex;
  }
  
  nav {
    position: fixed;
    top: 0;
    right: -100%;
    width: 70%;
    max-width: 300px;
    height: 100vh;
    background: var(--theme-background);
    border-left: 1px solid var(--theme-color);
    transition: right 0.3s ease;
    padding-top: 80px;
    overflow-y: auto;
  }
  
  nav.active {
    right: 0;
  }
  
  nav ul {
    flex-direction: column;
    gap: 20px;
    padding: 30px 20px;
    align-items: flex-start;
  }
  
  nav a {
    font-size: 1.2rem;
    display: block;
    padding: 12px 0;
  }
  
  header {
    padding: 12px 15px;
  }
  
  .site-logo {
    width: 40px;
    height: 40px;
  }
  
  .main-title {
    font-size: clamp(2rem, 12vw, 4rem);
    margin-bottom: 30px;
    margin-top: 0;
    padding: 0 10px;
  }
  
  h2 { 
    font-size: 1.5rem; 
  }
  
  h3 { 
    font-size: 1.2rem; 
  }
  
  .intro { 
    font-size: 1rem; 
  }
  
  .home-layout {
    flex-direction: column;
    gap: 30px;
    padding: 0 10px;
  }
  
  .ascii-sidebar {
    display: none;
  }
  
  main {
    padding: 80px 20px 80px;
    min-height: auto;
  }
  
  .hero {
    max-width: 100%;
  }
  
  .social-links {
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  
  /* Pages de contenu sur mobile */
  main.content-page {
    padding: 80px 20px 80px;
    min-height: auto;
  }
  
  .page-container {
    max-width: 100%;
  }
  
  .page-header {
    margin-bottom: 40px;
  }
  
  .page-header h1 {
    font-size: 2.2rem;
    margin-bottom: 15px;
  }
  
  .page-header p {
    font-size: 1rem;
  }
  
  .projects-list {
    gap: 40px;
  }
  
  .project-item {
    padding-left: 20px;
  }
  
  .project-item h3 {
    font-size: 1.3rem;
  }
  
  .project-item p {
    font-size: 1rem;
  }
  
  .contact-info {
    gap: 40px;
  }
  
  .contact-section {
    padding-left: 20px;
  }
  
  .contact-section h3 {
    font-size: 1.3rem;
  }
  
  .contact-section p {
    font-size: 1rem;
  }
  
  .fingerprint code {
    font-size: 0.75rem;
    padding: 8px 10px;
  }
  
  .veille-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .veille-item {
    padding: 20px;
  }
  
  .veille-item h3 {
    font-size: 1.2rem;
  }
  
  .veille-item p {
    font-size: 1rem;
  }
  
  .rss-controls {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }
  
  .filter-section {
    margin-bottom: 40px;
    padding-bottom: 30px;
  }
  
  .filter-section h3 {
    font-size: 1.2rem;
    margin-bottom: 15px;
  }
  
  .tags-filter {
    gap: 10px;
    margin-bottom: 15px;
  }
  
  .filter-tag-btn,
  .reset-btn {
    padding: 7px 14px;
    font-size: 0.9rem;
  }
  
  #theme-toggle {
    bottom: 15px;
    right: 15px;
    width: 50px;
    height: 50px;
  }
  
  footer {
    padding: 30px 20px;
  }
}