/* Kia Carmaster site - shared design tokens and components */

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

html, body {
  max-width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

img, video, iframe, table, pre {
  max-width: 100%;
  height: auto;
  display: block;
}

h1, h2, h3, p, li, a {
  overflow-wrap: anywhere;
  word-break: keep-all;
}

:root {
  --ink:        hsl(0, 0%, 9%);
  --ink-soft:   hsl(0, 0%, 32%);
  --paper:      hsl(30, 14%, 97%);
  --line:       hsl(30, 8%, 87%);
  --signal:     hsl(354, 68%, 44%);
  --signal-dp:  hsl(354, 60%, 32%);
  --sweep:      hsl(38, 82%, 62%);

  --accent: var(--signal);
  --accent-dp: var(--signal-dp);
  --page-bg: var(--paper);
  --radius: 4px;
  --divider: 1px solid var(--line);
  --h1-weight: 800;
  --h1-tracking: -0.02em;
}

body {
  margin: 0;
  background: var(--page-bg);
  color: var(--ink);
  font-family: 'Pretendard Variable', Pretendard, -apple-system, BlinkMacSystemFont, sans-serif;
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  padding-bottom: 76px;
}
@media (min-width: 768px) { body { padding-bottom: 0; } }

main { display: block; width: 100%; max-width: 100%; }

.container {
  width: 100%;
  max-width: 1120px;
  margin-inline: auto;
  padding-inline: 20px;
}

h1 { font-size: clamp(1.75rem, 6.2vw, 3.25rem); line-height: 1.22; font-weight: var(--h1-weight); letter-spacing: var(--h1-tracking); margin: 0 0 14px; }
h2 { font-size: clamp(1.35rem, 4.4vw, 2.1rem); line-height: 1.3; font-weight: 800; margin: 0 0 14px; }
h3 { font-size: clamp(1.1rem, 3.2vw, 1.4rem); line-height: 1.35; font-weight: 700; margin: 0 0 10px; }
p  { font-size: clamp(0.975rem, 2.9vw, 1.075rem); line-height: 1.78; color: var(--ink-soft); margin: 0 0 16px; }
a { color: inherit; }

.eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 10px;
}

/* ---------- Header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 950;
  background: hsla(30, 14%, 97%, 0.94);
  backdrop-filter: blur(6px);
  border-bottom: var(--divider);
  padding-top: env(safe-area-inset-top);
}
.header-inner {
  max-width: 1120px;
  margin-inline: auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.logo {
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.main-nav { display: none; }
.main-nav ul { list-style: none; display: flex; gap: 18px; margin: 0; padding: 0; flex-wrap: wrap; }
.main-nav a { text-decoration: none; font-size: 0.92rem; font-weight: 600; color: var(--ink-soft); }
.main-nav a:hover { color: var(--accent); }
@media (min-width: 1024px) { .main-nav { display: block; } }

.btn-call-top {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 18px;
  background: var(--accent);
  color: #fff;
  font-weight: 700;
  font-size: 0.92rem;
  text-decoration: none;
  border-radius: var(--radius);
  white-space: nowrap;
}
.btn-call-top:hover { background: var(--accent-dp); }

.hamburger {
  display: inline-flex;
  width: 44px; height: 44px;
  align-items: center; justify-content: center;
  border: none; background: none; cursor: pointer;
}
.hamburger-icon { width: 22px; height: 16px; position: relative; }
.hamburger-icon span { position: absolute; left: 0; width: 100%; height: 2px; background: var(--ink); }
.hamburger-icon span:nth-child(1) { top: 0; }
.hamburger-icon span:nth-child(2) { top: 7px; }
.hamburger-icon span:nth-child(3) { top: 14px; }
@media (min-width: 1024px) { .hamburger { display: none; } }

.mobile-nav-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: var(--paper);
  padding: env(safe-area-inset-top) 20px env(safe-area-inset-bottom);
  display: none;
  overflow-y: auto;
}
.mobile-nav-overlay.open { display: block; }
.mobile-nav-overlay .overlay-top { display: flex; justify-content: flex-end; padding: 14px 0; }
.mobile-nav-overlay .close-btn { width: 44px; height: 44px; border: none; background: none; font-size: 1.6rem; cursor: pointer; }
.mobile-nav-overlay ul { list-style: none; margin: 0; padding: 0; }
.mobile-nav-overlay li { border-bottom: var(--divider); }
.mobile-nav-overlay a { display: block; padding: 16px 4px; text-decoration: none; font-size: 1.1rem; font-weight: 700; color: var(--ink); }

/* ---------- Hero ---------- */
.hero {
  position: relative;
  min-height: 82dvh;
  display: flex;
  align-items: flex-end;
  color: #fff;
  overflow: hidden;
}
@supports not (height: 100dvh) { .hero { min-height: 82vh; } }
.hero-media { position: absolute; inset: 0; z-index: 0; }
.hero-media img { width: 100%; height: 100%; object-fit: cover; }
.hero-overlay {
  position: absolute; inset: 0; z-index: 1;
  background: linear-gradient(to top, hsla(0,0%,5%,0.86) 0%, hsla(0,0%,5%,0.42) 55%, hsla(0,0%,5%,0.55) 100%);
}
.hero-content { position: relative; z-index: 2; width: 100%; padding: 48px 20px 40px; max-width: 1120px; margin-inline: auto; }
@media (min-width: 768px) {
  .hero-content.profile-right { display: flex; flex-direction: row-reverse; align-items: center; gap: 40px; }
  .hero-content.profile-right .hero-profile {
    flex: 0 0 auto; margin-bottom: 0;
    width: clamp(260px, 32vw, 400px); height: clamp(260px, 32vw, 400px);
  }
  .hero-content.profile-right .hero-text { flex: 1 1 auto; }
}
.hero .eyebrow { color: var(--sweep); }
.hero p { color: hsla(0,0%,100%,0.86); max-width: 46ch; }

