/* 柚子AI工坊 — shared tokens, base type, layout primitives, nav and footer.
 *
 * Scaling: desktop sizes are all rem, and the root size grows with the viewport
 * (16px up to ~1930px wide, 22px max), so 2560 screens get a proportionally larger
 * page instead of a narrow strip. Phones (<768px) pin the root at 16px.
 * Stick to features old Android WeChat WebViews support (see test_css_avoids_fragile_features).
 * No `gap` on flex containers (X5 kernels < Chrome 84 ignore it): space flex children with
 * margins; `gap` is only for grids (see test_css_avoids_flex_gap).
 */

:root {
  --bg: #FFFCF5;
  --line: #F1E8D6;
  --line-2: #EFE6D4;
  --ink: #1a1a1a;
  --muted: #666;
  --accent: #FFD66B;
  --accent-2: #FFC23D;
  --shot: #F7F2E8;
  --white: #fff;
  --radius: 0.5rem;
  --radius-card: 0.625rem;
  --nav-h: 4rem;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Noto Sans CJK SC", "Noto Sans SC", "Helvetica Neue", Arial, sans-serif;
}

/* ---------- base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px; /* fallback for browsers without clamp() */
  font-size: clamp(16px, 0.83vw, 22px);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

main {
  flex: 1 0 auto;
}

img,
svg {
  max-width: 100%;
}

img {
  height: auto;
}

a {
  color: inherit;
}

button {
  font: inherit;
  color: inherit;
}

h1,
h2,
h3,
h4 {
  margin: 0 0 0.75rem;
  line-height: 1.3;
  font-weight: 800;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 3.25rem;
  line-height: 1.25;
}

h2 {
  font-size: 2rem;
}

h3 {
  font-size: 1.375rem;
}

p {
  margin: 0 0 1rem;
}

/* Yellow brush stroke under the key words of a headline. */
mark {
  background: linear-gradient(transparent 60%, var(--accent) 60%);
  color: inherit;
  padding: 0 0.1em;
}

:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* ---------- layout primitives ---------- */

.container {
  width: 88vw; /* fallback for browsers without min() */
  max-width: 90rem;
  width: min(88vw, 90rem);
  margin-left: auto;
  margin-right: auto;
}

.section {
  padding: 5rem 0;
}

.section__title {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 1.5rem;
}

.eyebrow {
  display: block;
  margin-bottom: 0.75rem;
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.muted {
  color: var(--muted);
}

.card {
  background: var(--white);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-card);
  overflow: hidden;
}

.icon {
  display: inline-block;
  width: 1.25em;
  height: 1.25em;
  flex-shrink: 0;
  vertical-align: -0.25em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  padding: 0 1.25rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

/* Icons inside a button trail the label; add .icon--lead for one in front. */
.btn > .icon {
  margin-left: 0.5rem;
}

.btn > .icon--lead {
  margin-left: 0;
  margin-right: 0.5rem;
}

.btn--primary {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--white);
}

.btn--primary:hover {
  background: #333;
  border-color: #333;
}

.btn--ghost {
  background: transparent;
  border-color: var(--line-2);
  color: var(--ink);
}

.btn--ghost:hover {
  border-color: var(--ink);
}

/* ---------- nav ---------- */

.site-nav {
  position: -webkit-sticky;
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.site-nav__inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--nav-h);
}

.nav-brand {
  display: inline-flex;
  align-items: center;
  font-size: 1.125rem;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.nav-brand img {
  width: 1.875rem;
  height: 1.875rem;
  margin-right: 0.625rem;
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  margin-right: -0.625rem;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.nav-toggle .icon {
  width: 1.5rem;
  height: 1.5rem;
}

.nav-toggle .icon-close,
.nav-toggle[aria-expanded="true"] .icon-menu {
  display: none;
}

.nav-toggle[aria-expanded="true"] .icon-close {
  display: inline-block;
}

.nav-menu ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-menu__list {
  display: flex;
  align-items: center;
}

.nav-menu__list > li + li {
  margin-left: 0.5rem;
}

.nav-link,
.nav-dropdown__toggle {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 0.875rem;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: #444;
  font-size: 0.9375rem;
  line-height: 1.5;
  text-decoration: none;
  cursor: pointer;
}

.nav-link:hover,
.nav-dropdown__toggle:hover,
.nav-link[aria-current="page"] {
  color: var(--ink);
}

.nav-link[aria-current="page"] {
  font-weight: 600;
}

.nav-dropdown {
  position: relative;
}

.nav-dropdown__toggle .icon {
  width: 1rem;
  height: 1rem;
  margin-left: 0.25rem;
  transition: transform 0.15s;
}

.nav-dropdown[data-open="true"] .nav-dropdown__toggle .icon {
  transform: rotate(180deg);
}

.nav-dropdown__menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 13rem;
  margin-top: 0.375rem;
  padding: 0.375rem;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  box-shadow: 0 0.75rem 2rem rgba(120, 90, 30, 0.12);
}

.nav-dropdown[data-open="true"] .nav-dropdown__menu {
  display: block;
}

.nav-dropdown__menu a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.625rem 0.875rem;
  border-radius: var(--radius);
  font-size: 0.9375rem;
  text-decoration: none;
  white-space: nowrap;
}

