/*
Theme Name: 有道翻译
Theme URI: https://example.com/lingua-desk-translator
Author: Codex
Author URI: https://example.com
Description: SEO-friendly WordPress translator theme with online translation, download page, article page, structured data, language controls, history, and configurable API endpoint.
Version: 1.2.0
Requires at least: 6.0
Tested up to: 6.5
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: lingua-desk-translator
Tags: custom-logo, custom-menu, translation, one-column, responsive-layout
*/

:root {
  --bg: #f7f8fb;
  --surface: #ffffff;
  --surface-soft: #f2f6ff;
  --text: #162033;
  --muted: #647084;
  --line: #dbe3f0;
  --primary: #1976d2;
  --primary-dark: #0e54a2;
  --accent: #00a88f;
  --warning: #f4a62a;
  --danger: #d74b4b;
  --shadow: 0 18px 50px rgba(26, 43, 72, 0.11);
  --radius: 8px;
  --container: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(246, 249, 255, 0.98) 0%, rgba(247, 248, 251, 1) 390px),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

body.admin-bar .site-header {
  top: 32px;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  display: block;
  max-width: 100%;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.screen-reader-text {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid rgba(219, 227, 240, 0.85);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(18px);
}

.header-inner {
  width: min(100% - 40px, var(--container));
  min-height: 70px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 190px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  background:
    linear-gradient(135deg, var(--primary) 0%, var(--accent) 100%);
  box-shadow: 0 10px 25px rgba(25, 118, 210, 0.22);
}

.custom-logo-link {
  display: inline-flex;
  flex: 0 0 auto;
}

.custom-logo {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  object-fit: cover;
}

.brand-copy {
  display: grid;
  gap: 1px;
}

.brand-name {
  color: var(--text);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-tagline {
  color: var(--muted);
  font-size: 12px;
}

.main-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 1;
}

.main-nav .menu-items {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.main-nav li {
  margin: 0;
}

.main-nav a {
  color: #344157;
  border-radius: 6px;
  padding: 9px 13px;
  font-size: 14px;
  font-weight: 600;
}

.main-nav a:hover,
.main-nav .current-menu-item > a {
  background: #edf4ff;
  color: var(--primary-dark);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.ghost-link,
.primary-link {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
}

.ghost-link {
  color: #2d3a50;
  background: #eef3fb;
}

.primary-link {
  color: #fff;
  background: var(--primary);
}

.primary-link:hover {
  background: var(--primary-dark);
}

.mobile-menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 6px;
  background: #eef3fb;
  color: var(--text);
  align-items: center;
  justify-content: center;
}

.mobile-menu-toggle span,
.mobile-menu-toggle::before,
.mobile-menu-toggle::after {
  content: "";
  width: 18px;
  height: 2px;
  border-radius: 99px;
  background: currentColor;
  display: block;
}

.mobile-menu-toggle {
  flex-direction: column;
  gap: 4px;
}

.site-main {
  min-height: calc(100vh - 70px);
}

.app-stage {
  width: min(100% - 40px, var(--container));
  margin: 0 auto;
  padding: 38px 0 0;
}

.app-heading {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.app-heading h1 {
  max-width: 720px;
  margin: 0;
  color: var(--text);
  font-size: 34px;
  line-height: 1.18;
  letter-spacing: 0;
}

.app-heading p {
  max-width: 760px;
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

.hero {
  width: min(100% - 40px, var(--container));
  margin: 0 auto;
  padding: 56px 0 24px;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.1fr);
  gap: 40px;
  align-items: center;
}

.hero-copy {
  display: grid;
  gap: 18px;
}

.eyebrow {
  width: fit-content;
  color: #0d6157;
  background: #dff7f2;
  border: 1px solid #b8ece3;
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 13px;
  font-weight: 800;
}

.hero h1 {
  margin: 0;
  color: var(--text);
  font-size: 48px;
  line-height: 1.08;
  letter-spacing: 0;
}

.hero p {
  max-width: 590px;
  margin: 0;
  color: var(--muted);
  font-size: 18px;
}

.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 10px;
}

.stat-tile {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.78);
  padding: 14px;
}

.stat-value {
  display: block;
  color: var(--primary-dark);
  font-size: 24px;
  font-weight: 850;
}

.stat-label {
  color: var(--muted);
  font-size: 13px;
}

.mini-visual {
  min-height: 300px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    radial-gradient(circle at 18% 22%, rgba(0, 168, 143, 0.18), transparent 32%),
    linear-gradient(145deg, #ffffff 0%, #edf5ff 100%);
  box-shadow: var(--shadow);
  padding: 24px;
  display: grid;
  align-content: center;
  gap: 18px;
}

.visual-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.visual-pill {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  padding: 0 14px;
  color: #2d3a50;
  font-weight: 700;
  box-shadow: 0 10px 25px rgba(26, 43, 72, 0.07);
}

.visual-card {
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid var(--line);
  padding: 18px;
  box-shadow: 0 12px 30px rgba(26, 43, 72, 0.08);
}

.visual-card strong {
  display: block;
  margin-bottom: 8px;
}

.visual-card p {
  margin: 0;
  font-size: 15px;
}

.translator-shell {
  width: min(100% - 40px, var(--container));
  margin: 18px auto 0;
}

.app-stage .translator-shell {
  width: 100%;
}

.translator-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.translator-toolbar {
  min-height: 62px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: #fbfcff;
}

.tool-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tool-tab {
  min-height: 34px;
  border-radius: 6px;
  padding: 0 13px;
  color: #42506a;
  background: transparent;
  font-size: 14px;
  font-weight: 750;
}

.tool-tab.is-active,
.tool-tab:hover {
  color: var(--primary-dark);
  background: #eaf3ff;
}

.tool-tab:disabled {
  cursor: not-allowed;
  color: #9aa5b5;
  background: transparent;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-badge {
  color: #0d6157;
  background: #e7f8f4;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.translator-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 56px minmax(0, 1fr);
  min-height: 390px;
}

.translate-column {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
}

.translate-column + .translate-column {
  border-left: 1px solid var(--line);
}

.column-head {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.language-select {
  min-width: 145px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 34px 0 12px;
  color: #213048;
  background: #fff;
  font-weight: 700;
  outline: none;
}

.language-select:focus,
.translate-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.14);
}

.column-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-button {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #4a5870;
  background: #f1f5fb;
}

.icon-button:hover {
  color: var(--primary-dark);
  background: #e8f2ff;
}

.icon-button svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.swap-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  border-left: 1px solid var(--line);
  border-right: 1px solid var(--line);
  background: #fbfcff;
}

.swap-button {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--primary-dark);
  background: #e8f2ff;
  box-shadow: inset 0 0 0 1px #cfe2fb;
}