.hero-profile {
  width: clamp(96px, 26vw, 148px);
  height: clamp(96px, 26vw, 148px);
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--paper);
  margin-bottom: 18px;
  position: relative;
  isolation: isolate;
}
@media (max-width: 767px) {
  .hero-profile { margin-inline: auto; }
}
.hero-profile img { width: 100%; height: 100%; object-fit: cover; object-position: top center; }
.hero-profile::after {
  content: "";
  position: absolute; inset: -2px;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--sweep);
  animation: light-sweep 1.4s ease-out 0.3s 1;
}
@keyframes light-sweep { from { transform: rotate(0deg); opacity: 1; } to { transform: rotate(360deg); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .hero-profile::after { animation: none; opacity: 0; }
}

.hero-cta { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; max-width: 480px; }
@media (min-width: 560px) {
  .hero-cta { flex-direction: row; flex-wrap: wrap; }
  .hero-cta .cta-kakao { flex-basis: 100%; }
}
.cta {
  display: flex; align-items: center; justify-content: center;
  min-height: 54px;
  padding: 10px 18px;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.98rem;
  line-height: 1.4;
  text-align: center;
  flex: 1 1 auto;
  white-space: normal;
}
.cta-call { background: var(--accent); color: #fff; }
.cta-call:hover { background: var(--accent-dp); }
.cta-sms { background: #fff; color: var(--ink); }
.cta-sms:hover { background: var(--line); }
.cta-kakao { background: hsl(48, 96%, 62%); color: hsl(30,20%,15%); }
.cta-kakao:hover { background: hsl(48, 96%, 55%); }

/* ---------- Image-first paragraph blocks ---------- */
.feature-block { padding: 56px 0; border-bottom: var(--divider); }
.feature-block img { border-radius: var(--radius); margin: 0 auto 24px; max-width: 380px; }
.feature-block .block-body { max-width: 68ch; }

/* text left / photo right on wider screens; mobile keeps image-first stacking */
@media (min-width: 768px) {
  .feature-block-media .container {
    display: flex;
    flex-direction: row-reverse;
    align-items: flex-start;
    gap: 40px;
  }
  .feature-block-media picture { flex: 0 0 38%; margin-top: 4px; }
  .feature-block-media picture img { max-width: 100%; margin: 0; }
  .feature-block-media .block-body { flex: 1 1 auto; max-width: none; }
  .feature-block-media.media-left .container { flex-direction: row; }
}
.checklist { list-style: none; margin: 18px 0; padding: 0; }
.checklist li { position: relative; padding-left: 26px; margin-bottom: 10px; color: var(--ink-soft); }
.checklist li::before { content: "-"; position: absolute; left: 0; color: var(--accent); font-weight: 800; }

.lead-answer {
  font-size: clamp(1rem, 3vw, 1.15rem);
  font-weight: 600;
  color: var(--ink);
  border-left: 3px solid var(--accent);
  padding-left: 16px;
  margin: 20px 0 28px;
}

.compare-table { width: 100%; border-collapse: collapse; margin: 20px 0 28px; font-size: 0.92rem; }
.compare-table th, .compare-table td { border: var(--divider); padding: 10px 12px; text-align: left; }
.compare-table th { background: var(--line); font-weight: 700; }

/* ---------- Body photo grids for detail pages ---------- */
.photo-row, .photo-grid-2x2 {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 12px; margin: 28px auto; max-width: 1000px;
}
.photo-grid-2x2 { max-width: 460px; }
.photo-row picture, .photo-grid-2x2 picture {
  display: block; flex: 0 1 220px; width: 220px; max-width: 100%;
  aspect-ratio: 4 / 3; overflow: hidden; border-radius: var(--radius);
}
.photo-row img, .photo-grid-2x2 img { width: 100%; height: 100%; object-fit: cover; border-radius: var(--radius); }

/* ---------- Carousel ---------- */
.carousel-section { padding: 56px 0; }
.carousel-track {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-card {
  scroll-snap-align: start;
  text-decoration: none;
  color: var(--ink);
  border: var(--divider);
  border-radius: var(--radius);
  overflow: hidden;
  background: #fff;
}
@media (min-width: 640px) {
  .carousel-track {
    grid-auto-flow: column;
    grid-template-columns: unset;
    grid-template-rows: repeat(2, 1fr);
    grid-auto-columns: 30%;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: 16px;
    padding-bottom: 6px;
    scrollbar-width: none;
  }
}
@media (min-width: 1024px) { .carousel-track { grid-auto-columns: 22%; } }
.carousel-card img { aspect-ratio: 1/1; object-fit: cover; }
.carousel-card-body { padding: 14px 16px 18px; }
.carousel-card-title { font-weight: 800; font-size: 1rem; margin-bottom: 4px; }
.carousel-card-desc { font-size: 0.86rem; color: var(--ink-soft); }
/* ---------- Model gallery (each vehicle's photos laid out in one horizontal row) ---------- */
.model-gallery { padding: 8px 0 56px; }
.model-row + .model-row { margin-top: 28px; }
.model-row .model-name { font-weight: 800; font-size: 1rem; margin: 0 0 10px; }
.model-photos {
  list-style: none; margin: 0; padding: 0 0 4px;
  display: flex; flex-wrap: nowrap; gap: 12px;
  overflow-x: auto; scrollbar-width: none;
}
.model-photos::-webkit-scrollbar { display: none; }
.model-photos li {
  flex: 0 0 auto; width: 140px; aspect-ratio: 3 / 4;
  border-radius: var(--radius); overflow: hidden;
}
.model-photos picture { display: block; width: 100%; height: 100%; }
.model-photos img { width: 100%; height: 100%; object-fit: cover; cursor: zoom-in; }
@media (max-width: 767px) {
  .model-photos { display: grid; grid-template-columns: repeat(2, 1fr); overflow-x: visible; }
  .model-photos li { width: auto; }
}

.photo-modal { border: 0; padding: 0; background: transparent; max-width: 92vw; max-height: 92vh; }
.photo-modal::backdrop { background: rgba(0, 0, 0, 0.8); }
.photo-modal img { display: block; max-width: 92vw; max-height: 92vh; width: auto; height: auto; border-radius: var(--radius); }
.photo-modal-close {
  position: absolute; top: -12px; right: -12px; width: 32px; height: 32px;
  border-radius: 50%; border: 0; background: #fff; font-size: 1.4rem; line-height: 1;
  cursor: pointer; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

/* ---------- FAQ (styled as a colored table: rows + zebra + accent rail) ---------- */
.faq-section { padding: 56px 0; }
.faq-table { border: var(--divider); border-radius: var(--radius); overflow: hidden; background: #fff; }
.faq-item {
  border-bottom: var(--divider);
  border-left: 4px solid var(--accent);
  padding: 0;
  background: #fff;
}
.faq-item:last-of-type { border-bottom: none; }
.faq-item:nth-of-type(even) { background: hsla(0,0%,0%,0.03); }
.faq-item[open] { background: hsla(0,0%,0%,0.045); }
.faq-item summary {
  cursor: pointer;
  list-style: none;
  font-weight: 700;
  font-size: 1rem;
  padding: 14px 34px 14px 16px;
  position: relative;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::before {
  content: "Q";
  color: var(--accent);
  font-weight: 800;
  margin-right: 10px;
}
.faq-item summary::after {
  content: "+";
  position: absolute; right: 14px; top: 12px;
  font-size: 1.4rem; color: var(--accent);
}
.faq-item[open] summary::after { content: "-"; }
.faq-item .faq-answer { padding: 0 16px 18px 16px; color: var(--ink-soft); }
.faq-item .faq-answer p::before { content: "A"; color: var(--accent-dp); font-weight: 800; margin-right: 10px; }

/* ---------- Related links ---------- */
.related-links { padding: 40px 0; }
.related-links ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.related-links a {
  display: flex; align-items: center; gap: 12px; padding: 8px 14px 8px 8px;
  border: var(--divider); border-radius: var(--radius);
  text-decoration: none; font-weight: 600; font-size: 0.92rem;
  background: #fff;
}
.related-links a:hover { border-color: var(--accent); color: var(--accent); }
.link-thumb { display: block; width: 44px; height: 44px; border-radius: 6px; overflow: hidden; flex: 0 0 auto; }
.link-thumb picture { display: block; width: 100%; height: 100%; }
.link-thumb img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Footer ---------- */
.site-footer { background: hsl(0, 0%, 9%); color: hsla(0,0%,100%,0.72); padding: 12px 0; margin-top: 40px; }
.site-footer .container { max-width: 1120px; }
.biz-info {
  font-size: 0.82rem;
  display: flex;
  flex-wrap: wrap;
  column-gap: 18px;
  row-gap: 4px;
}
.biz-info span:not(:last-child)::after { content: "·"; margin-left: 18px; color: hsla(0,0%,100%,0.3); }

/* ---------- Final CTA band (above footer) ---------- */
.final-cta { background: hsl(0, 0%, 9%); color: #fff; padding: 48px 0; text-align: center; }
.final-cta h2 { color: #fff; margin-bottom: 8px; }
.final-cta p { color: hsla(0,0%,100%,0.72); max-width: 52ch; margin-inline: auto; }
.final-cta .hero-cta { margin-inline: auto; max-width: 480px; }

/* ---------- Mobile bottom CTA ---------- */
.mobile-cta-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 900;
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: #fff;
  border-top: var(--divider);
  padding: 10px 8px calc(10px + env(safe-area-inset-bottom));
}
@media (min-width: 768px) { .mobile-cta-bar { display: none; } }
.mobile-cta-bar a {
  display: flex; align-items: center; justify-content: center;
  min-height: 44px;
  margin: 0 4px;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 700;
  font-size: 0.86rem;
}
.mobile-cta-bar .m-call { background: var(--accent); color: #fff; }
.mobile-cta-bar .m-sms { background: var(--line); color: var(--ink); }
.mobile-cta-bar .m-kakao { background: hsl(48, 96%, 62%); color: hsl(30,20%,15%); }

/* ---------- Layout archetype variants (detail pages) ---------- */
.layout-split .hero-content { max-width: 640px; }
.layout-timeline .feature-block { border-left: 3px solid var(--accent); padding-left: 20px; }
.layout-stack .feature-block { position: relative; }
.layout-magazine .container { max-width: 980px; }
.layout-magazine .feature-block .block-body { column-count: 1; }
@media (min-width: 900px) { .layout-magazine .feature-block .block-body { column-count: 2; column-gap: 32px; } }

.step-marker { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; font-weight: 800; font-size: 0.9rem; margin-bottom: 12px; }

.layout-zigzag .feature-block:nth-of-type(even) .container { direction: rtl; }
.layout-zigzag .feature-block:nth-of-type(even) .container > * { direction: ltr; }

.layout-cardgrid .feature-block .container { background: #fff; border: var(--divider); border-radius: var(--radius); padding: 28px 20px; }
.layout-cardgrid .feature-block { border-bottom: none; padding: 16px 20px; }

.layout-stack .feature-block .container { background: #fff; border-radius: var(--radius); box-shadow: 0 10px 30px hsla(0,0%,0%,0.08); padding: 32px 24px; margin-bottom: 20px; }
.layout-stack .feature-block { border-bottom: none; }

.layout-minimal .container { max-width: 760px; }
.layout-minimal .hero-content { text-align: center; margin-inline: auto; }
.layout-minimal .hero-cta { margin-inline: auto; }

/* ---------- Dark page inversion ---------- */
.dark-page { --ink: hsl(0,0%,96%); --ink-soft: hsl(0,0%,72%); --line: hsla(0,0%,100%,0.14); --page-bg: hsl(0,0%,9%); }
.dark-page .site-header { background: hsla(0,0%,10%,0.92); }
.dark-page .hamburger-icon span { background: var(--ink); }
.dark-page .mobile-nav-overlay { background: var(--page-bg); }
.dark-page .mobile-nav-overlay a { color: var(--ink); }
.dark-page .carousel-card, .dark-page .related-links a, .dark-page.layout-stack .feature-block .container, .dark-page.layout-cardgrid .feature-block .container {
  background: hsla(0,0%,100%,0.04);
  color: var(--ink);
}
.dark-page .compare-table th { background: hsla(0,0%,100%,0.08); }
.dark-page .compare-table td, .dark-page .compare-table th { border-color: var(--line); }
.dark-page .faq-table { background: hsla(0,0%,100%,0.04); }
.dark-page .faq-item { background: transparent; }
.dark-page .faq-item:nth-of-type(even) { background: hsla(0,0%,100%,0.03); }
.dark-page .faq-item[open] { background: hsla(0,0%,100%,0.06); }
.dark-page .cta-sms { background: hsla(0,0%,100%,0.12); color: #fff; }
.dark-page .mobile-cta-bar { background: hsl(0,0%,13%); border-top-color: var(--line); }
.dark-page .mobile-cta-bar .m-sms { background: hsla(0,0%,100%,0.12); color: #fff; }
