/* =========================================================
   takagii.fr
   ========================================================= */

:root {
  --bg: #f6f3ee;
  --ink: #1c1c1c;
  --ink-soft: #6b6b6b;
  --ink-faint: rgba(28, 28, 28, 0.10);
  --ink-line: rgba(28, 28, 28, 0.18);
  --accent: #5b8ec9;

  --serif: "Shippori Mincho", "Hiragino Mincho ProN", "Yu Mincho", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --topbar-h: 4.25rem;
}

:root[data-theme="dark"] {
  --bg: #141414;
  --ink: #e8e6e1;
  --ink-soft: #8e8e8e;
  --ink-faint: rgba(232, 230, 225, 0.10);
  --ink-line: rgba(232, 230, 225, 0.18);
  --accent: #82b3e5;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #141414;
    --ink: #e8e6e1;
    --ink-soft: #8e8e8e;
    --ink-faint: rgba(232, 230, 225, 0.10);
    --ink-line: rgba(232, 230, 225, 0.18);
    --accent: #82b3e5;
  }
}

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

html, body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-weight: 400;
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
  min-height: 100svh;
  transition: background 0.3s ease, color 0.3s ease;
}

/* fireworks canvas — sits behind everything */
#fireworks {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* ============== top bar ============== */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: clamp(1rem, 2.5vw, 1.5rem) clamp(1.25rem, 3vw, 2.5rem);
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: var(--bg);
  transition: background 0.3s ease, color 0.3s ease;
}

.mark {
  font-family: var(--serif);
  font-size: 1rem;
  letter-spacing: 0;
  text-transform: none;
  color: var(--ink);
}

.controls { display: inline-flex; align-items: center; gap: 1rem; }

nav.lang { display: inline-flex; gap: 0.4rem; align-items: center; }
nav.lang button {
  background: none;
  border: 0;
  font: inherit;
  letter-spacing: inherit;
  text-transform: inherit;
  color: var(--ink-soft);
  cursor: pointer;
  padding: 0.25rem 0.4rem;
  transition: color 0.2s;
}
nav.lang button:hover { color: var(--ink); }
nav.lang button[aria-current="true"] { color: var(--ink); }
nav.lang .sep { color: var(--ink-faint); }

.theme-toggle {
  background: none;
  border: 0;
  padding: 0.25rem;
  cursor: pointer;
  color: var(--ink-soft);
  display: inline-grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  transition: color 0.2s;
}
.theme-toggle:hover { color: var(--ink); }
.theme-toggle svg { width: 1.05rem; height: 1.05rem; display: block; }
.theme-toggle .icon-sun { display: none; }
.theme-toggle .icon-moon { display: block; }
.theme-toggle.is-dark .icon-sun { display: block; }
.theme-toggle.is-dark .icon-moon { display: none; }

/* ============== hero ============== */
.hero {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  max-width: 36rem;
  margin: 0 auto;
  padding: calc(var(--topbar-h) + 2rem) clamp(1.5rem, 4vw, 2.5rem) 3rem;
}

.hi {
  font-family: var(--serif);
  font-style: italic;
  color: var(--ink-soft);
  font-size: 1rem;
  margin-bottom: 1.4rem;
  opacity: 0;
  animation: fade 0.8s ease 0.1s forwards;
}

/* ============== profile (avatar + name + handle + bio) ============== */
.profile {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  margin-bottom: 2.2rem;
  opacity: 0;
  animation: fade 0.8s ease 0.25s forwards;
}

.avatar {
  position: relative;
  width: clamp(3.75rem, 14vw, 5rem);
  height: clamp(3.75rem, 14vw, 5rem);
  border-radius: 50%;
  overflow: hidden;
  background: var(--ink-faint);
  flex-shrink: 0;
  box-shadow: 0 0 0 1px var(--ink-faint) inset;
}
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.5s ease;
}
.avatar img.loaded { opacity: 1; }
.avatar-fallback {
  position: absolute;
  inset: 0;
}

.profile-text { min-width: 0; }

.display {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(1.85rem, 5.5vw, 2.6rem);
  line-height: 1.15;
  letter-spacing: -0.01em;
  color: var(--ink);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.25rem;
}

.handle {
  font-family: var(--sans);
  font-weight: 400;
  font-size: 0.55em;
  color: var(--accent);
  letter-spacing: 0;
}

.bio {
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0;
}

/* ============== links ============== */
.links {
  display: flex;
  gap: 1.75rem;
  flex-wrap: wrap;
  opacity: 0;
  animation: fade 0.8s ease 0.4s forwards;
}

.links a {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.92rem;
  letter-spacing: 0.04em;
  padding: 0.4rem 0;
  transition: color 0.2s;
}
.links a:hover { color: var(--ink-soft); }
.links svg { width: 1.05rem; height: 1.05rem; }

@keyframes fade { to { opacity: 1; } }

/* ============== language swap micro-transition ============== */
.lang-swap {
  display: inline-block;
  transition: opacity 0.15s ease;
}
.lang-swap.swapping { opacity: 0; }

/* ============== reduced motion ============== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .hi, .profile, .links { opacity: 1 !important; }
  #fireworks { display: none; }
}
