/* ============================================================
   Alexis Petit — Portfolio
   Style: dark/light tech, refined, terminal-inspired
   ============================================================ */

/* === THÈME SOMBRE (par défaut) === */
:root,
[data-theme="dark"] {
  --bg: #0b0e13;
  --bg-elevated: #11151c;
  --bg-card: #141923;
  --bg-card-hover: #1a2030;
  --border: #1f2733;
  --border-soft: #232c3a;

  --text: #e6edf3;
  --text-soft: #9aa6b8;
  --text-dim: #6a7689;
  --text-faint: #4a5468;

  --accent: #00d3a7;
  --accent-soft: #00d3a722;
  --accent-glow: #00d3a755;
  --accent-warm: #ffb547;
  --accent-cool: #6cc4ff;

  --grid-color: rgba(255, 255, 255, 0.025);

  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.4);
}

/* === THÈME CLAIR === */
[data-theme="light"] {
  --bg: #fafafa;
  --bg-elevated: #ffffff;
  --bg-card: #ffffff;
  --bg-card-hover: #f5f5f5;
  --border: #e4e7ec;
  --border-soft: #d1d5dc;

  --text: #1a1f29;
  --text-soft: #4a5468;
  --text-dim: #6a7689;
  --text-faint: #9aa6b8;

  --accent: #00a380;
  --accent-soft: #00a38018;
  --accent-glow: #00a38040;

  --grid-color: rgba(0, 0, 0, 0.035);

  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.08);
}

/* === TYPO COMMUNE === */
:root {
  --font-display: 'Fraunces', serif;
  --font-body: 'Manrope', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, monospace;

  --container: 1100px;
  --gutter: clamp(1.25rem, 4vw, 2.5rem);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
}

body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  position: relative;
  transition: background-color 0.3s ease, color 0.3s ease;
}

/* === BACKGROUND DECOR === */

.bg-grid {
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(to right, var(--grid-color) 1px, transparent 1px),
    linear-gradient(to bottom, var(--grid-color) 1px, transparent 1px);
  background-size: 60px 60px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 30%, transparent 80%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black 30%, transparent 80%);
  pointer-events: none;
  z-index: 0;
}

.bg-glow {
  position: fixed;
  top: -200px;
  left: 50%;
  transform: translateX(-50%);
  width: 700px;
  height: 700px;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 60%);
  filter: blur(80px);
  opacity: 0.5;
  pointer-events: none;
  z-index: 0;
}

[data-theme="light"] .bg-glow {
  opacity: 0.3;
}

main, .site-header, .site-footer {
  position: relative;
  z-index: 1;
}

/* === HEADER === */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem var(--gutter);
  max-width: var(--container);
  margin: 0 auto;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.3s ease, background-color 0.3s ease;
}

.site-header.scrolled {
  border-bottom-color: var(--border);
}

.logo {
  font-family: var(--font-mono);
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 0.15rem;
  letter-spacing: -0.01em;
}

.logo-bracket { color: var(--accent); }
.logo-name { color: var(--text); }
.logo-cursor {
  color: var(--accent);
  animation: blink 1.2s infinite step-end;
  margin-left: 0.15rem;
}

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

.site-nav {
  display: flex;
  gap: 1.75rem;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  flex: 1;
  justify-content: center;
}

.site-nav a {
  color: var(--text-soft);
  text-decoration: none;
  transition: color 0.2s ease;
  position: relative;
}

