/* =========================================================================
   이천수도설비 — Design tokens & global styles
   Mobile-first: base styles target 375px, then min-width: 768px (tablet),
   min-width: 1200px (desktop). Each component's responsive rules live right
   after its base rules (not lumped at file end) so this stays scannable.
   ========================================================================= */

:root {
  --color-primary: #1E5FA8;
  --color-primary-dark: #164682;
  --color-accent: #F4A820;
  --color-accent-text: #201400; /* on-accent text: passes WCAG AA (~9.9:1) */
  --color-bg: #FFFFFF;
  --color-bg-alt: #F5F8FF;
  --color-text: #1A1A1A;
  --color-text-muted: #5A6472;
  --color-border: #E1E8F2;

  --font-sans: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, sans-serif;

  --space-1: 0.4rem;
  --space-2: 0.8rem;
  --space-3: 1.2rem;
  --space-4: 1.6rem;
  --space-5: 2.4rem;
  --space-6: 3.2rem;
  --space-7: 4.8rem;

  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;

  --shadow-card: 0 2px 12px rgba(30, 95, 168, 0.08);
  --shadow-card-hover: 0 8px 24px rgba(30, 95, 168, 0.14);

  --cta-bar-height: 60px;
  --header-height: 64px;
}

/* Breakpoint convention used throughout this file:
   default          = 375px mobile base
   @media (min-width: 768px)  = tablet
   @media (min-width: 1200px) = desktop */

/* ---------- Reset & base ---------- */
* { box-sizing: border-box; }
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  overflow-x: hidden; /* see body comment: clips the translated off-canvas nav */
}
body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  padding-bottom: var(--cta-bar-height);
  /* The closed off-canvas mobile nav sits translateX(100%) just past the
     viewport edge; without this it still inflates document.scrollWidth
     and makes the page horizontally swipeable even while the nav is shut. */
  overflow-x: hidden;
}
img { max-width: 100%; height: auto; display: block; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; margin: 0; padding: 0; }
h1, h2, h3, p { margin: 0 0 var(--space-3); }
button { font-family: inherit; }

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-4);
}

section { padding: var(--space-6) 0; }
@media (min-width: 768px) {
  section { padding: var(--space-7) 0; }
}

.section-title {
  font-size: 1.5rem;
  font-weight: 900;
  text-align: center;
  margin-bottom: var(--space-5);
}
@media (min-width: 768px) {
  .section-title { font-size: 2rem; }
}

.bg-alt { background: var(--color-bg-alt); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 1rem;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }

.btn-primary {
  background: var(--color-primary);
  color: #fff;
}
.btn-cta {
  background: var(--color-accent);
  color: var(--color-accent-text); /* dark text required for AA contrast on accent bg */
}
.btn-outline {
  background: transparent;
  border-color: var(--color-primary);
  color: var(--color-primary);
}
.btn-sm { padding: var(--space-2) var(--space-3); font-size: 0.9rem; }
.btn-lg { padding: var(--space-4) var(--space-6); font-size: 1.1rem; }
.btn-block { width: 100%; }

