/* =========================================================
   Futuristic theme (readability-tuned dark mode)
   - Dark mode text contrast improved (WCAG-friendly)
   - Buttons unified (.btn / .button)
   - Contact layout polished + broken logo image avoided
   ========================================================= */

/* ========== 基础变量：科幻配色（暗色可读性加强） ========== */
:root{
  color-scheme: dark light;

  /* Background layers */
  --bg: #050b1a;
  --bg-2: #020617;

  /* Decorative glows (mode-specific) */
  --glow-1: rgba(56, 189, 248, 0.20);  /* cyan */
  --glow-2: rgba(99, 102, 241, 0.16);  /* indigo */
  --glow-3: rgba(255, 255, 255, 0.06);

  /* Surfaces */
  --surface: rgba(12, 18, 34, 0.88);
  --surface-2: rgba(15, 23, 42, 0.92);
  --card: rgba(9, 14, 28, 0.92);

  /* Text */
  --fg: #f4f8ff;
  --muted: #c6d2e6;
  --muted-2: #a7b7d4;
  --muted-3: #8ea2c6;

  /* Accent */
  --accent: #38bdf8;
  --accent2: #6366f1;
  --danger: #fb7185;

  /* Lines / shadows */
  --stroke: rgba(203, 213, 225, 0.26);
  --stroke-strong: rgba(203, 213, 225, 0.42);
  --shadow-soft: 0 18px 42px rgba(0, 0, 0, 0.55);

  /* Sizing */
  --radius-lg: 18px;
  --radius-md: 14px;
  --radius-pill: 999px;

  /* Inputs */
  --input-bg: rgba(7, 12, 24, 0.82);
  --focus: rgba(56, 189, 248, 0.75);

  /* Button foreground on gradient */
  --btn-on: #061021;

  --space: 18px;
}

/* 亮色模式 */
body.light-mode{
  --bg: #f6f7ff;
  --bg-2: #eef0ff;

  --glow-1: rgba(14, 165, 233, 0.18);
  --glow-2: rgba(99, 102, 241, 0.14);
  --glow-3: rgba(2, 6, 23, 0.05);

  --surface: rgba(255, 255, 255, 0.78);
  --surface-2: rgba(255, 255, 255, 0.86);
  --card: rgba(255, 255, 255, 0.86);

  --fg: #0b1220;
  --muted: #2b364c;
  --muted-2: #3b4863;
  --muted-3: #51607c;

  --stroke: rgba(15, 23, 42, 0.18);
  --stroke-strong: rgba(15, 23, 42, 0.28);
  --shadow-soft: 0 18px 38px rgba(15, 23, 42, 0.12);

  --input-bg: rgba(255, 255, 255, 0.92);
  --focus: rgba(14, 165, 233, 0.55);

  --btn-on: #061021;
}

/* ========== 全局 ========== */
*,
*::before,
*::after{ box-sizing: border-box; }

html, body{
  margin: 0;
  padding: 0;
}

