/* Homepage (functions/index.js). Builds on /makers/assets/site.css, which
   supplies the tokens, cards, buttons and dark mode. */

/* ── Header: logo + tagline ────────────────────────────────────────────── */
.home-header { gap: 18px; }
.home-brand { display: flex; align-items: center; gap: 14px; min-width: 0; color: var(--ink); text-decoration: none !important; }
.home-brand img { display: block; width: auto; height: 40px; }
.home-brand__tagline { font-size: .9rem; color: var(--ink-2); line-height: 1.3; max-width: 22ch; padding-left: 14px; border-left: 1px solid var(--line-strong); }
.home-nav { margin-left: auto; }
.home-header > .btn { flex: none; }
@media (max-width: 1100px) { .home-brand__tagline { display: none; } }
@media (max-width: 860px) {
  .site-header__inner.home-header { flex-wrap: wrap; height: auto; padding-block: 10px; row-gap: 6px; }
  .home-brand__tagline { display: block; font-size: .8rem; max-width: none; }
  .home-header > .btn { margin-left: auto; }
  .home-nav { display: flex; order: 3; width: 100%; margin: 0 calc(var(--gutter) * -1); padding-inline: var(--gutter); overflow-x: auto; scrollbar-width: none; }
  .home-nav::-webkit-scrollbar { display: none; }
  .home-nav a { white-space: nowrap; font-size: .9rem; }
}
@media (max-width: 860px) { .home .site-header { position: static; } }
/* Phones: the tagline keeps the row; "Share your app" is in the CTA below. */
@media (max-width: 560px) { .home-header > .btn { display: none; } }
@media (max-width: 480px) {
  .home-brand { gap: 10px; }
  .home-brand img { height: 32px; }
  .home-brand__tagline { padding-left: 10px; font-size: .75rem; }
}

