/* ==========================================================================
   Renaud Rabusseau — Personal Website
   Custom CSS — Dark Theme
   No frameworks. Hand-crafted.
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS Custom Properties
   -------------------------------------------------------------------------- */
:root {
  /* Colors */
  --bg-primary: #1a1a2e;
  --bg-secondary: #16213e;
  --bg-card: #1f2940;
  --bg-code: #0f1523;

  --text-primary: #e0e0e0;
  --text-secondary: #a0a0b8;
  --text-muted: #6b6b80;

  --accent: #00d4ff;
  --accent-hover: #00a8cc;
  --accent-glow: rgba(0, 212, 255, 0.15);

  --border: #2a2a45;
  --border-light: #3a3a55;

  /* Typography */
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;

  /* Spacing */
  --content-width: 720px;
  --wide-width: 960px;
  --site-padding: 1.5rem;

  /* Transitions */
  --transition: 0.3s ease;
  --transition-fast: 0.15s ease;
}

/* --------------------------------------------------------------------------
   2. Reset & Base
   -------------------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  width: 100%;
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 2rem var(--site-padding);
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-hover);
}

::selection {
  background: var(--accent);
  color: var(--bg-primary);
}

/* --------------------------------------------------------------------------
   3. Typography
   -------------------------------------------------------------------------- */
h1, h2, h3, h4 {
  font-weight: 600;
  line-height: 1.3;
  color: #fff;
}

h1 { font-size: 2.25rem; margin-bottom: 1rem; }
h2 { font-size: 1.5rem; margin-bottom: 0.75rem; }
h3 { font-size: 1.25rem; margin-bottom: 0.5rem; }

/* Prose content */
.prose p {
  margin-bottom: 1.25rem;
  color: var(--text-primary);
}

.prose h2 {
  margin-top: 2.5rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.prose h3 {
  margin-top: 2rem;
}

.prose ul, .prose ol {
  margin-bottom: 1.25rem;
  padding-left: 1.5rem;
}

.prose li {
  margin-bottom: 0.5rem;
}

.prose blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
  margin: 1.5rem 0;
  color: var(--text-secondary);
  font-style: italic;
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--bg-code);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  color: var(--accent);
}

.prose pre {
  background: var(--bg-code);
  padding: 1.25rem;
  border-radius: 8px;
  overflow-x: auto;
  margin-bottom: 1.5rem;
  border: 1px solid var(--border);
}

.prose pre code {
  background: none;
  padding: 0;
  color: var(--text-primary);
}

.prose img {
  margin: 2rem auto;
  border-radius: 8px;
}

/* --------------------------------------------------------------------------
   4. Header & Navigation
   -------------------------------------------------------------------------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(26, 26, 46, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}

.nav-container {
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 0 var(--site-padding);
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.site-logo {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: 0.05em;
}

.site-logo:hover {
  color: var(--accent);
}

.nav-menu {
  display: flex;
  align-items: center;
  gap: 2rem;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 0.25rem;
}

.nav-links a {
  color: var(--text-secondary);
  font-size: 0.9rem;
  font-weight: 500;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  transition: all var(--transition-fast);
}

.nav-links a:hover,
.nav-links a.active {
  color: #fff;
  background: var(--accent-glow);
}

.lang-switcher {
  display: flex;
  gap: 0.25rem;
  padding-left: 1rem;
  border-left: 1px solid var(--border);
}

.lang-link {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  transition: all var(--transition-fast);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.lang-link:hover {
  color: var(--text-primary);
}

.lang-link.active {
  color: var(--accent);
  background: var(--accent-glow);
}

/* Hamburger menu button */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.5rem;
  z-index: 110;
}

.hamburger {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  position: relative;
  transition: background var(--transition-fast);
}

.hamburger::before,
.hamburger::after {
  content: '';
  position: absolute;
  left: 0;
  width: 24px;
  height: 2px;
  background: var(--text-primary);
  transition: transform var(--transition);
}

.hamburger::before { top: -7px; }
.hamburger::after { top: 7px; }

/* Hamburger active state */
.nav-toggle[aria-expanded="true"] .hamburger {
  background: transparent;
}

.nav-toggle[aria-expanded="true"] .hamburger::before {
  transform: rotate(45deg);
  top: 0;
}

