:root {
  --bg: #f3efe6;
  --bg-2: #e7e1d4;
  --paper: #fbf8f1;
  --ink: #1c1d19;
  --muted: #5f645b;
  --line: #d8d1c3;
  --copper: #c45c26;
  --copper-dark: #9a4318;
  --moss: #2f5d45;
  --moss-soft: #dce8df;
  --chip: #ece6d8;
  --shadow: 0 18px 40px rgba(28, 29, 25, 0.08);
  --radius: 18px;
  --max: 1120px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #efe4cf 0%, transparent 55%),
    linear-gradient(180deg, var(--bg) 0%, #efebe3 100%);
  font-family: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Source Han Sans SC", "Microsoft YaHei", system-ui, sans-serif;
  line-height: 1.65;
  min-height: 100vh;
}
img { max-width: 100%; height: auto; display: block; }
a { color: var(--copper-dark); text-underline-offset: 3px; }
a:hover { color: var(--copper); }
code, pre {
  font-family: ui-monospace, "SFMono-Regular", "Sarasa Mono SC", Menlo, Consolas, monospace;
  font-size: 0.92em;
}
pre {
  background: #1c1d19;
  color: #f3efe6;
  padding: 16px 18px;
  border-radius: 12px;
  overflow: auto;
}
code {
  background: var(--chip);
  padding: 0.1em 0.4em;
  border-radius: 6px;
}
pre code { background: none; padding: 0; color: inherit; }

.skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  background: var(--ink);
  color: #fff;
  padding: 8px 12px;
}
.skip-link:focus { left: 8px; }

.wrap {
  width: min(var(--max), calc(100% - 40px));
  margin: 0 auto;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(243, 239, 230, 0.88);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex;
  align-items: center;
  min-height: 68px;
  gap: 12px;
  width: calc(100% - 48px);
  max-width: none;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: auto;
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  letter-spacing: 0.02em;
}
.brand-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  display: block;
  background: #fff;
  border-radius: 8px;
}
.brand-name { font-size: 1.05rem; }
.nav-toggle {
  display: none;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  cursor: pointer;
}
.site-nav .menu {
  display: flex;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}
.site-nav a {
  display: block;
  padding: 8px 12px;
  text-decoration: none;
  color: var(--ink);
  border-radius: 999px;
  font-size: 0.95rem;
}
.site-nav .menu > li > a:hover,
.site-nav .menu > .current-menu-item > a {
  background: var(--ink);
  color: var(--paper);
}
.site-nav .has-sub {
  position: relative;
}
.site-nav .has-sub > a::after {
  content: "▾";
  margin-left: 5px;
  font-size: 0.68em;
  opacity: 0.7;
}
.product-menu {
  list-style: none;
  margin: 0;
  padding: 8px 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  min-width: 260px;
}
.product-menu a {
  display: block;
  padding: 8px 16px;
  text-decoration: none;
  color: var(--ink);
  border-radius: 0;
  font-size: 0.92rem;
}
.product-menu a:hover,
.product-menu a[aria-current="page"] {
  background: var(--bg-2);
  color: var(--ink);
}
.product-menu .sub-label {
  padding: 10px 16px 4px;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.site-nav .product-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  z-index: 30;
}
.site-nav .has-sub::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 8px;
}
.site-nav .has-sub:hover > .product-menu,
.site-nav .has-sub:focus-within > .product-menu {
  display: block;
}