/* ── Featured carousel ─────────────────────────────────────────────────── */
.featured { padding-top: 24px; }
.carousel { position: relative; }
.carousel__track { position: relative; }
.carousel__track {
  list-style: none; margin: 0; padding: 0; display: flex; gap: 16px;
  overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth; scrollbar-width: none;
}
.carousel__track::-webkit-scrollbar { display: none; }
.slide { flex: 0 0 100%; scroll-snap-align: start; border-radius: 20px; overflow: hidden; }
.slide__inner {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 24px;
  min-height: 260px; padding: clamp(24px, 5vw, 56px); color: var(--ink); text-decoration: none !important;
  background: var(--slide-bg); border: 1px solid var(--line);
}
.slide__kicker { font-size: .8rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--slide-ink); margin-bottom: 10px; }
.slide h2 { font-size: clamp(1.7rem, 1.2rem + 2vw, 2.6rem); line-height: 1.1; margin-bottom: 12px; }
.slide__line { color: var(--ink-2); font-size: clamp(1rem, .95rem + .25vw, 1.12rem); max-width: 56ch; margin-bottom: 22px; }
.slide .btn--primary { background: var(--slide-ink); color: #fff; }
.slide__inner:hover .btn--primary { filter: brightness(1.08); }
.slide__art img, .slide__glyph {
  display: grid; place-items: center; width: clamp(96px, 16vw, 148px); height: clamp(96px, 16vw, 148px);
  border-radius: 22%; box-shadow: 0 10px 30px rgba(0, 0, 0, .12); object-fit: cover; background: var(--surface);
}
.slide__glyph { color: var(--slide-ink); }
.slide__glyph svg { width: 48%; height: 48%; }
@media (max-width: 600px) {
  .slide__inner { grid-template-columns: 1fr; min-height: 0; }
  .slide__art { order: -1; }
  .slide__art img, .slide__glyph { width: 72px; height: 72px; }
}

.slide--teal   { --slide-ink: #0f766e; --slide-bg: linear-gradient(120deg, #e3f1ef, #f4faf9 60%, #fff); }
.slide--amber  { --slide-ink: #b45309; --slide-bg: linear-gradient(120deg, #fcf1e2, #fdf8f1 60%, #fff); }
.slide--green  { --slide-ink: #15803d; --slide-bg: linear-gradient(120deg, #e7f4ea, #f5faf6 60%, #fff); }
.slide--violet { --slide-ink: #6d28d9; --slide-bg: linear-gradient(120deg, #f0eafb, #f8f5fd 60%, #fff); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .slide--teal   { --slide-ink: #14b8a6; --slide-bg: linear-gradient(120deg, #10302c, var(--surface)); }
  :root:not([data-theme="light"]) .slide--amber  { --slide-ink: #d97706; --slide-bg: linear-gradient(120deg, #362614, var(--surface)); }
  :root:not([data-theme="light"]) .slide--green  { --slide-ink: #16a34a; --slide-bg: linear-gradient(120deg, #17301f, var(--surface)); }
  :root:not([data-theme="light"]) .slide--violet { --slide-ink: #8b5cf6; --slide-bg: linear-gradient(120deg, #2a2140, var(--surface)); }
}

.carousel__dots { display: flex; justify-content: center; gap: 8px; margin-top: 14px; }
.carousel__dot { width: 8px; height: 8px; padding: 0; border: 0; border-radius: 999px; background: var(--line-strong); cursor: pointer; transition: width .2s, background .2s; }
.carousel__dot[aria-current="true"] { width: 24px; background: var(--accent); }

/* ── Products grid ─────────────────────────────────────────────────────── */
.home-search { flex: 0 1 280px; }
.home-search input {
  width: 100%; font: inherit; font-size: .95rem; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: 999px; padding: .55em 1em;
}
.home-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
@media (max-width: 600px) { .home-search { flex-basis: 100%; } }
.home-more { margin: 20px 0 0; text-align: right; }

/* ── Footer ────────────────────────────────────────────────────────────── */
.home-footer-logo { display: block; height: 30px; width: auto; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .home-footer-logo { content: url("/logo-light.png"); } }
.home-legal { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }
.home-legal p { font-size: .75rem; color: var(--ink-3); max-width: 90ch; margin: 0 0 6px; }

/* ── Product groups on the homepage ────────────────────────────────────── */
.home-group + .home-group { margin-top: 36px; }
.home-group__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.home-group__head h3 { font-size: 1.2rem; margin: 0; }
.home-group__head h3 a { color: inherit; text-decoration: none; }

/* ── Category pages (lib/home/category.js) ─────────────────────────────── */
.category-hero { padding-bottom: 0; }
.category-hero__kicker { font-size: .8rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: 10px; }
.category-hero h1 { font-size: clamp(2rem, 1.4rem + 2.4vw, 3rem); line-height: 1.1; margin-bottom: 14px; }
.category-hero__intro { color: var(--ink-2); font-size: clamp(1rem, .95rem + .3vw, 1.15rem); max-width: 62ch; margin: 0; }
.category-list { padding-top: 32px; }

/* ── About (functions/about.js) ────────────────────────────────────────── */
.about { padding-top: 32px; }
.about__list { display: grid; gap: 20px; }
.about__item { display: grid; grid-template-columns: minmax(0, 220px) minmax(0, 1fr); gap: 24px; padding: clamp(22px, 3.5vw, 36px); border: 1px solid var(--line); border-radius: 20px; background: var(--surface); }
.about__num { margin: 4px 0 0; font-size: .8rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.about__item h2 { font-size: clamp(1.3rem, 1.1rem + .8vw, 1.7rem); margin-bottom: 12px; }
.about__item p { color: var(--ink-2); font-size: 1.05rem; line-height: 1.7; max-width: 64ch; }
.about__item p:last-child { margin-bottom: 0; }
.cta .about__mail { color: inherit; text-decoration: underline; }
@media (max-width: 700px) { .about__item { grid-template-columns: 1fr; gap: 8px; } }

/* ── Product pages (lib/home/product-page.js → /app/<slug>/) ───────────── */
/* English by default; /app/lang.js sets data-ui-lang="zh" for the 中文 button. */
.t-zh { display: none; }
:root[data-ui-lang="zh"] .t-zh { display: revert; }
:root[data-ui-lang="zh"] .t-en { display: none; }

.product-hero { padding-block: 20px 36px; }
.product-hero__bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.product-hero__bar .crumbs ol { margin: 0; }
.lang-toggle { cursor: pointer; font-family: inherit; }
.product-hero .app-hero__main { margin-top: 18px; }
.product-hero h1 { font-size: clamp(2rem, 1.4rem + 2.4vw, 3rem); line-height: 1.1; }
.product-hero .app-hero__tagline { max-width: 62ch; }
.product-hero .actions { margin-top: 20px; }
.product-note { margin: 14px 0 0; font-size: .9rem; color: var(--ink-2); }
@media (max-width: 560px) { .product-hero .app-hero__main { flex-direction: column; } }

.product-toc { position: sticky; top: 64px; z-index: 10; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.product-toc .tabs { margin: 0; }
@media (max-width: 860px) { .product-toc { top: 0; } }
.product-section { scroll-margin-top: 120px; }
.product-section + .product-section { padding-top: 8px; }
.product-section h2 { margin-bottom: 18px; }

.product-features { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 250px), 1fr)); gap: 14px; }
.product-features li { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; }
.product-features__icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); font-size: 1.25rem; margin-bottom: 12px; }
.product-features h3 { margin-bottom: .35em; }
.product-features p { margin: 0; color: var(--ink-2); font-size: .95rem; }

.product-steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; counter-reset: step; max-width: 860px; }
.product-steps > li { counter-increment: step; position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px 18px 62px; color: var(--ink-2); }
.product-steps > li::before { content: counter(step); position: absolute; left: 18px; top: 18px; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; font-size: .85rem; display: grid; place-items: center; }
.product-steps p { margin: 0 0 .6em; }
.product-steps p:last-child, .product-steps ul:last-child { margin-bottom: 0; }
.product-steps ul { padding-left: 1.2em; margin: 0 0 .6em; }
.product-steps li li + li { margin-top: .3em; }
.product-steps strong { color: var(--ink); }
.product-steps code, .product-features code { font-family: var(--mono); font-size: .88em; background: var(--surface-2); padding: .1em .35em; border-radius: 5px; }

.product-prose { max-width: 760px; padding-top: 0; }
.product-cta__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.cta .btn--ghost { background: transparent; color: var(--bg); border-color: color-mix(in srgb, var(--bg) 40%, transparent); }
