/* ============================================================
   layout.css — 页头、首屏、工作台面板、页脚
   ============================================================ */

/* ── 页头 ─────────────────────────────────────────────────── */

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 120;
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: clamp(18px, 3vw, 48px);
  padding-inline: var(--gutter);
  background: var(--paper);
  border-bottom: 1.5px solid transparent;
  transition: border-color 260ms var(--ease);
}

.site-header.is-scrolled {
  border-bottom-color: var(--ink);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  flex: 0 0 auto;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: var(--ink);
  transition: transform 480ms var(--ease);
}

.brand-mark svg {
  width: 100%;
  height: 100%;
}

.brand:hover .brand-mark {
  transform: rotate(90deg);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.brand-text strong {
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.06em;
}

.brand-text em {
  margin-top: 4px;
  font-family: var(--font-mono);
  font-style: normal;
  font-size: 8.5px;
  letter-spacing: 0.28em;
  color: var(--muted);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: clamp(16px, 2.2vw, 34px);
  margin-left: clamp(8px, 3vw, 52px);
}

.site-nav a {
  position: relative;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-2);
  padding: 6px 0;
}

.site-nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: var(--red);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 260ms var(--ease);
}

.site-nav a:hover::after,
.site-nav a.is-active::after {
  transform: scaleX(1);
}

.site-nav a.is-active {
  color: var(--ink);
}

.header-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
}

.version-chip {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  padding: 5px 9px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
  white-space: nowrap;
}

.scroll-progress {
  position: absolute;
  left: 0;
  bottom: -1.5px;
  height: 3px;
  width: 100%;
  background: var(--red);
  transform: scaleX(0);
  transform-origin: left center;
  will-change: transform;
}

/* ── 首屏 ─────────────────────────────────────────────────── */

.hero {
  position: relative;
  overflow: clip;
  padding-top: calc(var(--header-h) + clamp(22px, 5vh, 64px));
  padding-bottom: clamp(26px, 5vh, 58px);
  min-height: 100svh;
}

.ink-field {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  pointer-events: none;
}

.hero-grid {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='104' height='104'%3E%3Cpath d='M0 0V104' stroke='%23151410' stroke-opacity='.055' stroke-width='1'/%3E%3Cpath d='M0 0H104' stroke='%23151410' stroke-opacity='.03' stroke-width='1'/%3E%3C/svg%3E");
}

.hero-corner {
  position: absolute;
  z-index: 1;
  font-family: var(--font-mono);
  font-size: 16px;
  color: var(--line-strong);
  pointer-events: none;
}

.hero-corner--tl {
  top: calc(var(--header-h) + 10px);
  left: 16px;
}
.hero-corner--tr {
  top: calc(var(--header-h) + 10px);
  right: 16px;
}
.hero-corner--bl {
  bottom: 14px;
  left: 16px;
}
.hero-corner--br {
  bottom: 14px;
  right: 16px;
}

.hero-inner {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  column-gap: clamp(16px, 2vw, 32px);
  align-content: start;
}

.hero-eyebrow {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 13px;
  border-bottom: 1.5px solid var(--line-strong);
}

.hero-eyebrow-text {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  color: var(--muted);
  text-transform: uppercase;
  text-align: right;
}

.hero-title {
  grid-column: 1 / 7;
  margin-top: clamp(26px, 5vh, 66px);
  font-size: clamp(88px, 15.2vw, 214px);
  line-height: 0.8;
  letter-spacing: -0.075em;
  font-weight: 900;
  position: relative;
  z-index: 3;
}

.hero-line {
  display: flex;
  align-items: flex-start;
  gap: clamp(10px, 1.4vw, 22px);
}

.hero-line--indent {
  padding-left: clamp(28px, 6vw, 92px);
}

.hero-cn {
  display: block;
  white-space: nowrap;
}

.hero-cn--outline {
  color: transparent;
  -webkit-text-stroke: clamp(1.5px, 0.16vw, 2.5px) var(--ink);
  paint-order: stroke fill;
}

.hero-block {
  display: block;
  width: clamp(18px, 2.2vw, 30px);
  height: clamp(18px, 2.2vw, 30px);
  margin-top: clamp(10px, 2.4vw, 30px);
  background: var(--red);
  flex: 0 0 auto;
  animation: block-tick 7s steps(1, end) infinite;
}

.hero-lead {
  grid-column: 1 / 6;
  margin-top: clamp(22px, 3.6vh, 38px);
  font-size: clamp(15px, 1.35vw, 18px);
  line-height: 1.82;
  color: var(--ink-2);
  position: relative;
  z-index: 3;
}

