/* 三聯消防工程公司 — design tokens & components */
:root {
  --color-navy: #0b1f3a;
  --color-navy-mid: #123056;
  --color-navy-deep: #071526;
  --color-red: #c8102e;
  --color-red-dark: #9a0c23;
  --color-cream: #f3efe6;
  --color-paper: #faf8f3;
  --color-steel: #d9e1ea;
  --color-ink: #1a2332;
  --color-muted: #5c6674;
  --color-line: #cfd7e1;
  --color-white: #ffffff;
  --font: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", sans-serif;
  --fs-xs: 0.75rem;
  --fs-sm: 0.875rem;
  --fs-md: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.5rem;
  --fs-2xl: 2rem;
  --fs-3xl: clamp(2.1rem, 4vw, 3.4rem);
  --lh-tight: 1.2;
  --lh-body: 1.8;
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.5rem;
  --space-6: 2rem;
  --space-7: 3rem;
  --space-8: 4.5rem;
  --space-9: 7rem;
  --header-h: 92px;
  --radius: 2px;
  --shadow: 0 18px 50px rgba(11, 31, 58, 0.14);
  --shadow-soft: 0 8px 24px rgba(11, 31, 58, 0.08);
  --max: 1180px;
  --z-header: 1000;
  --z-top: 1400;
  --z-menu: 5000;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-md);
  line-height: var(--lh-body);
  color: var(--color-ink);
  background: var(--color-paper);
}

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

a {
  color: var(--color-red);
  text-decoration: none;
}

a:hover {
  color: var(--color-red-dark);
}

h1, h2, h3, h4 {
  font-weight: 700;
  line-height: var(--lh-tight);
  color: var(--color-navy);
  letter-spacing: 0.01em;
}

p {
  margin: 0 0 1em;
}

ul, ol {
  margin: 0 0 1.2em;
  padding-left: 1.2em;
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--color-red);
  color: #fff;
  padding: 0.6rem 1rem;
  z-index: 6000;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

.container {
  width: min(100% - 2rem, var(--max));
  margin-inline: auto;
}

.section {
  padding: var(--space-8) 0;
}

.section--cream {
  background: var(--color-cream);
}

.section--navy {
  background: var(--color-navy);
  color: #fff;
}

.section--navy h2,
.section--navy h3 {
  color: #fff;
}

.eyebrow {
  display: inline-block;
  font-size: var(--fs-xs);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--color-red);
  font-weight: 700;
  margin-bottom: var(--space-3);
}

.section-title {
  font-size: var(--fs-2xl);
  margin: 0 0 var(--space-4);
  padding-left: 0.85rem;
  border-left: 3px solid var(--color-red);
}

.lede {
  font-size: var(--fs-lg);
  color: var(--color-muted);
  max-width: 46rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0.7rem 1.35rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), transform 0.2s var(--ease);
}

.btn:focus-visible,
.nav__link:focus-visible,
.mobile-menu a:focus-visible {
  outline: 2px solid var(--color-red);
  outline-offset: 3px;
}

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

.btn--primary:hover {
  background: var(--color-red-dark);
  color: #fff;
}

.btn--ghost {
  background: transparent;
  color: #fff;
  border-color: rgba(255, 255, 255, 0.55);
}

.btn--ghost:hover {
  background: #fff;
  color: var(--color-navy);
}

.btn--navy {
  background: var(--color-navy);
  color: #fff;
}

.btn--navy:hover {
  background: var(--color-navy-mid);
  color: #fff;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: var(--space-5);
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: rgba(250, 248, 243, 0.94);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid transparent;
  transition: box-shadow 0.25s var(--ease), border-color 0.25s var(--ease);
}

.site-header.is-scrolled {
  box-shadow: var(--shadow-soft);
  border-bottom-color: var(--color-line);
}

.site-header__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--header-h);
  gap: 1rem;
}

.logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.logo img {
  height: 52px;
  width: auto;
}

.nav {
  display: flex;
  align-items: center;
  gap: 0.15rem;
}