.swap-button:hover {
  color: #fff;
  background: var(--primary);
}

.swap-button svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.translate-textarea,
.translate-output {
  width: 100%;
  min-height: 250px;
  border: 0;
  padding: 20px;
  color: var(--text);
  background: #fff;
  resize: none;
  outline: none;
  font-size: 18px;
  line-height: 1.7;
}

.translate-output {
  overflow-y: auto;
  white-space: pre-wrap;
}

.translate-output.is-empty {
  color: #9aa5b5;
}

.column-foot {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: #fbfcff;
}

.counter {
  color: var(--muted);
  font-size: 13px;
}

.translate-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 6px;
  padding: 0 18px;
  color: #fff;
  background: var(--primary);
  font-weight: 800;
  white-space: nowrap;
}

.translate-button:hover {
  background: var(--primary-dark);
}

.translate-button:disabled {
  cursor: wait;
  background: #8fbbe8;
}

.translate-button svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.helper-strip {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
  width: min(100% - 40px, var(--container));
  margin: 22px auto 0;
}

.utility-panel,
.history-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 18px;
  box-shadow: 0 12px 34px rgba(26, 43, 72, 0.07);
}

.panel-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.panel-title-row h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}

.small-button {
  min-height: 32px;
  border-radius: 6px;
  padding: 0 10px;
  color: #3b4a63;
  background: #eef3fb;
  font-size: 13px;
  font-weight: 750;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.quick-action {
  min-height: 82px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcff;
  padding: 13px;
  color: #25334a;
  text-align: left;
  display: grid;
  align-content: start;
  gap: 5px;
}

.quick-action:hover {
  border-color: #b9d5f8;
  background: #f0f7ff;
}

.quick-action strong {
  font-size: 14px;
}

.quick-action span {
  color: var(--muted);
  font-size: 12px;
}

.history-list {
  display: grid;
  gap: 9px;
  max-height: 280px;
  overflow-y: auto;
}

.history-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcff;
  padding: 12px;
  display: grid;
  gap: 6px;
}