.nav-toggle[aria-expanded="true"] .hamburger::after {
  transform: rotate(-45deg);
  top: 0;
}

/* --------------------------------------------------------------------------
   5. Hero Section (Home Page)
   -------------------------------------------------------------------------- */
.hero {
  text-align: center;
  padding: 8rem 0 5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: radial-gradient(ellipse at center, #212145 0%, var(--bg-primary) 70%);
}

.hero-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}

.hero-portrait {
  width: 280px;
  height: 280px;
  margin-bottom: 0.75rem;
  flex-shrink: 0;
}

.hero-portrait img {
  width: 280px;
  height: 280px;
  min-width: 280px;
  min-height: 280px;
  max-width: none;
  border-radius: 50%;
  object-fit: cover;
  object-position: center 15%;
  border: 2px solid var(--accent);
  box-shadow: 0 0 50px rgba(0, 212, 255, 0.12);
  transition: box-shadow var(--transition);
}

.hero-portrait img:hover {
  box-shadow: 0 0 70px rgba(0, 212, 255, 0.25);
}

.hero-name {
  font-size: 3.5rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.025em;
}

.hero-tagline {
  font-family: var(--font-mono);
  font-size: 1rem;
  color: var(--accent);
  letter-spacing: 0.08em;
}

.cursor {
  animation: blink 1s step-end infinite;
  color: var(--accent);
  margin-left: 2px;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0; }
}

.hero-intro {
  font-size: 1.1rem;
  color: var(--text-secondary);
  max-width: 560px;
  line-height: 1.8;
}

/* --------------------------------------------------------------------------
   6. Home Page Sections
   -------------------------------------------------------------------------- */
.home-section {
  margin-top: 5rem;
}

.section-title {
  font-size: 1.25rem;
  color: #fff;
  margin-bottom: 1.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

/* --------------------------------------------------------------------------
   7. Article Cards (Blog List)
   -------------------------------------------------------------------------- */
.articles-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.article-card {
  padding: 1.5rem;
  background: var(--bg-card);
  border-radius: 10px;
  border: 1px solid var(--border);
  transition: border-color var(--transition), transform var(--transition);
}

.article-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.article-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  font-family: var(--font-mono);
}

.article-title {
  margin-bottom: 0.5rem;
}

.article-title a {
  color: #fff;
  transition: color var(--transition-fast);
}

.article-title a:hover {
  color: var(--accent);
}

.article-excerpt {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
}

.article-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.tag {
  font-size: 0.75rem;
  font-family: var(--font-mono);
  color: var(--accent);
  background: var(--accent-glow);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  transition: background var(--transition-fast);
}

.tag:hover {
  background: rgba(0, 212, 255, 0.25);
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   8. Blog Post (Single)
   -------------------------------------------------------------------------- */
.blog-post {
  max-width: var(--content-width);
  margin: 0 auto;
}

.blog-post-header {
  margin-bottom: 2rem;
}

.blog-post-meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: 1rem;
}

.separator {
  color: var(--text-muted);
}

.blog-post-header h1 {
  font-size: 2.25rem;
  line-height: 1.25;
  margin-bottom: 1rem;
}