.site-nav a::before {
  content: '·';
  color: var(--accent);
  margin-right: 0.4rem;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.site-nav a:hover { color: var(--text); }
.site-nav a:hover::before { opacity: 1; }

/* Header tools (lang + theme) */
.header-tools {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.theme-toggle,
.lang-toggle {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-soft);
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0;
}

.theme-toggle:hover,
.lang-toggle:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.theme-icon {
  width: 18px;
  height: 18px;
  transition: opacity 0.25s ease, transform 0.4s ease;
}

[data-theme="dark"] .theme-icon-sun { opacity: 1; transform: rotate(0deg); }
[data-theme="dark"] .theme-icon-moon { opacity: 0; transform: rotate(-90deg); position: absolute; }
[data-theme="light"] .theme-icon-sun { opacity: 0; transform: rotate(90deg); position: absolute; }
[data-theme="light"] .theme-icon-moon { opacity: 1; transform: rotate(0deg); }

@media (max-width: 720px) {
  .site-header { padding: 1rem var(--gutter); gap: 0.6rem; }
  .logo { font-size: 0.85rem; }
  .site-nav { gap: 0.9rem; font-size: 0.72rem; }
  .site-nav a::before { display: none; }
  .header-tools { gap: 0.3rem; }
  .theme-toggle, .lang-toggle { width: 32px; height: 32px; }
}

@media (max-width: 520px) {
  .site-nav a[href="#contact"] { display: none; }
}

@media (max-width: 440px) {
  .site-nav a[href="#projets"] { display: none; }
}

/* === HERO === */

.hero {
  max-width: var(--container);
  margin: 0 auto;
  padding: clamp(3rem, 8vw, 6rem) var(--gutter) clamp(4rem, 10vw, 7rem);
}

.hero-status {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.4rem 0.9rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 100px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-soft);
  margin-bottom: 2rem;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 4px var(--accent-soft), 0 0 12px var(--accent-glow);
  animation: pulse 2s ease-in-out infinite;
}

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

.hero-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: clamp(2.5rem, 7vw, 5rem);
  line-height: 1.05;
  letter-spacing: -0.03em;
  margin-bottom: 2rem;
}

.hero-line-1 {
  display: block;
  color: var(--text);
  font-style: italic;
  font-weight: 500;
}

.hero-line-2 {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.45em;
  font-weight: 500;
  color: var(--text-soft);
  letter-spacing: 0;
  margin-top: 0.6rem;
  font-style: normal;
  min-height: 1.5em; /* Évite que le layout saute pendant le typing */
}

.hero-prompt {
  color: var(--accent);
  margin-right: 0.3rem;
}

.hero-role {
  color: var(--text);
}

.hero-cursor {
  display: inline-block;
  width: 0.45em;
  height: 1em;
  background: var(--accent);
  vertical-align: middle;
  margin-left: 0.3em;
  animation: blink 1.2s infinite step-end;
}

.hero-tagline {
  font-size: clamp(1rem, 1.6vw, 1.2rem);
  line-height: 1.65;
  color: var(--text-soft);
  max-width: 60ch;
  margin-bottom: 2.5rem;
}

.hero-tagline em {
  color: var(--text);
  font-style: italic;
  font-family: var(--font-display);
  font-weight: 500;
}

.inline-link {
  color: var(--text);
  text-decoration: none;
  border-bottom: 1px dashed var(--accent);
  padding-bottom: 1px;
  transition: color 0.2s ease;
}

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

.accent {
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 0.92em;
  font-weight: 500;
}

/* Buttons */
.hero-actions {
  display: flex;
  gap: 0.9rem;
  flex-wrap: wrap;
  margin-bottom: 3.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.85rem 1.4rem;
  font-family: var(--font-mono);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  border-radius: 8px;
  transition: all 0.2s ease;
  cursor: pointer;
  border: 1px solid transparent;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #0b0e13;
}

.btn-primary:hover {
  box-shadow: 0 0 24px var(--accent-glow);
  transform: translateY(-1px);
}

.btn-ghost {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.btn-ghost:hover {
  background: var(--bg-card);
  border-color: var(--text-dim);
}

.btn-arrow, .btn-icon { transition: transform 0.2s ease; }
.btn-primary:hover .btn-arrow { transform: translateX(3px); }
.btn-ghost:hover .btn-icon { transform: translateY(2px); }

/* Hero meta */
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 1.4rem 2.5rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
  font-family: var(--font-mono);
  font-size: 0.85rem;
}

.meta-item { display: flex; align-items: center; gap: 0.6rem; }
.meta-key { color: var(--text-faint); }
.meta-sep { color: var(--accent); }
.meta-val { color: var(--text); }

/* === SECTIONS === */

.section {
  max-width: var(--container);
  margin: 0 auto;
  padding: clamp(3rem, 7vw, 5.5rem) var(--gutter);
}

