*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { height: 100%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  height: 100%; overflow: hidden;
  background: var(--bg); color: var(--fg);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  cursor: crosshair;
}

:root {
  --bg: #0c0c0f;
  --fg: #e8e4de;
  --fg-mid: rgba(232,228,222,0.50);
  --fg-dim: rgba(232,228,222,0.22);
  --fg-ghost: rgba(232,228,222,0.10);
  --accent: #7ba4f7;
  --accent-glow: rgba(123,164,247,0.12);
  --gold: #c9a84c;
  --gold-glow: rgba(201,168,76,0.15);
  --green: #5fdd6e;
  --green-dim: rgba(95,221,110,0.15);
  --serif: 'Instrument Serif', Georgia, serif;
  --sans: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --radius: 14px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

::selection { background: rgba(123,164,247,0.3); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* ── Language switching ── */
html[lang="en"] .fr { display: none; }
html[lang="fr"] .en { display: none; }

/* Screen reader only - crawlable content */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ── Language toggle button ── */
.lang-toggle {
  position: fixed; top: 1.2rem; right: 1.5rem; z-index: 12;
  font-family: var(--mono); font-size: 0.7rem; font-weight: 400;
  letter-spacing: 0.08em;
  color: var(--fg-mid); background: rgba(232,228,222,0.04);
  border: 1px solid var(--fg-ghost); border-radius: 6px;
  padding: 0.35rem 0.6rem; cursor: pointer;
  transition: color 0.3s ease, background 0.3s ease, border-color 0.3s ease, transform 0.2s var(--ease);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  animation: hintIn 0.8s ease 1.5s forwards;
}
.lang-toggle:hover {
  color: var(--fg); background: rgba(232,228,222,0.1);
  border-color: var(--fg-dim);
}
.lang-toggle:active { transform: scale(0.94); }

/* ── ASCII Canvas ── */
#ascii { position: fixed; inset: 0; z-index: 0; overflow: hidden; }
#ascii canvas { display: block; width: 100%; height: 100%; }

/* ── Card mode ── */
.frame {
  position: relative; z-index: 2;
  height: 100%; width: 100%;
  display: flex; align-items: center; justify-content: center;
  padding: 2rem;
  padding-bottom: calc(2rem + var(--safe-bottom));
  pointer-events: none;
  transition: opacity 0.4s ease, transform 0.4s var(--ease);
}
.frame.hidden { opacity: 0; transform: scale(0.97); pointer-events: none; }

.card {
  text-align: center; max-width: 480px; width: 100%;
  pointer-events: auto;
}

/* ── Staggered entry ── */
.card > * {
  opacity: 0; transform: translateY(14px);
  animation: cardIn 0.9s var(--ease) forwards;
}
.card > :nth-child(1) { animation-delay: 0.3s; }
.card > :nth-child(2) { animation-delay: 0.5s; }
.card > :nth-child(3) { animation-delay: 0.7s; }
.card > :nth-child(4) { animation-delay: 0.9s; }
.card > :nth-child(5) { animation-delay: 1.1s; }
.card > :nth-child(6) { animation-delay: 1.3s; }

.name {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(2.2rem, 7vw, 3.2rem);
  line-height: 1.05; letter-spacing: -0.02em;
  margin-bottom: 1rem; color: var(--fg);
  text-shadow: 0 0 80px rgba(0,0,0,0.9), 0 2px 20px rgba(0,0,0,0.5);
}

.tagline {
  font-size: 0.92rem; font-weight: 300; line-height: 1.7;
  color: var(--fg-mid); margin-bottom: 1.2rem;
  text-shadow: 0 0 40px rgba(0,0,0,0.9);
}
.tagline strong { font-weight: 500; color: var(--fg); }
.tagline .dot { display: inline-block; margin: 0 0.35em; color: var(--fg-dim); }

/* ── Availability ── */
.availability {
  display: flex; align-items: center; justify-content: center;
  gap: 0.5rem; margin-bottom: 1.5rem;
  padding: 0.5rem 1rem; border-radius: 8px;
  background: rgba(95,221,110,0.04);
  border: 1px solid rgba(95,221,110,0.12);
}
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 8px rgba(95,221,110,0.4);
  animation: pulse 2s ease-in-out infinite;
}
.status-text {
  font-family: var(--mono); font-size: 0.72rem; font-weight: 300;
  color: var(--green); letter-spacing: 0.02em;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.projects { display: flex; flex-direction: column; gap: 2px; margin-bottom: 2rem; }
.projects-label {
  font-family: var(--mono); font-size: 0.65rem; font-weight: 300;
  letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--fg-dim); margin-bottom: 0.4rem;
}
.projects a {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.85rem 1.2rem; margin: 0 -1.2rem;
  border-radius: var(--radius);
  text-decoration: none; color: var(--fg);
  font-size: 0.9rem; font-weight: 400; position: relative;
  transition: background 0.35s ease, padding-left 0.45s var(--ease),
    transform 0.3s var(--ease), box-shadow 0.35s ease;
}
.projects a::before {
  content: ''; position: absolute; inset: 0;
  border-radius: var(--radius); border: 1px solid transparent;
  transition: border-color 0.35s ease; pointer-events: none;
}
.projects a:hover,
.projects a.tapped {
  background: rgba(12,12,15,0.85); padding-left: 1.6rem;
  box-shadow: 0 4px 24px rgba(0,0,0,0.3);
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.projects a:hover::before { border-color: var(--fg-ghost); }
.projects a:active { transform: scale(0.985); transition-duration: 0.1s; }
.project-name { display: flex; align-items: center; gap: 0.6rem; }
.projects a .url {
  font-family: var(--mono); font-size: 0.72rem; font-weight: 300;
  color: var(--fg-dim); transition: color 0.35s ease;
}
.projects a:hover .url { color: var(--accent); }

/* ── Project info panel ── */
.projects a {
  flex-wrap: wrap;
}
.project-info {
  width: 100%; order: 3;
  font-family: var(--mono); font-size: 0.68rem; font-weight: 300;
  line-height: 1.6; color: var(--fg-dim);
  text-align: left;
  max-height: 0; opacity: 0; overflow: hidden;
  padding-left: 0;
  transition: max-height 0.35s var(--ease), opacity 0.3s ease, margin 0.35s var(--ease);
  margin-top: 0;
}
.projects a:hover .project-info,
.projects a.tapped .project-info {
  max-height: 3rem; opacity: 1;
  margin-top: 0.3rem;
}

.ico { width: 22px; height: 22px; flex-shrink: 0; opacity: 0.4; transition: opacity 0.35s ease, filter 0.35s ease; }
.projects a:hover .ico { opacity: 0.85; }

.socials {
  display: flex; justify-content: center; gap: 0.5rem;
  padding-top: 1.5rem; border-top: 1px solid rgba(255,255,255,0.06);
}
.social-btn {
  display: inline-flex; align-items: center; gap: 0.5rem;
  font-size: 0.82rem; font-weight: 400; color: var(--fg);
  text-decoration: none; letter-spacing: 0.01em;
  padding: 0.6rem 1.3rem; border-radius: 10px;
  transition: background 0.35s ease, border-color 0.35s ease, transform 0.2s var(--ease), box-shadow 0.35s ease;
}
.social-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.social-btn:active { transform: scale(0.97); transition-duration: 0.08s; }
.linkedin-btn {
  background: rgba(10,102,194,0.12);
  border: 1px solid rgba(10,102,194,0.25);
}
.linkedin-btn:hover {
  background: rgba(10,102,194,0.22);
  border-color: rgba(10,102,194,0.45);
  box-shadow: 0 0 20px rgba(10,102,194,0.15);
}
.email-btn {
  background: rgba(232,228,222,0.06);
  border: 1px solid var(--fg-ghost);
}
.email-btn:hover {
  background: rgba(232,228,222,0.12);
  border-color: var(--fg-dim);
  box-shadow: 0 0 20px rgba(232,228,222,0.08);
}

/* ── Toggle button ── */
.toggle-term {
  position: fixed; bottom: 1.2rem; right: 1.5rem; z-index: 10;
  font-family: var(--mono); font-size: 0.75rem; font-weight: 400;
  color: var(--green); background: rgba(95,221,110,0.06);
  border: 1px solid rgba(95,221,110,0.18); border-radius: 8px;
  padding: 0.45rem 0.75rem; cursor: pointer;
  transition: color 0.3s ease, background 0.3s ease, border-color 0.3s ease, transform 0.2s var(--ease), box-shadow 0.3s ease;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  animation: hintIn 1s ease 2s forwards, termGlow 3s ease-in-out 3s infinite;
  box-shadow: 0 0 12px rgba(95,221,110,0.08);
}
.toggle-term:hover {
  color: var(--green); background: var(--green-dim);
  border-color: rgba(95,221,110,0.35);
  box-shadow: 0 0 24px rgba(95,221,110,0.2);
  animation-play-state: paused;
}
.toggle-term:active { transform: scale(0.95); }
.toggle-term.active {
  color: var(--green); border-color: rgba(95,221,110,0.3);
  animation-play-state: paused;
  box-shadow: 0 0 16px rgba(95,221,110,0.12);
}

/* ── Hint ── */
.hint {
  position: fixed; bottom: 3rem; left: 50%; transform: translateX(-50%);
  z-index: 3; font-family: var(--mono); font-size: 0.6rem;
  font-weight: 300; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--fg-dim); opacity: 0; pointer-events: none;
  animation: hintIn 1s ease 2.5s forwards, hintPulse 3s ease-in-out 4s infinite;
  transition: opacity 0.3s ease;
}

/* ── Terminal overlay ── */
.terminal {
  position: fixed; inset: 0; z-index: 5;
  display: flex; flex-direction: column;
  padding: clamp(1rem, 3vw, 2.5rem);
  padding-bottom: calc(clamp(1rem, 3vw, 2.5rem) + var(--safe-bottom));
  pointer-events: none;
  opacity: 0; transform: translateY(10px);
  transition: opacity 0.4s ease, transform 0.4s var(--ease);
  overflow: hidden;
}
.terminal.active {
  pointer-events: auto; opacity: 1; transform: translateY(0);
}

.term-output {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  font-family: var(--mono); font-size: 0.8rem; line-height: 1.7;
  color: var(--fg-mid);
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.1) transparent;
  padding-bottom: 0.5rem;
}
.term-output::-webkit-scrollbar { width: 4px; }
.term-output::-webkit-scrollbar-track { background: transparent; }
.term-output::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 2px; }

