/* ===== Tokens & reset ===== */
:root {
  --sky: #7ec3f0;
  --sky-deep: #4c9fd8;   /* theme hue, deepened for text on frosted cards */
  --accent: #ff8a7a;
  --leaf: #63b26f;
  --ink: #2b3a55;
  --ink-soft: rgba(43, 58, 85, 0.72);
  --card: rgba(255, 255, 255, 0.65);
  --line-soft: #cfe6f7;  /* secondary background tone */
  --ring: rgba(255, 255, 255, 0.9);
  --ease-slide: cubic-bezier(0.65, 0, 0.35, 1);
}

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

html, body {
  height: 100%;
  overflow: hidden;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Noto Sans SC", -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
}

ul { list-style: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

/* ===== Blurred anime background ===== */
.bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    url("../assets/bg.jpg") center / cover no-repeat,
    linear-gradient(#7ec3f0, #eaf6ff); /* fallback if image missing */
  filter: blur(2px);
  transform: scale(1.08); /* hide blurred edges */
}

.bg-overlay {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: rgba(255, 255, 255, 0.22);
  transition: background 0.7s var(--ease-slide);
}

body.on-detail .bg-overlay { background: rgba(255, 255, 255, 0.45); }

/* ===== Two-screen slide shell ===== */
.screens {
  height: 200vh;
  height: 200dvh;
  transition: transform 0.7s var(--ease-slide);
  will-change: transform;
}

.screen {
  height: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 24px;
}

/* ===== Reduced motion ===== */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ===== Hero (screen 1) ===== */
.hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 14px;
  max-width: 560px;
}

.avatar {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: 4px solid var(--ring);
  box-shadow: 0 8px 32px rgba(43, 58, 85, 0.18);
  background: #fff;
  object-fit: cover;
}

.name { font-size: 2.2rem; letter-spacing: 0.02em; }

.intro { font-size: 1.05rem; color: var(--ink-soft); }

.contact-icons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 8px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 2px 10px rgba(43, 58, 85, 0.12);
  transition: transform 0.2s, color 0.2s;
}

.icon-btn:hover { transform: translateY(-3px); color: var(--accent); }

.icon { width: 22px; height: 22px; }

/* ===== Hero about tags ===== */
.hero-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 2px 10px rgba(43, 58, 85, 0.1);
  font-size: 0.85rem;
}

.tag-icon { display: inline-flex; color: var(--ink-soft); }

.tag-icon .icon { width: 15px; height: 15px; }

/* ===== Hero entrance stagger ===== */
@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to   { opacity: 1; transform: translateY(0); }
}

.hero > * { animation: rise 0.6s var(--ease-slide) both; }
.hero > :nth-child(1) { animation-delay: 0.05s; }
.hero > :nth-child(2) { animation-delay: 0.15s; }
.hero > :nth-child(3) { animation-delay: 0.25s; }
.hero > :nth-child(4) { animation-delay: 0.35s; }
.hero > :nth-child(5) { animation-delay: 0.45s; }

/* ===== Swipe hint ===== */
@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(6px); }
}

.swipe-hint {
  position: absolute;
  bottom: 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 0.85rem;
  animation: bob 1.8s ease-in-out infinite;
}

.chevron {
  width: 12px;
  height: 12px;
  border-right: 3px solid var(--accent);
  border-bottom: 3px solid var(--accent);
  transform: rotate(45deg);
}

/* ===== Language toggle ===== */
.lang-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10;
  width: 44px;
  height: 32px;
  border-radius: 16px;
  background: var(--card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  font-weight: 600;
  font-size: 0.85rem;
  box-shadow: 0 2px 10px rgba(43, 58, 85, 0.12);
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  z-index: 20;
  transform: translate(-50%, 16px);
  padding: 10px 22px;
  border-radius: 999px;
  background: rgba(43, 58, 85, 0.88);
  color: #fff;
  font-size: 0.9rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
}

.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }

/* ===== Detail screen (screen 2) ===== */
.detail {
  width: 100%;
  max-width: 780px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-height: 100%;
  overflow-y: auto;
  padding: 12px 0;
  scrollbar-width: none;
}

.detail::-webkit-scrollbar { display: none; }

.card {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.52));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 24px;
  padding: 24px 28px;
  box-shadow: 0 14px 44px rgba(43, 58, 85, 0.12);
}

