/* Shared visual foundation for the Nest tool family.
   The individual site stylesheet still owns its accent and tool-specific UI. */
:root {
  --nest-ink: #111827;
  --nest-muted: #64748b;
  --nest-canvas: #f6f8fb;
  --nest-workshop: #020914;
  --nest-workshop-raised: #071320;
  --nest-workshop-text: #f8f1df;
  --nest-workshop-muted: #c0cad6;
  --nest-border: color-mix(in srgb, var(--nest-ink) 10%, transparent);
  --nest-radius-control: 8px;
  --nest-radius-card: 14px;
  --nest-shadow-card:
    0 16px 34px rgba(25, 36, 51, 0.08),
    0 2px 6px rgba(25, 36, 51, 0.06);
  --nest-shadow-hover:
    0 22px 42px rgba(25, 36, 51, 0.12),
    0 4px 10px rgba(25, 36, 51, 0.08);
  --nest-fast: 160ms;
  --nest-ease: cubic-bezier(0.16, 1, 0.3, 1);
}

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

body {
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--primary) 2.5%, transparent), transparent 420px),
    var(--bg, var(--nest-canvas));
}

h1,
h2,
h3,
h4 {
  text-wrap: balance;
}

p,
li,
dd {
  text-wrap: pretty;
}

html[lang^="zh"] body {
  font-family:
    "Microsoft YaHei UI",
    "PingFang SC",
    "Noto Sans CJK SC",
    system-ui,
    sans-serif;
}

html[lang^="zh"] h1,
html[lang^="zh"] h2,
html[lang^="zh"] h3,
html[lang^="zh"] h4 {
  letter-spacing: 0;
  line-height: 1.28;
}

html[lang^="zh"] p,
html[lang^="zh"] li {
  line-height: 1.72;
}