body{
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
  color: var(--fg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;

  background:
    radial-gradient(1200px 800px at 10% 0%, var(--glow-1), transparent 60%),
    radial-gradient(1000px 700px at 100% 100%, var(--glow-2), transparent 58%),
    radial-gradient(900px 650px at 20% 120%, var(--glow-3), transparent 70%),
    linear-gradient(180deg, var(--bg), var(--bg-2));
}

a{
  color: var(--accent);
  text-decoration: none;
}
a:hover{ text-decoration: underline; }

:focus-visible{
  outline: 2px solid var(--focus);
  outline-offset: 3px;
  border-radius: 10px;
}

.hidden{ display: none !important; }

/* ========== 布局 ========== */
.layout{
  max-width: 1150px;
  margin: 32px auto 40px;
  padding: 0 18px;
  display: grid;
  grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
  gap: 22px;
}

/* ========== 顶部栏 & logo ========== */
.topbar{
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 22px;
  backdrop-filter: blur(16px);

  background: linear-gradient(90deg, var(--surface-2), var(--surface), var(--surface-2));
  border-bottom: 1px solid var(--stroke);
}

.logo{
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}

.logo__icon{
  width: 40px;
  height: 40px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 900;
  letter-spacing: 0.12em;
  font-size: 13px;
  text-transform: uppercase;
  color: var(--fg);
  background: conic-gradient(from 210deg, var(--accent), var(--accent2), var(--accent));
  box-shadow:
    0 0 0 2px rgba(0,0,0,0.18),
    0 0 26px rgba(56, 189, 248, 0.55);
}

.logo__text{
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.logo__name{
  font-weight: 750;
  font-size: 16px;
  color: var(--fg);
}

.logo__tag{
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted-2);
}

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

.nav-link{
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  text-decoration: none;
  color: var(--muted-2);
  border: 1px solid transparent;
}

.nav-link::after{
  content: "";
  position: absolute;
  inset-inline: 10px;
  bottom: 4px;
  height: 2px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transform-origin: center;
  transform: scaleX(0);
  transition: transform 0.22s ease-out;
}

.nav-link:hover{ color: var(--fg); }
.nav-link:hover::after{ transform: scaleX(1); }

.nav-link.is-active{
  color: var(--fg);
  border-color: var(--stroke-strong);
  background: radial-gradient(circle at top, var(--glow-1), transparent 70%);
}

/* ========== 按钮（统一 .btn / .button） ========== */
.btn{
  border-radius: var(--radius-pill);
  border: 1px solid var(--stroke-strong);
  padding: 7px 14px;
  font-size: 13px;
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn.primary{
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-color: transparent;
  color: var(--btn-on);
  font-weight: 700;
}

.btn.primary:hover{ filter: brightness(1.08); }

.btn.ghost:hover{
  background: rgba(255,255,255,0.06);
}

.button{
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  padding: 8px 14px;
  font-size: 13px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: var(--btn-on);
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.button:hover{ filter: brightness(1.08); }

/* ========== 左侧 sidebar（兼容 .sidebar 或 #sidebar） ========== */
.sidebar,
#sidebar{
  border-radius: var(--radius-lg);
  padding: 18px 18px 20px;
  background:
    radial-gradient(circle at top, var(--glow-1), transparent 62%),
    var(--surface-2);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sidebar__header h1{ margin: 6px 0 2px; font-size: 24px; }

.chip{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--stroke-strong);
  color: var(--muted-2);
}

.spark{ color: var(--accent); }

.sidebar__text{
  font-size: 14px;
  color: var(--muted);
}

.sidebar__meta h2{
  margin: 0 0 6px;
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted-2);
}

.sidebar__meta ul{
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 14px;
  color: var(--muted);
}

.sidebar__meta li + li{ margin-top: 4px; }

.sidebar__footer{
  margin-top: auto;
  font-size: 12px;
  color: var(--muted-2);
}

.brandmark{
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,0.04);
}
.brandmark .logo__icon{
  width: 34px;
  height: 34px;
  border-radius: 12px;
  font-size: 12px;
}

/* ========== 内容区（兼容 .content 或 #content） ========== */
.content,
#content{
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Panel */
.panel{
  border-radius: var(--radius-lg);
  padding: 18px 18px 20px;
  background:
    radial-gradient(circle at top left, rgba(37, 99, 235, 0.18), transparent 60%),
    radial-gradient(circle at bottom right, rgba(6, 182, 212, 0.14), transparent 60%),
    var(--surface-2);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow-soft);
  position: relative;
  overflow: hidden;
}

.panel__header{ margin-bottom: 12px; }

.panel__header h2{
  margin: 4px 0 2px;
  font-size: 22px;
  color: var(--fg);
}

.eyebrow{
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--muted-2);
}

.panel__lead{
  margin: 6px 0 0;
  font-size: 14px;
  color: var(--muted);
  font-weight: 520;
}

.muted{ color: var(--muted); }

/* Hero 网格 */
.hero__grid{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 12px;
}