.section-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2.5rem;
}

.section-num {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--accent);
  letter-spacing: 0.05em;
}

.section-title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.7rem, 3vw, 2.4rem);
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text);
}

.section-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, var(--border) 0%, transparent 100%);
}

/* === TIMELINE === */

.timeline {
  list-style: none;
  position: relative;
  padding-left: 1.75rem;
  border-left: 1px solid var(--border);
}

.timeline-item {
  position: relative;
  padding: 0 0 2.5rem 1.5rem;
}

.timeline-item:last-child { padding-bottom: 0; }

.timeline-marker {
  position: absolute;
  left: -1.75rem;
  top: 0.5rem;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--bg);
  border: 2px solid var(--border);
  transform: translateX(-50%);
  transition: all 0.2s ease;
}

.timeline-item.current .timeline-marker {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
  animation: pulse 2.2s ease-in-out infinite;
}

.timeline-meta {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}

.timeline-date {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
}

.timeline-badge,
.timeline-duration {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  padding: 0.15rem 0.55rem;
  border-radius: 4px;
  letter-spacing: 0.03em;
}

.timeline-badge {
  background: var(--accent-soft);
  color: var(--accent);
  border: 1px solid var(--accent-glow);
}

.timeline-duration {
  background: var(--bg-card);
  color: var(--text-dim);
  border: 1px solid var(--border);
}

.timeline-role {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.35rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 0.2rem;
  letter-spacing: -0.01em;
}

.timeline-company {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-soft);
  margin-bottom: 0.85rem;
}

.timeline-desc {
  font-size: 0.95rem;
  line-height: 1.65;
  color: var(--text-soft);
  max-width: 65ch;
}

/* Education */

.education {
  margin-top: 3rem;
  padding: 1.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.education-title {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-soft);
  margin-bottom: 1.1rem;
  letter-spacing: 0.02em;
}

.education-prompt { color: var(--accent); margin-right: 0.3rem; }

.education-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.education-list li {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 1.2rem;
  font-size: 0.9rem;
  line-height: 1.5;
}

.edu-year {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--text-dim);
  padding-top: 2px;
}

.edu-degree { color: var(--text); font-weight: 500; grid-column: 2; }
.edu-detail { color: var(--text-soft); font-size: 0.85rem; grid-column: 2; }

@media (max-width: 540px) {
  .education-list li {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }
  .edu-degree, .edu-detail { grid-column: 1; }
}

/* === STACK === */

.stack-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.stack-card {
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: all 0.3s ease;
}

.stack-card:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-soft);
  transform: translateY(-2px);
}

.stack-card-header {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-bottom: 1.1rem;
  padding-bottom: 1rem;
  border-bottom: 1px dashed var(--border);
}

.stack-icon { font-size: 1.15rem; color: var(--accent); }

.stack-card-header h3 {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.15rem;
  font-weight: 500;
  color: var(--text);
}

.stack-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.stack-list li {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-soft);
  padding-left: 1rem;
  position: relative;
  transition: color 0.2s ease;
}

.stack-list li::before {
  content: '◆';
  color: var(--accent);
  position: absolute;
  left: 0;
  font-size: 0.5rem;
  top: 0.55rem;
  opacity: 0.7;
}

.stack-card:hover .stack-list li { color: var(--text); }

/* === PROJECTS === */

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.project-card {
  padding: 1.75rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
}

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

.project-card-feat {
  border-color: var(--border-soft);
  position: relative;
  overflow: hidden;
}

.project-card-feat::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(to right, transparent, var(--accent), transparent);
  opacity: 0.4;
}

.project-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 0.35rem;
  flex-wrap: wrap;
}

.project-title {
  font-family: var(--font-display);
  font-style: italic;
  font-size: 1.5rem;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.01em;
}

.project-status {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--text-dim);
  padding: 0.2rem 0.55rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  letter-spacing: 0.03em;
}

.project-subtitle {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  color: var(--accent);
  margin-bottom: 1rem;
}

.project-desc {
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--text-soft);
  margin-bottom: 1.25rem;
  flex: 1;
}

