/* =========================================================
   Fabio Xie — Ocean Cyberpunk (clean + calm)
   ========================================================= */

/* ---------- 1) Design Tokens ---------- */
:root{
  color-scheme: dark;
  /* Typography / layout */
  --fg: #f9fbff;
  --fg-soft: rgba(244,248,255,.92);
  --content-max: clamp(820px,72vw,1200px);

  /* Accents */
  --acc-cyan: #92ecff;
  --acc-iris: #b5c6ff;
  --acc-slate: #d0dcff;

  /* Global background layers */
  --bg-base: radial-gradient(1360px 860px at 18% -16%, rgba(110,182,255,.26), transparent 66%),
              radial-gradient(1180px 760px at 86% 6%, rgba(98,228,255,.2), transparent 72%),
              linear-gradient(132deg, #101e2f 0%, #14263e 44%, #1a314f 100%);
  --bg-glow-primary: radial-gradient(640px 380px at 76% 18%, rgba(156,178,255,.3), transparent 76%);
  --bg-glow-secondary: radial-gradient(600px 360px at 14% 78%, rgba(112,206,240,.24), transparent 78%);
  --bg-line-color: rgba(144,184,230,.16);
  --bg-line-highlight: rgba(208,236,255,.2);
}

/* ---------- 2) Base Reset ---------- */
*{ box-sizing: border-box; }
html, body{ margin: 0; padding: 0; overflow-x: clip; }
body{
  color: var(--fg);
  font: 16px/1.65 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
        "SF Pro SC","PingFang SC","Hiragino Sans GB","Noto Sans CJK SC", sans-serif;
  background: transparent; /* 背景画在 html 上，保证统一 */
}

a{
  color: rgba(132,212,255,.9);
  transition: color .18s ease;
}
a:hover,
a:focus-visible{
  color: rgba(158,230,255,1);
}

.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;
}

/* ---------- 3) Global Background (light cyberpunk canvas) ---------- */
html{
  min-height: 100%;
  background: var(--bg-base);
  background-size: 210% 210%;
  background-attachment: fixed;
  animation: auroraDrift 48s ease-in-out infinite;
}

html::before{
  content:"";
  position: fixed; inset: -12% -12%;
  pointer-events: none; z-index: -1;
  background: var(--bg-glow-primary), var(--bg-glow-secondary);
  opacity: .82;
  filter: blur(.45px);
  animation: prismPulse 56s ease-in-out infinite;
}

html::after{
  content:"";
  position: fixed; inset: -10% -10%;
  pointer-events: none; z-index: -1;
  background:
    linear-gradient(115deg, var(--bg-line-highlight) 0%, rgba(255,255,255,0) 42%),
    repeating-linear-gradient(125deg, var(--bg-line-color) 0 1px, transparent 1px 58px);
  opacity: .14;
  mix-blend-mode: soft-light;
  animation: gridFloat 46s linear infinite;
}

body::before{
  content:"";
  position: fixed; inset: -16% -16%;
  pointer-events: none; z-index: -2;
  background: repeating-linear-gradient(90deg, rgba(25,229,255,.06) 0 1px, transparent 1px 48px);
  opacity: .08;
  animation: scanShift 28s linear infinite;
  will-change: transform;
}

@keyframes auroraDrift{
  0%   { background-position: 0% 38%; }
  50%  { background-position: 100% 62%; }
  100% { background-position: 0% 38%; }
}
@keyframes prismPulse{
  0%   { transform: translate3d(0%, 0%, 0) scale(1); opacity: .74; }
  50%  { transform: translate3d(1.8%, -1.2%, 0) scale(1.018); opacity: .9; }
  100% { transform: translate3d(0%, 0%, 0) scale(1); opacity: .74; }
}
@keyframes gridFloat{
  0%   { background-position: 0 0, 0 0; }
  100% { background-position: 84px 84px, 84px 84px; }
}
@keyframes scanShift{ 0%{ transform: translate3d(0,0,0); } 100%{ transform: translate3d(10px,48px,0); } }

@media (prefers-reduced-motion: reduce){
  html{ animation: none; }
  html::before, html::after, body::before{ animation: none; }
}

/* ---------- 4) Page Layout ---------- */
html, body { height: 100%; }
body { display: flex; min-height: 100vh; flex-direction: column; }
main.site-main { flex: 1; padding-top: clamp(12px, 2.8vw, 20px); }
body.reading main.site-main { padding-top: clamp(6px, 2vw, 14px); }

