:root {
  --bg: #07070b;
  --bg-deep: #040409;
  --panel: rgba(12, 12, 18, 0.78);
  --panel-strong: rgba(16, 16, 24, 0.88);
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --text: #f6f2f7;
  --muted: #b9b1be;
  --red: #ff355e;
  --cyan: #3cf2ff;
  --pink: #ff7ab8;
  --gold: #ffd27d;
  --shadow: 0 20px 70px rgba(0, 0, 0, 0.42);
  --radius-xl: 26px;
  --radius-lg: 18px;
  --max-width: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  font-family: "Inter", sans-serif;
  color: var(--text);
  background: none;
  position: relative;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    linear-gradient(rgba(5, 5, 10, 0.78), rgba(5, 5, 10, 0.9)),
    url("/assets/img/optimized/sakura-bg.webp") center center / cover no-repeat,
    linear-gradient(180deg, var(--bg-deep) 0%, var(--bg) 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

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

.page-shell {
  position: relative;
  width: min(calc(100% - 32px), var(--max-width));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.045;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.75) 0.7px, transparent 0.8px),
    radial-gradient(circle at 75% 35%, rgba(255, 255, 255, 0.45) 0.7px, transparent 0.8px),
    radial-gradient(circle at 30% 80%, rgba(255, 255, 255, 0.35) 0.7px, transparent 0.8px);
  background-size: 180px 180px;
}

.topbar,
.panel,
.nav-tile,
.glass-panel {
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  margin-bottom: 28px;
  border-radius: var(--radius-xl);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.05), rgba(255, 255, 255, 0.02)),
    rgba(10, 10, 18, 0.78);
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 14px;
  will-change: transform;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 58px;
  height: 58px;
  border-radius: 16px;
  border: 1px solid rgba(255, 122, 184, 0.22);
  background: linear-gradient(135deg, rgba(255, 53, 94, 0.22), rgba(60, 242, 255, 0.12));
  box-shadow: 0 0 22px rgba(255, 53, 94, 0.14);
  font-family: "Noto Serif JP", serif;
  font-size: 1.1rem;
  color: #fff1f7;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}

.brand-wrap:hover .brand-mark {
  transform: translateY(-1px) scale(1.02);
  box-shadow:
    0 0 22px rgba(255, 122, 184, 0.12),
    0 0 18px rgba(60, 242, 255, 0.08);
}

.brand-title,
.brand-subtitle,
.hero-kicker,
.section-kicker,
.tile-tag,
.tile-link {
  margin: 0;
}

.brand-title {
  font-family: "Orbitron", sans-serif;
  font-weight: 800;
  letter-spacing: 0.14em;
  font-size: 0.96rem;
}

.brand-subtitle {
  color: var(--muted);
  font-size: 0.95rem;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.topnav-link,
.portfolio-btn,
.nav-tile,
.portfolio-card,
.social-icon-wrap {
  will-change: transform;
}

.topnav-link {
  position: relative;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  color: var(--muted);
  transition:
    color 0.22s ease,
    border-color 0.22s ease,
    background 0.22s ease,
    box-shadow 0.22s ease,
    transform 0.22s ease;
}

.topnav-link:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  box-shadow:
    inset 0 0 12px rgba(255, 255, 255, 0.03),
    0 0 14px rgba(255, 255, 255, 0.04);
  transform: translateY(-1px);
}

.topnav-link.active {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.14);
  background:
    linear-gradient(135deg, rgba(255, 122, 184, 0.12), rgba(60, 242, 255, 0.10)),
    rgba(255, 255, 255, 0.04);
  box-shadow:
    inset 0 0 14px rgba(255, 255, 255, 0.03),
    0 0 18px rgba(255, 122, 184, 0.08),
    0 0 24px rgba(60, 242, 255, 0.06);
}

.topnav-link.active::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 22px;
  height: 3px;
  border-radius: 999px;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #ff7ab8, #3cf2ff);
  box-shadow:
    0 0 10px rgba(255, 122, 184, 0.28),
    0 0 16px rgba(60, 242, 255, 0.18);
}

.hero-kicker,
.section-kicker,
.tile-tag {
  display: inline-block;
  margin-bottom: 12px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--pink);
  font-size: 0.84rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.tile-tag,
.project-badge {
  font-weight: 800;
  letter-spacing: 0.1em;
}

.tile-tag {
  box-shadow:
    inset 0 0 10px rgba(255, 255, 255, 0.03),
    0 0 12px rgba(255, 255, 255, 0.04);
}

h1,
h2 {
  font-family: "Noto Serif JP", serif;
  letter-spacing: -0.03em;
}

p,
li {
  color: var(--muted);
  line-height: 1.72;
}

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

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

/* Fix BFCache / retour navigateur */
body.page-transition {
  opacity: 0;
  transform: scale(0.985);
}

body:not(.page-transition) {
  opacity: 1;
  transform: none;
}

.portfolio-btn,
.tile-link,
.copy-discord {
  transition:
    transform 0.22s ease,
    box-shadow 0.22s ease,
    background 0.22s ease,
    color 0.22s ease,
    border-color 0.22s ease,
    text-shadow 0.22s ease;
}

.portfolio-btn:focus-visible,
.topnav-link:focus-visible,
.nav-tile:focus-visible,
.tile-link:focus-visible,
.copy-discord:focus-visible {
  outline: none;
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.08),
    0 0 0 4px rgba(255, 122, 184, 0.12),
    0 0 18px rgba(60, 242, 255, 0.10);
}