.hero-lead::before {
  content: "";
  display: block;
  width: 54px;
  height: 6px;
  margin-bottom: 18px;
  background: var(--ink);
}

.hero-actions {
  grid-column: 1 / 6;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: clamp(16px, 2.4vw, 34px);
  margin-top: clamp(20px, 3vh, 34px);
  position: relative;
  z-index: 3;
}

/* ── 首屏 3D 工作台 ───────────────────────────────────────── */

.workbench-stage {
  grid-column: 7 / -1;
  grid-row: 2 / 6;
  align-self: center;
  justify-self: end;
  width: min(650px, 100%);
  min-height: 560px;
  perspective: 1600px;
  perspective-origin: 55% 45%;
  z-index: 1;
  will-change: transform;
}

.workbench {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  transform: scale(var(--wb-scale, 1)) rotateX(var(--tilt-x, 0deg)) rotateY(var(--tilt-y, 0deg));
  transform-origin: 70% 45%;
  transition: transform 520ms var(--ease);
}

.workbench.is-tracking {
  transition: transform 120ms linear;
}

.wb-panel {
  position: absolute;
  background: var(--paper-bright);
  border: 1.5px solid var(--ink);
  box-shadow: 7px 7px 0 rgba(21, 20, 16, 0.88);
  color: var(--ink);
  text-align: left;
}

.wb-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.4;
}

.wb-dot {
  width: 6px;
  height: 6px;
  background: var(--red);
  flex: 0 0 auto;
}

.wb-meta {
  margin-left: auto;
  color: rgba(240, 234, 220, 0.55);
  font-size: 9px;
}

.wb-body {
  padding: 12px;
}

.wb-msg {
  border: 1.5px solid var(--ink);
  padding: 9px 11px;
  font-size: 12px;
  line-height: 1.6;
  background: var(--paper);
}

.wb-agent {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line-strong);
}

.wb-avatar {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--paper);
  font-size: 11px;
  font-weight: 700;
}

.wb-agent-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.35;
}

.wb-agent-copy strong {
  font-size: 11.5px;
}

.wb-agent-copy small {
  font-size: 9.5px;
  color: var(--muted);
}

.wb-pulse {
  width: 7px;
  height: 7px;
  margin-left: auto;
  background: var(--red);
  animation: pulse-dot 1.6s steps(2, end) infinite;
}

.wb-tool {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  border-bottom: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-2);
}

.wb-tool:last-child {
  border-bottom: 0;
}

.wb-tool em {
  font-style: normal;
  font-size: 9px;
  padding: 1px 5px;
  border: 1px solid var(--line-strong);
  color: var(--muted);
}

.wb-tool em.is-run {
  border-color: var(--red);
  color: var(--red);
}

.wb-panel--chat {
  left: 0;
  top: 6px;
  width: 296px;
  transform: rotate(-5deg) translateZ(34px);
}

.wb-panel--editor {
  left: 232px;
  top: 168px;
  width: 342px;
  transform: rotate(2.4deg) translateZ(72px);
}

.wb-panel--editor .wb-head {
  background: var(--paper);
  color: var(--ink);
  border-bottom: 1.5px solid var(--ink);
}

.wb-panel--editor .wb-head .wb-meta {
  color: var(--muted);
}

.wb-code {
  margin: 0;
  padding: 12px 14px 14px;
  background: var(--ink);
  color: #ece5d3;
  font-size: 10.5px;
  line-height: 1.9;
  overflow: hidden;
}

.wb-code .wb-ln {
  display: inline-block;
  width: 20px;
  margin-right: 10px;
  color: rgba(213, 56, 31, 0.9);
  user-select: none;
}

.wb-panel--tasks {
  left: 52px;
  top: 366px;
  width: 274px;
  transform: rotate(-2.2deg) translateZ(12px);
}

.wb-tasks {
  padding: 4px 12px 12px;
}

.wb-tasks li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 11.5px;
}

.wb-tasks li:last-child {
  border-bottom: 0;
}

.wb-tasks i {
  width: 7px;
  height: 7px;
  border: 1.5px solid var(--ink);
  flex: 0 0 auto;
}

.wb-tasks li.is-done i {
  background: var(--ink);
}

.wb-tasks li.is-run i {
  background: var(--red);
  border-color: var(--red);
}

