/* 首页（body.home）、作品页（body.works）、文章（body.articles）、AI 灵感库（body.studio）、工具索引（body.tools）、联系页（body.contact）与 GIS 工具专区（body.gis）共用样式；自成一体，不依赖 styles.css */

@font-face {
  font-family: "Newsreader Name";
  src: url("./assets/fonts/newsreader-name.woff2") format("woff2");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  color-scheme: light;
  --h-ground: #f5f5f2;
  --h-ground-2: #ecece7;
  --h-ink: #1a1c1e;
  --h-muted: #62676c;
  --h-faint: #6b7075;
  --h-accent: #0e6f71;
  --h-sans: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --h-name: "Newsreader Name", Georgia, serif;
  --h-margin: 48px;
  --h-ease: cubic-bezier(0.2, 0, 0, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body.home,
body.works,
body.articles,
body.studio,
body.tools,
body.contact,
body.gis {
  margin: 0;
  background: var(--h-ground);
  color: var(--h-ink);
  font-family: var(--h-sans);
  font-size: 15px;
  line-height: 1.6;
}

:where(body.home, body.works, body.articles, body.studio, body.tools, body.contact, body.gis) a {
  color: inherit;
  text-decoration: none;
}

::selection {
  background: var(--h-accent);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--h-accent);
  outline-offset: 3px;
}

.h-frame {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 var(--h-margin);
}

/* 顶栏：纯文字链接 */
.h-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  height: 64px;
}

.h-brand {
  display: flex;
  flex: none;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
}

.h-brand img {
  width: 28px;
  height: 28px;
}

.h-nav {
  display: flex;
  gap: 26px;
  font-size: 14px;
  color: var(--h-muted);
}

.h-nav a {
  padding: 10px 0;
  white-space: nowrap;
  transition: color 0.15s ease-out;
}

.h-nav a:hover,
.h-nav a[aria-current="page"] {
  color: var(--h-ink);
}

.h-nav a[aria-current="page"] {
  text-decoration: underline;
  text-underline-offset: 6px;
}

/* 带下划线的文字链接 */
.h-link {
  text-decoration: underline;
  text-decoration-color: rgba(26, 28, 30, 0.3);
  text-underline-offset: 4px;
  transition: text-decoration-color 0.15s ease-out;
}

.h-link:hover {
  text-decoration-color: currentColor;
}

/* 首屏 */
.h-hero {
  display: grid;
  grid-template-columns: 5fr 7fr;
  align-items: center;
  gap: 24px;
  padding: 40px 0 24px;
}

.h-hero h1 {
  margin: 0;
  font-weight: 400;
}

.h-hero__name {
  display: block;
  font-family: var(--h-name);
  font-size: 72px;
  font-variation-settings: "opsz" 60;
  line-height: 1;
  letter-spacing: -0.03em;
}

.h-hero__role {
  display: block;
  margin-top: 16px;
  font-size: 19px;
  font-weight: 600;
}

.h-hero__lede {
  margin: 10px 0 0;
  color: var(--h-muted);
}

.h-facts {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 18px;
  margin: 22px 0 0;
  font-size: 14px;
}

.h-facts dt {
  color: var(--h-faint);
}

.h-facts dd {
  margin: 0;
}

.h-hero__links {
  display: flex;
  gap: 20px;
  margin-top: 22px;
  font-size: 14px;
}

/* 首屏地形：容器高度固定，3D 加载前后不改变布局 */
.hero-map {
  position: relative;
  height: 400px;
  overflow: hidden;
  overflow: clip;
  cursor: grab;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
}

.hero-map.is-dragging {
  cursor: grabbing;
}

.hero-map__canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.hero-map__pins {
  margin: 0;
  padding: 0;
  list-style: none;
}

.hero-pin {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 4px;
  font-size: 12.5px;
  white-space: nowrap;
  transition: color 0.15s ease-out;
}

.hero-pin::before {
  content: "";
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--h-ink);
  transition: transform 0.2s var(--h-ease), background-color 0.2s ease-out;
}

.hero-pin--left {
  flex-direction: row-reverse;
}

.hero-pin:hover,
.hero-pin:focus-visible {
  color: var(--h-accent);
}

.hero-pin:hover::before,
.hero-pin:focus-visible::before {
  transform: scale(1.5);
  background: var(--h-accent);
}

/* 未加载 3D（无 JS / 无 WebGL / 加载失败）：坐标显示为普通链接列表 */
.hero-map--static {
  display: flex;
  align-items: center;
  cursor: auto;
  touch-action: auto;
}

.hero-map--static .hero-map__canvas {
  display: none;
}

.hero-map--static .hero-map__pins {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 22px;
}

.hero-map--static .hero-pin {
  position: static;
}

/* 段落 */
.h-section {
  margin-top: 72px;
}

.h-section__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 20px;
}

.h-section__head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

.h-section__more {
  font-size: 13px;
  color: var(--h-muted);
  transition: color 0.15s ease-out;
}

.h-section__more:hover {
  color: var(--h-ink);
}

/* 作品条目（首页精选与作品页共用） */
.h-works {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.h-work {
  display: block;
}

.h-work__media {
  position: relative;
  aspect-ratio: 16 / 10;
  overflow: hidden;
  background: var(--h-ground-2);
}

.h-work__media::after {
  content: "";
  position: absolute;
  inset: 0;
  outline: 1px solid rgba(0, 0, 0, 0.08);
  outline-offset: -1px;
  pointer-events: none;
}

.h-work__media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s var(--h-ease);
}

