/* Theme controls leave the existing light palette intact. */
.ls-nav .ls-theme-toggle {
  display:inline-flex; align-items:center; justify-content:center;
  flex:0 0 44px; width:44px; height:44px; padding:10px;
  border:1px solid var(--border); border-radius:8px;
}
.ls-theme-toggle svg { width:22px; height:22px; }
.ls-theme-toggle .theme-sun { display:none; }
html[data-theme="dark"] .ls-theme-toggle .theme-sun { display:block; }
html[data-theme="dark"] .ls-theme-toggle .theme-moon { display:none; }
.ls-nav .ls-theme-toggle:focus-visible { outline:3px solid var(--accent-dark); outline-offset:3px; }

/* Reusable semantic palette; illustration colours are isolated below. */
html[data-theme="dark"], html[data-theme="dark"] body {
  color-scheme:dark;
  --bg:#0a0a0a; --surface:#0a0a0a; --surface-alt:#171717;
  --ink:#f5f5f5; --muted:#a3a3a3; --border:#262626;
  --brand:#f5f5f5; --brand-highlight:#f5b942; --brand-dark:#0a0a0a;
  --brand-soft:#171717; --accent:#f5b942; --accent-dark:#f5b942;
  --accent-soft:#16120a; --accent-hover:#ffd27a; --accent-ink:#0a0a0a;
  --bg-dark:#0a0a0a; --panel:#0a0a0a; --field:#171717;
  --control-border:#737373; --link:var(--accent); --on-accent:#0a0a0a;
  --grid-line:rgba(255,255,255,.04); --glow:rgba(245,185,66,.08);
  --hover-border:#7a5f20; --shadow:none;
}


