/* Shared visual treatment for the local preview pages. */
body {
  --preview-heading-size: clamp(28px,4vw,48px);
  --preview-heading-tracking: -.035em;
  --preview-section-space: clamp(30px,5vw,64px);
}
body:not(.landing-embed) :is(.landing-section h2, #process-title, #home-faq-title,
  .secondary-hero h1, .pricing-hero h1) {
  font-size: var(--preview-heading-size);
  line-height: 1.15;
  letter-spacing: var(--preview-heading-tracking);
}
body:not(.landing-embed) :is(.secondary-hero-description, .process-intro p, .landing-api-copy > p, #business p) {
  color: var(--refined-muted);
  line-height: 1.6;
  text-wrap: pretty;
}
body.landing-composition :is(#api-demo, #business) {
  padding: var(--preview-section-space) 0 0;
  border: 0;
  border-top: 1px solid var(--refined-line);
  border-radius: 0;
  background: transparent;
}
body.landing-composition #api-demo { align-items: start; }
body.landing-composition #api-demo .landing-terminal {
  border-radius: 14px;
  box-shadow: none;
}
body.landing-composition :is(.landing-api-copy,#business) h2 { text-wrap: pretty; margin-bottom: 8px; }
body.landing-composition .home-faq {
  width: var(--landing-measure);
  padding: var(--preview-section-space) 0 0;
  border-top: 1px solid var(--refined-line);
}
body.landing-composition #home-faq-title { text-align: start; margin: 0 0 22px; }
body.landing-composition .home-faq-grid > div {
  border-radius: 12px;
  border-color: var(--refined-line);
  background: var(--refined-surface);
}
body.landing-composition .landing-footer { row-gap: 24px; }
body.landing-composition .landing-footer strong { font-size: 1rem; }
body.landing-composition .landing-section .landing-action {
  align-items: center;
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid var(--refined-line);
  background: var(--refined-surface);
  color: var(--refined-emphasis);
  text-decoration: none;
}
body.landing-composition .landing-api-copy .landing-action {
  border-color: transparent;
  background: var(--refined-accent);
  color: var(--refined-on-accent);
}
body.landing-composition .landing-section .landing-action:hover { border-color: var(--refined-emphasis); }
@media (prefers-reduced-motion:no-preference) {
  body.landing-composition .landing-section .landing-action { transition: transform 160ms ease, border-color 160ms ease; }
  body.landing-composition .landing-section .landing-action:hover { transform: translateY(-2px); }
  body.landing-composition .landing-section .landing-action:active { transform: translateY(0); }
}
body.release-secondary .secondary-hero-inner { text-align: start; }
body.release-secondary .secondary-hero-description { max-width: 58ch; margin-inline: 0; }
body.release-secondary main section > h2:first-child {
  font-size: clamp(18px,2vw,26px);
  line-height: 1.2;
  letter-spacing: -.02em;
}
body.release-secondary :is(.support-panel, .api-docs > section) { border-radius: 14px; }
body.release-secondary :is(.api-toc a, .support-panel summary) { text-underline-offset: .22em; }
body.release-pricing:not(.landing-embed) #credit-packs > h2 {
  padding-top: var(--preview-section-space);
  border-top: 1px solid var(--refined-line);
  font-size: var(--preview-heading-size);
  letter-spacing: var(--preview-heading-tracking);
}
.preview-policies { line-height: 1.65; }
.preview-policies h1 { font-size: var(--preview-heading-size); line-height: 1.15; letter-spacing: var(--preview-heading-tracking); }
.preview-policies section { padding-block: 22px; border-top: 1px solid var(--refined-line,#d9deed); }
.preview-policies section h2 { margin-block: 0 10px; line-height: 1.2; letter-spacing: -.02em; }

/* Match the isometric credit packs while keeping small icons legible. */
body .account-credit-icon {
  --preview-credit-cube: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cg%20stroke%3D%22%232442c9%22%20stroke-width%3D%221.35%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20fill%3D%22%23a7b5ff%22%20d%3D%22M2%208v8l10%206v-8z%22%2F%3E%3Cpath%20fill%3D%22%237188ed%22%20d%3D%22m12%2014%2010-6v8l-10%206z%22%2F%3E%3Cpath%20fill%3D%22%23e7ecff%22%20d%3D%22m2%208%2010-6%2010%206-10%206z%22%2F%3E%3C%2Fg%3E%3Cpath%20fill%3D%22%232442c9%22%20d%3D%22m8%208%204-2.3L16%208l-4%202.3z%22%2F%3E%3C%2Fsvg%3E");
  background-image: var(--preview-credit-cube);
}
body[data-theme="lime"] .account-credit-icon {
  --preview-credit-cube: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20viewBox%3D%220%200%2024%2024%22%3E%3Cg%20stroke%3D%22%23274022%22%20stroke-width%3D%221.35%22%20stroke-linejoin%3D%22round%22%3E%3Cpath%20fill%3D%22%23b8ea72%22%20d%3D%22M2%208v8l10%206v-8z%22%2F%3E%3Cpath%20fill%3D%22%2383bd45%22%20d%3D%22m12%2014%2010-6v8l-10%206z%22%2F%3E%3Cpath%20fill%3D%22%23e7ffc3%22%20d%3D%22m2%208%2010-6%2010%206-10%206z%22%2F%3E%3C%2Fg%3E%3Cpath%20fill%3D%22%23274022%22%20d%3D%22m8%208%204-2.3L16%208l-4%202.3z%22%2F%3E%3C%2Fsvg%3E");
}
body .signup-credit-strip .account-credit-icon,
body[data-theme="lime"] .signup-credit-strip .account-credit-icon {
  filter: none;
  translate: none;
}

/* Shared control tokens and role mappings. See button-inventory.md. */
body {
  --ui-primary-radius: 10px;
  --ui-pill-radius: 999px;
  --ui-field-radius: 10px;
  --ui-card-radius: 16px;
  --ui-panel-radius: 24px;
  --ui-dialog-radius: 20px;
  --ui-control-height: 44px;
  --ui-control-weight: 700;
  --ui-control-gap: 8px;
  --ui-control-motion: 200ms;
  --ui-slider-motion: 280ms;
  --ui-accent: var(--refined-accent);
  --ui-on-accent: var(--refined-on-accent);
  --ui-focus: var(--refined-emphasis);
}
body .landing-terminal { --ui-focus:#b9ceff; }

/* Primary actions are assigned in their component context. */
body[data-release-ui] :is(.hero-actions .button.primary, .home-faq-cta .button.primary,
  #api-demo .landing-action, #pick-image, #online-studio .export-panel #export-all, #studio-download, .gallery-download,
  .landing-member-card button, .recharge-card:not(.landing-recharge-trial article) .purchase-button,
  .enterprise-card button, #create-api-key, #demo-next, #account-signin, #account-redeem button,
  dialog button[type=submit], .account-submit,
  .signup-welcome-start) {
  border-radius: var(--ui-primary-radius);
  min-block-size: var(--ui-control-height);
  font-weight: var(--ui-control-weight);
  gap: var(--ui-control-gap);
  transition-duration: var(--ui-control-motion);
}
body.release-support main button[type=submit] { border-radius:var(--ui-primary-radius); min-block-size:var(--ui-control-height); }
body[data-release-ui] :is(#pick-image,#export-all,#create-api-key,#demo-next,.account-submit,#account-signin) {
  background:var(--ui-accent);
  color:var(--ui-on-accent);
  border-color:var(--ui-accent);
}
body[data-theme="warm-white"] :is(#pick-image,#export-all,#create-api-key,#demo-next,.account-submit,#account-signin) {
  border-color:var(--refined-line);
}

/* Secondary, segmented, icon and text controls retain their own interaction handlers. */
body[data-release-ui] :is(#business .landing-action,.workspace-add,.batch-retry,.batch-original,.gallery-select,
  .batch-close,#quote-open,#quote-close,#billing-open,#billing-close,#invoice-close,#close-redemptions,
  #account-password-settings,.account-buy,.landing-copy-code,.site-header [data-sign-in]) {
  min-block-size:var(--ui-control-height);
  border-radius:var(--ui-pill-radius);
  font-weight:var(--ui-control-weight);
  transition-duration:var(--ui-control-motion);
}
body[data-release-ui] .landing-pricing-tabs { border-radius:var(--ui-pill-radius); }
body[data-release-ui] .landing-pricing-tabs::before {
  border-radius:var(--ui-pill-radius);
  transition-duration:var(--ui-slider-motion);
}
body[data-release-ui] :is(.landing-pricing-tabs button,.landing-switch button,.workspace-modes .quality-choice,
  .account-tabs,.account-tabs button,.gallery-controls [data-case]) { border-radius:var(--ui-pill-radius); }
body[data-release-ui] :is(.gallery-controls [data-scroll-cases],.account-close,.gallery-close,.password-eye,
  .password-copy,.paypal-checkout-close,.signup-welcome-close) {
  aspect-ratio:1;
  border-radius:50%;
  transition-duration:var(--ui-control-motion);
}
body[data-release-ui] :is(.demo-background,.completed-gallery-button,.export-history-entry,
  .redemption-link,#account-page-logout,.landing-member-benefits summary) { text-underline-offset:.2em; }
body[data-release-ui] :is(.landing-member-heading > span,.landing-credit-name > span,.pack-bonus,
  .enterprise-bonus,.image-label) { border-radius:var(--ui-pill-radius); }
body[data-release-ui] :is(.demo,.home-faq-grid > div,#credit-packs .landing-member-card,
  #credit-packs .landing-credit-pack,#credit-packs .recharge-card,#credit-packs .enterprise-card,
  .support-panel,.api-docs > section,.landing-terminal) { border-radius:var(--ui-card-radius); }
body[data-release-ui] :is(#online-studio .export-panel,#online-studio .dropzone,.completed-gallery) { border-radius:var(--ui-panel-radius); }
body[data-release-ui] :is(dialog,.account-dialog,.signup-welcome-dialog) { border-radius:var(--ui-dialog-radius); }
body[data-release-ui] :is(main form,dialog,#online-studio .export-panel) :is(
  input:not([type=checkbox],[type=radio],[type=range],[type=file],[type=hidden]),select,textarea,.export-picker > button
) { border-radius:var(--ui-field-radius); }
body[data-release-ui] :is(button,summary,a,input,select,textarea):focus-visible {
  outline:2px solid var(--ui-focus);
  outline-offset:3px;
}
body[data-release-ui] button:is(:disabled,[aria-disabled=true]) { cursor:not-allowed; }
body[data-release-ui] button:is([aria-busy=true],[data-button-state=loading]) { cursor:progress; }
body[data-release-ui] button[data-button-state=success] { box-shadow:inset 0 0 0 2px currentColor; }
@media (prefers-reduced-motion: reduce) {
  body[data-release-ui] :is(button,.button,.landing-action,.landing-pricing-tabs)::before,
  body[data-release-ui] :is(button,.button,.landing-action) { transition-duration:0s; }
}

body[data-release-ui] :is(.gallery-controls [data-scroll-cases],.account-close,.gallery-close,.paypal-checkout-close,.signup-welcome-close) {
  inline-size:36px;
  block-size:36px;
}
body[data-release-ui] :is(button,.button,.landing-action)[aria-busy=true] { opacity:.72; }
body[data-release-ui] :is(.landing-copy-code,.landing-action):active { filter:brightness(.92); }
body[data-release-ui] .landing-copy-status { min-block-size:1.2em; }

/* The hero promotion shares the adjacent action's silhouette. */
body[data-release-ui] .refined-visual .refined-hero .hero-actions:has(> .hero-credit-offer:not([hidden])) > .hero-credit-offer:not([hidden]) {
  border-radius:var(--ui-primary-radius);
}

/* Workbench mode picker: keep the animated selection, with a rectangular track. */
body.landing-composition[data-release-ui] #online-studio .workspace-modes.capsule-mode-picker {
  border-radius:var(--ui-card-radius);
  background:var(--refined-tint);
}
body.landing-composition[data-release-ui] #online-studio .workspace-modes.capsule-mode-picker :is(.quality-choice,.quality-slider) {
  border-radius:var(--ui-primary-radius);
}
body.landing-composition[data-release-ui] #online-studio .workspace-modes.capsule-mode-picker .quality-choice {
  min-height:64px;
  padding:8px 6px;
  text-align:center;
}
body.landing-composition[data-release-ui] #online-studio .capsule-mode-picker .workspace-mode-copy {
  display:grid;
  justify-items:center;
  gap:4px;
}
body.landing-composition[data-release-ui] #online-studio .capsule-mode-picker .workspace-mode-heading {
  justify-content:center;
  align-items:center;
  gap:6px;
}
body.landing-composition[data-release-ui] #online-studio .workspace-modes.capsule-mode-picker .quality-choice .workspace-mode-rate {
  display:none;
}
@media (max-width:520px) {
  body.landing-composition[data-release-ui] #online-studio .workspace-modes.capsule-mode-picker .quality-choice { min-height:76px; }
}

