/* =========================================================
   Samantha MA — Personal Portfolio (v2)
   Visual system inherited from "AI 术语图鉴"
   ========================================================= */

:root {
  --bg: #F7F6F2;
  --card: #FFFFFF;
  --ink: #171717;
  --ink-2: #737373;
  --ink-3: #A3A29C;
  --accent: #6757E8;
  --accent-faint: rgba(103, 87, 232, .08);
  --line: #E7E5E0;

  --serif: Georgia, 'Songti SC', serif;
  --mono: ui-monospace, Menlo, monospace;
  --sans: 'PingFang SC', system-ui, -apple-system, sans-serif;

  --container: 1240px;
  --pad: 28px;
  --radius: 3px;
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 80px;
  overflow-x: clip;
}

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.no-scroll { overflow: hidden; }

img { display: block; max-width: 100%; }

a { color: inherit; text-decoration: none; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

.container {
  max-width: var(--container);
  margin: 0 auto;
  padding-left: var(--pad);
  padding-right: var(--pad);
}

/* ---------- shared eyebrow (mono label) ---------- */
.eyebrow {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--ink-3);
  font-weight: 400;
}

/* =========================================================
   HEADER
   ========================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
  gap: 24px;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
}

.brand-logo {
  height: 36px;
  width: auto;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 26px;
}

.site-nav a {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--ink-2);
  transition: color .2s ease;
}

.site-nav a:hover { color: var(--accent); }

/* =========================================================
/* =========================================================
   HERO / ABOUT (v3 — Editorial Hero Block + Project Constellation)
   ========================================================= */
.hero {
  position: relative;
  display: flex;
  align-items: center;
  min-height: clamp(680px, calc(100vh - 64px), 760px);
  padding: 48px 0 64px;
}

.hero-grid {
  display: grid;
  /* 左 40% / 右 60%，用 fr 避免 gap 造成溢出 */
  grid-template-columns: 2fr 3fr;
  gap: 24px;
  align-items: center;
  width: 100%;
}

/* ---------- 左侧 Editorial Hero Block：紧凑视觉单元，略偏上 ---------- */
.hero-left {
  transform: translateY(-26px);
}

.hero-left .eyebrow { margin-bottom: 18px; }

.hero-title {
  font-family: var(--serif);
  font-size: clamp(52px, 5.4vw, 76px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: -.5px;
  white-space: nowrap; /* 不超过一行 */
  margin-bottom: 20px;
}

.hero-subtitle {
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 3px;
  color: #5B5B66;
  margin-bottom: 26px;
}

.hero-desc {
  font-size: 15px;
  line-height: 1.8;
  color: var(--ink);
  max-width: 40ch; /* 约 360–440px */
  margin-bottom: 42px;
}

.hero-explore {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--accent);
}

.hero-explore .arrow { transition: transform .2s ease; }
.hero-explore:hover .arrow { transform: translateX(3px); }

/* ---------- 右侧 Project Constellation ---------- */
/* 右侧视觉略微侵入左侧空间，形成连续视觉场 */
.hero-right {
  margin-left: -48px;
}

.constellation {
  width: 100%;
  height: auto;
  display: block;
  overflow: visible;
}

/* 长 Bézier 曲线：极细、低饱和，hover 相关星体时提亮 */
.constellation .curve {
  fill: none;
  stroke: #D6D2DE;
  stroke-width: 1;
  opacity: .62;
  transition: opacity .25s ease;
}
.constellation.hover-atlas .curve-atlas,
.constellation.hover-ev .curve-ev,
.constellation.hover-election .curve-election,
.constellation.hover-box .curve-box {
  opacity: .95;
}

/* 背景微小星点 */
.specks circle {
  fill: var(--ink-3);
  opacity: .38;
}
.specks .speck-purple {
  fill: var(--accent);
  opacity: .22;
}

/* 星体：实心四角星 + 极淡 halo */
.halo {
  fill: var(--card);
  stroke: var(--line);
  stroke-width: .75;
  opacity: .9;
}

.star { cursor: pointer; }

/* 缩放只能作用在「星体本体」上：
   1) 用独立 wrapper，避免 CSS transform 覆盖 star-inner 的 translate 呈现属性（否则会跳位）；
   2) fill-box 取 wrapper 自身包围盒（仅 halo + spark），中心即星心，
      不会因为外层还含文字标签而把缩放中心带偏。 */
.star .star-mark {
  transition: transform .25s ease;
  transform-box: fill-box;
  transform-origin: center;
}
.star:hover .star-mark { transform: scale(1.07); }