/* ---------- Header / nav ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--color-border);
}
.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--header-height);
}
.brand { display: flex; flex-direction: column; line-height: 1.2; }
.brand__name { font-weight: 900; font-size: 1.15rem; color: var(--color-primary); }
.brand__tagline { display: none; font-size: 0.7rem; color: var(--color-text-muted); }
@media (min-width: 768px) {
  .brand__tagline { display: block; }
}

.nav-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px; height: 40px;
  background: none;
  border: none;
  cursor: pointer;
}
.nav-toggle__bar {
  width: 100%; height: 2px;
  background: var(--color-text);
  border-radius: 2px;
}
@media (min-width: 1000px) {
  .nav-toggle { display: none; }
}

.site-nav {
  position: fixed;
  top: var(--header-height);
  left: 0; right: 0;
  height: calc(100vh - var(--header-height));
  background: #fff;
  overflow-y: auto;
  padding: var(--space-4);
  transform: translateX(100%);
  transition: transform 0.25s ease;
}
.site-nav.is-open { transform: translateX(0); }
.site-nav__list { display: flex; flex-direction: column; gap: var(--space-1); }
.site-nav__list > li > a {
  display: block;
  padding: var(--space-3) var(--space-2);
  font-weight: 700;
  border-radius: var(--radius-sm);
}
.site-nav__list > li > a.is-active,
.site-nav__list > li > a[aria-current="page"] {
  color: var(--color-primary);
  background: var(--color-bg-alt);
}
.dropdown {
  padding-left: var(--space-3);
  display: none;
}
.has-dropdown.is-open .dropdown { display: block; }
.dropdown li a { display: block; padding: var(--space-2); color: var(--color-text-muted); }
.site-nav__cta { margin-top: var(--space-4); }

@media (min-width: 1000px) {
  .site-nav {
    position: static;
    transform: none;
    height: auto;
    display: flex;
    align-items: center;
    padding: 0;
    overflow: visible;
    background: transparent;
  }
  .site-nav__list { flex-direction: row; align-items: center; gap: var(--space-2); }
  .site-nav__list > li { position: relative; }
  .has-dropdown:hover .dropdown,
  .has-dropdown.is-open .dropdown {
    display: block;
    position: absolute;
    top: 100%; left: 0;
    min-width: 200px;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    box-shadow: var(--shadow-card);
    padding: var(--space-2);
    padding-left: var(--space-2);
  }
  .site-nav__cta { margin-top: 0; margin-left: var(--space-3); }
}

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(160deg, var(--color-primary) 0%, var(--color-primary-dark) 100%);
  color: #fff;
  padding: var(--space-7) 0;
  position: relative;
  overflow: hidden;
}
.hero__pattern {
  position: absolute;
  inset: 0;
  opacity: 0.12;
  pointer-events: none;
}
.hero__inner { position: relative; text-align: center; }
.hero__headline {
  font-size: 1.8rem;
  font-weight: 900;
  margin-bottom: var(--space-3);
}
.hero__subcopy {
  font-size: 1.05rem;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: var(--space-5);
}
.hero__ctas {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  max-width: 320px;
  margin: 0 auto;
}
@media (min-width: 768px) {
  .hero__headline { font-size: 2.6rem; }
  .hero__subcopy { font-size: 1.25rem; }
  .hero__ctas { flex-direction: row; max-width: none; justify-content: center; }
}

/* ---------- Service cards ---------- */
.service-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
}
@media (min-width: 768px) {
  .service-grid { grid-template-columns: repeat(3, 1fr); gap: var(--space-4); }
}
@media (min-width: 1200px) {
  .service-grid { grid-template-columns: repeat(6, 1fr); }
}
.service-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  text-align: center;
  padding: var(--space-4) var(--space-2);
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.service-card:hover { box-shadow: var(--shadow-card-hover); transform: translateY(-2px); }
.service-card__icon { color: var(--color-primary); }
.service-card__name { font-weight: 700; font-size: 0.9rem; }