body.landing-composition[data-release-ui] #online-studio .workspace-mode-caption {
  margin-block-end:clamp(18px,2vw,24px);
}
body.landing-composition[data-release-ui] #online-studio .workspace-modes + .workspace-credits {
  margin-block:clamp(8px,1vw,12px) clamp(12px,1.5vw,18px);
}

/* Keep the desktop hero composition consistent in a window and at full screen. */
@media (min-width:1000px) {
  body.landing-composition {
    --landing-measure:min(calc(100% - 72px),calc(610px + 41vw),1680px);
  }
  body.landing-composition[data-release-ui] .site-header .site-header-inner {
    width:var(--landing-measure);
    max-width:none;
  }
  body.landing-composition[data-release-ui] .refined-hero.wrap {
    width:var(--landing-measure);
    left:auto;
    min-block-size:0 !important; /* Override the legacy viewport-height measurement. */
    height:auto;
    padding-block:24px clamp(42px,5vw,64px);
    grid-template-columns:minmax(0,1fr) minmax(0,1.05fr);
    column-gap:clamp(32px,5vw,64px);
    align-content:start;
  }
  body.landing-composition[data-release-ui] .refined-visual .refined-hero .hero-copy {
    padding-top:24px;
  }
  body.landing-composition[data-release-ui] .refined-hero .hero-actions { margin-top:clamp(24px,3vw,54px); padding-top:0; }
  body.landing-composition[data-release-ui] .refined-hero #comparison { aspect-ratio:1.58; }
  body.landing-composition[data-release-ui] .refined-hero #headline {
    font-size:clamp(44px,11.8cqi,86px);
  }
}