html[data-theme="dark"] body { background-color:var(--bg); color:var(--ink); --brand-text:var(--ink); }
html[data-theme="dark"] :is(input,textarea,select,.filters button) { background:var(--field); color:var(--ink); border-color:#767676; }
html[data-theme="dark"] :is(input,textarea)::placeholder { color:var(--muted); opacity:1; }
html[data-theme="dark"] :is(.ls-btn,.contact-button,.button,.primary,.send-button):not(.ls-line-cta) { background:var(--accent); color:var(--accent-ink); }
html[data-theme="dark"] :is(.ls-btn,.contact-button,.button,.primary,.send-button):not(.ls-line-cta):hover { background:var(--accent-hover); color:var(--accent-ink); }
html[data-theme="dark"] .ls-btn--ghost { background:transparent; color:var(--accent); border-color:var(--accent); }
html[data-theme="dark"] button:disabled { opacity:1; background:var(--surface-alt); color:var(--muted); }
html[data-theme="dark"] .field-error { color:#ffaaa1; }
html[data-theme="dark"] [aria-invalid="true"] { border-color:#ffaaa1; }
html[data-theme="dark"] :is(a,button,summary,input,textarea,select):focus-visible { outline:3px solid var(--accent); outline-offset:3px; }
html[data-theme="dark"] :is(.ls-nav,.ls-nav .ls-nav-dropdown,.ls-nav .ls-nav-panel,.ls-page-nav) { background:var(--panel); color:var(--ink); border-color:var(--border); }
html[data-theme="dark"] .ls-nav a { color:var(--ink); }
html[data-theme="dark"] :is(.ls-nav .ls-nav-group strong,.ls-page-nav>span,.ls-nav-label) { color:var(--muted); }
html[data-theme="dark"] .ls-nav :is(a,button):hover { background:var(--surface-alt); color:var(--accent); }
html[data-theme="dark"] body :is(a.ls-line-cta,.ls-nav .ls-nav-panel>.ls-nav-line) { background:var(--line); color:var(--line-ink); }
html[data-theme="dark"] body :is(a.ls-line-cta,.ls-nav .ls-nav-panel>.ls-nav-line):hover { background:var(--line); color:var(--line-ink); }
html[data-theme="dark"] .breadcrumbs li+li:before { color:var(--muted); }
html[data-theme="dark"] :is(footer,.site-footer,.mobile-contact,.mobile-dock,.composer,.ls-section--dark) { background:var(--panel); color:var(--ink); }
html[data-theme="dark"] :is(.demo-label,.demo-note,.demo-tag,.upgrade-label,.example-label,.price-orig) { color:var(--muted); }
html[data-theme="dark"] :is(pre,code,table,th,td) { border-color:var(--border); }
html[data-theme="dark"] pre { background:var(--panel); color:var(--ink); }
html[data-theme="dark"] .skip { background:var(--panel); color:var(--ink); }
@media (min-width:900px) and (max-width:1150px) {
  .ls-nav .ls-nav-inner { gap:6px; padding-inline:12px; }
  .ls-nav .ls-nav-label { display:none; }
  .ls-nav .ls-nav-panel { gap:0; font-size:13px; }
  .ls-nav .ls-nav-panel>a,.ls-nav .ls-nav-service-toggle { padding-inline:6px; }
}
@media (max-width:899px) { .ls-nav .ls-theme-toggle { margin-left:0; } }
@media (max-width:380px) { .ls-nav .ls-nav-label { display:none; } }
@media (prefers-reduced-motion:reduce) {
  html[data-theme="dark"] *,html[data-theme="dark"] *::before,html[data-theme="dark"] *::after { transition:none!important; animation:none!important; scroll-behavior:auto!important; }
}

/* Minimal 404 header: independent of nav.css and viewport-centred layouts. */
body.ls-error-page {
  display:flex; flex-direction:column; min-height:100vh; margin:0; padding:0;
}
body.ls-error-page > main { min-width:0; margin-block:auto; margin-inline:auto; }
.ls-nav.ls-nav--mini, .ls-nav.ls-nav--mini * { box-sizing:border-box; }
.ls-nav.ls-nav--mini {
  position:sticky; top:0; z-index:100; flex:0 0 64px;
  width:100%; height:64px; margin:0; padding:0;
  background:var(--bg); color:var(--ink); border-bottom:1px solid var(--border);
  font:14px/1.5 var(--sans,sans-serif);
}
.ls-nav.ls-nav--mini .ls-nav-inner {
  display:flex; align-items:center; gap:12px; width:100%; max-width:none;
  height:63px; margin:0; padding:0 24px;
}
.ls-nav.ls-nav--mini a { color:inherit; text-decoration:none; }
.ls-nav.ls-nav--mini .ls-nav-brand {
  flex-shrink:0; font-size:24px; font-weight:750; letter-spacing:-1px;
}
.ls-nav.ls-nav--mini .header-note { display:block; font-size:12px; color:var(--muted); }
.ls-nav.ls-nav--mini .ls-theme-toggle {
  appearance:none; margin:0 0 0 auto; background:transparent; color:inherit;
  border:1px solid var(--border); font:inherit; cursor:pointer;
}
.ls-nav.ls-nav--mini :is(a,button):hover { background:var(--surface-alt); }
html[data-theme="dark"] .ls-nav.ls-nav--mini { background:var(--panel); color:var(--ink); border-color:var(--border); }
html[data-theme="dark"] .ls-nav.ls-nav--mini .ls-theme-toggle { border-color:var(--border); }
html[data-theme="dark"] .ls-nav.ls-nav--mini .header-note { color:var(--muted); }
html[data-theme="dark"] .ls-nav.ls-nav--mini :is(a,button):hover { background:var(--surface-alt); color:var(--accent); }
@media (max-width:899px) {
  .ls-nav.ls-nav--mini .ls-nav-inner { padding-inline:16px; }
}

/* LINE 官方綠搭配深色文字；白字在官方綠上不足 AA。 */
html body a:is(.ls-line-cta,.ls-nav-line,.primary,.secondary,.button,.contact-button)[href*="line.me"] {
  background:var(--line); color:var(--line-ink); border:1px solid var(--line-ink);
}
html body a:is(.ls-line-cta,.ls-nav-line,.primary,.secondary,.button,.contact-button)[href*="line.me"]:is(:hover,:active) {
  background:var(--line); color:var(--line-ink); box-shadow:inset 0 0 0 2px var(--line-ink);
}
html body a:is(.ls-line-cta,.ls-nav-line,.primary,.secondary,.button,.contact-button)[href*="line.me"]:focus-visible {
  outline:3px solid var(--line-ink); outline-offset:3px; box-shadow:0 0 0 6px var(--bg);
}
html body :is(input:not([type="checkbox"]):not([type="radio"]),textarea,select) { border-color:var(--control-border); }
html body :is(input,textarea)::placeholder { color:var(--muted); opacity:1; }

/* ---- site: hub ---- */
html[data-theme="dark"] body[data-site="hub"] {
  --surface-alt:#242424; --border:rgba(255,255,255,.10); --bg-dark:#181818;
  background-color:var(--bg);
  background-image:radial-gradient(ellipse 80% 550px at 50% 0,var(--glow),transparent),linear-gradient(var(--grid-line) 1px,transparent 1px),linear-gradient(90deg,var(--grid-line) 1px,transparent 1px);
  background-size:auto,48px 48px,48px 48px;
}
html[data-theme="dark"] .hero-bright { background:var(--surface); border-color:var(--border); }
html[data-theme="dark"] .hero:before { background:radial-gradient(ellipse at 30% 0,var(--glow),transparent 70%); }
html[data-theme="dark"] :is(.channel,.work-card,.problem-card,.why-items li,.process-steps li,.questions,.price-floors article,.fee-grid>div,.why-choice li,#inquiry-form,.contact-channel) {
  background:var(--surface); border:1px solid var(--border);
  backdrop-filter:blur(12px); -webkit-backdrop-filter:blur(12px);
  box-shadow:var(--shadow); transition:transform .2s,border-color .2s,box-shadow .2s;
}
html[data-theme="dark"] :is(.channel,.work-card,.problem-card,.why-items li,.process-steps li,.price-floors article,.fee-grid>div,.why-choice li):is(:hover,:focus-within) {
  transform:translateY(-4px); border-color:var(--hover-border); box-shadow:0 14px 32px rgba(0,0,0,.3);
}
html[data-theme="dark"] :is(.contact,.site-footer,.contact-top,.programme-bar) { background:var(--panel); color:var(--ink); }
html[data-theme="dark"] .channel .channel-rail { background:var(--surface-alt); border-color:var(--border); color:var(--muted); }
html[data-theme="dark"] .channel .channel-rail>span:nth-child(n) { color:var(--muted); }
html[data-theme="dark"] :is(.why-choice li:before,.step-number) { color:var(--ink); }
/* Preserve the original multi-colour scenes on their light illustration panels. */
html[data-theme="dark"] .scene {
  /* Resolve inherited palette aliases again within the light artwork. */
  --brand-text:#242424; --bg-dark:#f4f4f4;
  color-scheme:light; color:#242424; background-color:#f4f4f4;
  --bg:#fff; --surface:#fff; --surface-alt:#f4f4f4; --ink:#242424;
  --brand-text:#242424; --muted:#505050; --border:#d9d9d9; --brand:#242424;
  --brand-dark:#141414; --brand-soft:#f3f3f3; --brand-highlight:#242424;
  --accent:#a74308; --accent-dark:#a74308; --accent-soft:#fdf0e8;
}

html[data-theme="dark"] .wall { background:var(--panel); }
html[data-theme="dark"] .wall-caption { color:var(--muted); }

html[data-theme="dark"] .filters button[aria-pressed="true"] { background:var(--accent); color:var(--accent-ink); }

/* Colour repair: preserve meaning and foreground contrast. */
html body :is(a,button,summary,input,textarea,select):focus-visible { outline:3px solid var(--accent-dark); outline-offset:4px; }
html body a:is(.ls-line-cta,.ls-nav-line)[href*="line.me"]:focus-visible { outline-color:var(--line-ink); box-shadow:0 0 0 6px var(--bg); }