.blog-post-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.blog-post-lang-notice {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.25rem;
  margin-bottom: 2rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.blog-post-lang-notice p {
  margin: 0;
}

.blog-post-lang-notice a {
  margin-left: 0.5rem;
}

.blog-post-content {
  margin-bottom: 3rem;
}

.blog-post-footer {
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.back-link {
  font-size: 0.95rem;
  color: var(--text-secondary);
  transition: color var(--transition-fast);
}

.back-link:hover {
  color: var(--accent);
}

/* --------------------------------------------------------------------------
   9. Page Layouts (About, Generic)
   -------------------------------------------------------------------------- */
.page-single {
  max-width: var(--content-width);
  margin: 0 auto;
}

.page-header {
  margin-bottom: 2rem;
}

.page-header h1 {
  font-size: 2.25rem;
}

.page-list {
  max-width: var(--wide-width);
  margin: 0 auto;
}

/* About page facts sidebar */
.about-page {
  position: relative;
}

.about-facts {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.fact {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.fact-label {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.fact-value {
  font-size: 0.95rem;
  color: var(--text-primary);
}

/* --------------------------------------------------------------------------
   10. Projects Grid
   -------------------------------------------------------------------------- */
.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 1.5rem;
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.75rem;
  transition: border-color var(--transition), transform var(--transition);
  display: flex;
  flex-direction: column;
}

.project-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.project-title {
  color: #fff;
  margin-bottom: 0.75rem;
}

.project-description {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 1rem;
  flex: 1;
}

.project-tech {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.tech-tag {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  background: var(--bg-primary);
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.project-link {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--accent);
  transition: color var(--transition-fast);
}

.project-link:hover {
  color: var(--accent-hover);
}

/* --------------------------------------------------------------------------
   11. CV Section
   -------------------------------------------------------------------------- */
.cv-intro {
  color: var(--text-secondary);
  font-size: 1rem;
  margin-top: 0.5rem;
}

.cv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-top: 2rem;
}

.cv-lang-notice {
  margin-top: 1rem;
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-style: italic;
}

.cv-lang-notice p {
  margin: 0;
}

.cv-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.75rem;
  transition: border-color var(--transition), transform var(--transition);
  display: flex;
  flex-direction: column;
}

.cv-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.cv-title {
  color: #fff;
  margin-bottom: 0.75rem;
}

.cv-description {
  color: var(--text-secondary);
  font-size: 0.9rem;
  margin-bottom: 1.25rem;
  flex: 1;
}

.cv-download {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--accent);
  transition: color var(--transition-fast);
}

.cv-download:hover {
  color: var(--accent-hover);
}

/* --------------------------------------------------------------------------
   12. Footer
   -------------------------------------------------------------------------- */
.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 4rem;
}

.footer-container {
  max-width: var(--wide-width);
  margin: 0 auto;
  padding: 2rem var(--site-padding);
  text-align: center;
}

.footer-text {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* --------------------------------------------------------------------------
   13. Animations
   -------------------------------------------------------------------------- */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* --------------------------------------------------------------------------
   14. Responsive — Tablet (768px)
   -------------------------------------------------------------------------- */
@media (max-width: 768px) {
  .nav-toggle {
    display: block;
  }

  .nav-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 280px;
    height: 100vh;
    background: var(--bg-secondary);
    flex-direction: column;
    align-items: flex-start;
    padding: 5rem 2rem 2rem;
    gap: 1.5rem;
    transition: right var(--transition);
    border-left: 1px solid var(--border);
  }

  .nav-menu.open {
    right: 0;
  }

  .nav-links {
    flex-direction: column;
    gap: 0.25rem;
    width: 100%;
  }

  .nav-links a {
    display: block;
    padding: 0.75rem;
    font-size: 1rem;
  }

  .lang-switcher {
    border-left: none;
    border-top: 1px solid var(--border);
    padding-left: 0;
    padding-top: 1rem;
  }

  .hero {
    padding: 5rem 0 3rem;
  }

  .hero-portrait img {
    width: 210px;
    height: 210px;
  }

  .hero-name {
    font-size: 2.5rem;
  }

  .hero-tagline {
    font-size: 0.85rem;
  }

  h1 {
    font-size: 1.75rem;
  }

  .blog-post-header h1 {
    font-size: 1.75rem;
  }

  .projects-grid {
    grid-template-columns: 1fr;
  }

  .cv-grid {
    grid-template-columns: 1fr;
  }

  .about-facts {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* --------------------------------------------------------------------------
   15. Responsive — Mobile (480px)
   -------------------------------------------------------------------------- */
@media (max-width: 480px) {
  :root {
    --site-padding: 1rem;
  }

  .hero {
    padding: 4rem 0 2.5rem;
  }

  .hero-portrait img {
    width: 180px;
    height: 180px;
  }

  .hero-name {
    font-size: 2rem;
  }

  .hero-intro {
    font-size: 1rem;
  }

  .article-card {
    padding: 1.25rem;
  }

  .blog-post-meta {
    flex-wrap: wrap;
  }

  .about-facts {
    grid-template-columns: 1fr;
  }
}

/* --------------------------------------------------------------------------
   16. Syntax Highlighting (Chroma — Dracula-inspired)
   -------------------------------------------------------------------------- */
.highlight pre {
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.25rem;
  overflow-x: auto;
}

/* Mobile nav overlay */
.nav-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 90;
}

.nav-overlay.active {
  display: block;
}