/* 首页可选：不拉伸（如果想把 footer 紧跟内容，给 index.md 加 home:true） */
body.home main.site-main { flex: 0; min-height: auto; }

/* ---------- 5) Site Navigation ---------- */
.site-nav{
  position: sticky;
  top: 0;
  z-index: 2000;
  display: flex;
  justify-content: center;
  width: 100%;
  background: rgba(18,30,54,.8);
  border-bottom: 1px solid rgba(162,212,255,.24);
  backdrop-filter: blur(18px) saturate(150%);
}
.nav-shell{
  width: min(1080px, 100%);
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: clamp(8px, 2vw, 20px);
  padding: clamp(10px, 2vw, 16px) clamp(18px, 3vw, 28px);
  background: rgba(28,42,78,.6);
  border-radius: 16px;
  border: 1px solid rgba(176,220,255,.26);
  box-shadow: 0 30px 68px rgba(10,18,40,.44);
}
.nav-logo{
  font-weight: 700;
  font-size: clamp(0.94rem, 1.8vw, 1.05rem);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #fdfefe;
  text-decoration: none;
}
.nav-primary{
  display: flex;
  justify-content: flex-end;
  gap: clamp(8px, 2.2vw, 18px);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.nav-primary::-webkit-scrollbar{ display: none; }
.nav-pill{
  position: relative;
  padding: 6px 14px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 0.9rem;
  letter-spacing: .03em;
  color: rgba(246,250,255,.88);
  border: 1px solid rgba(182,226,255,.28);
  transition: all .22s ease;
  background: rgba(34,48,84,.58);
}
.nav-pill:hover{
  color: #ffffff;
  border-color: rgba(146,236,255,.46);
  background: rgba(38,54,96,.84);
  box-shadow: 0 16px 32px rgba(12,20,44,.48);
}
.nav-pill.is-active{
  color: #ffffff;
  border-color: rgba(192,238,255,.48);
  background: linear-gradient(90deg, rgba(146,236,255,.3), rgba(190,214,255,.38));
  box-shadow: 0 20px 40px rgba(14,22,50,.52);
}


/* ---------- 6) Containers ---------- */
.container{
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto clamp(18px, 4vw, 38px);
  padding: clamp(24px, 5vw, 36px);
  background: transparent;
  border-radius: 24px;
  animation: fx-fade-up .5s ease-out both; animation-delay: .06s;
  will-change: opacity, transform;
}

/* ---------- 7) Footer（透明 + 居中 + 无底色） ---------- */
.site-footer{
  margin-top: auto;
  padding: 0;
  font-size: 14px;
  color: var(--fg-soft);
  text-shadow: none;
  background: transparent !important;
}
.site-footer, .container--footer{
  display: flex; justify-content: center; align-items: center; text-align: center;
}
.container--footer{
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 12px 0;
  background: transparent !important;
  border: 0 !important;
  border-radius: 0;
  box-shadow: none !important;
}

.contact-links{
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: clamp(28px, 6vw, 42px) 0 clamp(12px, 4vw, 20px);
}
.contact-chip{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 20px;
  border-radius: 999px;
  border: 1px solid rgba(78,128,255,.36);
  background: rgba(14,24,52,.86);
  text-decoration: none;
  color: #dfe6ff;
  font-size: 0.92rem;
  letter-spacing: .03em;
  transition: all .22s ease;
  box-shadow: 0 16px 32px rgba(4,10,28,.5);
}
.contact-chip:hover{
  color: #ffffff;
  border-color: rgba(56,230,255,.52);
  background: rgba(16,30,60,.9);
  box-shadow: 0 22px 40px rgba(4,10,28,.6);
  transform: translateY(-1px);
}

.essay-nav{
  position: sticky;
  top: clamp(14px, 4vw, 32px);
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: var(--content-max);
  margin: clamp(10px, 3vw, 20px) auto clamp(14px, 4vw, 24px);
  padding: 0;
  background: transparent;
}
.essay-nav__back{
  position: fixed;
  top: clamp(70px, 10vw, 92px);
  right: clamp(16px, 5vw, 28px);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid rgba(178,226,255,.36);
  background: rgba(30,44,78,.78);
  color: rgba(214,242,255,.94);
  text-decoration: none;
  font-size: 0.82rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  box-shadow: 0 20px 40px rgba(10,18,42,.48);
}
.essay-nav__links{
  display: flex;
  gap: 12px;
  margin-left: auto;
}
.essay-nav__link{
  color: rgba(228,236,255,.84);
  text-decoration: none;
  font-size: 0.88rem;
  max-width: clamp(140px, 28vw, 220px);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.essay-nav__link:hover,
.essay-nav__link:focus-visible{ color: rgba(196,244,255,1); }
.essay-nav__back:hover,
.essay-nav__back:focus-visible{
  color: #ffffff;
  border-color: rgba(150,234,255,.5);
  background: rgba(38,54,92,.88);
}

.contact-links{
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: clamp(28px, 6vw, 42px) 0 clamp(12px, 4vw, 20px);
}
.contact-chip{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 20px;
  border-radius: 999px;
  border: 1px solid rgba(182,226,255,.34);
  background: rgba(30,44,80,.78);
  text-decoration: none;
  color: #f6faff;
  font-size: 0.92rem;
  letter-spacing: .03em;
  transition: all .22s ease;
  box-shadow: 0 22px 44px rgba(12,20,44,.48);
}
.contact-chip:hover{
  color: #ffffff;
  border-color: rgba(150,234,255,.52);
  background: rgba(36,52,92,.9);
  box-shadow: 0 28px 52px rgba(12,20,44,.62);
  transform: translateY(-1px);
}

/* ---------- 8) Accessibility ---------- */
.skip-link{
  position: fixed; left: -9999px; top: 12px; z-index: 3000;
  padding: 8px 12px; border-radius: 10px; background: rgba(8,16,36,.95); color: var(--fg);
  box-shadow: 0 8px 20px rgba(0,0,0,.18); text-decoration: none;
}
.skip-link:focus-visible{ left: 12px; }

/* ---------- 9) Reading Mode ---------- */
body.reading{ background: transparent; color: var(--fg); }
body.reading .container{
  max-width: 68ch;
  padding: 32px;
  background: transparent;
}

/* ---------- 10) Lists / Blog ---------- */
.blog-list{ margin: 0 0 2rem 1.25rem; padding: 0; }
.blog-list li{ margin: .5rem 0; }

/* 首页 CTA：确保无底色条 */
.home-cta{ margin: 8px 0 0; }
.home-cta a{ background: transparent !important; text-decoration: underline; padding: 0; }

/* ---------- 11) Micro animations ---------- */
@keyframes fx-fade-up{ from{ opacity:0; transform: translate3d(0,8px,0) } to{ opacity:1; transform:none } }

/* ---------- 12) Responsive ---------- */
/* 顶部更紧凑：把容器上内边距收小 */
main .container { padding-top: 16px; }

/* 容器里的第一个元素不要自带上边距（通常是 H1） */
main .container > :first-child { margin-top: 0; }

/* 再保险：如果第一个就是标题，也清零 */
main .container h1:first-child,
main .container h2:first-child { margin-top: 0; }

/* 标题与正文的间距微调（更好看） */
main .container h1 { margin-bottom: .6em; }

.hero-intro{
  display: flex;
  align-items: center;
  gap: clamp(24px, 4vw, 48px);
  margin: clamp(12px, 3vw, 32px) 0 32px;
}
.hero-avatar{
  position: relative;
  width: clamp(120px, 22vw, 180px);
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 22px 48px rgba(31,54,94,.16);
  background: radial-gradient(circle at 32% 28%, rgba(25,229,255,.32), transparent 72%);
  border: 1px solid rgba(70,108,180,.22);
}
.hero-avatar::after{
  content:"";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(61,98,255,.25);
  mix-blend-mode: screen;
  pointer-events: none;
}
.hero-avatar img{
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 32%;
  display: block;
}
.hero-copy{
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.hero-copy p{ margin: 0; font-size: 1.02rem; color: var(--fg-soft); }

@media (max-width: 720px){
  .hero-intro{ flex-direction: column; align-items: flex-start; text-align: left; }
  .hero-avatar{ width: clamp(120px, 42vw, 180px); }
}

/* Books list base */
.books { list-style: none; padding-left: 0; margin: 1rem 0; }
.book { margin: .5rem 0; }
.book a { text-decoration: none; }

/* Highlights */
.book.favorite a { color: #e76033; font-weight: 700; }  /* red */
.book.good a     { color: #1ab168; font-weight: 600; }  /* deep blue */
.book.okay a     { color: #1278b8; }                    /* teal-ish */
