/* ============================================================
   components.css - 전역 컴포넌트 (헤더·푸터·마키·챗봇·폼·게시판)
   ============================================================ */

/* ---- C1. Header (마스터: is_trans/is_white 상태 기계) ---- */
.header {
  position: fixed; inset: 0 0 auto 0; z-index: var(--z-header);
  height: var(--header-h);
  display: flex; align-items: center;
  transition: background var(--dur-hover) var(--ease-out-quad),
              border-color var(--dur-hover) var(--ease-out-quad),
              color var(--dur-hover) var(--ease-out-quad),
              transform .4s var(--ease-out-quad);
  border-bottom: 1px solid transparent;
  color: var(--ondark);
}
.header .container { display: flex; align-items: center; justify-content: space-between; width: 100%; max-width: none; }
.header.is-white { background: rgba(255,255,255,.92); backdrop-filter: blur(12px); color: var(--ink-950); border-color: var(--ink-100); }
.header.is-hidden { transform: translateY(-100%); }

.header .logo img { height: 2.5rem; width: auto; }
@media (max-width: 1024px) { .header .logo img { height: 36px; } }
@media (max-width: 767px) { .header .logo img { height: 30px; } }
.header .logo { display: flex; align-items: center; }
.header .logo-light { display: none; }
.header.is-white .logo-dark { display: none; }
.header.is-white .logo-light { display: block; }
body.nav-open .header .logo-dark { display: block !important; }
body.nav-open .header .logo-light { display: none !important; }
.footer-brand .logo { margin-bottom: 1.25rem; }

.gnb { display: flex; gap: 2.25rem; }
.gnb > li { position: relative; }
.gnb > li > a {
  display: flex; align-items: center; height: var(--header-h);
  font-weight: 600; font-size: 1.0625rem; position: relative;
}
.gnb > li > a::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: 1.75rem;
  height: 2px; background: var(--brand);
  transition: right var(--dur-hover) var(--ease-out-quad);
}
.gnb > li > a:hover::after, .gnb > li.is-active > a::after { right: 0; }

/* depth2 드롭다운 */
.gnb .depth2 {
  position: absolute; top: 100%; left: 50%; transform: translate(-50%, 8px);
  min-width: 13rem; padding: .75rem;
  background: #fff; color: var(--ink-950);
  border: 1px solid var(--ink-100); border-radius: var(--radius-md);
  box-shadow: var(--shadow-card-hover);
  opacity: 0; visibility: hidden; pointer-events: none;
  transition: opacity .25s var(--ease-out-quad), transform .25s var(--ease-out-quad), visibility 0s .25s;
}
.gnb > li:hover .depth2, .gnb > li:focus-within .depth2 {
  opacity: 1; visibility: visible; pointer-events: auto; transform: translate(-50%, 0); transition-delay: 0s;
}
.gnb .depth2 a { display: block; padding: .625rem .875rem; border-radius: .5rem; font-size: .9375rem; white-space: nowrap; }
.gnb .depth2 a:hover { background: var(--surface-50); color: var(--brand); }