.star .spark { stroke: none; }
.star-purple  .spark { fill: #6757E8; }
.star-green   .spark { fill: #4E9A6F; }
.star-blue    .spark { fill: #4A7FB4; }
.star-magenta .spark { fill: #B4547E; }

.star-name {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: .5px;
  fill: var(--ink);
  transition: fill .2s ease;
}
.star:hover .star-name { fill: var(--accent); }

.star-year {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 1px;
  fill: var(--ink-3);
}

/* hover 才显现的微型 CTA */
.star-cta {
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 1px;
  fill: var(--accent);
  opacity: 0;
  transition: opacity .2s ease;
}
.star:hover .star-cta { opacity: 1; }

/* =========================================================
   SELECTED WORKS — PROJECT INDEX + INTERACTIVE PREVIEW
   ========================================================= */
.works {
  padding: 0 0 130px;
}

.works-eyebrow {
  border-top: 1px solid var(--line);
  padding-top: 22px;
  margin-bottom: 18px;
}

.works-intro {
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.75;
  color: var(--ink-2);
  max-width: 52ch;
  margin-bottom: 48px;
}

.index-grid {
  display: grid;
  grid-template-columns: 5fr 7fr;
  gap: 56px;
  align-items: stretch; /* 左侧列表与右侧 Preview 等高 */
}

/* ---------- 左侧 Editorial List ---------- */
.index-list {
  display: flex;
  flex-direction: column;
}

.index-item {
  position: relative;
  flex: 1 1 auto; /* 均分列表高度，与 Preview 面板对齐 */
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 10px 0 10px 26px;
  border-left: 1px solid var(--line);
  cursor: pointer;
  outline: none;
  transition: border-color .2s ease;
}

.index-item:hover { border-left-color: var(--ink-3); }

.index-item.active {
  border-left: 2px solid var(--accent);
  padding-left: 25px; /* 补偿边框宽度，文字不位移 */
}

.index-num {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--ink-3);
  display: block;
  margin-bottom: 5px;
}

.index-title {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.22;
  margin-bottom: 9px;
  transition: color .2s ease;
}

.index-item:hover .index-title,
.index-item.active .index-title { color: var(--accent); }

.index-desc {
  display: none;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--ink-2);
  margin-bottom: 9px;
  max-width: 40ch;
}

.index-item.active .index-desc { display: block; }

.index-more {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--ink-3);
  padding: 8px 0 2px 26px;
}

/* ---------- shared bits（列表与 Preview 共用） ---------- */
.work-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 7px;
}

.work-tag {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: .5px;
  color: var(--ink-2);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 2px 9px;
}

.work-num {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--ink-3);
  display: block;
  margin-bottom: 14px;
}

.work-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--accent);
}

.work-link .arrow { transition: transform .2s ease; }
.work-link:hover .arrow { transform: translateX(3px); }

/* ---------- 右侧 Interactive Preview ---------- */
.preview {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 16px 20px;
}

/* Preview 负责“预览”：保持原始比例，不裁切 Dashboard */
.preview-stage {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  height: 430px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.preview-stage img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.preview-meta {
  display: flex;
  align-items: center;
  /* 窄屏下整行换行，而不是把「Project Site ↗ / OPEN FULL VIEW ↗」压成两行 */
  flex-wrap: wrap;
  gap: 8px 20px;
  padding: 14px 4px 0;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--ink-2);
}

.preview-source {
  color: var(--ink-2);
  white-space: nowrap;
  transition: color .2s ease;
}
.preview-source:hover { color: var(--accent); }

.preview-full {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--accent);
  white-space: nowrap;
  transition: opacity .2s ease;
}
.preview-full:hover { opacity: .7; }

.preview-info {
  position: relative;
  margin-top: 16px;
  padding: 18px 4px 0;
  border-top: 1px solid var(--line);
}

.preview-title {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 12px;
}

.preview-desc {
  font-size: 14px;
  line-height: 1.75;
  color: var(--ink-2);
  max-width: 52ch;
}

.preview-nav {
  position: absolute;
  right: 4px;
  bottom: 0;
  display: flex;
  gap: 14px;
}

.preview-nav button {
  font-size: 17px;
  line-height: 1;
  color: var(--ink-2);
  padding: 4px 2px;
  transition: color .2s ease;
}
.preview-nav button:hover { color: var(--accent); }

/* =========================================================
   FULL VIEW LIGHTBOX
   ========================================================= */
.lightbox[hidden] { display: none; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(247, 246, 242, .96);
}

.lightbox-panel {
  position: relative;
  margin: 24px auto;
  width: min(1240px, calc(100% - 48px));
  max-height: calc(100vh - 48px);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
}

.lightbox-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.lightbox-title {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 2px;
  color: var(--ink-2);
}

.lightbox-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lightbox-actions button {
  font-size: 16px;
  line-height: 1;
  color: var(--ink-2);
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: color .2s ease, border-color .2s ease;
}
.lightbox-actions button:hover {
  color: var(--accent);
  border-color: var(--accent);
}

.lightbox-zoom {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--ink-3);
  min-width: 44px;
  text-align: center;
}

.lightbox-open {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--accent);
  padding: 4px 2px;
}
.lightbox-open:hover { opacity: .7; }

.lightbox-stage {
  flex: 1;
  overflow: auto;
  padding: 28px;
  text-align: center;
}

.lightbox-stage img {
  display: block;
  margin: 0 auto;
  max-width: none;
}

/* =========================================================
   FOOTER / CONTACT
   ========================================================= */
.site-footer {
  border-top: 1px solid var(--line);
  padding: 56px 0 64px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr auto; /* 左栏靠左、FOLLOW 栏靠右，与页面网格两端对齐 */
  gap: 40px;
  align-items: center;
}

.footer-col:last-child { text-align: right; }

.footer-name {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 6px;
}

.footer-line {
  font-size: 13px;
  color: var(--ink-2);
}

.footer-col .eyebrow { margin-bottom: 14px; }

.footer-link {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.footer-link .arrow { transition: transform .2s ease; }
.footer-link:hover .arrow { transform: translateX(3px); }

/* =========================================================
   RESPONSIVE  (<900px → single column)
   ========================================================= */
@media (max-width: 900px) {
  .hero {
    min-height: 0;
    padding: 64px 0 80px;
    display: block;
  }

  .hero-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .hero-left { transform: none; }

  .hero-right { margin-left: 0; }

  .hero-title { font-size: clamp(38px, 11vw, 52px); }

  .index-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }

  .preview-stage { height: 320px; }

  .preview-nav { position: static; margin-top: 12px; justify-content: flex-end; }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 36px;
  }

  .footer-col:last-child { text-align: left; }

  .site-nav {
    gap: 18px;
    flex-wrap: wrap;
  }

  .header-inner { height: auto; padding-top: 14px; padding-bottom: 14px; }

  .lightbox-panel {
    margin: 12px auto;
    width: calc(100% - 24px);
    max-height: calc(100vh - 24px);
  }
}
