/* VISION KING unified theme — 2026-10-28.
   Loaded after the legacy inline styles in header.php, so these rules
   win on equal specificity. PHP, SEO and ordering logic are untouched. */
:root {
  --primary: #12283d;
  --primary-soft: #1b3a56;
  --accent: #f39c12;
  --accent-dark: #b45309;
  --accent-hover: #d97706;
  --ink: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --card: #ffffff;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(15, 30, 46, .06), 0 8px 24px rgba(15, 30, 46, .08);
  --shadow-hover: 0 4px 8px rgba(15, 30, 46, .08), 0 16px 32px rgba(15, 30, 46, .14);
}

body {
  font-family: "Segoe UI", system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #f3f4f6;
  color: var(--ink);
  line-height: 1.6;
}

.container { max-width: 1240px; }

/* ---------- Header / nav ---------- */
header { background: var(--primary); box-shadow: 0 2px 16px rgba(0, 0, 0, .25); }
.logo a {
  font-family: "Segoe UI", system-ui, sans-serif;
  font-size: 26px; font-weight: 800; letter-spacing: 1.5px;
  color: #fff;
}
.logo a::after {
  content: "OPTICAL"; display: block;
  font-size: 10px; font-weight: 600; letter-spacing: 4px; color: var(--accent);
}
nav ul li a { font-size: 15px; transition: color .2s; }
nav ul li a:hover { color: var(--accent); }
/* Underline only on top-level nav items: dropdown links are only ~45px tall,
   so bottom:22px landed mid-text and drew a line through the item name. */
nav > ul > li > a { position: relative; }
nav > ul > li > a::after {
  content: ""; position: absolute; left: 20px; right: 20px; bottom: 22px;
  height: 2px; background: var(--accent); transform: scaleX(0); transition: transform .25s;
}
nav > ul > li > a:hover::after { transform: scaleX(1); }
nav .dropdown li > a::after, nav .sub-dropdown li > a::after { display: none; }
/* Do NOT put overflow:hidden here: the third-level menu is positioned at
   left:220px, i.e. exactly at (or beyond) the dropdown's right edge, so
   overflow:hidden clipped every submenu completely. Rounded bottom corners
   are kept via the last item's link instead. */
.dropdown {
  border-top: 2px solid var(--accent); border-radius: 0 0 12px 12px;
  box-shadow: 0 16px 32px rgba(0, 0, 0, .35); overflow: visible;
}
.dropdown > li:last-child > a { border-bottom-left-radius: 12px; border-bottom-right-radius: 12px; }
.dropdown li a { line-height: 46px; }
.dropdown li { position: relative; }
/* The toggle's height anchor: only the title row, never the whole li
   (which grows when its submenu expands — that is what pushed the arrow
   down onto a submenu row). */
.cat-head { position: relative; }
.cat-head > a { padding-right: 44px; }
/* Separate expand arrow for a category: the name stays a normal link, the
   arrow alone toggles the submenu, so tap-again can close it. */
.drop-toggle {
  position: absolute; right: 6px; top: 0; height: 46px; width: 36px;
  background: transparent; border: none; color: #fff; font-size: 18px;
  cursor: pointer; transition: transform .2s; z-index: 2;
}
.drop-toggle[aria-expanded="true"] { transform: rotate(90deg); }
.dropdown li.open > .sub-dropdown { display: block; }
.sub-dropdown { border-radius: 0 12px 12px 0; box-shadow: 0 16px 32px rgba(0, 0, 0, .35); }
/* Submenu on one line: the original panel was a fixed 200px wide, so long
   names wrapped to two lines. Let the panel grow to its longest item and
   never wrap (desktop only; mobile keeps the stacked, wrapping layout). */
@media (min-width: 993px) {
  .sub-dropdown { width: max-content; min-width: 240px; }
  .sub-dropdown li a, .dropdown li a { white-space: nowrap; }
}

/* ---------- Buttons ---------- */
.btn {
  border-radius: 999px; padding: 11px 22px; font-size: 14px;
  background: var(--accent); transition: background .2s, transform .2s, box-shadow .2s;
  box-shadow: 0 4px 12px rgba(243, 156, 18, .35);
}
.btn:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-block { display: block; width: 100%; text-align: center; padding: 14px; }

