:root {
  --bg: #f3f1ec;
  --surface: #ffffffcc;
  --surface-solid: #ffffff;
  --text: #17181a;
  --brand-accent: #27886b;
  --muted: #6b6861;
  --faint: #9a968e;
  --line: #17181a14;
  --glass-tint: rgb(255 255 255 / 0.5);
  --glass-spec: 1;
  --glass-shadow: 0 10px 30px -10px rgb(0 0 0 / 0.22), 0 1px 3px rgb(0 0 0 / 0.08);
  --card-shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 14px 34px -18px rgb(0 0 0 / 0.22);
  --cover-l: 0.86;
  --cover-c: 0.07;
  --ink-l: 0.42;
  --orb-a: 0.55;
  --radius: 22px;
  --spring: linear(0, 0.21 5%, 0.64 12%, 1.03 20%, 1.19 26%, 1.23 30%, 1.2 35%, 1.07 45%, 0.98 55%, 0.96 62%, 1 76%, 1.01 88%, 1);
  color-scheme: light;
}

/* 深色：跟随系统（未强制浅色时），或 data-theme="dark" 强制 */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #101113;
    --surface: #1a1b1ecc;
    --surface-solid: #1a1b1e;
    --text: #f1efea;
    --brand-accent: #77d7b5;
    --muted: #a19d95;
    --faint: #6e6b65;
    --line: #ffffff14;
    --glass-tint: rgb(28 29 32 / 0.5);
    --glass-spec: 0.55;
    --glass-shadow: 0 12px 32px -10px rgb(0 0 0 / 0.7), 0 1px 3px rgb(0 0 0 / 0.4);
    --card-shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 18px 40px -20px rgb(0 0 0 / 0.8);
    --cover-l: 0.34;
    --cover-c: 0.06;
    --ink-l: 0.84;
    --orb-a: 0.3;
    color-scheme: dark;
  }
}

:root[data-theme='dark'] {
  --bg: #101113;
  --surface: #1a1b1ecc;
  --surface-solid: #1a1b1e;
  --text: #f1efea;
  --brand-accent: #77d7b5;
  --muted: #a19d95;
  --faint: #6e6b65;
  --line: #ffffff14;
  --glass-tint: rgb(28 29 32 / 0.5);
  --glass-spec: 0.55;
  --glass-shadow: 0 12px 32px -10px rgb(0 0 0 / 0.7), 0 1px 3px rgb(0 0 0 / 0.4);
  --card-shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 18px 40px -20px rgb(0 0 0 / 0.8);
  --cover-l: 0.34;
  --cover-c: 0.06;
  --ink-l: 0.84;
  --orb-a: 0.3;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html { background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue', Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }

.shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 0 clamp(16px, 4vw, 40px);
}

/* ---------- Ambient color field (gives the glass something to bend) ---------- */
.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.ambient i {
  position: absolute;
  width: 46vmax;
  height: 46vmax;
  border-radius: 50%;
  filter: blur(70px);
  opacity: var(--orb-a);
  animation: drift 28s ease-in-out infinite alternate;
}

.ambient i:nth-child(1) { background: oklch(0.8 0.12 162); top: -22vmax; left: -12vmax; }
.ambient i:nth-child(2) { background: oklch(0.82 0.12 32); top: -18vmax; right: -16vmax; animation-delay: -7s; }
.ambient i:nth-child(3) { background: oklch(0.8 0.1 272); top: 38vh; left: 30vw; animation-delay: -14s; }
.ambient i:nth-child(4) { background: oklch(0.86 0.1 80); bottom: -26vmax; right: 4vw; animation-delay: -21s; }

@keyframes drift {
  to { transform: translate3d(6vw, 5vh, 0) scale(1.12); }
}

/* ---------- Navigation ---------- */
.nav-wrap {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: max(12px, env(safe-area-inset-top)) clamp(12px, 3vw, 28px) 0;
  pointer-events: none;
}

/* scroll edge effect：顶栏背后的内容向上渐隐 */
.nav-wrap::before {
  content: '';
  position: absolute;
  inset: 0 0 -28px;
  z-index: -1;
  background: linear-gradient(to bottom, color-mix(in srgb, var(--bg) 72%, transparent), transparent);
}

.nav {
  pointer-events: auto;
  max-width: 1120px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 8px 8px 10px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-word {
  display: flex;
  align-items: center;
  padding: 0 4px;
  color: var(--text);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: -0.035em;
  white-space: nowrap;
  gap: 0.22em;
}

.brand-and {
  color: var(--brand-accent);
}

.nav-actions {
  display: flex;
  gap: 8px;
  min-width: 0;
}

/* 分段控件：滑块跟着选中项弹过去 */
.seg {
  position: relative;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  padding: 3px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--text) 7%, transparent);
}

