/* Shared base stylesheet — layout, components, a11y.
   Theme files (theme-c / theme-d) override CSS variables and light polish only. */

/* -------------------------------------------------------------------------- */
/* 1. CSS variables (defaults; themes may override)                           */
/* -------------------------------------------------------------------------- */

:root {
  --bg: #fafaf9;
  --bg-elevated: #ffffff;
  --text: #1c1917;
  --text-muted: #78716c;
  --border: #e7e5e4;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --accent: #f97316;
  --radius: 12px;
  --radius-lg: 20px;
  --shadow: 0 1px 2px rgb(0 0 0 / 4%);
  --font: system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei",
    sans-serif;
  --font-display: var(--font);
  --max: 1100px;
  --header-h: 64px;
  --space-section: clamp(4rem, 8vw, 6rem);
  --focus-ring: 2px solid var(--primary);
  --focus-offset: 2px;
  --transition: 0.2s ease;
}

/* -------------------------------------------------------------------------- */
/* 2. Reset & base                                                            */
/* -------------------------------------------------------------------------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: var(--header-h);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--bg);
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--primary);
  text-decoration: none;
  transition: color var(--transition);
}

a:hover {
  color: var(--primary-hover);
}

:focus-visible {
  outline: var(--focus-ring);
  outline-offset: var(--focus-offset);
}

h1,
h2,
h3,
h4,
p {
  margin-block: 0;
}

ul,
ol {
  margin: 0;
  padding: 0;
  list-style: none;
}

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

/* -------------------------------------------------------------------------- */
/* 3. Layout utilities                                                        */
/* -------------------------------------------------------------------------- */

.container {
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: 1.25rem;
}

.section {
  padding-block: var(--space-section);
}

.section__head {
  margin-bottom: clamp(1.75rem, 4vw, 2.5rem);
  max-width: 40rem;
}

.section__eyebrow {
  display: inline-block;
  margin-bottom: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.section__title {
  font-family: var(--font-display);
  font-size: clamp(1.75rem, 3.5vw, 2.25rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  color: var(--text);
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

@media (max-width: 768px) {
  .grid-3,
  .grid-2 {
    grid-template-columns: 1fr;
  }
}

/* -------------------------------------------------------------------------- */
/* 4. Navigation                                                              */
/* -------------------------------------------------------------------------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  background-color: color-mix(in srgb, var(--bg) 92%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  min-height: var(--header-h);
}

.nav__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
  white-space: nowrap;
  text-decoration: none;
}

.nav__brand:hover {
  color: var(--text);
}

.nav__brand img {
  width: 32px;
  height: 32px;
  border-radius: 999px;
  object-fit: cover;
  flex-shrink: 0;
}

.nav__links {
  display: flex;
  flex: 1;
  min-width: 0;
  align-items: center;
  gap: 0.25rem 1.25rem;
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.nav__links::-webkit-scrollbar {
  display: none;
}

.nav__links a {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  padding-block: 0.25rem;
}

.nav__links a:hover,
.nav__links a[aria-current="page"] {
  color: var(--text);
}

.nav__theme-switch {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
  margin-left: 0.5rem;
  padding: 0.35rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elevated);
  text-decoration: none;
  white-space: nowrap;
  transition:
    color var(--transition),
    border-color var(--transition),
    background-color var(--transition);
}

.nav__theme-switch:hover {
  color: var(--text);
  border-color: color-mix(in srgb, var(--border) 60%, var(--text-muted));
}

@media (max-width: 640px) {
  .nav {
    gap: 0.5rem;
  }

  .nav__links {
    gap: 0.15rem 0.85rem;
  }

  .nav__links a {
    font-size: 0.8125rem;
  }

  .nav__theme-switch {
    padding: 0.3rem 0.55rem;
    font-size: 0.7rem;
  }
}

/* -------------------------------------------------------------------------- */
/* 5. Hero                                                                    */
/* -------------------------------------------------------------------------- */

.hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: clamp(1.5rem, 4vw, 2.5rem);
  align-items: center;
  padding-block: clamp(3rem, 8vw, 5rem);
}

.hero__identity {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.hero__avatar {
  width: clamp(96px, 16vw, 140px);
  height: clamp(96px, 16vw, 140px);
  border-radius: 999px;
  object-fit: cover;
  border: 3px solid var(--bg-elevated);
  box-shadow: var(--shadow);
  background: var(--border);
}

.hero__role {
  display: inline-block;
  margin-bottom: 0.65rem;
  padding: 0.25rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  border-radius: 999px;
}

.hero__title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 0.75rem;
  color: var(--text);
}

.hero__subtitle {
  font-family: var(--font-display);
  font-size: clamp(1.125rem, 2.4vw, 1.375rem);
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.hero__lead {
  max-width: 36rem;
  font-size: clamp(1rem, 2vw, 1.125rem);
  line-height: 1.7;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

@media (max-width: 640px) {
  .hero {
    grid-template-columns: 1fr;
    justify-items: start;
    text-align: left;
  }
}

/* 现在（NOW）状态条 */
.now-strip {
  display: flex;
  align-items: center;
  gap: 0.75rem 1rem;
  flex-wrap: wrap;
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius);
  background: var(--bg-elevated);
  box-shadow: var(--shadow);
}

.now-strip__label {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary);
}

.now-strip__text {
  flex: 1;
  min-width: 200px;
  margin: 0;
  color: var(--text);
}

.now-strip__link {
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
}

/* -------------------------------------------------------------------------- */
/* 6. Cards (about / capability)                                              */
/* -------------------------------------------------------------------------- */

.card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  height: 100%;
  padding: 1.35rem 1.25rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition:
    border-color var(--transition),
    box-shadow var(--transition),
    transform var(--transition);
}

.card:hover {
  border-color: color-mix(in srgb, var(--border) 50%, var(--text-muted));
}

.card__icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  font-size: 1.25rem;
  line-height: 1;
  border-radius: calc(var(--radius) - 2px);
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  color: var(--primary);
}