.nav-dropdown__menu a:hover,
.nav-dropdown__menu a[aria-current="page"] {
  background: var(--shot);
}

.nav-dropdown__menu .icon {
  width: 1rem;
  height: 1rem;
  margin-left: 1rem;
  color: var(--muted);
}

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.5rem 0;
  font-size: 0.8125rem;
  color: var(--muted);
}

.site-footer p {
  margin: 0;
}

.site-footer a {
  text-decoration: none;
  white-space: nowrap; /* keep the ICP number on one line */
}

.site-footer a:hover {
  color: var(--ink);
  text-decoration: underline;
}

/* ---------- home ---------- */

.hero {
  padding: 5.5rem 0 3rem;
}

.hero h1 {
  margin-bottom: 1rem;
}

.hero__lead {
  margin: 0;
  font-size: 1.1875rem;
  color: var(--muted);
}

.products {
  padding-bottom: 6rem;
}

.product-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-gap: 2rem;
  gap: 2rem;
}

.product-card {
  display: flex;
  flex-direction: column;
}

/* Fixed 16:10 slot (padding-top keeps old WebViews without aspect-ratio happy), so the
 * card keeps its size whatever mock fills it. --mock-w is the slot's rendered width
 * (half the container minus the grid gap and the card border); mock.css sizes the mock's
 * em scale from it. */
.product-card__media {
  --mock-w: calc((88vw - 2rem) / 2 - 2px);
  position: relative;
  padding-top: 62.5%;
  background: var(--shot);
  border-bottom: 1px solid var(--line-2);
}

@supports (width: min(1px, 2px)) {
  .product-card__media {
    --mock-w: calc((min(88vw, 90rem) - 2rem) / 2 - 2px);
  }
}

.product-card__media > .mock {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
}

.product-card__body {
  flex: 1 0 auto;
  display: flex;
  flex-direction: column;
  padding: 1.75rem 2rem 2rem;
}

.product-card__body h2 {
  margin-bottom: 0.5rem;
  font-size: 1.5rem;
}

.product-card__body p {
  margin-bottom: 1.5rem;
  color: var(--muted);
}

.product-card__actions {
  margin-top: auto;
}

.product-card__actions .btn + .btn {
  margin-left: 0.75rem;
}

/* ---------- product detail pages (image.html, hire.html share these) ----------
 * Sections: #hero .detail-hero > .detail-hero__inner > .detail-hero__text + .detail-hero__media,
 * #audience .detail-audience, #features .feature-grid > .feature (+ optional .detail-split),
 * #flow ol.flow > li (.flow__title + .flow__note), #showcase, #cta .detail-cta.
 */

.section__lead {
  margin: -0.75rem 0 2rem;
}

/* Sections after the hero sit closer together than the generic .section. */
.detail-hero ~ .section {
  padding: 0 0 6rem;
}

.detail-hero {
  padding: 5rem 0 6rem;
}

/* Text 5 parts, visual 7 parts. The media column width is
 * (container - 4rem gap) * 7/12; .detail-split uses the same split. */
.detail-hero__inner,
.detail-split {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  grid-gap: 4rem;
  gap: 4rem;
  align-items: center;
}

.detail-hero h1 {
  margin-bottom: 1rem;
}

.detail-hero__lead {
  margin-bottom: 2rem;
  font-size: 1.1875rem;
  color: var(--muted);
}

