/* ===========================================================
   Yin Weibang — Personal Site
   Modern redesign with animations, dark mode & responsiveness
   =========================================================== */

/* ---------- Design tokens ---------- */
:root {
  --bg: #f4f6fb;
  --bg-grad-1: #eef2ff;
  --bg-grad-2: #f5f7fa;
  --surface: rgba(255, 255, 255, 0.75);
  --surface-solid: #ffffff;
  --border: rgba(15, 23, 42, 0.08);
  --text: #1f2937;
  --text-muted: #64748b;
  --heading: #0f172a;
  --accent: #4f46e5;
  --accent-2: #06b6d4;
  --accent-soft: rgba(79, 70, 229, 0.12);
  --shadow: 0 10px 40px rgba(15, 23, 42, 0.08);
  --shadow-sm: 0 4px 16px rgba(15, 23, 42, 0.06);
  --radius: 18px;
}

[data-theme="dark"] {
  --bg: #0b1120;
  --bg-grad-1: #0f172a;
  --bg-grad-2: #0b1120;
  --surface: rgba(30, 41, 59, 0.6);
  --surface-solid: #111a2e;
  --border: rgba(148, 163, 184, 0.14);
  --text: #cbd5e1;
  --text-muted: #94a3b8;
  --heading: #f1f5f9;
  --accent: #818cf8;
  --accent-2: #22d3ee;
  --accent-soft: rgba(129, 140, 248, 0.16);
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
body, h1, h2, p, ul { margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: Monaco, Menlo, Consolas, 'Courier New', monospace;
  line-height: 1.7;
  color: var(--text);
  background: var(--bg);
  padding: 32px 20px;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  transition: background 0.4s ease, color 0.4s ease;
}

/* Animated aurora background blobs */
body::before,
body::after {
  content: "";
  position: fixed;
  z-index: -1;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.55;
  pointer-events: none;
}
body::before {
  width: 480px; height: 480px;
  top: -140px; left: -120px;
  background: radial-gradient(circle at center, var(--accent), transparent 70%);
  animation: float1 18s ease-in-out infinite;
}
body::after {
  width: 420px; height: 420px;
  bottom: -160px; right: -100px;
  background: radial-gradient(circle at center, var(--accent-2), transparent 70%);
  animation: float2 22s ease-in-out infinite;
}
@keyframes float1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(60px, 40px) scale(1.15); }
}
@keyframes float2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(-50px, -30px) scale(1.1); }
}

/* ---------- Layout ---------- */
.wrap {
  max-width: 820px;
  margin: 0 auto;
  background: var(--surface);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  padding: 48px 44px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  animation: cardIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(24px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Header ---------- */
header {
  text-align: center;
  margin-bottom: 44px;
}

header h1 {
  font-size: clamp(2rem, 5vw, 2.8rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
header h1 a {
  text-decoration: none;
  background: linear-gradient(120deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

#subtitle {
  font-size: 1.1rem;
  color: var(--text-muted);
  margin-top: 12px;
  min-height: 1.6em;
}
#subtitle .cursor {
  display: inline-block;
  width: 2px;
  margin-left: 2px;
  background: var(--accent);
  animation: blink 1s step-end infinite;
}
@keyframes blink { 50% { opacity: 0; } }

nav ul {
  list-style: none;
  margin-top: 24px;
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}
nav ul li a {
  text-decoration: none;
  color: var(--accent);
  font-weight: 700;
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--accent-soft);
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease, color 0.2s ease;
  display: inline-block;
}
nav ul li a:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
  background: var(--accent);
  color: #fff;
}

/* ---------- Controls (language + theme) ---------- */
.controls {
  margin-top: 26px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

#languageSwitcher {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
}
#languageSwitcher button {
  min-width: 84px;
  height: 36px;
  padding: 0 14px;
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: 700;
  background: transparent;
  color: var(--text-muted);
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}
#languageSwitcher button.active {
  background: var(--surface-solid);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}
#languageSwitcher button:hover { color: var(--accent); }

#themeToggle {
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.3s ease, background 0.25s ease;
}
#themeToggle:hover { transform: rotate(20deg) scale(1.08); }

/* ---------- Main ---------- */
main section {
  margin-bottom: 40px;
}

.intro-section {
  display: flex;
  align-items: flex-start;
  gap: 26px;
  flex-wrap: wrap;
}
.intro-section .avatar {
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.4s ease, box-shadow 0.4s ease;
  border: 3px solid var(--surface-solid);
}
.intro-section .avatar:hover {
  transform: scale(1.04) rotate(-1deg);
  box-shadow: var(--shadow);
}
.intro-section .intro-text { flex: 1; min-width: 240px; }