.site-header {
  background: color-mix(in srgb, var(--surface, #fff) 91%, transparent);
  border-bottom-color: color-mix(in srgb, var(--border, #dce3ec) 72%, transparent);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.025);
  backdrop-filter: blur(16px) saturate(130%);
  -webkit-backdrop-filter: blur(16px) saturate(130%);
}

.header-inner {
  min-height: 68px;
}

.brand {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  letter-spacing: -0.025em;
}

.brand svg {
  filter: drop-shadow(0 4px 8px color-mix(in srgb, var(--primary) 28%, transparent));
}

.main-nav a {
  border-radius: var(--nest-radius-control);
  padding: 9px 10px;
  transition:
    color var(--nest-fast) ease-out,
    background-color var(--nest-fast) ease-out;
}

.main-nav a:hover,
.main-nav a[aria-current="page"] {
  background: color-mix(in srgb, var(--primary) 9%, transparent);
  color: var(--primary);
}

.theme-toggle,
.nav-toggle {
  min-width: 44px;
  min-height: 44px;
  border-radius: var(--nest-radius-control);
}

.home-hero {
  overflow: hidden;
  padding: 0;
  text-align: left;
  background:
    linear-gradient(115deg, color-mix(in srgb, var(--primary) 16%, transparent), transparent 42%),
    linear-gradient(180deg, var(--nest-workshop-raised), var(--nest-workshop)) !important;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.home-hero-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(290px, 0.72fr);
  align-items: center;
  gap: clamp(24px, 5vw, 72px);
  min-height: 370px;
  padding-block: clamp(38px, 5vw, 56px);
}

.home-hero-copy {
  position: relative;
  z-index: 1;
  max-width: 720px;
  text-align: left;
}

.home-hero-copy h1 {
  max-width: 16ch;
  margin: 0 0 18px;
  color: var(--nest-workshop-text);
  font-size: clamp(2.35rem, 5vw, 4.25rem);
  font-weight: 780;
  letter-spacing: -0.055em;
  line-height: 0.98;
}

.home-hero-copy > p {
  max-width: 60ch;
  margin: 0;
  color: var(--nest-workshop-muted);
  font-size: clamp(1rem, 1.6vw, 1.18rem);
  line-height: 1.65;
}

html[lang^="zh"] .home-hero-copy h1 {
  max-width: 13ch;
  letter-spacing: -0.035em;
  line-height: 1.08;
}

html[lang^="zh"] .home-hero-copy > p {
  line-height: 1.8;
}

.home-hero-art {
  position: relative;
  align-self: stretch;
  min-height: 250px;
  margin: 0;
  isolation: isolate;
}

.home-hero-art::before {
  position: absolute;
  inset: 9% 4% 8% 8%;
  z-index: -1;
  border: 1px solid color-mix(in srgb, var(--primary) 30%, transparent);
  border-radius: 50%;
  content: "";
  opacity: 0.45;
}

.home-hero-art img {
  width: 100%;
  height: 100%;
  min-height: 250px;
  object-fit: contain;
  outline: none;
  mix-blend-mode: screen;
  mask-image: radial-gradient(ellipse 72% 70% at 52% 52%, #000 48%, transparent 88%);
  -webkit-mask-image: radial-gradient(ellipse 72% 70% at 52% 52%, #000 48%, transparent 88%);
  transition: transform 260ms var(--nest-ease);
}

.home-hero .search-wrap {
  width: min(100%, 610px);
  margin: 22px 0 0;
}

.home-hero-action {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 22px;
  padding-inline: 18px;
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  box-shadow: 0 12px 28px color-mix(in srgb, var(--primary) 28%, transparent);
}

.home-hero-action:hover {
  color: #fff;
  text-decoration: none;
}

#tools {
  scroll-margin-top: 88px;
}

.home-hero .search-wrap input {
  min-height: 58px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.97);
  box-shadow:
    0 16px 36px rgba(0, 0, 0, 0.2),
    0 2px 6px rgba(0, 0, 0, 0.14);
}

.section {
  margin-top: clamp(52px, 7vw, 84px);
}

.section-head {
  align-items: end;
  margin-bottom: 20px;
}

.section-head h2,
.content > h2 {
  color: var(--text, var(--nest-ink));
  font-size: clamp(1.55rem, 2.4vw, 2.15rem);
  letter-spacing: -0.035em;
}

.tool-grid {
  gap: clamp(14px, 2vw, 22px);
}

.tool-card {
  position: relative;
  min-height: 148px;
  padding: 22px;
  overflow: hidden;
  border-color: color-mix(in srgb, var(--primary) 11%, var(--border));
  border-radius: var(--nest-radius-card);
  box-shadow: var(--nest-shadow-card);
  transition:
    transform var(--nest-fast) var(--nest-ease),
    box-shadow var(--nest-fast) var(--nest-ease),
    border-color var(--nest-fast) ease-out;
}

.tool-card::after {
  position: absolute;
  right: -28px;
  bottom: -38px;
  width: 112px;
  height: 112px;
  border: 1px solid color-mix(in srgb, var(--primary) 22%, transparent);
  border-radius: 50%;
  content: "";
  pointer-events: none;
}

.tool-card .emoji {
  display: none;
}

.tool-card > a {
  position: relative;
  z-index: 1;
  display: inline-block;
  font-size: 1.08rem;
  letter-spacing: -0.018em;
}

.tool-card > a::after {
  position: absolute;
  z-index: 2;
  inset: -22px;
  content: "";
}

.tool-card:focus-within {
  border-color: var(--primary);
  outline: 3px solid color-mix(in srgb, var(--primary) 24%, transparent);
  outline-offset: 3px;
}

.tool-card p {
  position: relative;
  z-index: 1;
  color: var(--muted, var(--nest-muted));
}

.card {
  border-color: color-mix(in srgb, var(--primary) 11%, var(--border));
  border-radius: var(--nest-radius-card);
  box-shadow: var(--nest-shadow-card);
}

.btn {
  min-height: 44px;
  border-radius: var(--nest-radius-control);
  font-weight: 720;
}

:where(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select) {
  min-height: 44px;
}

.preset-chips :where(a, button) {
  min-height: 44px;
}

input,
textarea,
select {
  border-radius: var(--nest-radius-control);
}

.result.is-invalid {
  border-top-color: var(--danger, #dc2626);
}

.result.is-invalid .error-msg {
  margin: 0;
  padding: 12px 14px;
  border-radius: var(--nest-radius-control);
  background: color-mix(in srgb, var(--danger, #dc2626) 9%, transparent);
}

:where(a, button, input, textarea, select, summary):focus-visible {
  outline: 3px solid color-mix(in srgb, var(--primary) 62%, white);
  outline-offset: 3px;
}

.site-footer {
  margin-top: clamp(68px, 9vw, 112px);
}

.language-switch button {
  min-width: 44px !important;
  min-height: 44px !important;
}

.language-note {
  margin: 20px 0 0;
  padding: 12px 14px;
  border-inline-start: 3px solid var(--primary);
  background: color-mix(in srgb, var(--primary) 7%, transparent);
  color: var(--muted, var(--nest-muted));
  font-size: 0.9rem;
}

@media (hover: hover) and (pointer: fine) {
  .home-hero-art:hover img {
    transform: translateY(-4px) scale(1.025);
  }

  .tool-card:hover {
    transform: translateY(-3px);
    border-color: color-mix(in srgb, var(--primary) 34%, var(--border));
    box-shadow: var(--nest-shadow-hover);
  }
}

@media (max-width: 820px) {
  .header-inner {
    min-height: 64px;
  }

  .home-hero-layout {
    grid-template-columns: 1fr;
    gap: 16px;
    min-height: auto;
    padding-block: 40px 28px;
  }

  .home-hero-copy {
    max-width: none;
  }

  .home-hero-copy h1 {
    max-width: 14ch;
    font-size: clamp(2.25rem, 11vw, 3.75rem);
  }

  .home-hero-art {
    min-height: 170px;
    max-height: 220px;
  }

  .home-hero-art img {
    min-height: 170px;
    max-height: 220px;
  }

  .tool-card {
    min-height: 0;
  }
}

@media (max-width: 560px) {
  .home-hero-layout {
    padding-block: 32px 20px;
  }

  .home-hero-copy h1 {
    font-size: clamp(2.1rem, 12vw, 3.05rem);
  }

  .home-hero-copy > p {
    font-size: 1rem;
  }

  .home-hero-art {
    min-height: 145px;
  }

  .home-hero-art img {
    min-height: 145px;
    max-height: 175px;
  }

  .tool-grid {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tool-card,
  .main-nav a,
  .home-hero-art img {
    transition: none;
  }

  .tool-card:hover {
    transform: none;
  }
}