.nav__list {
  display: flex;
  align-items: center;
  gap: 0.1rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav__item {
  position: relative;
}

.nav__link {
  display: block;
  padding: 0.7rem 0.72rem;
  color: var(--color-navy);
  font-size: 0.86rem;
  font-weight: 600;
  white-space: nowrap;
}

.nav__link:hover,
.nav__link.is-current,
.nav__item:hover > .nav__link {
  color: var(--color-red);
}

.nav__dropdown {
  position: absolute;
  top: calc(100% - 0.2rem);
  left: 0;
  min-width: 12rem;
  background: #fff;
  box-shadow: var(--shadow);
  list-style: none;
  margin: 0;
  padding: 0.5rem 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: opacity 0.2s var(--ease), transform 0.2s var(--ease), visibility 0.2s;
}

.nav__item:hover > .nav__dropdown,
.nav__item:focus-within > .nav__dropdown {
  opacity: 1;
  visibility: visible;
  transform: none;
}

.nav__dropdown a {
  display: block;
  padding: 0.55rem 1rem;
  color: var(--color-ink);
  font-size: 0.88rem;
}

.nav__dropdown a:hover {
  background: var(--color-cream);
  color: var(--color-red);
}

.nav__cta {
  margin-left: 0.6rem;
}

.menu-toggle {
  display: none;
  width: 46px;
  height: 46px;
  border: 1px solid var(--color-line);
  background: #fff;
  cursor: pointer;
  padding: 0;
  position: relative;
}

.menu-toggle span,
.menu-toggle span::before,
.menu-toggle span::after {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--color-navy);
  position: absolute;
  left: 12px;
}

.menu-toggle span {
  top: 22px;
}

.menu-toggle span::before,
.menu-toggle span::after {
  content: "";
}

.menu-toggle span::before {
  top: -7px;
}

.menu-toggle span::after {
  top: 7px;
}

/* Independent full-screen mobile overlay */
.mobile-menu {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100dvh;
  z-index: var(--z-menu);
  background: var(--color-navy-deep);
  color: #fff;
  overflow-y: auto;
  display: none;
  flex-direction: column;
  padding: 1rem 1.25rem 2.5rem;
}

.mobile-menu.is-open {
  display: flex;
}

body.menu-open {
  overflow: hidden;
  height: 100dvh;
}

.mobile-menu__top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  margin-bottom: 1.5rem;
}

.mobile-menu__top img {
  height: 42px;
  background: #fff;
  padding: 0.25rem 0.45rem;
}

.mobile-menu__close {
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: transparent;
  color: #fff;
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
}

.mobile-menu nav {
  flex: 1;
}

.mobile-menu ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.mobile-menu a {
  display: block;
  color: #fff;
  padding: 0.95rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 1.15rem;
  font-weight: 600;
}

.mobile-menu .sub a {
  font-size: 1rem;
  font-weight: 400;
  padding-left: 1rem;
  color: var(--color-steel);
}

.mobile-menu__contact {
  margin-top: auto;
  padding-top: 1.5rem;
  font-size: 0.92rem;
  color: var(--color-steel);
}

.mobile-menu__contact a {
  display: inline;
  border: 0;
  padding: 0;
  color: #fff;
  font-size: inherit;
}

/* Hero */
.hero {
  position: relative;
  min-height: min(88vh, 760px);
  color: #fff;
  overflow: hidden;
  background: var(--color-navy);
}

.hero__slides {
  position: absolute;
  inset: 0;
}

.hero__slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.9s var(--ease);
}

.hero__slide.is-active {
  opacity: 1;
}

.hero__slide img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.hero__slide::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(7, 21, 38, 0.88) 0%, rgba(7, 21, 38, 0.45) 52%, rgba(7, 21, 38, 0.2) 100%),
    linear-gradient(180deg, rgba(7, 21, 38, 0.15), rgba(7, 21, 38, 0.55));
}

.hero__content {
  position: relative;
  z-index: 2;
  width: min(100% - 2rem, var(--max));
  margin: 0 auto;
  padding: 7.5rem 0 5.5rem;
}

.hero__content > * {
  max-width: 36rem;
}

.hero h1 {
  color: #fff;
  font-size: var(--fs-3xl);
  margin: 0 0 1rem;
}

.hero p {
  color: rgba(255, 255, 255, 0.86);
  font-size: 1.05rem;
}

.hero__dots {
  position: absolute;
  z-index: 3;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%);
  display: flex;
  gap: 0.5rem;
}

.hero__dots button {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  padding: 0;
}

.hero__dots button.is-active {
  background: var(--color-red);
}

.hero__nav-btn {
  position: absolute;
  top: 50%;
  z-index: 3;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(7, 21, 38, 0.35);
  color: #fff;
  cursor: pointer;
  font-size: 1.4rem;
}

.hero__nav-btn--prev { left: 1rem; }
.hero__nav-btn--next { right: 1rem; }

.page-hero {
  position: relative;
  min-height: 280px;
  display: grid;
  align-items: end;
  color: #fff;
  overflow: hidden;
  background: var(--color-navy);
}

.page-hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.page-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(7, 21, 38, 0.25), rgba(7, 21, 38, 0.82));
}

.page-hero__inner {
  position: relative;
  z-index: 1;
  width: min(100% - 2rem, var(--max));
  margin: 0 auto;
  padding: 4.5rem 0 2.2rem;
}

.page-hero h1 {
  color: #fff;
  font-size: clamp(1.8rem, 3.4vw, 2.8rem);
  margin: 0;
}

