/* Signed-out landing: product showcase, cross-site link and compliance footer.
   Every layout rule is scoped to body.auth-mode so the signed-in studio is untouched. */

body:not(.auth-mode) .auth-showcase,
body:not(.auth-mode) .auth-top-links { display: none !important; }

/* ---------- Language: only the active language's copy is shown (see i18n.js) ---------- */
html[data-ui-lang="en"] [data-lang="zh"],
html[data-ui-lang="zh"] [data-lang="en"] { display: none !important; }

.auth-top-links { display: flex; align-items: center; gap: 8px; }
.lang-toggle { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 14px; border: 1px solid rgba(255,255,255,.16); border-radius: 999px; background: rgba(18,24,31,.55); color: #e7eef2; font-size: 12px; font-weight: 700; white-space: nowrap; -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); }
.lang-toggle svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.lang-toggle:hover { border-color: rgba(216,255,79,.45); background: rgba(216,255,79,.08); color: var(--accent); }

/* ---------- Cross-site link ---------- */
.auth-crosslink { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border: 1px solid rgba(255,255,255,.16); border-radius: 999px; background: rgba(18,24,31,.55); color: #e7eef2; text-decoration: none; font-size: 12px; white-space: nowrap; -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px); transition: border-color var(--motion-base) ease, background-color var(--motion-base) ease, transform var(--motion-fast) var(--ease-out); }
.auth-crosslink b { font-weight: 700; }
.auth-crosslink small { color: var(--muted); font-size: 11px; }
.auth-crosslink i { color: var(--accent); font-style: normal; }
.auth-crosslink:hover { border-color: rgba(216,255,79,.45); background: rgba(216,255,79,.08); }

/* ---------- Intro ---------- */
.auth-showcase { position: relative; z-index: 2; animation: showcaseIn .6s cubic-bezier(.2,.8,.2,1) .28s both; }
.auth-intro { text-align: center; margin: 4px auto 0; max-width: 560px; }
.showcase-kicker { margin: 0 0 10px; color: var(--accent); font: 750 10px/1.4 ui-monospace, "SF Mono", monospace; letter-spacing: .16em; text-transform: uppercase; }
.showcase-kicker span { color: var(--muted); letter-spacing: .08em; }
.showcase-title { margin: 0; color: #f6f8f4; font-size: 21px; font-weight: 780; line-height: 1.22; letter-spacing: -.02em; }
.showcase-title .title-brand { display: block; margin-bottom: 2px; color: transparent; background: linear-gradient(112deg, #ffffff 8%, #e8ffd1 38%, #d8ff4f 61%, #87dfff 96%); -webkit-background-clip: text; background-clip: text; }
.showcase-title .title-tail { color: #b8c3cc; font-weight: 600; }
.showcase-subtitle { margin: 9px 0 0; color: #c9d2c4; font-size: 13px; line-height: 1.6; }
.showcase-lede { display: none; margin: 14px 0 0; color: var(--muted); font-size: 14px; line-height: 1.7; }
.showcase-features { display: flex; flex-wrap: wrap; justify-content: center; gap: 7px; margin: 16px 0 0; padding: 0; list-style: none; }
.showcase-features li { display: flex; align-items: center; gap: 7px; padding: 6px 11px 6px 7px; border: 1px solid rgba(255,255,255,.12); border-radius: 999px; background: rgba(255,255,255,.045); }
.showcase-features li > div { display: grid; text-align: left; }
.showcase-features b { color: #e9f0e4; font-size: 11px; font-weight: 700; }
.showcase-features li > div > span { display: none; color: var(--muted); font-size: 12px; line-height: 1.55; }
.feature-icon { flex: 0 0 auto; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: rgba(216,255,79,.12); color: var(--accent); }
.feature-icon svg { width: 13px; height: 13px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Auth card additions ---------- */
.auth-card-brand { margin: -8px 0 6px; text-align: center; color: #e8f2d2; font: 800 11px/1.4 ui-monospace, "SF Mono", monospace; letter-spacing: .18em; }
.auth-card-brand span { color: var(--muted); font-weight: 600; letter-spacing: .04em; }
.auth-tabs button small { margin-left: 3px; color: inherit; font-size: 10px; font-weight: 500; opacity: .7; }
.auth-consent a, .auth-notice a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

/* ---------- Generation preview ---------- */
.auth-demo { width: 100%; max-width: 460px; margin: 18px auto 0; padding: 16px; border: 1px solid rgba(255,255,255,.13); border-radius: 24px; background: linear-gradient(145deg, rgba(255,255,255,.07), rgba(255,255,255,.015) 40%, transparent 60%), rgba(14,19,26,.62); box-shadow: 0 24px 70px rgba(0,0,0,.3), inset 0 1px 0 rgba(255,255,255,.08); -webkit-backdrop-filter: blur(24px) saturate(140%); backdrop-filter: blur(24px) saturate(140%); }
.demo-head { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; margin-bottom: 12px; }
.demo-head h3 { margin: 0; color: #eef3ea; font-size: 14px; font-weight: 750; }
.demo-head small { color: var(--muted); font-size: 11px; }
.demo-dots { display: inline-flex; gap: 5px; align-self: center; }
.demo-dots i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.16); }
.demo-dots i:first-child { background: var(--accent); box-shadow: 0 0 10px rgba(216,255,79,.6); }
.demo-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px; padding: 4px; border: 1px solid rgba(255,255,255,.08); border-radius: 14px; background: rgba(0,0,0,.35); }
.demo-tabs button { display: grid; gap: 1px; min-height: 44px; padding: 5px 4px; border: 0; border-radius: 10px; background: transparent; color: #9aa5b1; text-align: center; }
.demo-tabs button b { font-size: 12px; font-weight: 650; white-space: nowrap; }
.demo-tabs button small { font-size: 10px; opacity: .75; }
.demo-tabs button[aria-selected="true"] { background: rgba(216,255,79,.12); color: var(--accent); box-shadow: inset 0 0 0 1px rgba(216,255,79,.28); }
.demo-stage { display: grid; gap: 10px; margin-top: 12px; }
.demo-bubble { padding: 10px 12px; border-radius: 16px; }
.demo-bubble > small { display: block; margin-bottom: 5px; color: var(--muted); font: 700 9px/1.4 ui-monospace, "SF Mono", monospace; letter-spacing: .12em; text-transform: uppercase; }
/* Fixed bubble size (width + exactly three lines) so switching samples never resizes the card. */
.demo-user { justify-self: end; width: 88%; border: 1px solid rgba(216,255,79,.2); border-bottom-right-radius: 5px; background: rgba(216,255,79,.07); }
.demo-user p { margin: 0; color: #eef4e3; font-size: 13px; line-height: 1.55; height: calc(1.55em * 3); overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.demo-user p.is-typing::after { content: ""; display: inline-block; width: 7px; height: 1em; margin-left: 2px; vertical-align: -2px; background: var(--accent); animation: demoCaret .9s steps(1) infinite; }
.demo-ai { justify-self: start; width: 100%; border: 1px solid rgba(255,255,255,.1); border-bottom-left-radius: 5px; background: rgba(255,255,255,.035); }
.demo-media { display: grid; gap: 6px; overflow: hidden; border-radius: 12px; }
.demo-media figure { position: relative; margin: 0; }
.demo-media figcaption { position: absolute; left: 6px; top: 6px; padding: 2px 7px; border-radius: 999px; background: rgba(0,0,0,.6); color: #fff; font-size: 10px; }
.demo-media img, .demo-media video { display: block; width: 100%; height: auto; aspect-ratio: 1216 / 832; object-fit: cover; border-radius: 12px; background: rgba(255,255,255,.04); }
.demo-compare { position: relative; overflow: hidden; border-radius: 12px; touch-action: pan-y; }
.demo-compare .compare-before { position: absolute; inset: 0; height: 100%; clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.compare-line { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 2px; margin-left: -1px; background: var(--accent); box-shadow: 0 0 12px rgba(216,255,79,.7); pointer-events: none; }
.compare-line::after { content: "⇆"; position: absolute; top: 50%; left: 50%; width: 28px; height: 28px; display: grid; place-items: center; transform: translate(-50%, -50%); border-radius: 50%; background: var(--accent); color: var(--accent-ink); font-size: 14px; font-weight: 800; }
.compare-label { position: absolute; top: 8px; left: 8px; padding: 2px 8px; border-radius: 999px; background: rgba(0,0,0,.62); color: #fff; font-size: 10px; pointer-events: none; }
.compare-label.is-after { left: auto; right: 8px; }
.demo-compare input[type="range"] { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize; }
.demo-compare:has(input:focus-visible) { outline: 2px solid rgba(216,255,79,.7); outline-offset: 3px; }
.demo-media.is-swapping { animation: demoSwap .45s cubic-bezier(.2,.8,.2,1) both; }
.demo-meta { display: flex; flex-wrap: nowrap; gap: 5px; min-height: 20px; margin: 8px 0 0; padding: 0; overflow: hidden; list-style: none; }
.demo-meta li { flex: 0 0 auto; white-space: nowrap; }
.demo-meta li { padding: 3px 8px; border-radius: 999px; background: rgba(255,255,255,.06); color: #aeb8c2; font: 600 10px/1.4 ui-monospace, "SF Mono", monospace; }
.demo-note { margin: 10px 0 0; color: #6f7a88; font-size: 10px; line-height: 1.5; }

/* ---------- Compliance footer ---------- */
/* Same three lines as chat.baizhiai.org: copyright / contact + location / legal + sister site. */
.shell footer.site-footer { position: relative; z-index: 2; display: grid; justify-items: center; gap: 6px; margin-top: 34px; padding: 18px 0 4px; border-top: 1px solid rgba(255,255,255,.07); color: #8a95a2; font: 400 12px/1.6 Inter, "Segoe UI", "Microsoft YaHei", sans-serif; letter-spacing: 0; text-align: center; }
.site-footer p { margin: 0; }
.footer-copy { color: #c3ccd4; }
.footer-contact, .footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 18px; }
.footer-links { gap: 4px 8px; }
.footer-links span { color: #4f5966; }
.site-footer a { color: #a9b4bf; text-decoration: none; }
.site-footer a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
/* The signed-in desktop studio has never shown the footer (studio.css); keep it that way. */
body.studio-layout:not(.auth-mode) .shell footer.site-footer { display: none; }
body:not(.auth-mode) .shell footer.site-footer { margin-top: 26px; padding-top: 14px; font-size: 11px; }

/* Legal and contact links at the bottom of the signed-in account page. */
.account-legal-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px 10px; margin: 4px 0 0; padding: 12px 0 2px; color: #4f5966; font-size: 12px; }
.account-legal-links a { color: #8e98a8; text-decoration: none; }
.account-legal-links a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

@keyframes showcaseIn { from { opacity: 0; transform: translateY(14px); } }
@keyframes demoSwap { from { opacity: 0; transform: scale(.985); } }
@keyframes demoCaret { 50% { opacity: 0; } }

/* ---------- Mobile / tablet (single column) ---------- */
@media (max-width: 1023px) {
  .auth-mode .topbar { display: flex; flex-direction: column; align-items: center; gap: 10px; padding-bottom: 12px; }
  .auth-mode .auth-crosslink, .auth-mode .lang-toggle { min-height: 32px; padding: 0 12px; font-size: 11px; }
  .auth-mode .auth-card { margin-top: 18px; }
}
@media (max-width: 619px) {
  /* Phones are the main audience: keep the sign-in form close to the top. */
  .showcase-kicker, .showcase-title .title-brand { display: none; }
  .showcase-title { font-size: 18px; }
  .showcase-title .title-tail { display: block; font-size: 14px; }
  .showcase-subtitle { margin-top: 6px; font-size: 12px; }
  .showcase-features { flex-wrap: nowrap; justify-content: flex-start; margin: 12px -16px 0; padding: 0 16px 2px; overflow-x: auto; scrollbar-width: none; -webkit-mask-image: linear-gradient(90deg, transparent, #000 16px, #000 calc(100% - 16px), transparent); mask-image: linear-gradient(90deg, transparent, #000 16px, #000 calc(100% - 16px), transparent); }
  .showcase-features::-webkit-scrollbar { display: none; }
  .showcase-features li { flex: 0 0 auto; }
  .auth-demo { padding: 13px; border-radius: 20px; }
  .demo-tabs button b { font-size: 11px; }
  .auth-mode .topbar { gap: 8px; padding-bottom: 6px; }
  .auth-mode .auth-brand { font-size: 38px; }
  .auth-mode .auth-crosslink, .auth-mode .lang-toggle { min-height: 30px; }
  .showcase-features { margin-top: 8px; }
  .auth-mode .auth-card { margin-top: 12px; }
  .auth-mode .auth-mark { margin-bottom: 12px; }
}

/* ---------- Desktop split screen ---------- */
@media (min-width: 1024px) {
  .auth-mode .shell {
    width: min(100%, 1320px);
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(400px, 452px);
    grid-template-areas: "top top" "intro card" "demo card" "foot foot";
    grid-template-rows: auto auto 1fr auto;
    column-gap: clamp(40px, 5.5vw, 104px);
    align-content: start;
    padding: 22px clamp(32px, 4vw, 56px) 18px;
  }
  .auth-mode .topbar { grid-area: top; justify-content: space-between; align-items: center; text-align: left; padding: 0 0 clamp(16px, 3vh, 40px); }
  .auth-mode .auth-brand { font-size: 34px; }
  .auth-mode .auth-intro { grid-area: intro; margin: 0; max-width: 680px; text-align: left; }
  .auth-mode .auth-card { grid-area: card; align-self: start; position: sticky; top: 22px; margin: 0; max-width: none; }
  /* Same size in login, sign-up and reset modes (fits the longest, sign-up). */
  .auth-mode .auth-card { display: flex; flex-direction: column; justify-content: center; min-height: 590px; }
  .auth-mode .auth-demo { grid-area: demo; align-self: start; max-width: 680px; margin: 20px 0 0; padding: 16px 18px; }
  .auth-mode .site-footer { grid-area: foot; }
  .showcase-kicker { font-size: 11px; }
  .showcase-title { font-size: clamp(30px, 2.4vw, 40px); line-height: 1.12; letter-spacing: -.035em; }
  .showcase-title .title-tail { display: block; margin-top: 6px; font-size: .58em; letter-spacing: -.015em; }
  .showcase-subtitle { font-size: 15px; }
  .showcase-lede { display: block; max-width: 600px; }
  .showcase-features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
  .showcase-features li { align-items: flex-start; flex-direction: column; gap: 10px; padding: 14px; border-radius: 16px; background: rgba(255,255,255,.04); }
  .showcase-features li > div > span { display: block; margin-top: 4px; }
  .showcase-features b { font-size: 13px; }
  .feature-icon { width: 34px; height: 34px; border-radius: 10px; }
  .feature-icon svg { width: 18px; height: 18px; }
  .demo-stage { grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); align-items: start; gap: 14px; }
  .demo-user { justify-self: stretch; width: auto; }
  .auth-mode .shell footer.site-footer { margin-top: 20px; padding-top: 14px; }
}

/* ---------- Wide screens: intro | sample generations | sign-in, side by side ---------- */
@media (min-width: 1440px) {
  .auth-mode .shell {
    width: min(100%, 1680px);
    /* Equal columns: the sample card and the sign-in card are the same width. */
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-areas: "top top top" "intro demo card" "foot foot foot";
    /* Header pinned top, footer bottom, the three panels centred between them. */
    grid-template-rows: auto auto auto;
    align-content: space-between;
    column-gap: clamp(28px, 2.4vw, 48px);
    padding-bottom: 8px;
  }
  .auth-mode .auth-intro, .auth-mode .auth-demo { max-width: none; }
  /* The intro spans the same height as the two cards: headline pinned to the top edge,
     feature list to the bottom edge, so English and Chinese occupy the same box. */
  .auth-mode .auth-intro { align-self: stretch; display: flex; flex-direction: column; min-height: 690px; padding: 26px 0; }
  .auth-mode .auth-intro .showcase-features { margin-top: auto; padding-top: 18px; }
  /* Both cards stretch to the taller of the two, so they always match in height. */
  .auth-mode .auth-demo, .auth-mode .auth-card { align-self: stretch; }
  /* One fixed size for both cards, tall enough for the longest form (registration),
     so neither card changes size when switching samples or login / sign-up / reset. */
  .auth-mode .auth-demo, .auth-mode .auth-card { min-height: 690px; }
  .auth-mode .auth-demo { display: flex; flex-direction: column; margin: 0; padding: 22px 24px; }
  .auth-mode .demo-stage { flex: 1 1 auto; align-content: start; }
  .auth-mode .demo-note { margin-top: auto; padding-top: 12px; }
  .auth-mode .auth-card { position: static; display: flex; flex-direction: column; justify-content: center; padding: 30px 32px; }
  /* A larger sign-in form to sit beside the sample card. */
  .auth-mode .auth-card .card-heading h2 { font-size: 26px; }
  .auth-mode .auth-card .auth-copy { font-size: 14px; }
  .auth-mode .auth-row { gap: 14px; }
  .auth-mode .auth-row input, .auth-mode .auth-row input#username, .auth-mode .auth-row .password-field input { height: 56px; font-size: 15px; }
  .auth-mode .auth-tabs button { min-height: 42px; font-size: 14px; }
  .auth-mode .auth-notice summary { min-height: 50px; }
  .auth-mode .auth-consent { font-size: 13px; }
  .auth-mode .auth-row #loginButton, .auth-mode .auth-row .auth-submit { min-height: 58px; font-size: 17px; }
  .showcase-title { font-size: clamp(30px, 2vw, 38px); }
  .showcase-features { grid-template-columns: 1fr; gap: 8px; }
  .showcase-features li { flex-direction: row; align-items: center; gap: 12px; padding: 12px 14px; }
  .showcase-features li > div > span { margin-top: 2px; }
  .demo-stage { grid-template-columns: 1fr; gap: 10px; }
  .demo-user { justify-self: end; width: 94%; }
}

@media (prefers-reduced-motion: reduce) {
  .auth-showcase, .demo-media.is-swapping { animation: none; }
  .demo-user p.is-typing::after { animation: none; }
}
@media (prefers-reduced-transparency: reduce) {
  .auth-demo, .auth-crosslink, .lang-toggle { background: rgba(17,22,30,.94); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