@media (min-width:1000px) {
  body.landing-composition[data-release-ui]:has(.signup-credit-strip-wrap:not([hidden])) .refined-hero.wrap {
    padding-block-start:64px;
  }
}

@media (min-width:1600px) {
  body.landing-composition[data-release-ui] .refined-hero.wrap {
    grid-template-columns:minmax(0,.74fr) minmax(0,1fr);
    column-gap:clamp(36px,3vw,52px);
  }
  body.landing-composition[data-release-ui] .refined-hero #headline {
    font-size:clamp(44px,calc(29px + 2.5vw),86px);
  }
}

/* Example picker uses a quiet outline and a tint-only selected state. */
body.landing-composition[data-release-ui] .refined-hero .gallery-controls button {
  border-color:color-mix(in srgb,var(--refined-line) 65%,transparent);
}
body.landing-composition[data-release-ui] .refined-hero .gallery-controls button[data-case][aria-pressed=true] {
  border-color:transparent;
  background:var(--refined-tint);
  color:var(--refined-emphasis);
}
@media (hover:hover) and (prefers-reduced-motion:no-preference) {
  body.landing-composition[data-release-ui] .refined-hero .gallery-controls button {
    transition:transform var(--ui-control-motion,200ms) ease,background-color var(--ui-control-motion,200ms) ease;
  }
  body.landing-composition[data-release-ui] .refined-hero .gallery-controls button:not(:disabled):hover {
    position:relative;
    z-index:1;
    transform:translateY(-2px) scale(1.04);
  }
}