.card__title {
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
}

.card__body {
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--text-muted);
}

/* -------------------------------------------------------------------------- */
/* 7. Work cards                                                              */
/* -------------------------------------------------------------------------- */

.work-card {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 1.5rem;
  align-items: center;
  padding: 1.25rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  transition:
    border-color var(--transition),
    box-shadow var(--transition),
    transform var(--transition);
}

.work-card + .work-card {
  margin-top: 1.25rem;
}

.work-card:hover {
  border-color: color-mix(in srgb, var(--border) 50%, var(--text-muted));
}

.work-card__badge {
  display: inline-block;
  margin-bottom: 0.65rem;
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-radius: 999px;
}

.work-card h3,
.work-card__title {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.5rem;
  color: var(--text);
}

.work-card p,
.work-card__desc {
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
}

.work-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.85rem;
  margin-bottom: 1rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.work-card__meta span {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.work-card__meta span::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: var(--border);
}

.work-card__meta span:first-child::before {
  display: none;
}

.work-card__gallery {
  border-radius: calc(var(--radius-lg) - 4px);
  overflow: hidden;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--border) 40%, var(--bg));
  aspect-ratio: 16 / 10;
}

.work-card__gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.work-card__link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
  font-weight: 600;
}

@media (max-width: 768px) {
  .work-card {
    grid-template-columns: 1fr;
  }

  .work-card__gallery {
    order: -1;
  }
}

/* 作品条目（卡片式：一个产品一张卡片） */
.work-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1.25rem 2rem;
  align-items: center;
  padding: clamp(1.25rem, 3vw, 2rem);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.work-entry + .work-entry {
  margin-top: 1.25rem;
}

.work-entry__num {
  font-size: 0.875rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.work-entry__head {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.work-entry__name {
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text);
}

.work-entry__badge {
  display: inline-block;
  padding: 0.15rem 0.55rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-radius: 999px;
}

.work-entry__status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.work-entry__dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--primary);
}

