/* =========================================================
   SOAR CNC — base stylesheet (industrial / technical)
   Light + dark theme. Save as UTF-8 without BOM.
   ========================================================= */

:root {
  /* Font system: SF Pro on Apple, Segoe UI on Windows, Roboto on Android;
     PingFang TC / Microsoft JhengHei / Noto Sans TC for 繁體中文. */
  --font-sans: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', Roboto, 'PingFang TC', 'Microsoft JhengHei', 'Heiti TC', 'Noto Sans TC', sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', Roboto, 'PingFang TC', 'Microsoft JhengHei', 'Heiti TC', 'Noto Sans TC', sans-serif;

  /* Light theme (default) */
  --color-bg: #ffffff;
  --color-text: #16191d;
  --color-muted: #5c6470;
  --color-surface: #ffffff;    /* cards */
  --color-card: #f5f7f8;       /* alt sections / subtle fills */
  --color-border: #e8ecef;

  --color-steel: #1f262d;      /* dark charcoal — header/footer/hero (both themes) */
  --color-steel-2: #141a1f;
  --color-accent: #2e9e44;     /* SOAR green (logo + 五色鳥 body) */
  --color-accent-dark: #24813a;
  --color-accent-soft: #eaf5ec;/* pale green surface */
  --color-accent-ink: #24813a; /* text on soft-green fills */
  --color-accent-2: #e8b431;   /* 五色鳥 gold */
  --color-accent-teal: #149aab;/* 五色鳥 teal */
  --color-accent-coral: #e0533d;/* 五色鳥 red */

  --max-width: 1140px;
  --space: 1.25rem;
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 22px;
  --shadow: 0 1px 2px rgba(16,25,20,.05), 0 10px 30px rgba(16,25,20,.06);
  --shadow-hover: 0 2px 8px rgba(16,25,20,.07), 0 20px 48px rgba(16,25,20,.12);
}

/* Dark theme values — applied automatically by system pref (unless forced light),
   or explicitly when the user toggles to dark. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-bg: #0d0f12;
    --color-text: #e9ebee;
    --color-muted: #9aa3ad;
    --color-surface: #161a20;
    --color-card: #12151a;
    --color-border: #2a3038;
    --color-accent-soft: rgba(46,158,68,.18);
    --color-accent-ink: #7ed598;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.45);
    --shadow-hover: 0 2px 8px rgba(0,0,0,.5), 0 20px 48px rgba(0,0,0,.6);
  }
}
[data-theme="dark"] {
  --color-bg: #0d0f12;
  --color-text: #e9ebee;
  --color-muted: #9aa3ad;
  --color-surface: #161a20;
  --color-card: #12151a;
  --color-border: #2a3038;
  --color-accent-soft: rgba(46,158,68,.18);
  --color-accent-ink: #7ed598;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.45);
  --shadow-hover: 0 2px 8px rgba(0,0,0,.5), 0 20px 48px rgba(0,0,0,.6);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.7;
  transition: background-color .2s ease, color .2s ease;
}

/* 繁體中文 typography */
:lang(zh) {
  line-height: 1.75;
  letter-spacing: 0.02em;
  word-break: normal;
  overflow-wrap: anywhere;
  text-align: left;
}
/* Safety: let cards/grid items shrink and wrap so text never overflows its box */
.cap-grid > *, .news-grid > *, .stats > *, .contact-layout > *, .gallery > * { min-width: 0; }
.cap-card, .news-card, .news-body, .hovercard, .footer-col, p, h1, h2, h3, li { overflow-wrap: break-word; }

h1, h2, h3 { font-family: var(--font-display); line-height: 1.35; margin: 0 0 0.6rem; color: var(--color-text); }
h1 { font-size: clamp(1.6rem, 4.5vw, 2.2rem); letter-spacing: -0.01em; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); letter-spacing: -0.01em; }
h3 { font-size: 1.18rem; }
p { margin: 0 0 1rem; }
a { color: var(--color-accent); }
img { max-width: 100%; height: auto; display: block; }

.wrap { width: 100%; max-width: var(--max-width); margin: 0 auto; padding: 0 var(--space); }
.muted { color: var(--color-muted); }
.eyebrow { text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.78rem; font-weight: 700; color: var(--color-accent); }

