/* Hybrid page structure — skin files (skin-a..d.css) supply identity tokens. */

/* release the app.css body lock: this page scrolls */
html, body { height: auto; }
body {
  display: block;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--page-bg, var(--bg));
  color: var(--page-text, var(--text));
  font-family: var(--font-body, system-ui, sans-serif);
}

:root {
  --font-body: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: var(--font-body);
  --font-mono: ui-monospace, 'Cascadia Code', 'SF Mono', Consolas, monospace;
  --page-accent: var(--accent);
  --page-radius: 12px;
}

/* ---- header ---- */
.site-head {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px clamp(16px, 3vw, 44px);
  position: relative;
  z-index: 5;
}
.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.1rem;
  color: var(--page-text);
  text-decoration: none;
  letter-spacing: -.01em;
}
.brand-dot { fill: var(--page-accent); }
.head-note {
  margin: 0;
  flex: 1;
  text-align: center;
  font-size: .82rem;
  color: var(--page-dim);
  font-family: var(--font-mono);
}
.head-links { display: flex; align-items: center; gap: 16px; }
.head-links a { color: var(--page-dim); text-decoration: none; font-size: .9rem; }
.head-links a:hover { color: var(--page-text); }

/* ---- hero copy ---- */
.hero-copy {
  text-align: center;
  padding: clamp(18px, 4vw, 44px) 20px 22px;
  position: relative;
  z-index: 2;
}
.hero-copy h1 {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: clamp(2rem, 4.6vw, 3.4rem);
  line-height: 1.08;
  letter-spacing: var(--display-tracking, -.02em);
  text-transform: var(--display-transform, none);
}
.hero-copy .sub {
  margin: 0 auto;
  max-width: 640px;
  color: var(--page-dim);
  font-size: 1.05rem;
}

/* ---- editor shell ---- */
#editor-shell {
  padding: 8px clamp(12px, 2.5vw, 36px) 0;
  position: relative;
  z-index: 2;
}
/* the editor + its floating UI keep the EDITOR palette even when the page palette differs */
#editor-frame, #label-popup, #export-card, #toast {
  color: var(--text);
}

#editor-frame {
  height: clamp(540px, 72vh, 880px);
  max-width: 1680px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--page-radius);
  overflow: hidden;
  box-shadow: var(--frame-shadow, 0 18px 60px rgba(10, 14, 24, .18));
  background: var(--bg);
}
#editor-frame #topbar { flex: 0 0 auto; }
#editor-frame #workspace { flex: 1 1 auto; min-height: 0; display: flex; }

#try-bar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 9px 14px;
  border-top: 1px solid var(--border);
  background: var(--bg2);
}
.try-label { font-size: .84rem; color: var(--text-dim); }
#demo-chips { display: flex; gap: 6px; }
.chip-sample {
  appearance: none;
  font: inherit;
  font-size: .82rem;
  padding: 4px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
}
.chip-sample:hover { color: var(--text); border-color: var(--text-dim); }
.chip-sample.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---- pro locks ---- */
.btn.pro { display: inline-flex; align-items: center; gap: 5px; }
.btn.pro .lock { width: 11px; height: 11px; opacity: .7; flex: 0 0 auto; }

#pro-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, .55);
  display: grid;
  place-items: center;
  padding: 24px;
}
#pro-card {
  width: min(420px, 100%);
  background: var(--bg2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 18px 20px;
}
#pro-card header { display: flex; align-items: center; justify-content: space-between; }
#pro-card h2 { margin: 0; font-size: 1.05rem; }
#pro-card ul { margin: 10px 0; padding-left: 20px; color: var(--text-dim); font-size: .92rem; display: grid; gap: 5px; }
#pro-want { margin: 10px 0 0; font-size: .9rem; font-weight: 600; }
.pro-price { color: var(--text-dim); font-size: .86rem; margin: 12px 0 2px; }