/* Fixed 16:10 frame for a mock (padding-top so old WebViews without aspect-ratio work).
 * The edge is a box-shadow, not a border, so the mock fills the slot's full width and
 * --mock-w can equal the slot width exactly. */
.media-slot {
  position: relative;
  padding-top: 62.5%;
  background: var(--shot);
  border-radius: var(--radius-card);
  box-shadow: 0 0 0 1px var(--line-2), 0 1.5rem 3rem rgba(120, 90, 30, 0.08);
  overflow: hidden;
}

.media-slot > .mock {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
}

.detail-hero__media,
.detail-split__media {
  --mock-w: calc((88vw - 4rem) * 7 / 12);
}

@supports (width: min(1px, 2px)) {
  .detail-hero__media,
  .detail-split__media {
    --mock-w: calc((min(88vw, 90rem) - 4rem) * 7 / 12);
  }
}

.detail-audience__text {
  max-width: 48rem;
  margin: 0;
  font-size: 1.3125rem;
  line-height: 1.7;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-gap: 1.5rem;
  gap: 1.5rem;
}

.feature {
  padding: 2rem;
  background: var(--white);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-card);
}

.feature__icon {
  display: block;
  width: 2.75rem;
  height: 2.75rem;
  margin-bottom: 1.25rem;
  padding: 0.625rem;
  background: var(--shot);
  border-radius: var(--radius);
  stroke-width: 1.75;
}

.feature h3 {
  margin-bottom: 0.5rem;
  font-size: 1.1875rem;
}

.feature p {
  margin: 0;
  color: var(--muted);
}

.detail-split {
  margin-top: 4rem;
}

.detail-split__lead {
  font-size: 1.3125rem;
  font-weight: 700;
  line-height: 1.5;
}

/* Numbered steps; any count fits one row on desktop. */
.flow {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  grid-gap: 1.5rem;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: flow;
}

.flow > li {
  position: relative;
  padding-top: 3.5rem;
  counter-increment: flow;
}

.flow > li::before {
  content: counter(flow);
  position: absolute;
  top: 0;
  left: 0;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: var(--ink);
  color: var(--white);
  font-weight: 700;
  line-height: 2.25rem;
  text-align: center;
}

.flow > li:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 1.125rem;
  left: 3rem;
  right: 0;
  height: 1px;
  background: var(--line-2);
}

.flow__title {
  display: block;
  margin-bottom: 0.375rem;
  font-size: 1.0625rem;
}

.flow__note {
  display: block;
  font-size: 0.9375rem;
  color: var(--muted);
}

/* Original image on the left, a 2x2 grid of finished images on the right. All slots are
 * squares (padding-top: 100%), and the 2x2 grid ends up exactly as tall as the original,
 * so dropping an <img> into a .shot never moves the layout. */
.showcase-pair {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 2rem minmax(0, 1fr);
  grid-gap: 1.5rem;
  gap: 1.5rem;
  align-items: center;
}

.showcase-pair__label {
  margin: 0 0 0.75rem;
  font-weight: 700;
}

.showcase-pair__arrow {
  width: 2rem;
  height: 2rem;
  color: var(--muted);
}

.showcase-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-gap: 1rem;
  gap: 1rem;
}

.shot {
  position: relative;
  padding-top: 100%;
  background: var(--shot);
  border-radius: var(--radius-card);
  box-shadow: 0 0 0 1px var(--line-2);
  overflow: hidden;
}

.shot > img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.shot__tag {
  position: absolute;
  left: 0.75rem;
  bottom: 0.75rem;
  z-index: 1;
  padding: 0.125rem 0.625rem;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 999px;
  font-size: 0.8125rem;
  color: var(--muted);
}

.detail-cta__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 3rem 3.5rem;
  background: var(--white);
  border: 1px solid var(--line-2);
  border-radius: var(--radius-card);
}

.detail-cta__title {
  margin: 0 2rem 0 0;
  font-size: 1.75rem;
}

/* ---------- phones ---------- */