/* ---------- Section / page headings ---------- */
.section-title {
  margin: 44px 0 8px; font-size: clamp(20px, 3vw, 26px); font-weight: 800;
  letter-spacing: .5px; color: var(--primary);
}
.section-subtitle { margin: 0 0 20px; color: var(--muted); font-size: 15px; }
.page-title {
  margin-top: 32px; border-left: 5px solid var(--accent); padding-left: 15px;
  font-size: clamp(20px, 3vw, 26px); color: var(--primary);
}
.page-title a { color: var(--accent-dark); text-decoration: none; }
.page-card {
  background: var(--card); padding: 32px; border-radius: var(--radius);
  margin-top: 28px; box-shadow: var(--shadow); border: 1px solid var(--line);
}

/* ---------- Product cards (home / category / products) ---------- */
.p-grid { gap: 24px; }
/* Card bottom alignment: the card itself must be a full-height flex column,
   otherwise .p-body never stretches and the price/button sit right under
   each title — so a 3-line title pushes its button lower than a 2-line one. */
.p-card {
  display: flex; flex-direction: column; height: 100%;
  border-radius: var(--radius); border: 1px solid var(--line);
  box-shadow: var(--shadow); transition: transform .25s, box-shadow .25s;
}
.p-img { flex-shrink: 0; }
.p-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-hover); }
.p-img {
  height: 210px; margin: 12px 12px 0; border-radius: 10px;
  background: #fff; border: 1px solid #f0f0f0;
}
.p-img img { object-fit: contain; padding: 8px; transition: transform .35s; }
.p-card:hover .p-img img { transform: scale(1.04); }
.p-body { padding: 16px; display: flex; flex-direction: column; flex-grow: 1; }
.p-title { flex-grow: 1; margin-bottom: 12px; }
.p-title h3 {
  font-size: 15px; line-height: 1.55; color: var(--ink); font-weight: 650;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.p-cat { font-size: 12px; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.p-price { color: var(--accent-dark); font-weight: 800; font-size: 16px; margin-bottom: 12px; }
.p-card .btn { display: block; text-align: center; padding: 9px 12px; font-size: 13px; }

/* ---------- Hero slider ---------- */
.hero-slider { border-radius: var(--radius); box-shadow: var(--shadow); }
.slide::after {
  content: ""; position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(180deg, rgba(0, 0, 0, .15), rgba(0, 0, 0, .55));
}
.slide-content h1 { font-weight: 800; letter-spacing: .5px; }
.slide-content p { opacity: .92; }
.slider-arrow {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 10;
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .4);
  background: rgba(0, 0, 0, .35); color: #fff; font-size: 22px; cursor: pointer;
}
.slider-arrow:hover { background: var(--accent); border-color: var(--accent); }
.slider-arrow.prev { left: 14px; }
.slider-arrow.next { right: 14px; }
.slider-dots { bottom: 18px; }
.slider-dots .dot { border: none; padding: 0; }
.slider-dots .dot.active { background: var(--accent); }

/* ---------- Detail page ---------- */
.ql-editor { color: #374151; font-size: 16px; }
.ql-editor h2, .ql-editor h3 { color: var(--primary); margin: 1em 0 .5em; }
.ql-editor th { background: #f8fafc; color: var(--primary); }
/* Detail content area: title + meta, hero image, readable body text,
   a real spec table, and one inquiry block (the duplicated title is gone). */
.prod-detail-title {
  border-bottom: 1px solid var(--line); padding-bottom: 14px; margin: 0;
  font-size: clamp(20px, 3vw, 26px); line-height: 1.35; color: var(--primary);
}
.prod-meta { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 20px; }
.prod-meta-cat {
  background: #eef2f7; color: var(--primary); border-radius: 999px;
  padding: 4px 12px; font-size: 13px; font-weight: 600;
}
.prod-meta-price { color: var(--accent-dark); font-weight: 800; font-size: 16px; line-height: 1.9; }
.prod-detail-body > * { margin-bottom: 20px; }
.prod-hero, .prod-img {
  background: #fff; border: 1px solid var(--line); border-radius: 12px;
  padding: 12px; box-shadow: var(--shadow); text-align: center;
}
.prod-hero img, .prod-img img {
  display: block; width: 100%; height: auto; border-radius: 8px; object-fit: contain;
}
.prod-hero img { max-height: 560px; margin: 0 auto; }
.prod-text { color: var(--ink); font-size: 16px; line-height: 1.75; overflow-wrap: break-word; }
.prod-text p { margin: 0 0 12px; }
.prod-text ul, .prod-text ol { padding-left: 1.5em; margin: 0 0 14px; }
.prod-text li { margin-bottom: 6px; }
.prod-text img { max-width: 100%; height: auto; }
.prod-text table { border-collapse: collapse; width: 100%; display: block; overflow-x: auto; }
.prod-text td, .prod-text th { border: 1px solid var(--line); padding: 10px 12px; text-align: left; }
.prod-spec-title {
  border-left: 4px solid var(--accent); padding-left: 12px; margin: 28px 0 16px !important;
  font-size: 19px; letter-spacing: .5px; color: var(--primary);
}
.spec-grid {
  display: grid; grid-template-columns: 190px 1fr; margin: 0 0 8px;
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
}
.spec-grid dt, .spec-grid dd { margin: 0; padding: 11px 14px; border-bottom: 1px solid var(--line); font-size: 15px; line-height: 1.6; }
.spec-grid dt { background: #f8fafc; font-weight: 700; color: var(--primary); }
.spec-grid dt:last-of-type, .spec-grid dd:last-of-type { border-bottom: none; }
.prod-inquiry { border-top: 2px solid var(--accent); padding-top: 20px; margin-top: 28px; }
.prod-inquiry p { color: var(--muted); margin: 0 0 14px; }
.fixed-mail-btn, .fixed-x-btn {
  right: 18px; top: auto; width: 52px; height: 52px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .3);
}
.fixed-mail-btn { bottom: 84px; }
.fixed-x-btn { bottom: 20px; }
.fixed-mail-btn span { font-size: 28px; }
.fixed-x-btn span { font-size: 24px; }

/* ---------- Generic content cards (careers etc.) ---------- */
.card {
  background: var(--card); padding: 32px; border-radius: var(--radius);
  margin-top: 28px; box-shadow: var(--shadow); border: 1px solid var(--line);
}
.card h2 { font-size: clamp(20px, 3vw, 26px); color: var(--primary); }

/* ---------- Footer ---------- */
.site-footer { background: var(--primary); color: #cbd5e1; padding: 48px 0 32px; margin-top: 56px; border-top: 3px solid var(--accent); }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr; gap: 32px; text-align: left; }
.site-footer h4 { color: #fff; margin-bottom: 14px; font-size: 15px; letter-spacing: .5px; }
.site-footer p, .site-footer a { color: #cbd5e1; font-size: 14px; line-height: 1.9; text-decoration: none; }
.site-footer a:hover { color: var(--accent); }
.footer-bottom { border-top: 1px solid rgba(255, 255, 255, .15); margin-top: 32px; padding-top: 20px; text-align: center; font-size: 13px; color: #94a3b8; }

/* ---------- Mobile ---------- */
@media (max-width: 992px) {
  /* The nav lives inside the fixed header, so a tall expanded menu used to
     run off the bottom of the screen with nowhere to scroll to. Let the
     menu itself scroll within the viewport instead. */
  nav { max-height: calc(100vh - var(--nav-h)); overflow-y: auto; -webkit-overflow-scrolling: touch; }
  /* Main menu spacing: top-level links inherited line-height:80px from the
     desktop header, so each mobile item was 80px tall and looked sparse.
     ~52px is the natural mobile menu height. Submenu links inherited the
     same 80px, so they get the same treatment. */
  nav > ul > li > a { line-height: 1.3; padding: 15px 20px; }
  nav .dropdown li > a, nav .sub-dropdown li > a { line-height: 1.3; padding-top: 13px; padding-bottom: 13px; }
  .drop-toggle { height: 100%; display: flex; align-items: center; justify-content: center; }
  nav ul li > a::after { display: none; }
  nav .dropdown, nav .sub-dropdown {
    position: static !important; display: none !important; width: 100%;
    min-width: 0; border: none; border-radius: 0; box-shadow: none; background: #1a1a1a;
  }
  nav .has-drop.open > .dropdown, nav .dropdown li.open > .sub-dropdown { display: block !important; }
  nav .dropdown li a { padding-left: 36px; }
  nav .sub-dropdown li a { padding-left: 56px; background: #222; }
  .slider-arrow { width: 36px; height: 36px; font-size: 18px; }
  .footer-grid { grid-template-columns: 1fr; }
  .page-card, .card { padding: 22px; }
  .spec-grid { grid-template-columns: 1fr; }
  .spec-grid dt { border-bottom: none; padding-bottom: 2px; }
  .spec-grid dd { padding-top: 2px; }
  .fixed-mail-btn, .fixed-x-btn { right: 12px; width: 48px; height: 48px; }
}
@media (max-width: 600px) {
  .p-grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
  .p-img { height: 180px; }
}