.card h2 {
  font-size: 1.05rem;
  color: var(--sky-deep);
  margin-bottom: 14px;
  letter-spacing: 0.04em;
}

/* ===== Detail top row: profile card | (about + contact cards) ===== */
.top-row { display: flex; gap: 16px; align-items: stretch; }

.profile-card {
  flex: 2;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.side-col {
  flex: 3;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.side-col .card { flex: 1; }

.contact-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.detail-name { font-size: 1.25rem; font-weight: 700; margin-bottom: 6px; }

.detail-avatar {
  display: block;
  width: 112px;
  height: 112px;
  border-radius: 50%;
  border: 4px solid var(--ring);
  box-shadow: 0 6px 20px rgba(43, 58, 85, 0.16);
  background: #fff;
  object-fit: cover;
  margin-bottom: 12px;
}

.detail-bio {
  text-align: center;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--ink-soft);
  max-width: 26em;
}

.about-list { font-size: 0.92rem; }

.about-list .row-label { min-width: 3.2em; }

.contact-card .info-row { font-size: 0.98rem; }
.contact-card .info-list { gap: 14px; }
.contact-card .row-label { min-width: 3.5em; }

.info-list { display: flex; flex-direction: column; gap: 12px; }

.info-row { display: flex; align-items: center; gap: 12px; }

.row-icon {
  display: inline-flex;
  color: var(--ink-soft);
  flex-shrink: 0;
}

.row-icon .icon { width: 19px; height: 19px; }

.row-label { color: var(--ink-soft); min-width: 5.5em; flex-shrink: 0; }

.row-value {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-copy {
  margin-left: auto;
  display: inline-flex;
  color: var(--ink-soft);
  padding: 4px;
  border-radius: 8px;
  transition: color 0.2s, background 0.2s;
  flex-shrink: 0;
}

.row-copy:hover { color: var(--accent); background: rgba(255, 138, 122, 0.12); }

.row-copy .icon { width: 16px; height: 16px; }

/* ===== Sites (illustrated tiles) ===== */
.site-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.site-tile {
  position: relative;
  display: block;
  border-radius: 18px;
  overflow: hidden;
  aspect-ratio: 16 / 10;
  background: var(--line-soft);
  box-shadow: 0 4px 16px rgba(43, 58, 85, 0.12);
  transition: transform 0.25s, box-shadow 0.25s;
}

.site-tile:hover, .site-tile:focus-visible {
  transform: translateY(-5px);
  box-shadow: 0 14px 30px rgba(43, 58, 85, 0.2);
}

.tile-art {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.45s var(--ease-slide);
}

.site-tile:hover .tile-art, .site-tile:focus-visible .tile-art { transform: scale(1.07); }

.tile-scrim {
  position: absolute;
  inset: auto 0 0 0;
  display: flex;
  flex-direction: column;
  padding: 32px 14px 10px;
  background: linear-gradient(transparent, rgba(43, 58, 85, 0.58));
  color: #fff;
}

.tile-name { font-weight: 700; font-size: 0.98rem; text-shadow: 0 1px 4px rgba(43, 58, 85, 0.35); }

.tile-host { font-size: 0.72rem; opacity: 0.85; }

/* ===== Footer ===== */
.footer {
  text-align: center;
  font-size: 0.85rem;
  color: var(--ink-soft);
  display: flex;
  justify-content: center;
  gap: 14px;
}

/* ===== Dots indicator ===== */
.dots {
  position: fixed;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(43, 58, 85, 0.25);
  transition: background 0.3s, transform 0.3s;
}

.dot.is-active { background: var(--accent); transform: scale(1.3); }

/* ===== Screen-2 entrance ===== */
.screen-detail .card,
.screen-detail .footer {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.5s var(--ease-slide), transform 0.5s var(--ease-slide);
}

body.on-detail .screen-detail .card,
body.on-detail .screen-detail .footer {
  opacity: 1;
  transform: translateY(0);
}

body.on-detail .screen-detail .profile-card { transition-delay: 0.25s; }
body.on-detail .screen-detail .about-card { transition-delay: 0.33s; }
body.on-detail .screen-detail .contact-card { transition-delay: 0.41s; }
body.on-detail .screen-detail .sites-card { transition-delay: 0.5s; }
body.on-detail .screen-detail .footer { transition-delay: 0.6s; }

/* The bio crossfades in while the hero intro's ghost dissolves onto it
 * (the name itself flies, so it needs no entrance of its own). */
.screen-detail .detail-bio {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.45s var(--ease-slide), transform 0.45s var(--ease-slide);
}

body.on-detail .screen-detail .detail-bio {
  opacity: 1;
  transform: translateY(0);
  transition-delay: 0.4s;
}

/* ===== Flying contact icons (screen transition) ===== */
.fly-icon {
  position: fixed;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--card);
  box-shadow: 0 2px 10px rgba(43, 58, 85, 0.12);
  color: var(--ink);
  pointer-events: none;
  transition:
    top 0.7s var(--ease-slide), left 0.7s var(--ease-slide),
    width 0.7s var(--ease-slide), height 0.7s var(--ease-slide),
    background 0.7s var(--ease-slide), box-shadow 0.7s var(--ease-slide),
    color 0.7s var(--ease-slide);
}

.fly-icon .icon {
  width: 22px;
  height: 22px;
  transition: width 0.7s var(--ease-slide), height 0.7s var(--ease-slide);
}

.fly-icon.is-small { background: transparent; box-shadow: none; color: var(--ink-soft); }
.fly-icon.is-small .icon { width: 19px; height: 19px; }

.fly-avatar {
  position: fixed;
  z-index: 30;
  box-sizing: border-box;
  border-radius: 50%;
  border: 4px solid var(--ring);
  background: #fff;
  object-fit: cover;
  box-shadow: 0 6px 20px rgba(43, 58, 85, 0.16);
  pointer-events: none;
  transition:
    top 0.7s var(--ease-slide), left 0.7s var(--ease-slide),
    width 0.7s var(--ease-slide), height 0.7s var(--ease-slide);
}

.fly-text {
  position: fixed;
  z-index: 30;
  pointer-events: none;
  white-space: nowrap;
  transition:
    top 0.7s var(--ease-slide), left 0.7s var(--ease-slide),
    font-size 0.7s var(--ease-slide), letter-spacing 0.7s var(--ease-slide),
    line-height 0.7s var(--ease-slide), color 0.7s var(--ease-slide),
    opacity 0.55s ease;
}

.icon-hidden { visibility: hidden !important; }

/* ===== Transition paper plane ===== */
.transition-plane {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 25;
  width: 44px;
  height: 44px;
  pointer-events: none;
  color: #ffffff;
  filter: drop-shadow(0 3px 8px rgba(43, 58, 85, 0.35));
  opacity: 0;
  animation-duration: 0.85s;
  animation-timing-function: ease-in-out;
  animation-fill-mode: forwards;
}

.transition-plane .icon { width: 100%; height: 100%; }

@keyframes plane-to-detail {
  0%   { transform: translate(-8vw, 80vh) rotate(-14deg); opacity: 0; }
  15%  { opacity: 1; }
  85%  { opacity: 1; }
  100% { transform: translate(104vw, 8vh) rotate(6deg); opacity: 0; }
}

@keyframes plane-to-hero {
  0%   { transform: translate(104vw, 8vh) rotate(194deg); opacity: 0; }
  15%  { opacity: 1; }
  85%  { opacity: 1; }
  100% { transform: translate(-8vw, 80vh) rotate(166deg); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .screen-detail .card,
  .screen-detail .footer,
  .screen-detail .detail-bio { opacity: 1; transform: none; }
}

/* ===== Responsive ===== */
@media (max-width: 640px) {
  .name { font-size: 1.7rem; }
  .avatar { width: 100px; height: 100px; }
  .screen { padding: 18px; }
  .card { padding: 18px; border-radius: 16px; }
  .row-label { min-width: 4.5em; }
  .top-row { flex-direction: column; }
  .hero-tag { font-size: 0.8rem; padding: 5px 12px; }
  .site-grid { grid-template-columns: 1fr; }
  .site-tile { aspect-ratio: 16 / 7; }
  .dots { right: 12px; }
  .lang-toggle { top: 14px; right: 14px; }
  .detail { gap: 14px; }
}

@media (max-height: 700px) {
  .card { padding: 16px 20px; }
  .info-list { gap: 9px; }
  .detail { gap: 12px; }
}