.header-links {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-left: 12px;
  margin-left: 4px;
  border-left: 1px solid var(--line);
}
.header-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
}
.header-link svg {
  width: 18px;
  height: 18px;
  display: block;
}
.header-link:hover {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.header-link.is-taobao {
  color: #ff5000;
  border-color: #ffd0bf;
}
.header-link.is-taobao:hover {
  background: #ff5000;
  color: #fff;
  border-color: #ff5000;
}
.header-link.is-github:hover {
  background: #24292f;
  border-color: #24292f;
  color: #fff;
}
.lang-switch {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}
.lang-switch a {
  text-decoration: none;
  color: var(--muted);
  padding: 4px 2px;
}
.lang-switch a:hover,
.lang-switch a.is-active {
  color: var(--ink);
}
.lang-switch a.is-active {
  pointer-events: none;
}
.mail-pop { position: relative; }
.mail-pop summary {
  list-style: none;
  cursor: pointer;
}
.mail-pop summary::-webkit-details-marker { display: none; }
.mail-pop[open] .header-link.is-mail {
  background: var(--ink);
  color: var(--paper);
  border-color: var(--ink);
}
.mail-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(280px, calc(100vw - 32px));
  padding: 14px 16px 16px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  z-index: 40;
}
.mail-kicker {
  margin: 0 0 6px;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.mail-addr {
  margin: 0 0 12px;
  font-weight: 700;
  word-break: break-all;
  user-select: all;
}
.mail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.mail-actions .btn {
  padding: 8px 12px;
  font-size: 0.88rem;
}

.hero {
  padding: 72px 0 40px;
}

.showcase {
  position: relative;
  height: min(480px, calc(100svh - 72px));
  min-height: 300px;
  background: #141512;
  overflow: hidden;
  color: #f6f3ec;
}
.showcase-slide {
  display: none;
  height: 100%;
  position: relative;
}
.showcase-slide.is-active {
  display: grid;
  grid-template-columns: minmax(240px, 0.85fr) minmax(0, 1.15fr);
  align-items: stretch;
}
.showcase-slide > picture {
  display: block;
  height: 100%;
  min-height: 0;
  min-width: 0;
  background: #1b1c18;
}
.showcase-image {
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: 100%;
  min-height: 0;
  object-fit: contain;
  object-position: center;
  background: #1b1c18;
  padding: 16px 20px 36px 8px;
}
.showcase-copy {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 28px 8px 40px 48px;
  order: -1;
}
.showcase-copy .kicker {
  color: #9fd0b4;
}
.showcase-copy h1 {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  line-height: 1.2;
  margin: 8px 0 12px;
  letter-spacing: -0.03em;
  max-width: 10ch;
  color: #f6f3ec;
}
.showcase-copy .lede {
  color: #c9c4b8;
  max-width: 34rem;
  font-size: 0.98rem;
}
.showcase-copy .hero-actions {
  margin-top: 18px;
}
.showcase-copy .btn-ghost {
  border-color: rgba(246, 243, 236, 0.28);
  color: #f6f3ec;
}
.showcase-copy .btn-ghost:hover {
  border-color: #f6f3ec;
  color: #f6f3ec;
}
html[lang="en"] .showcase-copy {
  padding: 22px 8px 44px 36px;
}
html[lang="en"] .showcase-copy h1 {
  max-width: none;
  font-size: clamp(1.45rem, 2.6vw, 2.15rem);
  margin: 6px 0 8px;
}
html[lang="en"] .showcase-copy .lede {
  font-size: 0.9rem;
  line-height: 1.5;
}
html[lang="en"] .showcase-copy .hero-actions {
  margin-top: 14px;
}
html[lang="en"] .showcase-copy .btn {
  padding: 8px 14px;
  font-size: 0.9rem;
}
.showcase-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  width: 44px;
  height: 44px;
  border: 0;
  border-radius: 999px;
  background: rgba(246, 243, 236, 0.12);
  color: #f6f3ec;
  font-size: 1.6rem;
  cursor: pointer;
}
.showcase-prev { left: 16px; }
.showcase-next { right: 16px; }
.showcase-nav:hover { background: rgba(246, 243, 236, 0.24); }
.showcase-dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 18px;
  display: flex;
  justify-content: center;
  gap: 8px;
  z-index: 2;
}
.showcase-dot {
  width: 8px;
  height: 8px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: rgba(246, 243, 236, 0.35);
  cursor: pointer;
}
.showcase-dot.is-active { background: #f6f3ec; width: 22px; }
.kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--moss);
  font-weight: 700;
}
.hero h1 {
  font-size: clamp(2.1rem, 4.6vw, 3.5rem);
  line-height: 1.15;
  margin: 12px 0 16px;
  letter-spacing: -0.03em;
  max-width: 12ch;
}
.lede {
  max-width: 42rem;
  color: var(--muted);
  font-size: 1.08rem;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 18px;
  border-radius: 999px;
  text-decoration: none;
  font-weight: 650;
  border: 1px solid transparent;
}
.btn-primary {
  background: var(--ink);
  color: var(--paper);
}
.btn-primary:hover { background: #000; color: #fff; }
.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}
.btn-ghost:hover { border-color: var(--ink); color: var(--ink); }
.btn-copper {
  background: var(--copper);
  color: #fff;
}
.btn-copper:hover { background: var(--copper-dark); color: #fff; }

.section { padding: 28px 0 56px; }
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 22px;
}
.section-head h2 {
  margin: 0;
  font-size: 1.55rem;
  letter-spacing: -0.03em;
}
.section-head p { margin: 0; color: var(--muted); }

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 100%;
  text-decoration: none;
  color: inherit;
}
a.card:hover {
  transform: translateY(-2px);
  border-color: #c9bca6;
}
.card h3 {
  margin: 8px 0 8px;
  font-size: 1.18rem;
  letter-spacing: -0.02em;
}
.card p { margin: 0; color: var(--muted); flex: 1; }
.product-group + .product-group { margin-top: 32px; }
.group-title {
  margin: 0 0 14px;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}
.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 16px;
}
.chip {
  background: var(--chip);
  color: var(--ink);
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.78rem;
  font-weight: 650;
}
.chip-moss { background: var(--moss-soft); color: var(--moss); }
.chip-copper { background: #f3ddd0; color: var(--copper-dark); }

.page-hero {
  padding: 48px 0 12px;
}
.page-hero h1 {
  margin: 8px 0 8px;
  font-size: clamp(1.8rem, 3.5vw, 2.6rem);
  letter-spacing: -0.03em;
}
.crumb-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}
.crumb-link {
  text-decoration: none;
}
.crumb-link:hover { color: var(--copper-dark); }
.crumb-sep { color: var(--muted); }
.crumb-current { color: var(--moss); font-weight: 700; }
.product-switch {
  position: relative;
}
.product-switch summary {
  cursor: pointer;
  list-style: none;
  color: var(--moss);
  font-weight: 700;
  font-size: 0.95rem;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper);
}
.product-switch summary::-webkit-details-marker { display: none; }
.product-switch summary::after {
  content: " ▾";
  font-size: 0.75em;
  opacity: 0.7;
}
.product-switch .product-menu {
  position: absolute;
  left: 0;
  top: calc(100% + 6px);
  z-index: 15;
}