@media (max-width: 767px) {
  html {
    font-size: 16px;
  }

  h1 {
    font-size: 1.75rem;
  }

  h2,
  .section__title {
    font-size: 1.5rem;
  }

  .container {
    width: auto;
    max-width: none;
    padding-left: 16px;
    padding-right: 16px;
  }

  .section {
    padding: 3rem 0;
  }

  .hero {
    padding: 2.5rem 0 1.75rem;
  }

  .hero__lead {
    font-size: 1rem;
  }

  .products {
    padding-bottom: 3rem;
  }

  .product-grid {
    display: grid; /* restated so every gap sits next to its grid (test_css_avoids_flex_gap) */
    grid-template-columns: 1fr;
    grid-gap: 1rem;
    gap: 1rem;
  }

  .product-card__media {
    --mock-w: calc(100vw - 34px); /* 16px gutters + card border */
  }

  .product-card__body {
    padding: 1.25rem 1.25rem 1.5rem;
  }

  .product-card__body h2 {
    font-size: 1.25rem;
  }

  .product-card__actions {
    display: flex;
  }

  .product-card__actions .btn {
    flex: 1 1 0;
  }

  .detail-hero {
    padding: 2.5rem 0 3rem;
  }

  .detail-hero ~ .section {
    padding: 0 0 3.5rem;
  }

  .detail-hero__inner,
  .detail-split {
    display: grid; /* restated so every gap sits next to its grid (test_css_avoids_flex_gap) */
    grid-template-columns: minmax(0, 1fr);
    grid-gap: 2rem;
    gap: 2rem;
  }

  .detail-hero__lead {
    margin-bottom: 1.5rem;
    font-size: 1rem;
  }

  .detail-hero__actions .btn {
    width: 100%;
  }

  .detail-hero__media,
  .detail-split__media {
    --mock-w: calc(100vw - 32px); /* 16px gutters, no border */
  }

  .detail-audience__text,
  .detail-split__lead {
    font-size: 1.0625rem;
  }

  .feature-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-gap: 1rem;
    gap: 1rem;
  }

  .feature {
    padding: 1.25rem;
  }

  .feature__icon {
    margin-bottom: 0.875rem;
  }

  .detail-split {
    margin-top: 2.5rem;
  }

  .flow {
    display: grid;
    grid-auto-flow: row;
    grid-auto-columns: auto;
    grid-template-columns: minmax(0, 1fr);
    grid-gap: 1.25rem;
    gap: 1.25rem;
  }

  .flow > li {
    padding: 0.25rem 0 0 3.25rem;
    min-height: 2.25rem;
  }

  .flow > li:not(:last-child)::after {
    display: none;
  }

  .showcase-pair {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    grid-gap: 1rem;
    gap: 1rem;
  }

  .showcase-pair__arrow {
    justify-self: center;
    -webkit-transform: rotate(90deg);
    transform: rotate(90deg);
  }

  .detail-cta__inner {
    display: block;
    padding: 1.75rem 1.25rem;
  }

  .detail-cta__title {
    margin: 0 0 1.25rem;
    font-size: 1.375rem;
  }

  .detail-cta__inner .btn {
    width: 100%;
  }

  /* static, so the menu panel anchors to the (sticky) header and spans its full width */
  .site-nav__inner {
    height: 3.5rem;
    position: static;
  }

  .nav-toggle {
    display: inline-flex;
  }

  .nav-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: calc(100vh - 3.5rem);
    overflow-y: auto;
    padding: 0.5rem 0 1rem;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
    box-shadow: 0 0.75rem 1.5rem rgba(120, 90, 30, 0.08);
  }

  .nav-menu[data-open="true"] {
    display: block;
  }

  .nav-menu__list {
    display: block;
  }

  .nav-menu__list > li + li {
    margin-left: 0;
  }

  /* Phones list every entry; the dropdown toggles become group labels. */
  .nav-link,
  .nav-dropdown__toggle,
  .nav-dropdown__menu a {
    display: flex;
    width: 100%;
    min-height: 2.75rem;
    padding: 0 16px;
    border-radius: 0;
    font-size: 1rem;
  }

  .nav-dropdown__toggle {
    color: var(--muted);
    font-size: 0.875rem;
    cursor: default;
    pointer-events: none;
  }

  .nav-dropdown__toggle .icon {
    display: none;
  }

  .nav-dropdown__menu,
  .nav-dropdown[data-open="true"] .nav-dropdown__menu {
    display: block;
    position: static;
    min-width: 0;
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .nav-dropdown__menu a {
    padding-left: 32px;
  }
}