/* ---- Header / nav ---- */
.site-header { background: var(--color-surface); color: var(--color-text); border-bottom: 1px solid var(--color-border); position: relative; }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.9rem 1.25rem; position: relative; z-index: 1; }
.brand { display: inline-flex; align-items: center; gap: .5rem; font-weight: 800; font-size: 1.25rem; letter-spacing: 0.04em; color: var(--color-text); text-decoration: none; }
.brand::before { content: ""; width: 78px; height: 29px; background: url("/assets/images/logo-mark.webp") left center / contain no-repeat; flex: 0 0 auto; }
.brand span { color: var(--color-accent); }
.site-nav { display: flex; align-items: center; }
.site-nav a { margin-left: 1.2rem; color: var(--color-muted); text-decoration: none; font-size: 0.95rem; }
.site-nav a:hover { color: var(--color-text); }
.lang-switch { font-weight: 700; color: var(--color-accent) !important; }
/* Optional faded real-life photo behind the header: add class "has-photo" and style="--header-img:url('/assets/images/your-photo.webp')" on the <header>. */
.site-header.has-photo::before { content: ""; position: absolute; inset: 0; background: var(--header-img) center / cover no-repeat; opacity: .10; filter: blur(1px); pointer-events: none; }

/* ---- Theme toggle (injected into nav) ---- */
.theme-toggle { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; margin-left: .9rem; padding: 0; border: 1px solid var(--color-border); border-radius: 8px; background: transparent; color: var(--color-muted); cursor: pointer; flex: 0 0 auto; transition: background-color .15s ease, color .15s ease; }
.theme-toggle:hover { color: var(--color-text); background: var(--color-card); }
.nav-toggle { display: none; align-items: center; justify-content: center; width: 40px; height: 34px; padding: 0; border: 1px solid var(--color-border); border-radius: 8px; background: transparent; color: var(--color-text); cursor: pointer; }
.nav-toggle svg { width: 22px; height: 22px; }
.theme-toggle svg { width: 18px; height: 18px; }