.history-item button {
  width: 100%;
  color: inherit;
  background: transparent;
  text-align: left;
  padding: 0;
}

.history-source {
  color: var(--text);
  font-weight: 700;
}

.history-result {
  color: var(--muted);
  font-size: 14px;
}

.empty-history {
  margin: 0;
  color: var(--muted);
}

.content-band {
  width: min(100% - 40px, var(--container));
  margin: 34px auto 0;
  padding: 26px 0 70px;
}

.page-hero {
  width: min(100% - 40px, var(--container));
  margin: 0 auto;
  padding: 52px 0 18px;
  display: grid;
  gap: 14px;
}

.page-hero h1 {
  max-width: 820px;
  margin: 0;
  font-size: 42px;
  line-height: 1.16;
  letter-spacing: 0;
}

.page-hero p {
  max-width: 780px;
  margin: 0;
  color: var(--muted);
  font-size: 17px;
}

.hero-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.page-section {
  padding-bottom: 34px;
}

.page-section > h2,
.seo-copy h2,
.faq-section > h2 {
  margin: 0 0 16px;
  font-size: 24px;
  line-height: 1.25;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.feature-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 20px;
}

.feature-card h2,
.feature-card h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.feature-card p {
  margin: 0;
  color: var(--muted);
}

.seo-copy {
  margin-top: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 24px;
}

.seo-copy p {
  max-width: 900px;
  margin: 0 0 12px;
  color: #3a465d;
}

.inline-links {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.inline-links a {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  background: #eef5ff;
  color: var(--primary-dark);
  padding: 0 12px;
  font-weight: 750;
}

.faq-section {
  margin-top: 24px;
}

.faq-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.faq-item {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 18px;
}

.faq-item h3 {
  margin: 0 0 8px;
  font-size: 17px;
}

.faq-item p {
  margin: 0;
  color: var(--muted);
}

.step-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding-left: 22px;
  color: #334158;
}

.step-list li {
  padding-left: 4px;
}

.posts-section {
  margin-top: 30px;
}

.posts-section h2 {
  margin: 0 0 16px;
  font-size: 22px;
}

.post-list {
  display: grid;
  gap: 12px;
}

.post-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 18px;
}

.post-card h3 {
  margin: 0 0 6px;
  font-size: 18px;
}

.post-card p {
  margin: 0;
  color: var(--muted);
}

.article-card {
  display: grid;
  gap: 7px;
}

.article-meta {
  color: #7b8798;
  font-size: 13px;
}

.pagination-nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.pagination-nav .page-numbers {
  min-width: 34px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: #fff;
  color: #2d3a50;
  padding: 0 10px;
}

.pagination-nav .current {
  color: #fff;
  background: var(--primary);
  border-color: var(--primary);
}

.article-wrap {
  width: min(100% - 40px, 880px);
  margin: 0 auto;
  padding: 52px 0 76px;
}