.project-tech {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.project-tech li {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-soft);
  padding: 0.25rem 0.6rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  transition: all 0.2s ease;
}

.project-card:hover .project-tech li {
  color: var(--text);
  border-color: var(--border-soft);
}

/* === CONTACT === */

.section-contact { padding-bottom: clamp(4rem, 8vw, 6rem); }

.contact-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: clamp(1.75rem, 4vw, 2.75rem);
  position: relative;
  overflow: hidden;
}

.contact-block::before {
  content: '';
  position: absolute;
  top: -50%;
  right: -20%;
  width: 60%;
  height: 200%;
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 60%);
  filter: blur(80px);
  opacity: 0.15;
  pointer-events: none;
}

.contact-intro {
  font-family: var(--font-display);
  font-style: italic;
  font-size: clamp(1.15rem, 2vw, 1.4rem);
  line-height: 1.55;
  color: var(--text);
  margin-bottom: 2rem;
  max-width: 50ch;
  font-weight: 400;
  position: relative;
}

.contact-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.85rem;
  position: relative;
}

.contact-card {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  padding: 1.1rem 1.25rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-decoration: none;
  transition: all 0.25s ease;
  position: relative;
}

.contact-card:hover {
  border-color: var(--accent);
  background: var(--bg-elevated);
  transform: translateY(-2px);
}

.contact-card-label {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.contact-card-value {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text);
  font-weight: 500;
}

.contact-card-arrow {
  position: absolute;
  top: 1.1rem;
  right: 1.25rem;
  color: var(--text-dim);
  font-family: var(--font-mono);
  transition: all 0.2s ease;
}

.contact-card:hover .contact-card-arrow {
  color: var(--accent);
  transform: translate(2px, -2px);
}

/* Bouton "copier email" */
.contact-card-copy {
  font: inherit;
  cursor: pointer;
  text-align: left;
  width: 100%;
  color: inherit;
  outline: none;
}

.contact-card-copy:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.contact-card-arrow-default,
.contact-card-arrow-success {
  position: absolute;
  top: 1.1rem;
  right: 1.25rem;
  font-family: var(--font-mono);
  transition: opacity 0.2s ease, transform 0.2s ease, color 0.2s ease;
}

.contact-card-arrow-default { color: var(--text-dim); opacity: 1; }
.contact-card-arrow-success { color: var(--accent); opacity: 0; font-weight: 700; }

.contact-card-feedback {
  position: absolute;
  bottom: 0.85rem;
  right: 1.25rem;
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--accent);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 0.2s ease;
  pointer-events: none;
}

.contact-card-copy:hover .contact-card-arrow-default {
  color: var(--accent);
  transform: translate(2px, -2px);
}

.contact-card-copy.is-copied { border-color: var(--accent); }
.contact-card-copy.is-copied .contact-card-arrow-default { opacity: 0; transform: scale(0.5); }
.contact-card-copy.is-copied .contact-card-arrow-success { opacity: 1; }
.contact-card-copy.is-copied .contact-card-feedback { opacity: 1; }

/* === FOOTER === */

.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

.footer-content {
  max-width: var(--container);
  margin: 0 auto;
  padding: 1.5rem var(--gutter);
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.8rem;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-faint);
}

.footer-prompt { color: var(--accent); margin-right: 0.3rem; }

/* === SCROLL REVEAL === */

.reveal {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* Hero : animations directes au load, pas via IntersectionObserver */
.hero .reveal { animation: fadeUp 0.7s ease forwards; }
.hero .reveal[data-reveal-delay="0"]    { animation-delay: 0s; }
.hero .reveal[data-reveal-delay="100"]  { animation-delay: 0.1s; }
.hero .reveal[data-reveal-delay="250"]  { animation-delay: 0.25s; }
.hero .reveal[data-reveal-delay="400"]  { animation-delay: 0.4s; }
.hero .reveal[data-reveal-delay="550"]  { animation-delay: 0.55s; }
.hero .reveal[data-reveal-delay="700"]  { animation-delay: 0.7s; }

@keyframes fadeUp {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Sélection */
::selection {
  background: var(--accent);
  color: var(--bg);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}