/* ---- Hero (dark in both themes) ---- */
/* Base hero = compact + theme-aware (clean light in light mode, dark in dark mode) — used on subpages */
.hero { background: var(--color-card); color: var(--color-text); padding: 2.75rem 0; }
.hero h1 { color: var(--color-text); max-width: 26ch; font-size: clamp(1.6rem, 4vw, 2.1rem); overflow-wrap: break-word; }
.hero p { color: var(--color-muted); font-size: 1.1rem; max-width: 62ch; }
.hero .eyebrow { color: var(--color-accent); }
/* Home photo hero = bigger + dark with white text */
.hero--img { padding: 5rem 0; color: #fff; }
.hero--img h1 { color: #fff; max-width: 24ch; font-size: clamp(1.9rem, 5vw, 2.6rem); }
.hero--img p { color: #c7cfd8; font-size: 1.2rem; }
.hero--img .eyebrow { color: var(--color-accent-2); }

/* ---- Buttons ---- */
.btn {
  display: inline-block; background: var(--color-accent); color: #fff;
  padding: 0.85rem 1.7rem; border-radius: var(--radius-sm); text-decoration: none; font-weight: 700;
  transition: background .15s ease, transform .12s ease, box-shadow .15s ease;
  box-shadow: 0 1px 2px rgba(16,25,20,.12);
}
.btn:hover { background: var(--color-accent-dark); transform: translateY(-1px); box-shadow: var(--shadow); }
.btn--ghost { background: transparent; border: 1px solid #ffffff66; color: #fff; }
.btn--ghost:hover { background: #ffffff14; }

/* ---- Sections ---- */
main section { padding: 4.5rem 0; }
section.alt { background: var(--color-card); border-top: 1px solid var(--color-border); border-bottom: 1px solid var(--color-border); }

/* ---- Capability cards ---- */
.cap-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-top: 1.5rem; }
.cap-card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); padding: 1.6rem; box-shadow: var(--shadow); }
.cap-card h3 { margin-top: 0; }
.cap-card .num { display: inline-flex; align-items: center; justify-content: center; width: 2.1rem; height: 2.1rem; border-radius: 50%; background: var(--color-accent-soft); font-size: 0.85rem; font-weight: 800; color: var(--color-accent-ink); margin-bottom: .5rem; }
.cap-icon { width: 48px; height: 48px; display: block; margin-bottom: .8rem; }
.step-no { color: var(--color-accent); font-weight: 800; margin-right: .5rem; }

/* ---- Spec table ---- */
.spec-table { width: 100%; border-collapse: separate; border-spacing: 0; margin: 1.25rem 0; font-size: 0.97rem; border: 1px solid var(--color-border); border-radius: var(--radius); overflow: hidden; }
.spec-table th, .spec-table td { text-align: left; padding: 0.8rem 1rem; border-bottom: 1px solid var(--color-border); }
.spec-table th { background: var(--color-steel); color: #fff; }
.spec-table tr:nth-child(even) td { background: var(--color-card); }

/* ---- Certification badges ---- */
.badges { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1rem; }
.badge { background: var(--color-accent-soft); color: var(--color-accent-ink); border-radius: 999px; padding: 0.5rem 1.05rem; font-size: 0.9rem; font-weight: 600; }

/* ---- Industry pills ---- */
.pills { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1rem; }
.pill { background: var(--color-accent-soft); color: var(--color-accent-ink); border-radius: 999px; padding: 0.5rem 1.05rem; font-size: 0.9rem; font-weight: 600; }
a.pill { text-decoration: none; cursor: pointer; transition: background-color .15s ease, color .15s ease, transform .12s ease; }
a.pill:hover { background: var(--color-accent); color: #fff; transform: translateY(-1px); }
.cap-card[id] { scroll-margin-top: 1.5rem; }

/* Industry pill hover-card (desktop enhancement — click still links) */
.pill-wrap { position: relative; display: inline-flex; }
.hovercard { position: absolute; top: calc(100% + 8px); left: 0; width: 240px; max-width: 80vw; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-sm); box-shadow: var(--shadow-hover); overflow: hidden; opacity: 0; visibility: hidden; transform: translateY(4px); transition: opacity .15s ease, transform .15s ease; z-index: 50; pointer-events: none; }
.pill-wrap:hover .hovercard, .pill-wrap:focus-within .hovercard { opacity: 1; visibility: visible; transform: translateY(0); }
.hovercard img { width: 100%; height: 118px; object-fit: cover; display: block; }
.hovercard .hc-text { padding: .55rem .8rem; font-size: .82rem; line-height: 1.45; color: var(--color-muted); }

/* ---- Photo gallery ---- */
.gallery { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.25rem; margin-top: 1.75rem; }
.gallery figure { margin: 0; border: 1px solid var(--color-border); border-radius: var(--radius); overflow: hidden; background: var(--color-surface); box-shadow: var(--shadow); transition: transform .15s ease, box-shadow .15s ease; }
.gallery figure:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.gallery img { width: 100%; height: 260px; object-fit: cover; display: block; }
.gallery figcaption { padding: 0.85rem 1rem; font-size: 0.95rem; font-weight: 600; color: var(--color-text); }

/* ---- Tally embed placeholder boxes ---- */
.form-block { border: 1px solid var(--color-border); border-radius: var(--radius); padding: 1.6rem; margin: 1.25rem 0; background: var(--color-surface); box-shadow: var(--shadow); }
.form-block h3 { margin-top: 0; }
.form-block.primary { border: 2px solid var(--color-accent); }
.form-embed { margin-top: 1rem; padding: 1.75rem; border: 1px dashed var(--color-border); border-radius: var(--radius-sm); color: var(--color-muted); font-size: .9rem; text-align: center; background: var(--color-card); }

/* ---- Footer ---- */
.site-footer { background: var(--color-steel-2); color: #aeb6c0; font-size: 0.92rem; border-top: 1px solid var(--color-border); }
.footer-grid { display: grid; grid-template-columns: 1.5fr 1fr 1.2fr; gap: 2.5rem; padding: 3rem 0 2.5rem; }
.footer-brand .brand { margin-bottom: .9rem; }
.footer-tag { color: #9aa3ad; margin: 0 0 .6rem; max-width: 34ch; line-height: 1.6; }
.footer-legal { color: #7e8893; font-size: .85rem; margin: 0; }
.footer-col h4 { color: #fff; font-size: .95rem; margin: .2rem 0 .9rem; }
.footer-col ul { list-style: none; padding: 0; margin: 0; }
.footer-col li { margin-bottom: .55rem; }
.site-footer a { color: #d7dde4; text-decoration: none; }
.site-footer a:hover { color: #fff; }
.footer-contact { margin: 0 0 .7rem; }
.footer-contact span { display: block; color: #7e8893; font-size: .76rem; text-transform: uppercase; letter-spacing: .08em; margin-bottom: .1rem; }
.footer-cta { margin-top: 1.1rem; }
.footer-bottom { border-top: 1px solid #ffffff1a; }
.footer-bottom .wrap { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 1.1rem var(--space); font-size: .85rem; color: #8b94a0; }
@media (max-width: 720px) {
  .footer-grid { grid-template-columns: 1fr; gap: 2rem; padding: 2.25rem 0; }
  .footer-bottom .wrap { flex-direction: column; gap: .4rem; }
}

/* ---- Clickable cards ---- */
a.cap-card { text-decoration: none; color: inherit; display: block; transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease; }
a.cap-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); border-color: var(--color-accent); }
.cap-card .more { display: inline-block; margin-top: .6rem; font-size: .85rem; font-weight: 600; color: var(--color-accent); }
.inline-link { display: inline-block; margin-top: 1rem; font-weight: 600; }

/* ---- FAQ ---- */
.faq-item { border-top: 1px solid var(--color-border); padding: 1.1rem 0; }
.faq-item:last-child { border-bottom: 1px solid var(--color-border); }
.faq-item h3 { margin: 0 0 .4rem; }
.faq-item p { margin: 0; }

/* ---- Hero with background photo ---- */
.hero--img { position: relative; background: var(--color-steel-2); overflow: hidden; }
.hero--img::before {
  content: ""; position: absolute; inset: 0;
  background-image: linear-gradient(90deg, rgba(16,21,26,.9) 0%, rgba(16,21,26,.6) 55%, rgba(16,21,26,.42) 100%), url("/assets/images/hero-cnc-1600.webp");
  background-size: cover; background-position: center;
}
.hero--img .wrap { position: relative; z-index: 1; }
@media (min-width: 1600px) {
  .hero--img::before { background-image: linear-gradient(90deg, rgba(16,21,26,.9) 0%, rgba(16,21,26,.6) 55%, rgba(16,21,26,.42) 100%), url("/assets/images/hero-cnc-1920.webp"); }
}
/* Industries Served page uses its own banner (machined-parts collage) */
.hero--img.hero--industries::before { background-image: linear-gradient(90deg, rgba(16,21,26,.9) 0%, rgba(16,21,26,.6) 55%, rgba(16,21,26,.42) 100%), url("/assets/images/hero-industries-1373.webp"); }
@media (max-width: 680px) {
  .hero--img.hero--industries::before { background-image: linear-gradient(90deg, rgba(16,21,26,.92), rgba(16,21,26,.7)), url("/assets/images/hero-industries-800.webp"); }
}

/* ---- CTA band ---- */
.cta-band { background: var(--color-accent); color: #fff; padding: 2.75rem 0; }
.cta-band h2 { color: #fff; margin-bottom: 1rem; }
.cta-band .btn { background: #fff; color: var(--color-accent); }
.cta-band .btn:hover { background: #e7f4ea; }

/* ---- Contact methods (copy / open) ---- */
.contact-methods { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin: 1.5rem 0 2rem; }
.contact-card { border: 1px solid var(--color-border); border-radius: var(--radius); padding: 1.3rem; background: var(--color-surface); box-shadow: var(--shadow); }
.contact-card .label { font-size: .78rem; text-transform: uppercase; letter-spacing: .1em; color: var(--color-muted); }
.contact-card .value { font-size: 1.05rem; font-weight: 600; margin: .3rem 0 .7rem; word-break: break-all; }
.contact-card.pending .value { color: var(--color-muted); font-weight: 500; }
.copy-btn { cursor: pointer; border: 1px solid var(--color-accent); background: var(--color-accent); color: #fff; border-radius: var(--radius-sm); padding: .55rem 1.05rem; font-size: .85rem; font-weight: 600; font-family: inherit; transition: background .15s ease; }
.copy-btn:hover { background: var(--color-accent-dark); }
.copy-btn[disabled] { opacity: .5; cursor: not-allowed; background: var(--color-muted); border-color: var(--color-muted); }

/* ---- Contact form (lead form) ---- */
.contact-layout { display: grid; grid-template-columns: 1fr 1.1fr; gap: 2.5rem; align-items: start; }
.lead-form { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.75rem; }
.field { margin-bottom: 1rem; }
.field label { display: block; font-size: .85rem; font-weight: 600; margin-bottom: .35rem; color: var(--color-text); }
.field .req { color: var(--color-accent-coral); }
.field input, .field textarea, .field select { width: 100%; padding: .7rem .8rem; border: 1px solid var(--color-border); border-radius: var(--radius-sm); background: var(--color-bg); color: var(--color-text); font-family: inherit; font-size: .95rem; }
.field input:focus, .field textarea:focus, .field select:focus { outline: none; border-color: var(--color-accent); box-shadow: 0 0 0 3px rgba(46,158,68,.15); }
.field textarea { min-height: 110px; resize: vertical; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.lead-form button.btn { width: 100%; text-align: center; border: none; cursor: pointer; margin-top: .4rem; }
.form-note { font-size: .8rem; color: var(--color-muted); margin: .8rem 0 0; text-align: center; }
@media (max-width: 760px) { .contact-layout { grid-template-columns: 1fr; gap: 1.75rem; } .field-row { grid-template-columns: 1fr; } }

/* ---- Toast ---- */
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--color-steel-2); color: #fff; padding: .7rem 1.2rem; border-radius: 8px; font-size: .9rem; opacity: 0; transition: opacity .2s ease; z-index: 9999; pointer-events: none; box-shadow: 0 4px 16px rgba(0,0,0,.25); }
.toast.show { opacity: 1; }

/* ---- Stats / highlights band ---- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1.5rem; text-align: center; }
.stat .num { font-family: var(--font-display); font-size: clamp(1.9rem, 4.5vw, 2.8rem); font-weight: 800; color: var(--color-accent); line-height: 1.05; letter-spacing: -.02em; }
.stat .label { display: block; margin-top: .4rem; color: var(--color-muted); font-size: .92rem; }

/* ---- Photo placeholder box ---- */
.photo-box { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35rem; min-height: 200px; border: 2px dashed var(--color-border); border-radius: var(--radius); background: var(--color-card); color: var(--color-muted); text-align: center; padding: 1.5rem; }
.photo-box svg { width: 38px; height: 38px; opacity: .55; }
.photo-box .ph-label { font-size: .9rem; font-weight: 700; }
.photo-box .ph-hint { font-size: .8rem; }

/* ---- News ---- */
.news-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.25rem; margin-top: 1.5rem; }
.news-card { border: 1px solid var(--color-border); border-radius: var(--radius); overflow: hidden; background: var(--color-surface); box-shadow: var(--shadow); display: flex; flex-direction: column; transition: transform .15s ease, box-shadow .15s ease; }
.news-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); }
.news-card .photo-box { border: none; border-radius: 0; min-height: 168px; }
.news-card .news-body { padding: 1.1rem 1.25rem 1.4rem; }
.news-date { color: var(--color-muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; margin: 0 0 .4rem; }
.news-card h3 { margin: 0 0 .4rem; font-size: 1.05rem; }
.news-card p { margin: 0; }
.news-card > img { width: 100%; height: 168px; object-fit: cover; display: block; }
.news-card[id] { scroll-margin-top: 1.5rem; }

/* ---- Back to top ---- */
.to-top { position: fixed; right: 20px; bottom: 20px; width: 44px; height: 44px; border-radius: 50%; border: none; background: var(--color-accent); color: #fff; cursor: pointer; box-shadow: 0 6px 18px rgba(0,0,0,.28); opacity: 0; visibility: hidden; transform: translateY(8px); transition: opacity .2s ease, transform .2s ease, background-color .15s ease; z-index: 9998; display: inline-flex; align-items: center; justify-content: center; }
.to-top.show { opacity: 1; visibility: visible; transform: translateY(0); }
.to-top:hover { background: var(--color-accent-dark); }
.to-top svg { width: 20px; height: 20px; }

/* ---- Responsive ---- */
@media (max-width: 860px) {
  .site-header .wrap { flex-wrap: wrap; align-items: center; gap: .4rem; padding: .7rem 1rem; }
  .brand { margin-right: auto; }
  .nav-toggle { display: inline-flex; }
  .site-nav { display: none; order: 5; width: 100%; flex-direction: column; align-items: stretch; gap: 0; padding-top: .4rem; }
  .site-header.nav-open .site-nav { display: flex; }
  .site-nav a { margin: 0; padding: .8rem .25rem; border-radius: 0; border-top: 1px solid var(--color-border); }
  .site-nav a:hover { background: var(--color-card); }
  .lang-switch { margin-left: 0; }
  .theme-toggle { margin: .5rem 0 0; }
}
@media (max-width: 680px) {
  body { font-size: 16px; }
  main section { padding: 2.25rem 0; }
  .hero { padding: 2.5rem 0; }
  .hero p { font-size: 1.05rem; }
  .cta-band { padding: 2rem 0; }
  .gallery img { height: 200px; }
  .btn { display: inline-block; }
  .hero .btn, .hero .btn--ghost { margin: .35rem .5rem .35rem 0; }
  .hero--img::before { background-image: linear-gradient(90deg, rgba(16,21,26,.92), rgba(16,21,26,.7)), url("/assets/images/hero-cnc-800.webp"); }
}
@media (max-width: 380px) {
  .site-nav a { padding: .5rem .55rem; font-size: .9rem; }
}