.seg::before {
  content: '';
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc((100% - 6px) / 3);
  border-radius: 999px;
  background: var(--surface-solid);
  box-shadow: 0 1px 2px rgb(0 0 0 / 0.1), 0 4px 12px -4px rgb(0 0 0 / 0.2);
  transform: translateX(calc(var(--i) * 100%));
  transition: transform 0.55s var(--spring);
}

.seg button {
  position: relative;
  display: grid;
  place-items: center;
  width: 36px;
  height: 32px;
  padding: 0;
  border: 0;
  background: none;
  border-radius: 999px;
  color: var(--muted);
  transition: color 0.2s;
}

.seg button[aria-pressed='true'],
.seg button:hover { color: var(--text); }
.seg button:focus-visible { outline: 2px solid var(--text); outline-offset: -2px; }

.seg svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- Liquid glass ---------- */
.liquid-glass {
  position: relative;
  isolation: isolate;
  border-radius: 999px;
  /* 退化方案（Safari / Firefox）：没有折射，用更重的模糊 + 底色 */
  background: var(--glass-tint);
  -webkit-backdrop-filter: blur(22px) saturate(1.8);
  backdrop-filter: blur(22px) saturate(1.8);
  box-shadow: var(--glass-shadow);
}

/* Chromium：模糊、折射、色散、明暗自适应都在 SVG 滤镜里完成 */
.liquid-glass.lg-refract { background: transparent; }

.liquid-glass::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  pointer-events: none;
  background: var(--lg-spec, none) center / 100% 100% no-repeat;
  opacity: var(--glass-spec);
}

.lg-defs {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
  pointer-events: none;
}

/* ---------- Tooltip ---------- */
.tip {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 20;
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 15px;
  font-size: 13px;
  line-height: 1.4;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transform: translate(var(--x, 0), var(--y, 0)) translateY(-6px) scale(0.9);
  transform-origin: 50% 0;
  transition: opacity 0.18s, visibility 0s 0.18s, transform 0.45s var(--spring);
}

.tip.show {
  opacity: 1;
  visibility: visible;
  transform: translate(var(--x, 0), var(--y, 0));
  transition: opacity 0.18s, visibility 0s, transform 0.45s var(--spring);
}

.tip.instant { transition: none; }
.tip strong { font-weight: 600; }
.tip span { color: var(--muted); }

/* ---------- Hero ---------- */
.hero {
  padding: clamp(64px, 12vw, 128px) 0 clamp(40px, 6vw, 64px);
}

h1 {
  margin: 0;
  font-size: clamp(38px, 7.2vw, 76px);
  line-height: 1.08;
  letter-spacing: -0.035em;
  font-weight: 700;
}

/* ---------- Service grid ---------- */
.grid {
  display: grid;
  /* 主推卡片独占一行，其余为小卡片：窄屏两列，宽屏三列、五列 */
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  padding-bottom: max(56px, env(safe-area-inset-bottom));
}

.card[hidden] { display: none; }

.card {
  --accent: oklch(var(--cover-l) var(--cover-c) var(--h));
  --ink: oklch(var(--ink-l) 0.1 var(--h));
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  background: var(--surface);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  box-shadow: var(--card-shadow), inset 0 0 0 1px var(--line);
  overflow: hidden;
  transition: transform 0.5s var(--spring), box-shadow 0.3s;
}

.cover {
  position: relative;
  height: 84px;
  background:
    radial-gradient(120% 140% at 100% 0%, oklch(from var(--accent) calc(l + 0.06) calc(c + 0.04) h), transparent 60%),
    var(--accent);
  overflow: hidden;
}


.glyph {
  position: absolute;
  right: -10px;
  bottom: -20px;
  width: 100px;
  height: 100px;
  fill: none;
  stroke: var(--ink);
  stroke-width: 1.4;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: 0.55;
  transition: transform 0.7s var(--spring), opacity 0.3s;
}

/* 图标的各个部件单独动：SVG 内按自身包围盒做变换 */
.glyph * { transform-box: fill-box; }
.g-line, .g-pulse, .g-write, .g-rib { stroke-dasharray: 1; }

.body { padding: 14px 16px 0; flex: 1; }
.body > :last-child { margin-bottom: 4px; }

.card h2 {
  margin: 0;
  font-size: 17px;
  letter-spacing: -0.015em;
  line-height: 1.25;
}

.sub { margin: 2px 0 0; font-size: 13px; font-weight: 500; color: var(--ink); }