.product-layout,
.article-layout {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr;
  gap: 28px;
  padding-bottom: 64px;
}
.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
}
.panel h1 { margin-top: 0; letter-spacing: -0.03em; }
.prose :where(h2, h3) { letter-spacing: -0.02em; margin-top: 1.6em; }
.prose :where(p, ul, ol) { color: #3a3d37; }
.prose ul, .prose ol { padding-left: 1.2em; }
.thumb {
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 20px;
  background:
    linear-gradient(135deg, #1c1d19 0%, #3d4f43 48%, #c45c26 100%);
  min-height: 180px;
}
.thumb img { width: 100%; object-fit: cover; max-height: 320px; }
.spec-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.spec-list li {
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.95rem;
}
.spec-list span { color: var(--muted); }
.side-card h2 {
  font-size: 1rem;
  margin: 0 0 12px;
}
.side-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.side-list a {
  display: block;
  padding: 8px 0;
  text-decoration: none;
  color: var(--ink);
  border-bottom: 1px solid var(--line);
}
.side-list a:hover { color: var(--copper-dark); }
.stack { display: grid; gap: 16px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
button.btn {
  font: inherit;
  cursor: pointer;
  appearance: none;
}
esp-web-install-button {
  display: inline-flex;
  align-items: center;
}
esp-web-install-button[install-unsupported] {
  color: var(--muted);
  font-size: 0.92rem;
}
.flash-tool {
  margin: 18px 0 22px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}
.flash-tool-lead {
  margin: 0 0 14px;
  color: var(--muted);
}
.flash-tool-actions {
  margin-top: 0;
}
.firmware-pack {
  margin-top: 28px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}
.firmware-pack .firmware-model {
  margin: 0.9em 0 0.25em;
  font-weight: 650;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 28px 0 40px;
  background: #ebe6db;
}
.footer-inner {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: start;
}
.footer-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}
.footer-nav a { text-decoration: none; color: var(--ink); }
.muted { color: var(--muted); }

.search-box {
  margin: 18px 0 8px;
}
.search-box input[type="search"] {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 999px;
  padding: 10px 16px;
  font: inherit;
}

.empty {
  padding: 28px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,0.4);
}

.prose img {
  border-radius: 12px;
  margin: 1rem 0;
}
.gallery {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 16px 0 4px;
}
.gallery img {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--chip);
}
.video-list {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}
.video-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}
.video-card iframe,
.video-card video {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  background: #1c1d19;
}
.video-card .video-meta {
  padding: 10px 12px;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.9rem;
}
.hint {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 8px;
}
.prose a[href^="mailto:"] {
  font-weight: 650;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}
.prose a[href^="mailto:"]:hover {
  border-bottom-color: var(--copper);
}

.cap-grid {
  grid-template-columns: repeat(4, 1fr);
}
.cap-card {
  box-shadow: none;
}
.cap-card h3 {
  margin-top: 0;
}
.contact-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.contact-banner h2 {
  margin: 0 0 6px;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}
.contact-banner p {
  margin: 0;
}
#contact {
  scroll-margin-top: 84px;
}

@media (max-width: 880px) {
  .grid { grid-template-columns: 1fr; }
  .product-layout,
  .article-layout { grid-template-columns: 1fr; }
  .nav-toggle { display: inline-flex; }
  .header-links .header-link { width: 34px; height: 34px; }
  .header-link svg { width: 16px; height: 16px; }
  .site-nav {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 68px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    padding: 8px 20px 16px;
  }
  .site-nav.is-open { display: block; }
  .site-nav .menu { flex-direction: column; }
  .site-nav .has-sub::after { display: none; }
  .site-nav .has-sub > .product-menu {
    display: block;
    position: static;
    border: 0;
    box-shadow: none;
    background: transparent;
    padding: 4px 0 8px 8px;
    min-width: 0;
  }
  .site-nav .product-menu a { border-radius: 8px; }
  .footer-inner { flex-direction: column; }
  .hero { padding-top: 40px; }
  .cap-grid { grid-template-columns: 1fr 1fr; }
  .showcase {
    height: auto;
    max-height: none;
    min-height: 0;
  }
  .showcase-slide.is-active { grid-template-columns: 1fr; }
  .showcase-slide > picture {
    height: min(240px, 42vh);
  }
  .showcase-copy { order: 0; padding: 20px 0 48px; }
  .showcase-image { height: 100%; padding: 8px 16px 0; }
}
@media (max-width: 560px) {
  .cap-grid { grid-template-columns: 1fr; }
}