.term-line { white-space: pre-wrap; word-break: break-word; }
.term-line.cmd { color: var(--fg); }
.term-line.cmd .prompt { color: var(--green); }
.term-line.info { color: var(--fg-mid); }
.term-line.accent { color: var(--accent); }
.term-line.gold { color: var(--gold); }
.term-line.green { color: var(--green); }
.term-line.dim { color: var(--fg-dim); }
.term-line.error { color: #e85d5d; }
.term-line a { color: var(--accent); text-decoration: none; }
.term-line a:hover { text-decoration: underline; }

/* ── Input row ── */
.term-input-row {
  display: flex; align-items: center; gap: 0;
  font-family: var(--mono); font-size: 0.8rem;
  padding-top: 0.3rem;
  border-top: 1px solid rgba(255,255,255,0.04);
  margin-top: 0.3rem;
}
.term-prompt { color: var(--green); white-space: pre; user-select: none; }
.term-input {
  flex: 1; background: none; border: none; outline: none;
  font-family: var(--mono); font-size: 0.8rem;
  color: var(--fg); caret-color: var(--green);
  padding: 0.4rem 0;
}
.term-input::placeholder { color: var(--fg-dim); }

/* ── Keyframes ── */
@keyframes cardIn { to { opacity: 1; transform: translateY(0); } }
@keyframes hintIn { to { opacity: 1; } }
@keyframes hintPulse { 0%, 100% { opacity: 0.6; } 50% { opacity: 0.2; } }
@keyframes termGlow {
  0%, 100% { box-shadow: 0 0 8px rgba(95,221,110,0.06); border-color: rgba(95,221,110,0.15); }
  50% { box-shadow: 0 0 20px rgba(95,221,110,0.18); border-color: rgba(95,221,110,0.3); }
}

/* ── Footer ── */
.footer {
  position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%);
  z-index: 1;
  font-family: var(--mono); font-size: 0.6rem; font-weight: 300;
  letter-spacing: 0.04em;
}
.footer a {
  color: var(--fg-dim); text-decoration: none;
  transition: color 0.3s ease;
}
.footer a:hover { color: var(--accent); }
.footer { transition: opacity 0.3s ease; }
.footer.hidden { opacity: 0; pointer-events: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .card { opacity: 1; transform: none; }
  .hint { opacity: 0.5; }
  .toggle-term { opacity: 1; }
  .lang-toggle { opacity: 1; }
}

