/* ============================================================
   e-translate · public landing (self-contained, CSP 'self')
   ============================================================ */

:root {
  --bg:          #0a0b10;
  --surface:     #14161f;
  --surface-2:   #1b1e2a;
  --surface-3:   #232737;
  --border:      #2a2e3f;
  --text:        #eef0f7;
  --text-dim:    #a4a9bd;
  --text-faint:  #6e7488;
  --accent:      #b14bff;
  --accent-2:    #7c3aed;
  --accent-soft: rgba(177, 75, 255, 0.14);
  --accent-glow: rgba(177, 75, 255, 0.35);
  --success:     #34d399;
  --danger:      #ff5d6c;
  --radius:      14px;
  --radius-sm:   10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
code { font-family: var(--mono); }
a { color: inherit; }

/* background orbs */
.bg-orbs { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.bg-orbs span {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.5;
}
.bg-orbs span:nth-child(1) {
  width: 520px; height: 520px;
  top: -160px; left: -120px;
  background: radial-gradient(circle, rgba(124, 58, 237, 0.55), transparent 70%);
}
.bg-orbs span:nth-child(2) {
  width: 460px; height: 460px;
  top: 10%; right: -140px;
  background: radial-gradient(circle, rgba(177, 75, 255, 0.4), transparent 70%);
}

.brand-mark {
  display: grid; place-items: center;
  width: 36px; height: 36px;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 18px var(--accent-glow);
  flex: none;
}

/* nav */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px clamp(16px, 4vw, 32px);
}
.nav-brand { display: flex; align-items: center; gap: 11px; }
.nav-name { font-weight: 700; letter-spacing: -0.01em; }
.nav-links { display: flex; align-items: center; gap: 22px; }
.nav-links a { text-decoration: none; color: var(--text-dim); font-size: 0.92rem; transition: color 0.15s; }
.nav-links a:hover { color: var(--text); }
.nav-admin {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text) !important;
}
.nav-admin:hover { background: var(--surface-2); border-color: var(--accent); }

main { max-width: 1080px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 32px); }