.header-util { display: flex; align-items: center; gap: 1.25rem; }
.lang-switch { font-family: var(--font-mono); font-size: .8125rem; letter-spacing: .08em; display: flex; gap: .5rem; align-items: center; }
.lang-switch .sep { opacity: .35; }
.lang-switch a { opacity: .45; }
.lang-switch a.is-on, .lang-switch a:hover { opacity: 1; }
.btn-chat-open { background: var(--brand); color: #fff; border-radius: 999px; padding: .625rem 1.25rem; font-weight: 600; font-size: .9375rem; display: inline-flex; gap: .5rem; align-items: center; }
.btn-chat-open:hover { background: var(--brand-deep); }
.btn-remote { display: inline-flex; align-items: center; gap: .375rem; padding: .5625rem 1.125rem; border: 1px solid currentColor; border-radius: 999px; font-weight: 600; font-size: .875rem; opacity: .85; transition: opacity .2s, background .2s, color .2s, border-color .2s; }
.btn-remote:hover { opacity: 1; background: var(--tech); border-color: var(--tech); color: #fff; }

.nav-toggle { display: none; width: 44px; height: 44px; position: relative; z-index: calc(var(--z-overlay) + 1); }
.nav-toggle span { position: absolute; left: 10px; right: 10px; height: 2px; background: currentColor; transition: .3s var(--ease-out-quad); }
.nav-toggle span:nth-child(1) { top: 15px; } .nav-toggle span:nth-child(2) { top: 21px; } .nav-toggle span:nth-child(3) { top: 27px; }
body.nav-open .nav-toggle span:nth-child(1) { top: 21px; transform: rotate(45deg); }
body.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
body.nav-open .nav-toggle span:nth-child(3) { top: 21px; transform: rotate(-45deg); }

@media (max-width: 1024px) {
  .gnb {
    position: fixed; inset: 0; z-index: var(--z-overlay);
    flex-direction: column; gap: 0; padding: calc(var(--header-h) + 24px) 24px 24px;
    background: var(--ink-950); color: var(--ondark);
    opacity: 0; visibility: hidden; transition: opacity .3s, visibility 0s .3s;
    overflow-y: auto;
  }
  body.nav-open .gnb { opacity: 1; visibility: visible; transition-delay: 0s; }
  .gnb > li { border-bottom: 1px solid var(--ondark-border); }
  .gnb > li > a { height: auto; padding: 18px 0; font-size: 20px; }
  .gnb > li > a::after { display: none; }
  .gnb .depth2 { position: static; transform: none; opacity: 1; visibility: visible; pointer-events: auto; background: none; border: 0; box-shadow: none; color: var(--ondark-sub); padding: 0 0 16px; transition: none; }
  /* 데스크톱 드롭다운용 focus-within transform(translate -50%)이 모바일 정적
     레이아웃을 밀어내 depth2가 화면 밖으로 나가던 문제 방지 */
  .gnb > li:hover .depth2, .gnb > li:focus-within .depth2 { transform: none; }
  .gnb .depth2 a:hover { background: none; }
  .nav-toggle { display: block; }
  .header-util .btn-chat-open, .header-util .btn-remote { display: none; }
  /* is-white 헤더의 backdrop-filter가 fixed 메뉴의 컨테이닝 블록이 되어
     메뉴가 헤더 높이로 잘리는 문제 방지: 열림 동안 필터 해제 */
  body.nav-open .header { background: transparent; color: var(--ondark); border-color: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }
  body.nav-open .logo, body.nav-open .lang-switch { position: relative; z-index: calc(var(--z-overlay) + 1); }
  body.nav-open .lang-switch { color: var(--ondark); }
}

/* ---- C14. Footer ---- */
.footer { background: var(--ink-950); color: var(--ondark-sub); font-size: .9375rem; }
.footer a:hover { color: var(--ondark); }
.footer-top { display: grid; grid-template-columns: 1.2fr 2fr; gap: var(--gap); padding-block: 5rem 3.5rem; border-bottom: 1px solid var(--ondark-border); }
.footer-brand img { height: 1.25rem; margin-bottom: 1.25rem; }
.footer-nav { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap); }
.footer-nav h4 { font-size: .8125rem; font-family: var(--font-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--steel); margin-bottom: 1rem; font-weight: 500; }
.footer-nav li { margin-bottom: .625rem; }
.footer-info { padding-block: 2.5rem; display: flex; justify-content: space-between; gap: var(--gap); flex-wrap: wrap; font-size: .8125rem; line-height: 1.9; }
.footer-sns { display: flex; gap: 1rem; align-items: center; }
.footer-sns a { display: inline-flex; gap: .375rem; align-items: center; font-family: var(--font-mono); font-size: .75rem; letter-spacing: .06em; color: var(--steel); border: 1px solid var(--ondark-border); padding: .5rem .875rem; border-radius: 999px; }
.footer-sns a:hover { color: var(--ondark); border-color: var(--steel); }
@media (max-width: 767px) {
  .footer-top { grid-template-columns: 1fr; }
  .footer-nav { grid-template-columns: repeat(2, 1fr); }
}

/* ---- C8. Logo Marquee ---- */
.marquee { overflow: hidden; position: relative; }
.marquee-track { display: flex; gap: 4rem; width: max-content; animation: marquee 32s linear infinite; align-items: center; }
.marquee-track.rev { animation-direction: reverse; }
.marquee:hover .marquee-track { animation-play-state: paused; }
.marquee-cell { flex: none; width: 10rem; height: 4rem; display: flex; align-items: center; justify-content: center; }
.marquee-cell img { max-height: 2.5rem; width: auto; }
@keyframes marquee { to { transform: translateX(-50%); } }
@media (prefers-reduced-motion: reduce) { .marquee-track { animation: none; flex-wrap: wrap; width: auto; } }

/* ---- C12. Chatbot ---- */
.chatbot-fab {
  position: fixed; right: 1.75rem; bottom: 1.75rem; z-index: var(--z-chatbot);
  width: 3.5rem; height: 3.5rem; min-width: 52px; min-height: 52px; border-radius: 50%;
  background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(231,20,32,.35);
  transition: transform .25s var(--ease-out-quad), background .25s, opacity var(--dur-hover) var(--ease-out-quad), visibility 0s var(--dur-hover);
}
.chatbot-fab:hover { transform: translateY(-3px); background: var(--brand-deep); }
.chatbot-fab svg { width: 45%; height: 45%; }

.chatbot-panel {
  position: fixed; right: 1.75rem; bottom: 6rem; z-index: var(--z-chatbot);
  width: 23.75rem; max-width: calc(100vw - 32px); max-height: min(35rem, 70vh);
  background: #fff; color: var(--ink-950); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card-hover); border: 1px solid var(--ink-100);
  display: flex; flex-direction: column; overflow: hidden;
  opacity: 0; visibility: hidden; transform: translateY(12px);
  transition: opacity .25s var(--ease-out-quad), transform .25s var(--ease-out-quad), visibility 0s .25s;
}
.chatbot-panel.is-open { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.chatbot-head { background: var(--ink-950); color: var(--ondark); padding: 1.25rem 1.5rem; display: flex; justify-content: space-between; align-items: center; }
.chatbot-head strong { font-size: 1rem; }
.chatbot-body { padding: 1.5rem; overflow-y: auto; display: flex; flex-direction: column; gap: .75rem; }
.chatbot-q { text-align: left; border: 1px solid var(--ink-100); border-radius: var(--radius-md); padding: .875rem 1.125rem; font-size: .9375rem; transition: border-color .2s, background .2s; }
.chatbot-q:hover { border-color: var(--brand); background: var(--brand-tint); }
.chatbot-a { background: var(--surface-50); border-radius: var(--radius-md); padding: 1rem 1.125rem; font-size: .9375rem; line-height: 1.6; }
.chatbot-foot { padding: 1rem 1.5rem; border-top: 1px solid var(--ink-100); display: flex; gap: .625rem; }
.chatbot-foot a { flex: 1; text-align: center; font-size: .8125rem; font-weight: 600; padding: .625rem; border-radius: .5rem; background: var(--surface-50); }
.chatbot-foot a:hover { background: var(--brand-tint); color: var(--brand); }

/* ---- C11. Form ---- */
.form-grid { display: grid; gap: 1.75rem; }
.form-field label { display: block; font-weight: 600; font-size: .9375rem; margin-bottom: .625rem; }
.form-field label .req { color: var(--brand); }
.form-field input, .form-field textarea, .form-field select {
  width: 100%; border: 1px solid var(--ink-100); border-radius: var(--radius-sm);
  padding: .875rem 1rem; font-size: 1rem; background: #fff;
  transition: border-color .2s;
}
.form-field input:focus, .form-field textarea:focus, .form-field select:focus { border-color: var(--brand); outline: none; }
.form-field textarea { min-height: 11rem; resize: vertical; }
.form-field .err { display: none; font-size: .8125rem; color: #D92D20; margin-top: .375rem; }
.form-field.is-error input, .form-field.is-error textarea, .form-field.is-error select { border-color: #D92D20; }
.form-field.is-error .err { display: block; }
.form-consent { display: flex; align-items: center; gap: .625rem; font-size: .9375rem; }
.form-consent a { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }

/* 동의 팝업 (K-철도 방식) */
.modal { position: fixed; inset: 0; z-index: var(--z-modal); display: none; align-items: center; justify-content: center; padding: 20px; }
.modal.is-open { display: flex; }
.modal-dim { position: absolute; inset: 0; background: rgba(11,13,16,.6); }
.modal-card { position: relative; background: #fff; border-radius: var(--radius-lg); max-width: 40rem; width: 100%; max-height: 80vh; display: flex; flex-direction: column; }
.modal-card header { padding: 1.5rem 2rem; border-bottom: 1px solid var(--ink-100); display: flex; justify-content: space-between; align-items: center; }
.modal-card .modal-body { padding: 1.5rem 2rem; overflow-y: auto; font-size: .9375rem; color: var(--ink-700); line-height: 1.8; }
.modal-close { font-size: 1.5rem; line-height: 1; color: var(--ink-500); }

/* ---- C9. Board ---- */
.board-tabs { display: flex; gap: .625rem; margin-bottom: 3rem; }
.board-tab { border: 1px solid var(--ink-100); border-radius: 999px; padding: .625rem 1.5rem; font-weight: 600; font-size: .9375rem; transition: .2s; }
.board-tab:hover { border-color: var(--brand); color: var(--brand); }
.board-tab.is-on { background: var(--brand); border-color: var(--brand); color: #fff; }
.board-list { border-top: 1px solid var(--ink-950); }
.board-row { display: grid; grid-template-columns: 7.5rem 1fr 8rem; gap: var(--gap); align-items: center; padding: 1.75rem .5rem; border-bottom: 1px solid var(--ink-100); transition: background .2s; }
.board-row:hover { background: var(--surface-50); }
.board-row .badge { font-family: var(--font-mono); font-size: .75rem; letter-spacing: .06em; border: 1px solid currentColor; border-radius: 999px; padding: .25rem .75rem; justify-self: start; }
.board-row .badge.press { color: var(--brand); }
.board-row .title { font-weight: 600; font-size: 1.125rem; }
.board-row .date { font-family: var(--font-mono); font-size: .8125rem; color: var(--ink-500); text-align: right; }
.board-empty { padding: 6rem 0; text-align: center; color: var(--ink-500); border-bottom: 1px solid var(--ink-100); }
@media (max-width: 767px) {
  .board-row { grid-template-columns: 1fr; gap: 8px; }
  .board-row .date { text-align: left; }
}

/* ---- 카드 공통 ---- */
.card { background: #fff; border: 1px solid var(--ink-100); border-radius: var(--radius-lg); transition: transform var(--dur-hover) var(--ease-out-quad), box-shadow var(--dur-hover) var(--ease-out-quad); }
@media (hover: hover) { .card:hover { transform: translateY(-4px); box-shadow: var(--shadow-card-hover); } }

/* 문의 폼 2열 (2026-10-01 고객 요청, 리퓨터 참고) */
.form-2col { grid-template-columns: 1fr 1fr; column-gap: 1.25rem; }
.form-2col > .is-full { grid-column: 1 / -1; }
.form-field select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%236B7280' stroke-width='1.6'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 1rem center; padding-right: 2.5rem; }
.form-field input::placeholder, .form-field textarea::placeholder { color: var(--ink-300); }
@media (max-width: 640px) { .form-2col { grid-template-columns: 1fr; } }
/* 개인정보 처리방침 본문 */
.policy { font-size: .9375rem; line-height: 1.75; color: var(--ink-700); }
.policy h4 { margin: 1.75rem 0 .5rem; font-size: 1rem; font-weight: 700; color: var(--ink-950); }
.policy p + p { margin-top: .25rem; }