.wb-tasks em {
  margin-left: auto;
  font-style: normal;
  font-size: 9px;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.wb-stamp {
  position: absolute;
  right: 8px;
  top: 292px;
  padding: 8px 10px;
  border: 2px solid var(--red);
  color: var(--red);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.22em;
  line-height: 1.45;
  text-align: center;
  transform: rotate(9deg) translateZ(90px);
  background: var(--paper-bright);
}

/* ── 首屏数据条 ───────────────────────────────────────────── */

.hero-facts {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-end;
  gap: clamp(24px, 4vw, 64px);
  margin-top: clamp(34px, 7vh, 80px);
  padding-top: 16px;
  border-top: 1.5px solid var(--ink);
  position: relative;
  z-index: 4;
}

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

.hero-fact strong {
  font-family: var(--font-mono);
  font-size: clamp(22px, 2.2vw, 30px);
  line-height: 1;
  letter-spacing: -0.04em;
}

.hero-fact span {
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.hero-scroll {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.14em;
  color: var(--muted);
  white-space: nowrap;
}

.hero-scroll span {
  display: inline-block;
  margin-left: 6px;
  color: var(--red);
  animation: nudge-down 2.4s var(--ease) infinite;
}

/* ── 页脚 ─────────────────────────────────────────────────── */

.site-footer {
  border-top: 1.5px solid var(--ink);
  background: var(--paper);
  padding: clamp(40px, 6vw, 76px) 0 24px;
}

.footer-top {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: clamp(32px, 6vw, 100px);
  padding-bottom: clamp(34px, 5vw, 60px);
}

.footer-brand {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.footer-brand .brand-mark {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
}

.footer-brand strong {
  font-size: 20px;
  font-weight: 900;
  letter-spacing: 0.08em;
  display: block;
}

.footer-brand p {
  margin-top: 8px;
  max-width: 34ch;
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.8;
}

.footer-cols {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 32px;
}

.footer-cols h3 {
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.2em;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 14px;
}

.footer-cols nav {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 9px;
}

.footer-cols a {
  font-size: 13.5px;
  border-bottom: 1px solid transparent;
  transition: border-color 180ms var(--ease), color 180ms var(--ease);
}

.footer-cols a:hover {
  color: var(--red);
  border-color: var(--red);
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.footer-bottom a {
  color: var(--ink);
  border-bottom: 1px solid var(--line-strong);
}

.footer-bottom a:hover {
  color: var(--red);
  border-color: var(--red);
}

/* ── 窄幅布局 ─────────────────────────────────────────────── */

@media (max-width: 1180px) {
  .site-nav {
    gap: 18px;
  }

  .hero-title {
    grid-column: 1 / 8;
    font-size: clamp(76px, 14vw, 168px);
  }

  .hero-lead,
  .hero-actions {
    grid-column: 1 / 7;
  }

  .workbench-stage {
    grid-column: 7 / -1;
    width: min(560px, 100%);
    --wb-scale: 0.9;
  }
}

@media (max-width: 960px) {
  .site-nav {
    display: none;
  }

  .hero {
    min-height: 0;
  }

  .hero-inner {
    display: flex;
    flex-direction: column;
  }

  .hero-title {
    font-size: clamp(72px, 18vw, 150px);
    /* 单栏堆叠时两行必须分开，否则空心「不立」会压住实心「不破」 */
    line-height: 0.92;
  }

  .hero-lead {
    max-width: 46ch;
  }

  .workbench-stage {
    width: 100%;
    min-height: 540px;
    margin-top: 44px;
    perspective: 1200px;
    --wb-scale: 0.86;
  }

  .workbench {
    transform-origin: 50% 45%;
  }

  .wb-panel--chat {
    left: 2%;
  }

  .wb-panel--editor {
    left: 36%;
  }

  .wb-panel--tasks {
    left: 12%;
  }

  .hero-facts {
    flex-wrap: wrap;
    row-gap: 18px;
  }

  .hero-scroll {
    width: 100%;
    margin-left: 0;
  }

  .footer-top {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  :root {
    --header-h: 60px;
  }

  .version-chip {
    display: none;
  }

  .hero-title {
    font-size: clamp(62px, 22vw, 118px);
    line-height: 1;
  }

  .hero-line--indent {
    padding-left: 12vw;
  }

  .hero-eyebrow {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .hero-eyebrow-text {
    text-align: left;
  }

  .hero-facts {
    gap: 20px;
  }

  /* 小屏上绝对定位会互相盖住，改成顺序堆叠的卡片 */
  .workbench-stage {
    min-height: 0;
    margin-top: 34px;
    perspective: none;
  }

  .workbench {
    position: static;
    inset: auto;
    display: grid;
    gap: 14px;
    transform: none;
  }

  .wb-panel {
    position: relative;
    inset: auto;
    width: 100%;
    transform: none;
  }

  .wb-panel--chat {
    order: 1;
  }

  .wb-panel--editor {
    order: 2;
  }

  .wb-panel--tasks {
    order: 3;
  }

  .wb-stamp {
    display: none;
  }

  .footer-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
}