body.landing-composition .site-header .site-links a:is(:hover,.landing-nav-current) {
  color:var(--refined-emphasis);
}
@media (hover:hover) and (prefers-reduced-motion:no-preference) {
  body.landing-composition .site-header .site-links a { transition:transform 200ms ease,color 200ms ease; }
  body.landing-composition .site-header .site-links a:hover { transform:translateY(-2px); }
}
body.landing-composition[data-release-ui] #process.process-section.wrap {
  width:var(--landing-measure);
  max-width:none;
  margin-inline:auto;
  box-sizing:border-box;
}
body.landing-composition[data-release-ui] #process-title {
  font-size:clamp(26px,4vw,48px);
  line-height:1.15;
  letter-spacing:-.035em;
}

body.landing-composition[data-release-ui] #process.process-section {
  padding-block-end:clamp(14px,2vw,28px);
}
body.landing-composition[data-release-ui] #process .process-intro {
  margin-block-end:clamp(20px,2.5vw,34px);
}
body.landing-composition[data-release-ui] #process .process-capabilities-heading {
  margin-block-start:clamp(36px,4vw,58px);
  margin-block-end:clamp(16px,2vw,24px);
}
body.landing-composition[data-release-ui] #process .process-capabilities {
  row-gap:clamp(16px,2vw,24px);
}