/* hero */
.hero { padding: clamp(40px, 8vw, 90px) 0 60px; text-align: center; }
.pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 14px;
  background: var(--accent-soft);
  border: 1px solid rgba(177, 75, 255, 0.3);
  border-radius: 999px;
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-bottom: 26px;
}
.pill-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.hero h1 {
  margin: 0 0 18px;
  font-size: clamp(2.1rem, 6vw, 3.6rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  font-weight: 800;
}
.grad {
  background: linear-gradient(120deg, var(--accent), #d8a6ff);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.lede {
  max-width: 640px;
  margin: 0 auto 30px;
  color: var(--text-dim);
  font-size: clamp(1rem, 2.2vw, 1.15rem);
}
.lede strong { color: var(--text); }
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px;
  font: inherit; font-size: 0.95rem; font-weight: 600;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.08s, filter 0.15s, background 0.15s, border-color 0.15s, opacity 0.15s;
}
.btn:hover { filter: brightness(1.08); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 22px var(--accent-glow);
}
.btn-ghost { color: var(--text-dim); background: transparent; border-color: var(--border); }
.btn-ghost:hover { color: var(--text); background: var(--surface-2); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-spinner {
  display: none; width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.4); border-top-color: #fff;
  animation: spin 0.6s linear infinite;
}
.btn.loading .btn-spinner { display: inline-block; }
.btn.loading .btn-label { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* features */
.features {
  list-style: none;
  margin: 48px 0 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  text-align: left;
}
.features li {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.feat-ico {
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border-radius: 10px;
  margin-bottom: 12px;
  color: var(--accent);
  background: var(--accent-soft);
}
.features strong { display: block; margin-bottom: 4px; }
.features span { color: var(--text-faint); font-size: 0.9rem; }

/* sections */
section h2 { font-size: clamp(1.5rem, 3.5vw, 2rem); letter-spacing: -0.02em; margin: 0 0 8px; }
.section-sub { color: var(--text-dim); margin: 0 0 28px; }
.section-sub code, .api code, .try code {
  background: var(--surface-2);
  padding: 1px 6px;
  border-radius: 6px;
  font-size: 0.88em;
  color: var(--accent);
}

.api, .try, .langs { padding: 50px 0; border-top: 1px solid var(--border); }
.lang-loading { color: var(--text-faint); font-size: 0.9rem; }
#langs .lang-chips { gap: 8px; }
#langs .lang-chip { font-size: 0.85rem; padding: 6px 12px; }

.endpoints { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.ep {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.ep header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.ep header code { background: none; color: var(--text); font-size: 0.95rem; font-weight: 600; padding: 0; }
.ep p { margin: 0; color: var(--text-faint); font-size: 0.9rem; }
.method {
  font-size: 0.68rem; font-weight: 800; letter-spacing: 0.05em;
  padding: 3px 8px; border-radius: 6px;
}
.method.post { color: var(--success); background: rgba(52, 211, 153, 0.12); }
.method.get  { color: var(--accent); background: var(--accent-soft); }
.snippet {
  margin: 14px 0 0;
  padding: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-size: 0.8rem;
  color: var(--text-dim);
}
.snippet code { background: none; padding: 0; color: inherit; }

/* try-it card */
.try-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 560px;
}
.try-row { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.try-row label { font-size: 0.82rem; font-weight: 600; color: var(--text-dim); }
.try-row input {
  padding: 11px 14px;
  font: inherit; font-family: var(--mono); font-size: 0.9rem;
  color: var(--text);
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.try-row input::placeholder { color: var(--text-faint); }
.try-row input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.try-result { margin-top: 16px; }
.try-result:empty { display: none; }
.try-result .ok-head, .try-result .err-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 0.9rem; font-weight: 600; margin-bottom: 10px;
}
.try-result .ok-head { color: var(--success); }
.try-result .err-head { color: var(--danger); }
.lang-chips { display: flex; flex-wrap: wrap; gap: 7px; }
.lang-chip {
  font-size: 0.8rem;
  padding: 4px 10px;
  background: var(--accent-soft);
  border: 1px solid rgba(177, 75, 255, 0.25);
  border-radius: 999px;
  color: var(--text);
}
.lang-chip code { background: none; padding: 0; color: var(--accent); font-size: 0.95em; }

/* footer */
.landing-foot {
  max-width: 1080px;
  margin: 40px auto 0;
  padding: 28px clamp(16px, 4vw, 32px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
  color: var(--text-faint);
  font-size: 0.85rem;
}
.landing-foot a { color: var(--text-dim); text-decoration: none; }
.landing-foot a:hover { color: var(--accent); }

@media (max-width: 560px) {
  .nav-links { gap: 14px; }
  .nav-links a:not(.nav-admin) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* ---- demo widget ---- */
.try-card { max-width: 640px; }
.key-row { display: flex; gap: 8px; }
.key-row input { flex: 1; min-width: 0; }
.key-row .btn { flex: none; white-space: nowrap; }

.demo-selects {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}
.try-row select, #src-text {
  width: 100%;
  padding: 11px 14px;
  font: inherit; font-size: 0.92rem;
  color: var(--text);
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.try-row select:focus, #src-text:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
#src-text { font-family: var(--font); resize: vertical; min-height: 64px; }
#src-text::placeholder { color: var(--text-faint); }

.swap-btn {
  display: grid; place-items: center;
  width: 42px; height: 42px;
  margin-bottom: 1px;
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.swap-btn:hover { color: var(--accent); border-color: var(--accent); background: var(--surface-3); }
.swap-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#translate-btn { width: 100%; }

.try-result .ok-head .badge { margin-left: auto; }
.badge {
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em;
  padding: 2px 9px; border-radius: 999px;
}
.badge-cache { color: var(--accent); background: var(--accent-soft); border: 1px solid rgba(177, 75, 255, 0.3); }
.badge-fresh { color: var(--success); background: rgba(52, 211, 153, 0.12); border: 1px solid rgba(52, 211, 153, 0.3); }

.result-text {
  padding: 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
.detected { margin-top: 10px; font-size: 0.85rem; color: var(--text-faint); }
.detected code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; color: var(--accent); }

.langs-supported { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
.langs-head { font-size: 0.82rem; font-weight: 600; color: var(--text-dim); margin-bottom: 10px; }

@media (max-width: 480px) {
  .demo-selects { grid-template-columns: 1fr; }
  .swap-btn { transform: rotate(90deg); justify-self: center; }
  .key-row { flex-direction: column; }
}