/* ---- "New" popover ---- */
#actions { position: relative; }
#new-pop {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 70;
}
#new-drop {
  width: 300px;
  background: var(--bg2, var(--bg));
  color: var(--text);
  border: 1.5px dashed var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 18px 16px;
  text-align: center;
  cursor: pointer;
  display: grid;
  gap: 6px;
}
#new-drop:hover, #new-drop:focus-visible { border-color: var(--accent); outline: none; }
#new-drop strong { font-size: .95rem; }
#new-drop em { font-style: normal; color: var(--text-dim); font-size: .8rem; line-height: 1.5; }

/* ---- projects popover (premium) ---- */
#proj-pop {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 70;
  width: 320px;
  background: var(--bg2, var(--bg));
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 12px 14px 14px;
}
#proj-head {
  margin: 0 0 8px;
  font-family: var(--font-mono, monospace);
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-dim);
}
#proj-folder {
  width: 100%;
  margin: 0 0 10px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 6px 8px;
  font-size: .84rem;
}
#proj-list { display: grid; gap: 4px; margin-bottom: 10px; max-height: 260px; overflow-y: auto; }
.proj-move { flex: 0 0 auto; font-size: .8rem; }
#cloud-section { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
#cloud-head {
  margin: 0 0 8px;
  font-family: var(--font-mono, monospace);
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--premium, #9256d9);
}
#cloud-list { display: grid; gap: 4px; margin-bottom: 8px; max-height: 180px; overflow-y: auto; font-size: .84rem; color: var(--text-dim); }
#cloud-save { width: 100%; }
.proj-empty { margin: 2px 0 6px; color: var(--text-dim); font-size: .84rem; }
.proj-row { display: flex; align-items: center; gap: 6px; }
.proj-row.active .proj-name { border-color: var(--accent); color: var(--text); }
.proj-name {
  flex: 1;
  text-align: left;
  background: none;
  border: 1px solid var(--border);
  border-radius: 7px;
  color: var(--text-dim);
  font-size: .84rem;
  padding: 7px 10px;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.proj-name:hover { border-color: var(--accent); }
.proj-del { flex: 0 0 auto; }
body.premium .pro .lock { display: none; }

/* premium locks stand out in purple */
.pro .lock {
  color: var(--premium, #9256d9);
  filter: drop-shadow(0 0 3px color-mix(in srgb, var(--premium, #9256d9) 60%, transparent));
}

/* ---- Auto (AI annotate) button — the attention-grabber ---- */
#btn-auto {
  position: relative;
  color: var(--premium, #9256d9);
  border: 1px solid color-mix(in srgb, var(--premium, #9256d9) 45%, transparent);
  border-radius: 8px;
  padding-right: 30px;
  animation: auto-breathe 3s ease-in-out infinite;
}
#btn-auto::after {
  content: 'AI';
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  font-size: .56rem;
  font-weight: 700;
  letter-spacing: .06em;
  padding: 1px 4px;
  border-radius: 4px;
  background: var(--premium, #9256d9);
  color: #fff;
  line-height: 1.3;
}
#btn-auto:disabled { animation: none; opacity: .45; }
@keyframes auto-breathe {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--premium, #9256d9) 0%, transparent); }
  50% { box-shadow: 0 0 10px 1px color-mix(in srgb, var(--premium, #9256d9) 45%, transparent); }
}
@media (prefers-reduced-motion: reduce) { #btn-auto { animation: none; } }

/* ---- Auto popover (hint + consent + progress) ---- */
#auto-wrap { position: relative; display: inline-flex; }
#auto-pop {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 75;
  width: 300px;
  background: var(--bg2, var(--bg));
  color: var(--text);
  border: 1px solid color-mix(in srgb, var(--premium, #9256d9) 40%, var(--border));
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 14px 16px;
}
#auto-pop h3 {
  margin: 0 0 8px;
  font-family: var(--font-mono, monospace);
  font-size: .72rem;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--premium, #9256d9);
}
#auto-hint {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: .86rem;
  margin-bottom: 10px;
}
#auto-hint:focus { outline: none; border-color: var(--premium, #9256d9); }
.auto-consent { margin: 0 0 10px; font-size: .74rem; color: var(--text-dim); line-height: 1.45; }
.auto-consent a { color: var(--premium, #9256d9); }
#auto-run {
  width: 100%;
  padding: 8px 0;
  border-radius: 8px;
  background: var(--premium, #9256d9);
  border-color: var(--premium, #9256d9);
  color: #fff;
}
#auto-status { margin: 4px 0 2px; font-size: .84rem; color: var(--text-dim); display: flex; align-items: center; gap: 8px; }
#auto-status .scan {
  width: 14px;
  height: 14px;
  border: 2px solid color-mix(in srgb, var(--premium, #9256d9) 30%, transparent);
  border-top-color: var(--premium, #9256d9);
  border-radius: 50%;
  animation: auto-spin 0.9s linear infinite;
  flex: 0 0 auto;
}
@keyframes auto-spin { to { transform: rotate(360deg); } }
#auto-cancel {
  margin-top: 8px;
  background: none;
  border: 0;
  color: var(--text-dim);
  font-size: .78rem;
  text-decoration: underline;
  cursor: pointer;
}

/* ---- sign-in modal (dormant until auth is configured) ---- */
#signin-modal {
  position: fixed;
  inset: 0;
  z-index: 95;
  background: rgba(0, 0, 0, .6);
  display: grid;
  place-items: center;
  padding: 24px;
}
#signin-card {
  width: min(360px, 100%);
  background: var(--bg2, var(--bg));
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--frame-shadow, var(--shadow));
  padding: 18px 22px 20px;
}
#signin-card header { display: flex; align-items: center; justify-content: space-between; }
#signin-card h2 { margin: 0; font-size: 1.05rem; }
.signin-sub { margin: 6px 0 14px; color: var(--text-dim); font-size: .88rem; }
#signin-google { display: grid; place-items: center; min-height: 44px; }
.signin-or { display: flex; align-items: center; gap: 10px; margin: 12px 0; color: var(--text-dim); font-size: .78rem; }
.signin-or::before, .signin-or::after { content: ''; flex: 1; height: 1px; background: var(--border); }
#signin-email-form { display: grid; gap: 8px; }
#signin-email {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 10px;
  font-size: .9rem;
}
#signin-note { margin: 10px 0 0; font-size: .84rem; color: var(--accent); }
.signin-pass { display: block; margin: 14px auto 0; background: none; border: 0; color: var(--text-dim); font-size: .82rem; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.signin-pass:hover { color: var(--text); }
.acct-badge { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 5px; background: var(--premium, #9256d9); color: #fff; font-size: .68rem; font-weight: 700; letter-spacing: .04em; vertical-align: middle; }
.acct-dim { color: var(--text-dim); font-size: .8rem; }
#keys-section { margin: 14px 0 4px; padding-top: 12px; border-top: 1px solid var(--border); }
#keys-head { margin: 0 0 8px; font-family: var(--font-mono, monospace); font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--premium, #9256d9); }
#keys-list { display: grid; gap: 4px; margin-bottom: 8px; }
.key-row { display: flex; align-items: center; gap: 6px; }
.key-meta { flex: 1; font-family: var(--font-mono, monospace); font-size: .78rem; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.keys-doc { margin: 6px 0 0; }
.key-reveal { margin: 8px 0; padding: 10px; border: 1px solid var(--premium, #9256d9); border-radius: 8px; background: color-mix(in srgb, var(--premium, #9256d9) 7%, transparent); }
.key-reveal code { display: block; margin: 4px 0 8px; padding: 6px 8px; background: var(--bg); border-radius: 6px; font-size: .8rem; word-break: break-all; }

/* ---- premium upsell (buy-or-pass after Done) ---- */
#upsell-modal {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(0, 0, 0, .6);
  display: grid;
  place-items: center;
  padding: 24px;
}
#upsell-card {
  position: relative;
  width: min(430px, 100%);
  background: var(--bg2, var(--bg));
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--frame-shadow, var(--shadow));
  padding: 20px 26px 22px;
}
#upsell-card .crop {
  position: absolute;
  width: 14px;
  height: 14px;
  border: 2px solid var(--premium, #9256d9);
  opacity: .85;
}
#upsell-card .crop.tl { border-top-left-radius: 10px; }
#upsell-card .crop.tr { border-top-right-radius: 10px; }
#upsell-card .crop.bl { border-bottom-left-radius: 10px; }
#upsell-card .crop.br { border-bottom-right-radius: 10px; }
#upsell-card .crop.tl { top: -2px; left: -2px; border-right: 0; border-bottom: 0; }
#upsell-card .crop.tr { top: -2px; right: -2px; border-left: 0; border-bottom: 0; }
#upsell-card .crop.bl { bottom: -2px; left: -2px; border-right: 0; border-top: 0; }
#upsell-card .crop.br { bottom: -2px; right: -2px; border-left: 0; border-top: 0; }
.upsell-rule { display: flex; justify-content: space-between; margin: 0 0 12px; }
.upsell-rule span { width: 1px; height: 8px; background: var(--border); }
#upsell-card header { display: flex; align-items: center; justify-content: space-between; }
.upsell-ref {
  margin: 0;
  font-family: var(--font-mono, monospace);
  font-size: .72rem;
  letter-spacing: .14em;
  color: var(--text-dim);
}
#upsell-card h2 {
  margin: 10px 0 6px;
  font-family: var(--font-display);
  text-transform: var(--display-transform, none);
  letter-spacing: var(--display-tracking, 0);
  font-size: 2rem;
  line-height: 1.02;
}
.upsell-sub { margin: 0 0 14px; color: var(--text-dim); font-size: .92rem; }
.upsell-features {
  list-style: none;
  margin: 0 0 16px;
  padding: 14px 16px;
  display: grid;
  gap: 9px;
  background: color-mix(in srgb, var(--premium, #9256d9) 7%, var(--bg2, var(--bg)));
  border: 1px solid color-mix(in srgb, var(--premium, #9256d9) 30%, transparent);
  border-radius: 14px;
}
.upsell-features li { display: grid; grid-template-columns: 16px 1fr; column-gap: 10px; align-items: baseline; }
.upsell-features .tick { width: 10px; height: 10px; border-radius: 2px; align-self: center; }
.upsell-features li[data-k="projects"] .tick { background: #3e7bfa; }
.upsell-features li[data-k="batch"] .tick { background: #f5a623; }
.upsell-features li[data-k="auto"] .tick { background: #30a46c; }
.upsell-features li[data-k="cloud"] .tick { background: #9256d9; }
.upsell-features strong { font-size: .93rem; }
.upsell-features em { grid-column: 2; font-style: normal; color: var(--text-dim); font-size: .8rem; }
.upsell-price-row { display: flex; align-items: baseline; gap: 10px; margin: 0 0 12px; }
.upsell-price { font-family: var(--font-display); font-size: 1.5rem; }
.upsell-price-note { color: var(--text-dim); font-size: .8rem; }
#upsell-card .upsell-cta {
  width: 100%;
  padding: 11px 0;
  font-size: 1rem;
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  background: var(--premium, #9256d9);
  border-color: var(--premium, #9256d9);
  color: #fff;
}
#upsell-card .upsell-cta:hover { background: color-mix(in srgb, var(--premium, #9256d9) 85%, white); }
.upsell-price { color: var(--premium, #9256d9); }
.upsell-cta::after {
  content: '';
  position: absolute;
  top: 0;
  left: -60%;
  width: 40%;
  height: 100%;
  background: linear-gradient(105deg, transparent, rgba(255, 255, 255, .35), transparent);
  animation: upsell-sheen 3.2s ease-in-out infinite;
}
@keyframes upsell-sheen { 0%, 55% { left: -60%; } 85%, 100% { left: 120%; } }
@media (prefers-reduced-motion: reduce) { .upsell-cta::after { animation: none; } }
.upsell-note { margin: 10px 0 0; font-size: .85rem; color: var(--accent); }
.upsell-meter {
  margin: 12px 0 0;
  font-family: var(--font-mono, monospace);
  font-size: .78rem;
  color: var(--text-dim);
}
.upsell-pass {
  display: block;
  margin: 14px auto 0;
  background: none;
  border: 0;
  color: var(--text-dim);
  font-size: .82rem;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.upsell-pass:hover { color: var(--text); }

/* ---- story sections ---- */
.story {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 clamp(16px, 3vw, 44px);
  position: relative;
  z-index: 1;
}
.story section { padding: clamp(34px, 5vw, 60px) 0; }
.story h2 {
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 2.6vw, 2.1rem);
  letter-spacing: var(--display-tracking, -.015em);
  text-transform: var(--display-transform, none);
  margin: 0 0 24px;
}

.trio { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 26px; }
.trio h3 { margin: 0 0 8px; }
.trio p { margin: 0; color: var(--page-dim); font-size: .95rem; line-height: 1.6; }
.trio a { color: var(--page-accent); }
.tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: .82rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 5px;
  border: 1.5px solid var(--tag-border, var(--page-accent));
  color: var(--tag-text, var(--page-accent));
  background: var(--tag-bg, transparent);
}
.tag.t1 { --tag-border: var(--c1, #e5484d); --tag-text: var(--c1, #e5484d); }
.tag.t2 { --tag-border: var(--c2, #3e7bfa); --tag-text: var(--c2, #3e7bfa); }
.tag.t3 { --tag-border: var(--c3, #30a46c); --tag-text: var(--c3, #30a46c); }

.output-sample .sample-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }
.output-sample figure { margin: 0; }
.output-sample figcaption {
  font-family: var(--font-mono);
  font-size: .78rem;
  color: var(--page-dim);
  margin-bottom: 8px;
}
.output-sample pre {
  margin: 0;
  padding: 16px;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: .78rem;
  line-height: 1.55;
  background: var(--code-bg, var(--bg2));
  color: var(--code-text, var(--text));
  border: 1px solid var(--border);
  border-radius: 10px;
}

.uses ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 11px; max-width: 760px; }
.uses li { color: var(--page-dim); padding-left: 22px; position: relative; }
.uses li::before { content: '›'; position: absolute; left: 4px; color: var(--page-accent); font-weight: 800; }
.uses strong { color: var(--page-text); }

.faq-s dl { max-width: 760px; margin: 0; }
.faq-s dt { font-weight: 700; margin-top: 18px; }
.faq-s dd { margin: 6px 0 0; color: var(--page-dim); line-height: 1.6; }
.faq-s a { color: var(--page-accent); }

.site-foot { padding: 28px 20px 34px; text-align: center; }
.site-foot p { margin: 0; color: var(--page-dim); font-size: .85rem; }
.site-foot a { color: var(--page-dim); }

/* ---- garnish defaults (skins enable) ---- */
.crop-marks, #coord-readout { display: none; }

#coord-readout {
  position: absolute;
  right: 12px;
  bottom: 12px;
  font-family: var(--font-mono);
  font-size: .74rem;
  padding: 3px 9px;
  border-radius: 5px;
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text-dim);
  pointer-events: none;
  z-index: 3;
}

@media (max-width: 760px) {
  .head-note { display: none; }
  #editor-frame { height: 70vh; }
}