.work-entry__desc {
  max-width: 42rem;
  margin-top: 0.4rem;
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--text-muted);
}

.work-entry__meta {
  display: grid;
  gap: 0.4rem;
  margin-top: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.work-entry__link {
  display: inline-block;
  margin-top: 0.8rem;
  font-size: 0.9rem;
  font-weight: 600;
}

.work-entry__gallery {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: flex-end;
  gap: 0.75rem;
  max-width: 520px;
}

.work-entry__gallery img {
  height: auto;
  width: auto;
  max-height: 480px;
  max-width: 260px;
  object-fit: contain;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
}

/* 横屏截图（网页类作品）：卡片单列，截图全宽铺开 */
.work-entry--landscape {
  grid-template-columns: 1fr;
  gap: 1.25rem 0;
}

.work-entry--landscape .work-entry__gallery {
  grid-column: 1;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  justify-content: initial;
  max-width: none;
  width: 100%;
}

.work-entry--landscape .work-entry__gallery img {
  width: 100%;
  height: auto;
  max-width: none;
  max-height: none;
}

@media (max-width: 640px) {
  .work-entry {
    grid-template-columns: 1fr;
    gap: 1rem;
    align-items: start;
  }

  .work-entry__gallery {
    justify-content: flex-start;
    max-width: none;
  }

  .work-entry__gallery img {
    max-height: 320px;
    max-width: 220px;
  }

  .work-entry--landscape .work-entry__gallery {
    grid-template-columns: 1fr 1fr;
  }
}

/* -------------------------------------------------------------------------- */
/* 8. Process steps                                                           */
/* -------------------------------------------------------------------------- */

.step {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  height: 100%;
  padding: 1.25rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.step__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, transparent);
  border-radius: 999px;
}

.step h3,
.step__title {
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text);
}

.step p,
.step__body {
  font-size: 0.9375rem;
  line-height: 1.65;
  color: var(--text-muted);
}

/* -------------------------------------------------------------------------- */
/* 9. Contact                                                                 */
/* -------------------------------------------------------------------------- */

.contact-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(1.5rem, 4vw, 2.5rem);
  align-items: center;
  padding: clamp(1.5rem, 3vw, 2rem);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.contact-panel p {
  color: var(--text-muted);
  margin-bottom: 1rem;
  max-width: 36rem;
}

.contact-panel__links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1.25rem;
  margin-bottom: 0.5rem;
}

.contact-panel__links a {
  font-weight: 600;
  font-size: 0.95rem;
}

.contact-qr {
  width: 140px;
  height: 140px;
  padding: 0.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  object-fit: contain;
}

.contact-qr img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

@media (max-width: 640px) {
  .contact-panel {
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .contact-qr {
    width: 120px;
    height: 120px;
  }
}

/* -------------------------------------------------------------------------- */
/* 10. Buttons                                                                */
/* -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.75rem;
  padding: 0.65rem 1.25rem;
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: pointer;
  transition:
    background-color var(--transition),
    color var(--transition),
    border-color var(--transition),
    box-shadow var(--transition),
    transform var(--transition);
}

.btn--primary {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
  box-shadow: var(--shadow);
}

.btn--primary:hover {
  color: #fff;
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.btn--ghost {
  color: var(--text);
  background: transparent;
  border-color: var(--border);
}

.btn--ghost:hover {
  color: var(--text);
  background: var(--bg-elevated);
  border-color: color-mix(in srgb, var(--border) 50%, var(--text-muted));
}

/* -------------------------------------------------------------------------- */
/* 11. Footer                                                                 */
/* -------------------------------------------------------------------------- */

.site-footer {
  padding-block: 2rem;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.875rem;
  text-align: center;
}

.site-footer p {
  margin-block: 0;
}

.site-footer a {
  color: var(--text-muted);
}

.site-footer a:hover {
  color: var(--text);
}

/* -------------------------------------------------------------------------- */
/* 12. Accessibility & motion                                                 */
/* -------------------------------------------------------------------------- */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