.holo-card{
  border-radius: var(--radius-md);
  border: 1px solid var(--stroke-strong);
  background: var(--card);
  padding: 14px;
  box-shadow: 0 18px 30px rgba(0, 0, 0, 0.35);
  position: relative;
}

.holo-card::before{
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: inherit;
  border: 1px solid rgba(255,255,255,0.08);
  opacity: 0.85;
  pointer-events: none;
}

.holo-card h3{
  margin: 0 0 6px;
  font-size: 16px;
  color: var(--fg);
}

.holo-card p{
  margin: 0;
  color: var(--muted);
}

/* Featured projects 卡片 */
.featured-grid{
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.project-card{
  border-radius: var(--radius-md);
  border: 1px solid var(--stroke-strong);
  padding: 14px 14px 16px;
  background: var(--card);
}

.project-card header h3{
  margin: 0 0 4px;
  font-size: 17px;
  color: var(--fg);
}

.project-tag{
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--muted-2);
}

.project-card p{
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--muted);
}

.project-card footer{
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ✅ Projects page grid (NEW) */
.projects-grid{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 14px;
}
.project-card--list footer{
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

/* Project screenshot */
.project-screenshot{
  width: 100%;
  display: block;
  border-radius: var(--radius-md);
  border: 1px solid var(--stroke);
  background: rgba(255,255,255,0.03);
}

/* 内容底部 footer */
.content-footer{
  border-radius: var(--radius-lg);
  border: 1px dashed var(--stroke-strong);
  padding: 14px 16px;
  background: rgba(255,255,255,0.03);
  font-size: 14px;
  color: var(--muted);
}

.link-underline{
  margin-top: 4px;
  display: inline-flex;
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid rgba(34, 211, 238, 0.55);
}
.link-underline:hover{ border-bottom-color: var(--accent2); }

/* reveal */
.reveal{
  opacity: 0;
  transform: translateY(28px) scale(0.98);
  transition:
    opacity 0.5s ease-out,
    transform 0.6s cubic-bezier(0.23, 1, 0.32, 1);
}
.reveal.is-visible{
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* tilt */
[data-tilt]{
  transform-style: preserve-3d;
  will-change: transform;
  transition: transform 0.22s ease-out;
}

/* 表单 */
form{ font-size: 14px; }

.form-field{ margin-bottom: 14px; }

.form-field label{
  font-weight: 650;
  color: var(--fg);
}

.form-field input,
.form-field textarea{
  width: 100%;
  margin-top: 6px;
  padding: 10px 10px;
  border-radius: 12px;
  border: 1px solid var(--stroke-strong);
  background: var(--input-bg);
  color: var(--fg);
}

.form-field input::placeholder,
.form-field textarea::placeholder{
  color: var(--muted-3);
}

.form-field input:focus,
.form-field textarea:focus{
  outline: none;
  border-color: rgba(56, 189, 248, 0.75);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.18);
}

/* Contact layout */
.contact-container{
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.contact-container aside{
  color: var(--muted);
}

#success-message{
  margin-top: 12px;
  color: var(--fg);
}

/* back to top + footer */
.backtop{
  position: fixed;
  right: 18px;
  bottom: 20px;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-pill);
  background: radial-gradient(circle at top, var(--accent), var(--accent2));
  border: none;
  color: var(--btn-on);
  font-size: 16px;
  cursor: pointer;
  box-shadow: var(--shadow-soft);
  display: none;
}
.backtop.show{
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.page-footer{
  border-top: 1px solid var(--stroke);
  padding: 16px 22px 24px;
  text-align: center;
  font-size: 13px;
  color: var(--muted-2);
}
.page-footer a{ color: var(--accent); }

/* responsive */
@media (max-width: 900px){
  .layout{ grid-template-columns: minmax(0, 1fr); }
  .contact-container{ grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 768px){
  .topbar{
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px 12px;
  }
  .hero__grid{ grid-template-columns: minmax(0, 1fr); }
  .featured-grid{ grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 480px){
  .topnav{
    flex-wrap: wrap;
    justify-content: flex-end;
  }
  .logo__tag{ display: none; }
}