main h2 {
  font-size: 1.45rem;
  font-weight: 700;
  color: var(--heading);
  margin-bottom: 14px;
  padding-bottom: 8px;
  position: relative;
  display: inline-block;
}
main h2::after {
  content: "";
  position: absolute;
  left: 0; bottom: 0;
  width: 100%; height: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal.visible main h2::after,
section.visible h2::after { transform: scaleX(1); }

main p { font-size: 1.02rem; }

main ul { padding-left: 4px; list-style: none; }

/* Project list: card-like rows */
#projectsListEn li,
#projectsListJp li {
  position: relative;
  padding: 12px 16px 12px 40px;
  margin-bottom: 10px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
#projectsListEn li::before,
#projectsListJp li::before {
  content: "▹";
  position: absolute;
  left: 16px; top: 12px;
  color: var(--accent);
  font-weight: 700;
}
#projectsListEn li:hover,
#projectsListJp li:hover {
  transform: translateX(4px);
  box-shadow: var(--shadow);
}

/* Skills list rows */
#skillsListEn li,
#skillsListJp li {
  padding: 8px 0;
  border-bottom: 1px dashed var(--border);
}
#skillsListEn li:last-child,
#skillsListJp li:last-child { border-bottom: none; }
#skillsListEn strong,
#skillsListJp strong { color: var(--heading); }

/* Tech tag pills */
.tag {
  display: inline-block;
  padding: 2px 10px;
  margin: 3px 4px 3px 0;
  font-size: 0.82rem;
  font-family: Monaco, Menlo, Consolas, 'Courier New', monospace;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: transform 0.2s ease, background 0.2s ease, color 0.2s ease;
  cursor: default;
}
.tag:hover {
  transform: translateY(-2px);
  background: var(--accent);
  color: #fff;
}

/* ---------- Language visibility ---------- */
[data-lang-mode="en"] .lang-jp { display: none !important; }
[data-lang-mode="jp"] .lang-en { display: none !important; }

/* ---------- Experience timeline ---------- */
.timeline {
  position: relative;
  padding-left: 26px;
}
.timeline::before {
  content: "";
  position: absolute;
  left: 6px; top: 6px; bottom: 6px;
  width: 2px;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  opacity: 0.5;
}
.exp-card {
  position: relative;
  margin-bottom: 22px;
  padding: 18px 20px;
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}
.exp-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow);
}
.exp-card::before {
  content: "";
  position: absolute;
  left: -26px; top: 24px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid var(--surface-solid);
  box-shadow: 0 0 0 2px var(--accent);
}
.exp-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin-bottom: 8px;
}
.exp-role { font-weight: 700; color: var(--heading); }
.exp-company {
  color: var(--accent);
  font-weight: 700;
  margin-left: 6px;
}
.exp-period {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: Monaco, Menlo, Consolas, 'Courier New', monospace;
  white-space: nowrap;
}
.exp-card ul { padding-left: 4px; margin-top: 6px; list-style: none; }
.exp-card ul li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 6px;
  font-size: 0.98rem;
}
.exp-card ul li::before {
  content: "▹";
  position: absolute;
  left: 2px; top: 0;
  color: var(--accent);
}
.exp-card .tags { margin-top: 10px; }

.project-meta {
  font-size: 0.86rem;
  color: var(--text-muted);
  font-family: Monaco, Menlo, Consolas, 'Courier New', monospace;
  margin: 2px 0 4px;
}
.project-link {
  color: var(--accent);
  font-weight: 700;
  text-decoration: none;
}
.project-link:hover { text-decoration: underline; }

/* ---------- Education ---------- */
.edu-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 2px 12px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--border);
}
.edu-item:last-child { border-bottom: none; }
.edu-school { font-weight: 700; color: var(--heading); }
.edu-degree { color: var(--text-muted); font-size: 0.96rem; }
.edu-period {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-family: Monaco, Menlo, Consolas, 'Courier New', monospace;
  white-space: nowrap;
}

/* ---------- Footer ---------- */
footer {
  text-align: center;
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-top: 44px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}
footer a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s ease;
}
footer a:hover { text-decoration: underline; }
footer .copyright { margin-top: 8px; font-size: 0.82rem; opacity: 0.75; }

/* ---------- Scroll reveal ---------- */
.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s ease, transform 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
  body { padding: 16px 10px; }
  .wrap { padding: 30px 20px; }
  .intro-section { justify-content: center; text-align: left; }
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