.foot {
  display: flex;
  align-items: center;
  margin: 14px 16px 0;
  padding: 10px 0 13px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}

/* ---------- 主推卡片 ---------- */
.card.feature { grid-column: 1 / -1; }
.feature .cover { height: clamp(140px, 20vw, 200px); }
.feature .glyph { right: clamp(8px, 4vw, 48px); bottom: -20px; width: clamp(150px, 22vw, 220px); height: clamp(150px, 22vw, 220px); }
.feature .body { padding: 22px 24px 0; }
.feature h2 { font-size: clamp(24px, 3.4vw, 32px); letter-spacing: -0.025em; }
.feature .sub { margin-top: 6px; font-size: clamp(15px, 1.8vw, 18px); }
.feature .foot { margin: 20px 24px 0; padding: 14px 0 18px; font-size: 12.5px; }

.domain {
  font-family: ui-monospace, 'SF Mono', 'Cascadia Mono', 'Segoe UI Mono', Consolas, 'Liberation Mono', 'DejaVu Sans Mono', Menlo, monospace;
  color: var(--faint);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition: color 0.2s;
}

@media (hover: hover) {
  .card:hover {
    transform: translateY(-4px);
    box-shadow: var(--card-shadow), 0 26px 50px -26px oklch(0.5 0.12 var(--h) / 0.55), inset 0 0 0 1px var(--line);
  }
  .card:hover .glyph { transform: scale(1.04); opacity: 0.7; }

  /* PortfolioX：折线重新画出，箭头随后弹到终点 */
  .card:hover .g-line { animation: draw 0.7s cubic-bezier(0.6, 0, 0.2, 1); }
  .card:hover .g-arrow { animation: pop-in 0.6s var(--spring) 0.45s backwards; transform-origin: 100% 0; }

  /* Layer Lab：逐层打印，自下而上落位 */
  .card:hover .g-layer { animation: print-layer 0.55s var(--spring) var(--d) backwards; }

  /* OmniServer：心电波形扫过一遍，支架轻点一下 */
  .card:hover .g-pulse { animation: draw 0.9s cubic-bezier(0.4, 0, 0.2, 1); }
  .card:hover .g-stand { animation: nudge 0.5s var(--spring); }

  /* LEGO：积木先压扁，凸点依次弹起 */
  .card:hover .g-brick { animation: squash 0.6s var(--spring); transform-origin: 50% 100%; }
  .card:hover .g-stud { animation: stud 0.7s ease-out var(--d); }

  /* Barker Campaigns：日历扣环翻动，条目一笔写出 */
  .card:hover .g-ring { animation: ring 0.6s var(--spring) var(--d); transform-origin: 50% 100%; }
  .card:hover .g-write { animation: draw 0.45s ease-out var(--d) backwards; }

  /* Seashelf（沿用拾贝自己的 logo）：贝壳在架上轻摇，贝纹依次画出 */
  .card:hover .g-shell { animation: rock 0.7s var(--spring); transform-origin: 50% 100%; }
  .card:hover .g-rib { animation: draw 0.4s ease-out var(--d) backwards; }
  .card:hover .domain { color: var(--text); }
}

.card:active { transform: scale(0.985); transition-duration: 0.2s; }
.card:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }

@keyframes draw {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}

@keyframes pop-in {
  from { opacity: 0; transform: translate(-3px, 3px) scale(0.4); }
}

@keyframes print-layer {
  from { opacity: 0; transform: translateY(-5px) scaleX(0.7); }
}

@keyframes nudge {
  40% { transform: translateY(1px); }
}

@keyframes squash {
  30% { transform: scale(1.06, 0.9); }
}

@keyframes stud {
  0%, 100% { transform: translateY(0); }
  35% { transform: translateY(-3px); }
  60% { transform: translateY(0); }
  78% { transform: translateY(-1px); }
}

@keyframes ring {
  0%, 100% { transform: none; }
  35% { transform: translateY(-1.5px) rotate(-14deg); }
  65% { transform: rotate(6deg); }
}

@keyframes rock {
  0%, 100% { transform: none; }
  30% { transform: rotate(-8deg); }
  60% { transform: rotate(4deg); }
}

/* ---------- Responsive ---------- */
@media (min-width: 760px) {
  .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
}

@media (min-width: 1040px) {
  .grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  .nav-actions { gap: 6px; }
  .brand-word { font-size: 15px; padding: 0 2px; }
}

@media (prefers-reduced-motion: reduce) {
  .ambient i, .glyph * { animation: none !important; }
  *, *::before { transition-duration: 0.01ms !important; }
}