@media (max-width: 768px) {
  .frame { padding: 1.5rem; }
  .projects a { margin: 0 -0.8rem; padding: 0.8rem 0.8rem; }
  .projects a:hover { padding-left: 1.3rem; }
  .lang-toggle { top: 1rem; right: 1rem; }
}
@media (max-width: 480px) {
  .frame { padding: 1.25rem; padding-bottom: calc(1.25rem + var(--safe-bottom)); }
  .name { font-size: clamp(1.9rem, 9vw, 2.6rem); margin-bottom: 0.85rem; }
  .tagline { font-size: 0.85rem; margin-bottom: 1.75rem; }
  .projects { margin-bottom: 1.5rem; }
  .projects a { margin: 0 -0.5rem; padding: 0.75rem 0.65rem; font-size: 0.85rem; }
  .projects a:hover { padding-left: 0.65rem; background: none; box-shadow: none; }
  .projects a:hover::before { border-color: transparent; }
  .projects a:hover .url { color: var(--fg-dim); }
  .projects a:active { background: rgba(255,255,255,0.06); transform: scale(0.98); }
  .projects a:active .url { color: var(--accent); }
  .socials { gap: 0.25rem; }
  .linkedin-btn { font-size: 0.78rem; padding: 0.55rem 1.1rem; }
  .toggle-term { bottom: 0.8rem; right: 1rem; font-size: 0.7rem; padding: 0.4rem 0.65rem; }
  .terminal { padding: 1rem; }
  .term-output { font-size: 0.72rem; }
  .term-input-row { font-size: 0.72rem; }
  .term-input { font-size: 0.72rem; }
  .lang-toggle { top: 0.8rem; right: 0.8rem; font-size: 0.65rem; padding: 0.3rem 0.5rem; }
}
@media (max-height: 580px) {
  .name { font-size: 1.8rem; margin-bottom: 0.6rem; }
  .tagline { font-size: 0.82rem; margin-bottom: 1.2rem; }
  .projects { margin-bottom: 1rem; }
  .projects a { padding: 0.55rem 0.8rem; }
  .socials { padding-top: 1rem; }
  .hint { display: none; }
}
@media (min-height: 900px) and (min-width: 600px) {
  .name { margin-bottom: 1.3rem; }
  .tagline { margin-bottom: 3rem; }
  .projects { margin-bottom: 2.5rem; }
}