.portfolio-btn-secondary:hover {
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
}

.portfolio-btn-primary:hover {
  box-shadow:
    0 12px 28px rgba(0, 0, 0, 0.24),
    0 0 20px rgba(255, 122, 184, 0.10),
    0 0 24px rgba(60, 242, 255, 0.08);
}

@media (max-width: 768px) {
  .noise {
    display: none;
  }

  .page-shell {
    width: min(calc(100% - 20px), var(--max-width));
    padding: 14px 0 calc(48px + env(safe-area-inset-bottom, 0));
  }

  .topbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 16px;
    border-radius: 22px;
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
  }

  .brand-wrap {
    min-width: 0;
    gap: 10px;
    flex: 1;
  }

  .brand-mark {
    width: 46px;
    height: 46px;
    border-radius: 14px;
    font-size: 0.95rem;
    flex: 0 0 auto;
  }

  .brand-title {
    font-size: 0.84rem;
    letter-spacing: 0.1em;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .brand-subtitle {
    font-size: 0.82rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .topnav {
    gap: 8px;
    flex: 0 0 auto;
  }

  .topnav-link {
    padding: 8px 12px;
    font-size: 0.92rem;
  }

  .topnav-link.active::after {
    bottom: -4px;
    width: 16px;
    height: 2px;
  }

  .portfolio-card,
  .nav-tile,
  .project-section,
  .portfolio-section,
  .social-page .nav-tile,
  .status-card,
  .mini-stat {
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.16) !important;
  }

  .section-kicker,
  .hero-kicker,
  .tile-tag,
  .project-badge {
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  .brand-wrap,
  .topnav-link,
  .portfolio-btn,
  .nav-tile,
  .portfolio-card,
  .social-icon-wrap {
    will-change: auto !important;
  }

  .brand-wrap:hover .brand-mark,
  .nav-tile:hover,
  .portfolio-card:hover,
  .portfolio-btn:hover {
    transform: none !important;
  }

  .reveal,
  .reveal.is-visible {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
  }

  .nav-tile,
  .portfolio-card,
  .portfolio-btn,
  .topnav-link,
  .project-section,
  .portfolio-section {
    transition:
      color 0.18s ease,
      background 0.18s ease,
      border-color 0.18s ease,
      box-shadow 0.18s ease !important;
  }

  body.page-transition {
    opacity: 1;
    transform: none;
  }
}


/* =========================================================
   Global auth button — login/logout inside the top navigation
   ========================================================= */

.topnav-login-btn,
.topnav-logout-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.topnav-login-btn {
  color: #8be9fd;
}

.topnav-login-btn:hover,
.topnav-login-btn:focus-visible {
  color: #a4f0ff;
  border-color: rgba(139, 233, 253, 0.24);
  background: rgba(139, 233, 253, 0.08);
}

.topnav-logout-btn {
  color: #ff4d4d;
}

.topnav-logout-btn:hover,
.topnav-logout-btn:focus-visible {
  color: #ff7070;
  border-color: rgba(255, 77, 77, 0.24);
  background: rgba(255, 77, 77, 0.08);
}

.topnav-login-btn:disabled,
.topnav-logout-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* =========================================================
   Mobile topbar fix — prevent auth button/brand overlap
   ========================================================= */

@media (max-width: 640px) {
  .topbar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
    padding: 18px;
  }

  .brand-wrap {
    width: 100%;
    max-width: 100%;
    flex: none;
    min-width: 0;
  }

  .brand-wrap > div {
    min-width: 0;
  }

  .brand-title,
  .brand-subtitle {
    max-width: 100%;
    white-space: normal;
    overflow: visible;
    text-overflow: unset;
  }

  .topnav {
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
  }

  .topnav-link {
    flex: 0 1 auto;
    padding: 9px 13px;
    font-size: 0.9rem;
    white-space: nowrap;
  }

  .topnav-login-btn,
  .topnav-logout-btn {
    order: -1;
  }
}

/* =========================================================
   Mobile back-to-top button
   Native scroll friendly
   ========================================================= */

.mobile-back-to-top {
  display: none;
}

@media (max-width: 900px), (pointer: coarse) {
  .mobile-back-to-top {
    position: fixed;
    right: max(18px, env(safe-area-inset-right));
    bottom: max(22px, env(safe-area-inset-bottom));
    z-index: 9998;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    width: 48px;
    height: 48px;

    border: 1px solid rgba(60, 242, 255, 0.32);
    border-radius: 999px;

    background:
      linear-gradient(135deg, rgba(255, 122, 184, 0.42), rgba(60, 242, 255, 0.36)),
      rgba(12, 12, 20, 0.94);

    color: #ffffff;

    box-shadow:
      0 0 24px rgba(60, 242, 255, 0.18),
      0 0 18px rgba(255, 122, 184, 0.14),
      inset 0 0 10px rgba(255, 255, 255, 0.065);

    cursor: pointer;
    pointer-events: auto;

    opacity: 0;
    visibility: hidden;
    transform: translateY(14px) scale(0.94);

    transition:
      opacity 0.22s ease,
      transform 0.22s ease,
      visibility 0.22s ease,
      border-color 0.18s ease,
      box-shadow 0.18s ease;
  }

  .mobile-back-to-top.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) scale(1);
  }

  .mobile-back-to-top svg {
    width: 22px;
    height: 22px;
    display: block;
  }
}

@media (min-width: 901px) and (pointer: fine) {
  .mobile-back-to-top {
    display: none !important;
  }
}