/* Layout helpers */
.split {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: var(--space-7);
  align-items: center;
}

.split img {
  width: 100%;
  height: 100%;
  max-height: 460px;
  object-fit: cover;
  filter: saturate(0.92);
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

.card {
  background: #fff;
  border: 1px solid var(--color-line);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
}

.card__body {
  padding: 1.2rem 1.25rem 1.4rem;
}

.card h3 {
  margin: 0 0 0.4rem;
  font-size: 1.05rem;
}

.card p {
  color: var(--color-muted);
  font-size: 0.92rem;
  margin: 0 0 0.8rem;
}

.card a {
  font-weight: 700;
  font-size: 0.88rem;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.2rem;
}

.product-card {
  background: #fff;
  border: 1px solid var(--color-line);
  padding: 1.4rem 1.2rem 1.6rem;
  text-align: center;
}

.product-card img {
  width: 180px;
  height: 180px;
  object-fit: contain;
  margin: 0 auto 1rem;
}

.product-card h3 {
  font-size: 1.05rem;
  margin: 0 0 0.5rem;
}

.product-card p {
  color: var(--color-muted);
  font-size: 0.92rem;
  white-space: pre-line;
  margin: 0;
}

.gallery {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
}

.gallery a {
  display: block;
  cursor: zoom-in;
  overflow: hidden;
}

.gallery a,
.gallery img {
  width: 100%;
  height: 160px;
  object-fit: cover;
}

.lightbox {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100dvh;
  z-index: 6000;
  background: rgba(7, 21, 38, 0.94);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 4.2rem 3.6rem 2.4rem;
}

.lightbox.is-open {
  display: flex;
}

body.lightbox-open {
  overflow: hidden;
  height: 100dvh;
}

.lightbox__figure {
  margin: 0;
  max-width: min(100%, 1120px);
  max-height: calc(100dvh - 6rem);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.lightbox__figure img {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: calc(100dvh - 7.2rem);
  object-fit: contain;
}

.lightbox__caption {
  color: #fff;
  font-size: 0.88rem;
  margin-top: 0.75rem;
  text-align: center;
}

.lightbox__close,
.lightbox__prev,
.lightbox__next {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(7, 21, 38, 0.45);
  color: #fff;
  cursor: pointer;
  font-size: 1.5rem;
  line-height: 1;
}

.lightbox__close {
  top: 1rem;
  right: 1rem;
  width: 46px;
  height: 46px;
}

.lightbox__prev,
.lightbox__next {
  top: 50%;
  transform: translateY(-50%);
  width: 46px;
  height: 46px;
}

.lightbox__prev { left: 0.8rem; }
.lightbox__next { right: 0.8rem; }

.lightbox__close:hover,
.lightbox__prev:hover,
.lightbox__next:hover {
  background: var(--color-red);
  border-color: var(--color-red);
}

.lightbox__close:focus-visible,
.lightbox__prev:focus-visible,
.lightbox__next:focus-visible {
  outline: 2px solid var(--color-red);
  outline-offset: 3px;
}

.prose {
  max-width: 48rem;
}

.prose h2 {
  font-size: 1.35rem;
  margin: 2rem 0 0.7rem;
  padding-left: 0.7rem;
  border-left: 3px solid var(--color-red);
}

.prose h3 {
  font-size: 1.08rem;
  margin: 1.4rem 0 0.5rem;
}

.prose img {
  margin: 1.2rem 0;
}

.prose table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.4rem;
  font-size: 0.92rem;
}

.prose th,
.prose td {
  border: 1px solid var(--color-line);
  padding: 0.55rem 0.7rem;
  text-align: left;
  vertical-align: top;
}

.prose th {
  background: var(--color-cream);
}

.service-block {
  background: #fff;
  border-left: 3px solid var(--color-red);
  padding: 1.4rem 1.5rem 1.2rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-soft);
}

.service-block h2 {
  margin: 0 0 0.4rem;
  font-size: 1.2rem;
}

.service-block h3 {
  margin: 1rem 0 0.35rem;
  font-size: 1rem;
  color: var(--color-navy-mid);
}

/* FAQ */
.faq-list {
  display: grid;
  gap: 0.6rem;
}

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

.faq-item summary {
  cursor: pointer;
  padding: 1rem 1.2rem;
  font-weight: 700;
  color: var(--color-navy);
  list-style: none;
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::after {
  content: "+";
  float: right;
  color: var(--color-red);
  font-weight: 400;
  font-size: 1.3rem;
}

.faq-item[open] summary::after {
  content: "–";
}

.faq-item .faq-a {
  padding: 0 1.2rem 1.1rem;
  color: var(--color-muted);
}

.faq-item .faq-a table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.8rem 0;
}