.h-work:hover .h-work__media img {
  transform: scale(1.025);
}

.h-work__title {
  display: block;
  margin-top: 12px;
  font-size: 16px;
  font-weight: 600;
  transition: color 0.15s ease-out;
}

.h-work:hover .h-work__title {
  color: var(--h-accent);
}

.h-work__desc {
  margin: 4px 0 0;
  font-size: 14px;
  color: var(--h-muted);
}

.h-work__meta {
  margin-top: 8px;
  font-size: 12.5px;
  color: var(--h-faint);
}

/* 最近的文章 + 站内栏目 */
.h-duo {
  display: grid;
  grid-template-columns: 7fr 5fr;
  align-items: start;
  gap: 56px;
}

.home-article {
  display: block;
  padding: 12px 0;
}

.home-article__meta {
  display: block;
  font-size: 12.5px;
  color: var(--h-faint);
  font-variant-numeric: tabular-nums;
}

.home-article__meta span::before {
  content: "·";
  margin: 0 8px;
}

.home-article__title {
  display: block;
  margin-top: 2px;
  font-size: 16px;
  font-weight: 600;
  transition: color 0.15s ease-out;
}

.home-article:hover .home-article__title {
  color: var(--h-accent);
}

.home-article__summary {
  display: -webkit-box;
  margin-top: 2px;
  overflow: hidden;
  font-size: 14px;
  color: var(--h-muted);
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  line-clamp: 1;
}

.h-entries {
  padding: 24px 26px 18px;
  background: var(--h-ground-2);
}

.h-entries h2 {
  margin: 0 0 12px;
  font-size: 20px;
  font-weight: 600;
}

.h-entry {
  display: grid;
  grid-template-columns: 7.5em 1fr;
  gap: 14px;
  padding: 8px 0;
  font-size: 14px;
}

.h-entry b {
  font-weight: 600;
  transition: color 0.15s ease-out;
}

.h-entry span {
  color: var(--h-muted);
  text-wrap: pretty;
}

.h-entry:hover b {
  color: var(--h-accent);
}

/* 页脚 */
.h-footer {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: baseline;
  gap: 28px;
  margin-top: 88px;
  padding: 22px 0 30px;
  font-size: 13px;
  color: var(--h-faint);
}

.h-footer__name {
  font-family: var(--h-name);
  font-size: 20px;
  letter-spacing: -0.01em;
  color: var(--h-ink);
}

.h-footer__links {
  display: flex;
  gap: 18px;
}

.h-footer a {
  transition: color 0.15s ease-out;
}

.h-footer a:hover {
  color: var(--h-ink);
}

/* 作品页 */
.w-intro {
  display: grid;
  grid-template-columns: 5fr 7fr;
  align-items: end;
  gap: 24px;
  padding: 48px 0 8px;
}

.w-intro h1 {
  margin: 0;
  font-size: 40px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.w-intro p {
  max-width: 36em;
  margin: 0;
  color: var(--h-muted);
}

.w-jump {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 22px;
  margin-top: 28px;
  font-size: 14px;
  color: var(--h-muted);
}

.w-jump strong {
  font-weight: 600;
  color: var(--h-ink);
}

.w-jump a {
  transition: color 0.15s ease-out;
}

.w-jump a:hover {
  color: var(--h-ink);
}

.w-group {
  margin-top: 64px;
  scroll-margin-top: 24px;
}

.w-group__head {
  display: flex;
  align-items: baseline;
  gap: 14px;
  margin-bottom: 20px;
}

.w-group__head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 600;
}

.w-group__head span {
  font-size: 13px;
  color: var(--h-faint);
}

.w-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 40px 28px;
}

.h-work__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 16px;
  margin-top: 14px;
}

.h-work__row .h-work__title {
  margin-top: 0;
  font-size: 17px;
}

.h-work__status {
  font-size: 12.5px;
  color: var(--h-faint);
  white-space: nowrap;
}

/* 平板 */
@media (max-width: 980px) {
  .h-hero,
  .w-intro {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .hero-map {
    height: 340px;
  }

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

/* 手机 */
@media (max-width: 720px) {
  :root {
    --h-margin: 20px;
  }

  .h-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    height: auto;
    padding-top: 12px;
  }

  .h-brand {
    min-height: 44px;
  }

  .h-nav {
    width: 100%;
    gap: 22px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .h-nav::-webkit-scrollbar {
    display: none;
  }

  .h-nav a {
    padding: 12px 0;
  }

  .h-nav a:focus-visible {
    outline-offset: -2px;
  }

  .h-hero {
    padding-top: 24px;
  }

  .h-hero__name {
    font-size: 52px;
  }

  .h-hero__links a,
  .h-section__more,
  .h-footer a,
  .hero-pin,
  .w-jump a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }

  .w-jump {
    row-gap: 0;
    align-items: center;
  }

  .hero-map {
    height: 280px;
  }

  .h-works,
  .w-grid {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .h-section,
  .w-group {
    margin-top: 56px;
  }

  .h-entry {
    padding: 11px 0;
  }

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

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  .h-work__media img,
  .hero-pin::before {
    transition: none;
  }
}