body:has(.preview-policies) {
  margin:0; background:var(--refined-bg,#f9f8f5);
  color:var(--refined-ink,#171e32); font:16px/1.65 Geist,system-ui,sans-serif;
}
.preview-policies { width:min(760px,calc(100% - 36px)); margin:clamp(32px,7vw,90px) auto; }
.preview-policies a { color:var(--refined-emphasis,#2a48dc); text-underline-offset:.18em; }
.preview-policies > h1 { margin:12px 0 8px; }
.preview-policies > p { margin:0 0 24px; }
.preview-policies section p { margin:0; color:var(--refined-muted,#4d5870); }

body.landing-composition footer .footer-bottom a[href="#privacy-policy"] { display:none; }

/* Keep the hero action row anchored when switching between English and Chinese. */
body[data-release-ui] .refined-hero #headline:is(:lang(en), :lang(zh)) {
  line-height: 1.08;
}
body[data-release-ui] .refined-hero #headline:lang(zh) {
  letter-spacing: .025em;
}
body[data-release-ui] .refined-hero .hero-intro:is(:lang(en), :lang(zh)) {
  position: relative;
  min-block-size: 4lh;
}
body[data-release-ui] .refined-visual .refined-hero .hero-actions > .button.primary {
  box-sizing: border-box;
  inline-size: min(210px, 100%);
  min-block-size: 54px;
  justify-content: center;
}

body[data-release-ui] .refined-visual .refined-hero .hero-actions {
  --hero-action-width: min(210px, 100%);
}
body[data-release-ui] .refined-visual .refined-hero .hero-actions:has(> .hero-credit-offer:not([hidden])) {
  --hero-action-width: min(210px, calc((100% - 20px) / 2));
  grid-template-columns: repeat(2, var(--hero-action-width)) !important;
  width: 100%;
}
body[data-release-ui] .refined-visual .refined-hero .hero-actions > .button.primary {
  width: var(--hero-action-width) !important;
  min-height: 48px;
}
body[data-release-ui] .refined-visual .refined-hero .hero-actions:has(> .hero-credit-offer:not([hidden])) > .button.primary {
  width: 100% !important;
}
@media (max-width: 759px) {
  body[data-release-ui] .refined-hero #headline:is(:lang(en), :lang(zh)) {
    font-size: clamp(32px, 11cqi, 66px);
  }
}

@media (max-width: 360px) {
  body[data-release-ui] .refined-hero .hero-intro:is(:lang(en), :lang(zh)) {
    min-block-size: 5lh;
  }
}

/* Keep both action slots the same size regardless of account state or language. */
body.landing-composition[data-release-ui] .refined-visual .refined-hero .hero-actions {
  display: grid !important;
  width: 100%;
  grid-template-columns: repeat(2, min(210px, calc((100% - 20px) / 2))) !important;
  column-gap: 20px;
}
body.landing-composition[data-release-ui] .refined-visual .refined-hero .hero-actions > :is(.button.primary, .hero-credit-offer):not([hidden]) {
  box-sizing: border-box;
  width: 100% !important;
  height: 48px;
  min-height: 48px;
  padding-inline: 8px;
  justify-content: center;
  text-align: center;
}

body.landing-composition[data-release-ui] .refined-visual .refined-hero .hero-actions > :is(.button.primary, .hero-credit-offer):not([hidden]) {
  min-width: 0 !important;
}

/* Show a single divider while keeping the comparison slider interactive. */
.refined-hero #comparison .split-rule > span {
  display: none;
}
.refined-hero #comparison:has(.split-input:focus-visible) .split-rule {
  outline: 1px solid var(--refined-emphasis);
}

/* Studio action widths follow their English labels in both languages. */
body.landing-composition[data-release-ui] #online-studio .studio-batch-actions :is(.studio-download-batch,.workspace-add) {
  box-sizing: border-box;
  max-inline-size: 100%;
  justify-content: center;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease, transform .16s ease;
}
body.landing-composition[data-release-ui] #online-studio .studio-batch-actions .studio-download-batch {
  inline-size: 134px;
  justify-self: center;
}
body.landing-composition[data-release-ui] #online-studio .studio-batch-actions .workspace-add {
  inline-size: 131px;
}
@media (hover:hover) {
  body.landing-composition[data-release-ui] #online-studio .studio-batch-actions :is(.studio-download-batch,.workspace-add):not(:disabled):hover {
    box-shadow: 0 4px 12px color-mix(in srgb, var(--refined-accent) 24%, transparent);
  }
}
@media (hover:hover) and (prefers-reduced-motion:no-preference) {
  body.landing-composition[data-release-ui] #online-studio .studio-batch-actions :is(.studio-download-batch,.workspace-add):not(:disabled):hover {
    transform: translateY(-2px);
  }
}
@media (prefers-reduced-motion:reduce) {
  body.landing-composition[data-release-ui] #online-studio .studio-batch-actions :is(.studio-download-batch,.workspace-add) {
    transition: none;
  }
}