/* ---------- Portfolio cards ---------- */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
}
@media (min-width: 768px) {
  .portfolio-grid { grid-template-columns: repeat(3, 1fr); gap: var(--space-4); }
}
@media (min-width: 1200px) {
  .portfolio-grid { grid-template-columns: repeat(4, 1fr); }
}
.portfolio-card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.portfolio-card:hover { box-shadow: var(--shadow-card-hover); transform: translateY(-2px); }
.portfolio-card[hidden] { display: none; }
.portfolio-card__thumb {
  aspect-ratio: 4 / 3;
  overflow: hidden;
  background: var(--color-bg-alt);
}
.portfolio-card__thumb img { width: 100%; height: 100%; object-fit: cover; }
.portfolio-card__body { padding: var(--space-3); }
.portfolio-card__tags { display: flex; flex-wrap: wrap; gap: var(--space-1); margin-bottom: var(--space-2); }
.tag {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--color-bg-alt);
  color: var(--color-primary);
}
.tag--category { background: #FFF3E0; color: #8A5A00; }
.portfolio-card__title {
  font-size: 0.85rem;
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.portfolio-filters {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: center;
  margin-bottom: var(--space-5);
}
.filter-tab {
  padding: var(--space-2) var(--space-4);
  border-radius: 999px;
  border: 2px solid var(--color-border);
  background: #fff;
  font-weight: 700;
  cursor: pointer;
}
.filter-tab.is-active {
  border-color: var(--color-primary);
  background: var(--color-primary);
  color: #fff;
}

/* ---------- Trust counters ---------- */
.counters {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  text-align: center;
}
.counter__value {
  font-size: 1.8rem;
  font-weight: 900;
  color: var(--color-primary);
}
@media (min-width: 768px) {
  .counter__value { font-size: 2.6rem; }
}
.counter__label { font-size: 0.85rem; color: var(--color-text-muted); }

/* ---------- Area / coverage ---------- */
.area-grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: 1fr;
}
@media (min-width: 768px) {
  .area-grid { grid-template-columns: repeat(2, 1fr); }
}
.area-card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  box-shadow: var(--shadow-card);
}
.area-card__title { font-weight: 900; color: var(--color-primary); font-size: 1.1rem; }
.map-embed {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: var(--radius-md);
}
.coverage-illustration {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: center;
}
.coverage-illustration__region {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-bg-alt);
  font-weight: 700;
  color: var(--color-primary);
  border: 2px dashed var(--color-primary);
}

/* ---------- Service detail page ---------- */
.service-detail__keywords {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-top: var(--space-3);
}
.service-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: var(--space-4);
}
.service-table th, .service-table td {
  border: 1px solid var(--color-border);
  padding: var(--space-3);
  text-align: left;
  vertical-align: top;
  font-size: 0.9rem;
}
.service-table th { background: var(--color-primary); color: #fff; }
.service-table-wrap { overflow-x: auto; }

/* ---------- Contact ---------- */
.contact-grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: 1fr;
}
@media (min-width: 768px) {
  .contact-grid { grid-template-columns: 1fr 1fr; }
}
.contact-card {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  box-shadow: var(--shadow-card);
  text-align: center;
}

/* ---------- Floating CTA bar (pure CSS, always visible per PRD) ---------- */
.floating-cta {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 50;
  display: flex;
  height: var(--cta-bar-height);
  box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.12);
}
.floating-cta__btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  font-weight: 800;
  font-size: 1rem;
}
.floating-cta__btn--call { background: var(--color-primary); color: #fff; }
.floating-cta__btn--kakao { background: var(--color-accent); color: var(--color-accent-text); }

/* PRD §6.1⑥: floating CTA is a mobile-only pattern — desktop already has a
   persistent call button in the header nav, so hide it above the nav's own
   mobile/desktop breakpoint to avoid a redundant bottom bar. */
@media (min-width: 1000px) {
  .floating-cta { display: none; }
  body { padding-bottom: 0; }
}

/* ---------- Footer ---------- */
.site-footer {
  background: #0F2440;
  color: rgba(255, 255, 255, 0.85);
  margin-top: var(--space-7);
}
.site-footer__inner {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: 1fr;
  padding-top: var(--space-6);
  padding-bottom: var(--space-4);
}
@media (min-width: 768px) {
  .site-footer__inner { grid-template-columns: repeat(3, 1fr); }
}
.site-footer__brand { font-weight: 900; font-size: 1.1rem; color: #fff; }
.site-footer a:hover { text-decoration: underline; }
.site-footer__bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  padding: var(--space-3) var(--space-4);
  font-size: 0.8rem;
  text-align: center;
}

/* ---------- Utilities ---------- */
.text-center { text-align: center; }
.mt-0 { margin-top: 0; }
.stack { display: flex; flex-direction: column; gap: var(--space-3); }

/* Respect reduced-motion preference for any future transition/animation additions. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