.faq-item .faq-a td {
  border: 1px solid var(--color-line);
  padding: 0.5rem 0.65rem;
  vertical-align: top;
}

.faq-group-title {
  margin: 2.2rem 0 0.8rem;
  font-size: 1.35rem;
}

/* Form */
.contact-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: var(--space-7);
}

.contact-card {
  background: var(--color-navy);
  color: #fff;
  padding: 2rem 1.6rem;
}

.contact-card h2,
.contact-card a {
  color: #fff;
}

.contact-card dl {
  margin: 0;
}

.contact-card dt {
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--color-steel);
  margin-top: 1rem;
}

.contact-card dd {
  margin: 0.2rem 0 0;
}

.form {
  background: #fff;
  padding: 1.8rem;
  border: 1px solid var(--color-line);
}

.form label {
  display: block;
  font-weight: 700;
  font-size: 0.88rem;
  margin-bottom: 0.35rem;
}

.form input,
.form textarea {
  width: 100%;
  margin-bottom: 1rem;
  padding: 0.8rem 0.85rem;
  border: 1px solid var(--color-line);
  font: inherit;
  background: var(--color-paper);
}

.form textarea {
  min-height: 140px;
  resize: vertical;
}

.form-msg {
  display: none;
  padding: 0.8rem 1rem;
  margin-bottom: 1rem;
  background: #e8f6ec;
  color: #165b2d;
}

.form-msg.is-error {
  background: #fde8ea;
  color: #8a1224;
}

.form-msg.is-visible {
  display: block;
}

.map-placeholder {
  margin-top: var(--space-7);
  border: 1px solid var(--color-line);
  background: var(--color-steel);
  min-height: 320px;
}

.map-placeholder iframe {
  width: 100%;
  height: 360px;
  border: 0;
  display: block;
}

/* Footer */
.site-footer {
  background: var(--color-navy-deep);
  color: var(--color-steel);
  padding: 3.5rem 0 1.5rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 2rem;
}

.site-footer h2 {
  color: #fff;
  font-size: 1rem;
  margin: 0 0 1rem;
}

.site-footer ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-footer a {
  color: var(--color-steel);
}

.site-footer a:hover {
  color: #fff;
}

.site-footer .logo img {
  height: 44px;
  margin-bottom: 1rem;
  background: #fff;
  padding: 0.3rem 0.5rem;
}

.copyright {
  margin-top: 2.5rem;
  padding-top: 1.2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.85rem;
}

/* Back to top */
.back-to-top {
  position: fixed;
  right: 1.1rem;
  bottom: 1.1rem;
  z-index: var(--z-top);
  width: 46px;
  height: 46px;
  border: 0;
  background: var(--color-red);
  color: #fff;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  font-size: 1.2rem;
}

.back-to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
}

/* Reveal */
.reveal {
  opacity: 1;
  transform: none;
}

html.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

html.js .reveal.is-in {
  opacity: 1;
  transform: none;
}

html.js .prose {
  opacity: 1;
  transform: none;
}

.meta {
  color: var(--color-muted);
  font-size: 0.88rem;
}

.cta-band {
  background:
    linear-gradient(110deg, rgba(11, 31, 58, 0.88), rgba(200, 16, 46, 0.78)),
    url("../images/pages/webimg008.jpg") center/cover;
  color: #fff;
  padding: var(--space-8) 0;
}

.cta-band h2 {
  color: #fff;
  margin-top: 0;
}

/* Responsive */
@media (max-width: 1024px) {
  .cards,
  .product-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .gallery {
    grid-template-columns: repeat(3, 1fr);
  }

  .nav__link {
    padding-inline: 0.45rem;
    font-size: 0.8rem;
  }
}

@media (max-width: 1120px) {
  .nav,
  .nav__cta {
    display: none;
  }

  .menu-toggle {
    display: inline-block;
  }

  .split,
  .contact-grid,
  .footer-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: 72vh;
  }

  .hero__content {
    padding-top: 5.5rem;
  }
}

@media (max-width: 640px) {
  .cards,
  .product-grid,
  .gallery {
    grid-template-columns: 1fr 1fr;
  }

  .gallery a,
  .gallery img {
    height: 120px;
  }

  .section {
    padding: var(--space-7) 0;
  }

  .hero__nav-btn {
    display: none;
  }

  .hero__content {
    padding: 4.5rem 0 4rem;
  }

  .lightbox {
    padding: 4rem 0.8rem 1.5rem;
  }

  .lightbox__prev { left: 0.25rem; }
  .lightbox__next { right: 0.25rem; }
}

@media (max-width: 430px) {
  .cards,
  .product-grid {
    grid-template-columns: 1fr;
  }

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

  .logo img {
    height: 42px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  .reveal {
    opacity: 1;
    transform: none;
  }
}