body.landing-composition[data-release-ui] #online-studio .studio-batch-actions :is(.studio-download-batch,.workspace-add) {
  block-size: 44px;
  padding-inline: 8px;
  white-space: nowrap;
  align-items: center;
}
@media (hover:hover) and (prefers-reduced-motion:no-preference) {
  body.landing-composition[data-release-ui] #online-studio .studio-batch-actions :is(.studio-download-batch,.workspace-add):not(:disabled):hover {
    translate: 0 -2px;
    transform: none;
  }
}

@media (prefers-reduced-motion:no-preference) {
  #online-studio .export-picker > .account-menu:not([hidden]) {
    animation: studio-export-menu-enter .18s cubic-bezier(.2,.75,.25,1) both;
  }
}
@keyframes studio-export-menu-enter {
  from { opacity: 0; translate: 0 -7px; }
  to { opacity: 1; translate: 0 0; }
}

/* Lift the three workspace actions slightly on hover. */
@media (hover:hover) and (prefers-reduced-motion:no-preference) {
  body.landing-composition[data-release-ui] #online-studio :is(.studio-download-batch,.studio-batch-actions .workspace-add,#export-all) {
    transition: translate .16s ease, background-color .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease;
  }
  body.landing-composition[data-release-ui] #online-studio :is(.studio-download-batch,.studio-batch-actions .workspace-add,#export-all):not(:disabled):hover {
    translate: 0 -2px;
    transform: none;
  }
}
