/* =====================================================================
   AWGEN · FND Brand Theme v2.0  (fnd-brand SKILL 强制规范)
   昼 = light (官网优先)  夜 = dark (#0B1120 深海军蓝·水主题)
   ===================================================================== */

/* ---------- 夜 Night (default fallback) ---------- */
:root, :root[data-theme="dark"] {
  --fnd-orange: #FF8C42;          /* 深色模式亮橙 */
  --fnd-orange-base: #EB6100;
  --fnd-blue: #38BDF8;            /* 深色模式亮蓝 */
  --fnd-blue-base: #0085D0;
  --water-deep: #005A8D;
  --hover-orange: #C44F00;
  --hover-blue: #0085D0;

  --bg: #0B1120;
  --bg2: #111827;
  --bg3: #1E293B;
  --bg4: #243447;
  --card: #111827;
  --panel-grad: linear-gradient(180deg, #111827, #0D1526);

  --ink: #F1F5F9;
  --muted: #94A3B8;
  --faint: #475569;

  --line: rgba(56,189,248,0.10);
  --line2: rgba(56,189,248,0.20);
  --line-orange: rgba(235,97,0,0.25);

  --chip-bg: rgba(0,133,208,0.12);
  --chip-line: rgba(56,189,248,0.20);
  --chip-ink: #38BDF8;

  --good: #22C87A;  --good-bg: rgba(34,200,122,0.12);  --good-line: rgba(34,200,122,0.30);
  --warning: #F0A500; --warn-bg: rgba(240,165,0,0.12); --warn-line: rgba(240,165,0,0.30);
  --danger: #F05454; --danger-bg: rgba(240,84,84,0.10); --danger-line: rgba(240,84,84,0.30);
  --info-bg: rgba(0,133,208,0.12); --info-line: rgba(56,189,248,0.25); --info-ink: #38BDF8;

  --shadow: 0 18px 45px rgba(0,0,0,.45);
  --glow-blue: 0 0 20px rgba(56,189,248,.25), 0 4px 15px rgba(0,133,208,.30);
  --glow-orange: 0 0 20px rgba(235,97,0,.30), 0 4px 15px rgba(235,97,0,.25);
  --grid-line: rgba(0,133,208,0.05);
  --nav-bg: rgba(11,17,32,0.82);
  --hero-grad: radial-gradient(circle, rgba(56,189,248,.14), rgba(0,133,208,.04) 58%, transparent 70%);
  --cta-grad: linear-gradient(135deg, #005A8D, #0B1120);
  --preview-bg: #FFFFFF; /* CAD 线稿画布恒白, 保证黑色线条可见 */
}

/* ---------- 昼 Day ---------- */
:root[data-theme="light"] {
  --fnd-orange: #EB6100;
  --fnd-orange-base: #EB6100;
  --fnd-blue: #0085D0;
  --fnd-blue-base: #0085D0;
  --water-deep: #005A8D;
  --hover-orange: #C44F00;
  --hover-blue: #006FB3;

  --bg: #FFFFFF;
  --bg2: #F8FBFE;
  --bg3: #E6F6FD;
  --bg4: #F1F8FD;
  --card: #FFFFFF;
  --panel-grad: linear-gradient(180deg, #FFFFFF, #F8FBFE);

  --ink: #334E68;
  --muted: #627D98;
  --faint: #9AAEC1;

  --line: #D0E4F0;
  --line2: #A9CFE4;
  --line-orange: rgba(235,97,0,0.35);

  --chip-bg: #E6F6FD;
  --chip-line: #A9CFE4;
  --chip-ink: #005A8D;

  --good: #077A55;  --good-bg: #ECFDF3;  --good-line: #BBF7D0;
  --warning: #B45309; --warn-bg: #FFF7ED; --warn-line: #FED7AA;
  --danger: #B42318; --danger-bg: #FFF1F1; --danger-line: #FECACA;
  --info-bg: #E6F6FD; --info-line: #A9CFE4; --info-ink: #005A8D;

  --shadow: 0 18px 45px rgba(0,90,141,.10);
  --glow-blue: 0 4px 15px rgba(0,133,208,.30);
  --glow-orange: 0 4px 15px rgba(235,97,0,.30);
  --grid-line: rgba(0,133,208,0.04);
  --nav-bg: rgba(255,255,255,0.86);
  --hero-grad: radial-gradient(circle, rgba(0,133,208,.16), rgba(230,246,253,.4) 58%, transparent 70%);
  --cta-grad: linear-gradient(135deg, #0085D0, #005A8D);
  --preview-bg: #FFFFFF;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Noto Sans SC', ui-sans-serif, system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  transition: background .25s ease, color .25s ease;
}
/* 水主题网格背景 (品牌规范·标志元素2) */
body::before {
  content: ''; position: fixed; inset: 0;
  background-image:
    linear-gradient(var(--grid-line) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none; z-index: 0;
}
main, header, footer { position: relative; z-index: 1; }
a { color: inherit; text-decoration: none; }
.container { width: min(1180px, calc(100% - 36px)); margin: 0 auto; }

/* ---------- 导航 (含品牌顶部线·标志元素1) ---------- */
.nav {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(12px);
  background: var(--nav-bg);
  border-bottom: 1px solid var(--line);
}
.nav::before {
  content: ''; display: block; height: 2px;
  background: linear-gradient(90deg, var(--fnd-blue-base), var(--fnd-orange-base));
}
.nav-inner { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.logo { display: inline-flex; align-items: center; gap: 12px; font-weight: 900; letter-spacing: .02em; font-size: 21px; font-family: 'Orbitron', 'Noto Sans SC', sans-serif; }
.logo-img { height: 34px; width: auto; filter: drop-shadow(0 0 8px rgba(0,133,208,0.4)); }
.logo .logo-text, .logo span { color: var(--fnd-blue); }
.nav-links { display: flex; align-items: center; gap: 22px; color: var(--muted); font-weight: 650; font-size: 14px; }
.nav-links a:hover { color: var(--fnd-blue); }

/* 昼夜切换按钮 */
.theme-toggle {
  order: 99; margin-left: 4px;
  width: 40px; height: 40px; border-radius: 999px;
  border: 1px solid var(--line2); background: var(--bg3); color: var(--ink);
  font-size: 17px; line-height: 1; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: all .2s ease;
}
.theme-toggle:hover { transform: translateY(-1px); border-color: var(--fnd-blue); box-shadow: var(--glow-blue); }

/* ---------- 按钮 (品牌规范·第六节) ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid var(--line2); background: var(--bg2); color: var(--ink);
  border-radius: 999px; padding: 12px 18px; font-weight: 800;
  font-family: inherit;
  cursor: pointer; transition: all .2s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--glow-blue); border-color: var(--fnd-blue); }
.btn-primary {
  background: linear-gradient(135deg, var(--fnd-blue-base), var(--water-deep));
  color: #fff; border-color: transparent;
  box-shadow: 0 4px 15px rgba(0,133,208,.30);
}
.btn-primary:hover { box-shadow: 0 6px 20px rgba(0,133,208,.40); }
.btn-dark {
  background: linear-gradient(135deg, var(--fnd-orange-base), var(--hover-orange));
  color: #fff; border-color: transparent;
  box-shadow: 0 4px 15px rgba(235,97,0,.30);
}
.btn-dark:hover { box-shadow: 0 6px 20px rgba(235,97,0,.40); }
.btn-soft { background: var(--chip-bg); color: var(--chip-ink); border-color: var(--chip-line); }

/* ---------- Hero ---------- */
.hero { padding: 82px 0 54px; position: relative; overflow: hidden; }
.hero:before {
  content: ""; position: absolute; inset: -200px -100px auto auto; width: 620px; height: 620px;
  background: var(--hero-grad);
  z-index: 0;
}
.hero-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 40px; align-items: center; position: relative; z-index: 1; }
.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--chip-ink); background: var(--chip-bg); border: 1px solid var(--chip-line);
  padding: 7px 12px; border-radius: 999px; font-weight: 850; font-size: 13px;
  font-family: 'JetBrains Mono', monospace;
}
h1 { font-size: clamp(40px, 6.4vw, 70px); line-height: 1.04; letter-spacing: -.04em; margin: 22px 0 20px; font-weight: 900; }
h1 span, h2 span { color: var(--fnd-orange); }
.lead { color: var(--muted); font-size: 19px; line-height: 1.75; max-width: 760px; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }

.panel {
  background: var(--panel-grad);
  border: 1px solid var(--line); border-radius: 28px; box-shadow: var(--shadow);
  padding: 26px;
}
.visual-card { min-height: 420px; position: relative; overflow: hidden; }
/* 概念机形象: 品牌蓝格栅 + 橙色出水指示 + 水滴浮动 */
.machine {
  margin: 10px auto; width: 300px; height: 360px; background: var(--bg2);
  border: 2px solid var(--line2); border-radius: 28px; position: relative;
  box-shadow: inset 0 0 0 8px var(--bg3), var(--glow-blue);
  animation: float 3s ease-in-out infinite;
}
.machine:before {
  content: ""; position: absolute; left: 42px; right: 42px; top: 48px; height: 92px; border-radius: 18px;
  background: repeating-linear-gradient(0deg, var(--fnd-blue-base) 0 5px, transparent 5px 13px); opacity: .85;
}
.machine:after {
  content: ""; position: absolute; left: 58px; right: 58px; bottom: 42px; height: 76px; border-radius: 18px;
  border: 2px solid var(--line-orange); background: var(--chip-bg);
}
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.badge-float {
  position: absolute; background: var(--card); border: 1px solid var(--line2);
  border-radius: 18px; padding: 14px; box-shadow: var(--shadow); font-weight: 850;
}
.badge-float small { display: block; color: var(--muted); font-weight: 700; margin-top: 4px; }
.b1 { top: 35px; left: 20px; }
.b2 { right: 20px; top: 160px; }
.b3 { left: 34px; bottom: 30px; }

/* ---------- 区块 ---------- */
.section { padding: 70px 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 30px; margin-bottom: 28px; }
h2 { font-size: clamp(30px, 4vw, 46px); letter-spacing: -.03em; line-height: 1.1; margin: 0; font-weight: 900; }
.sub { color: var(--muted); line-height: 1.7; max-width: 650px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 22px; padding: 24px; box-shadow: var(--shadow); transition: all .2s ease; }
.card:hover { border-color: var(--line2); transform: translateY(-2px); }
.card h3 { margin: 0 0 10px; font-size: 21px; letter-spacing: -.01em; }
.card p { margin: 0; color: var(--muted); line-height: 1.65; }
.num {
  width: 38px; height: 38px; border-radius: 12px;
  background: var(--chip-bg); color: var(--fnd-blue);
  display: grid; place-items: center; font-weight: 700; margin-bottom: 14px;
  font-family: 'Orbitron', monospace;
  border: 1px solid var(--chip-line);
}
.kicker { color: var(--fnd-orange); font-weight: 900; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; font-family: 'Orbitron', sans-serif; }
.split { display: grid; grid-template-columns: .9fr 1.1fr; gap: 24px; align-items: stretch; }
.stack { display: grid; gap: 12px; }
.layer { display: flex; gap: 14px; align-items: flex-start; padding: 16px; background: var(--card); border: 1px solid var(--line); border-radius: 18px; }
.layer strong { display: block; margin-bottom: 4px; }
.layer span { color: var(--muted); line-height: 1.5; }
.cta {
  background: var(--cta-grad); color: #fff; border-radius: 30px; padding: 44px;
  display: flex; justify-content: space-between; align-items: center; gap: 30px;
  position: relative; overflow: hidden;
}
.cta::before {
  content: ''; position: absolute; left: 0; top: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--fnd-blue-base), var(--fnd-orange-base));
}
.cta h2 { color: #fff; }
.cta p { color: rgba(255,255,255,.85); line-height: 1.7; max-width: 680px; }
.cta .btn { background: var(--fnd-orange-base); color: #fff; border-color: transparent; box-shadow: 0 4px 15px rgba(235,97,0,.40); }
.cta .btn:hover { background: var(--hover-orange); }
.footer { padding: 42px 0; color: var(--muted); border-top: 1px solid var(--line); }
.footer-inner { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; align-items: center; }

/* ---------- Studio ---------- */
.studio-shell { display: grid; grid-template-columns: 280px 1fr; min-height: calc(100vh - 74px); }
.sidebar {
  background: var(--bg2); border-right: 1px solid var(--line); padding: 20px;
  position: sticky; top: 74px; height: calc(100vh - 74px); overflow: auto;
}
.sidebar::before {
  content: ''; display: block; height: 2px; margin: -20px -20px 18px;
  background: linear-gradient(90deg, var(--fnd-blue-base), var(--fnd-orange-base));
}
.tool-btn {
  width: 100%; padding: 14px; border: 1px solid var(--line); border-radius: 16px;
  background: var(--card); text-align: left; font-weight: 850; margin-bottom: 10px;
  cursor: pointer; color: var(--ink); font-family: inherit; transition: all .2s ease;
}
.tool-btn:hover { border-color: var(--fnd-blue); transform: translateY(-1px); }
.tool-btn.active {
  background: linear-gradient(135deg, var(--fnd-blue-base), var(--water-deep));
  color: #fff; border-color: transparent; box-shadow: var(--glow-blue);
}
.studio-main { padding: 28px; }
.workspace { display: none; }
.workspace.active { display: block; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-row { display: grid; gap: 7px; }
label { font-weight: 850; color: var(--ink); font-size: 14px; }
input, select, textarea {
  width: 100%; border: 1px solid var(--line2); border-radius: 14px; padding: 12px 13px;
  background: var(--bg2); color: var(--ink); font: inherit;
  transition: border-color .2s ease, box-shadow .2s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--fnd-blue);
  box-shadow: 0 0 0 3px rgba(56,189,248,0.2);
}
input::placeholder, textarea::placeholder { color: var(--faint); }
textarea { min-height: 120px; resize: vertical; }
.output { margin-top: 18px; display: grid; grid-template-columns: 1fr .8fr; gap: 18px; align-items: start; }
.preview {
  background: var(--preview-bg); border: 1px dashed var(--line2); border-radius: 20px;
  min-height: 320px; display: grid; place-items: center; overflow: auto; padding: 14px;
}
.preview svg { max-width: 100%; height: auto; }
.result-box { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 18px; }
.result-box h3 { margin-top: 0; }
.file-links { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.notice { border-radius: 14px; padding: 12px 14px; margin: 10px 0; line-height: 1.55; }
.notice.info { background: var(--info-bg); color: var(--info-ink); border: 1px solid var(--info-line); }
.notice.warn { background: var(--warn-bg); color: var(--warning); border: 1px solid var(--warn-line); }
.notice.danger { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger-line); }
.notice.good { background: var(--good-bg); color: var(--good); border: 1px solid var(--good-line); }
.score { font-size: 56px; line-height: 1; font-weight: 700; letter-spacing: -.02em; color: var(--fnd-blue); font-family: 'Orbitron', monospace; }
.project-table { width: 100%; border-collapse: collapse; background: var(--card); border-radius: 18px; overflow: hidden; border: 1px solid var(--line); }
.project-table th, .project-table td { padding: 12px 14px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.project-table th { background: var(--bg3); color: var(--ink); }
.small { color: var(--muted); font-size: 13px; line-height: 1.55; }
code, .mono { font-family: 'JetBrains Mono', monospace; }

@media (max-width: 900px) {
  .nav-links { display: none; }
  .hero-grid, .split, .grid-3, .grid-4, .output { grid-template-columns: 1fr; }
  .studio-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .form-grid { grid-template-columns: 1fr; }
  .cta { display: block; }
}
@media (prefers-reduced-motion: reduce) {
  .machine, .water-element { animation: none; }
  * { transition: none !important; }
}

/* ---------- EN-Scribe chat FAB (FND unified IM entry) ---------- */
#fnd-chat-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 90;
  display: inline-flex; align-items: center; gap: 9px;
  padding: 13px 20px; border: 0; border-radius: 999px;
  background: linear-gradient(135deg, var(--fnd-orange-base), var(--hover-orange));
  color: #fff; font: 800 15px 'Noto Sans SC', sans-serif;
  cursor: pointer; box-shadow: 0 4px 15px rgba(235,97,0,.35);
  transition: all .2s ease;
}
#fnd-chat-fab:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(235,97,0,.45); }
#fnd-chat-fab .fab-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #22C87A;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 0 rgba(34,200,122,0.5); }
  50%     { box-shadow: 0 0 0 6px rgba(34,200,122,0); }
}