.article-header {
  display: grid;
  gap: 10px;
  margin-bottom: 24px;
}

.article-header h1 {
  margin: 0;
  font-size: 40px;
  line-height: 1.18;
  letter-spacing: 0;
}

.article-content {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 30px;
  color: #2d3a50;
}

.article-content p {
  margin: 0 0 16px;
}

.article-content h2,
.article-content h3 {
  margin: 26px 0 12px;
  color: var(--text);
}

.article-footer {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.site-footer {
  border-top: 1px solid var(--line);
  background: #101827;
  color: #d5dcec;
}

.footer-inner {
  width: min(100% - 40px, var(--container));
  min-height: 96px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.footer-inner p {
  margin: 0;
}

.footer-links {
  display: flex;
  align-items: center;
  gap: 14px;
  color: #aeb9ce;
  font-size: 14px;
}

.footer-links .footer-menu {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.page-wrap {
  width: min(100% - 40px, 880px);
  margin: 0 auto;
  padding: 56px 0 80px;
}

.page-wrap article {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  padding: 30px;
  box-shadow: 0 12px 34px rgba(26, 43, 72, 0.06);
}

.page-wrap h1 {
  margin: 0 0 16px;
  font-size: 34px;
  line-height: 1.2;
}

.page-wrap p {
  color: #3a465d;
}

@media (max-width: 980px) {
  body.admin-bar .site-header {
    top: 46px;
  }

  .header-inner {
    min-height: 64px;
  }

  .mobile-menu-toggle {
    display: inline-flex;
  }

  .main-nav {
    position: absolute;
    left: 20px;
    right: 20px;
    top: calc(100% + 8px);
    display: none;
    flex-direction: column;
    align-items: stretch;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    padding: 8px;
    box-shadow: var(--shadow);
  }

  .main-nav.is-open {
    display: flex;
  }

  .main-nav .menu-items {
    flex-direction: column;
    align-items: stretch;
  }

  .main-nav a {
    padding: 12px;
  }

  .header-actions {
    margin-left: auto;
  }

  .ghost-link {
    display: none;
  }

  .hero-grid,
  .helper-strip {
    grid-template-columns: 1fr;
  }

  .app-stage {
    padding-top: 28px;
  }

  .app-heading h1 {
    font-size: 30px;
  }

  .hero {
    padding-top: 36px;
  }

  .hero h1 {
    font-size: 40px;
  }

  .translator-grid {
    grid-template-columns: 1fr;
  }

  .swap-wrap {
    min-height: 56px;
    border-left: 0;
    border-right: 0;
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
  }

  .swap-button {
    transform: rotate(90deg);
  }

  .quick-actions,
  .feature-grid,
  .faq-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .header-inner,
  .hero,
  .page-hero,
  .translator-shell,
  .helper-strip,
  .content-band,
  .footer-inner,
  .page-wrap,
  .article-wrap {
    width: min(100% - 28px, var(--container));
  }

  .brand {
    min-width: 0;
  }

  .brand-tagline,
  .header-actions .primary-link {
    display: none;
  }

  .hero h1 {
    font-size: 32px;
  }

  .page-hero h1,
  .article-header h1 {
    font-size: 30px;
  }

  .app-stage {
    width: min(100% - 28px, var(--container));
  }

  .app-heading h1 {
    font-size: 26px;
  }

  .hero p {
    font-size: 16px;
  }

  .hero-stats,
  .quick-actions,
  .feature-grid,
  .faq-grid {
    grid-template-columns: 1fr;
  }

  .translator-toolbar,
  .column-head,
  .column-foot,
  .footer-inner {
    align-items: stretch;
    flex-direction: column;
  }

  .tool-tabs,
  .toolbar-right,
  .column-actions {
    flex-wrap: wrap;
  }

  .language-select {
    width: 100%;
  }

  .translate-textarea,
  .translate-output {
    min-height: 210px;
    font-size: 16px;
  }
}
