/* 더마그넷 홈페이지 공통 헤더 · 드로어 — 쇼룸 첫 화면(/)·도입 기간 계산(/estimate/) 전용
   원본: themagnet_web templates/homepage/base.html(헤더·드로어 마크업), static/css/main.css(.hf-* 규칙)
   클래스·변수 접두어만 hf- → tm- 로 바꾸고 값은 그대로 옮김. 홈페이지 메뉴/모양이 바뀌면 여기도 같이 고칠 것(README 할 일).
   쇼룸 쪽 차이: 로그인 링크·플로팅 「무료진단·문의하기」 탭 없음, 쇼룸 기본 스타일(a:hover 색 등)을 덮는 초기화 몇 줄,
   밤 모드에서 바 배경을 더 불투명하게, Archivo 는 static/vendor/fonts/archivo 에 직접 둠(외부 CDN 없음). */

@font-face {
  font-family: 'Archivo';
  font-style: normal;
  font-weight: 700 900;
  font-display: swap;
  src: url('../vendor/fonts/archivo/Archivo-latin-wght.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  /* main.css :root 의 --ds-* 값을 --tm-* 로 (원본 --hf-* → --ds-* 위임 구조를 한 단계로 풀어 씀) */
  --tm-primary-green: #0E3B2C;
  --tm-amber: #F5A524;
  --tm-amber-hover: #A8620A;
  --tm-amber-text: #A8620A;
  --tm-cream: #FDF3E3;
  --tm-white: #FFFFFF;
  --tm-ink: #0D0D0D;
  --tm-gray: #6b6b6b;
  --tm-font: 'Pretendard Variable', Pretendard, 'Apple SD Gothic Neo', 'Malgun Gothic', 'Nanum Gothic', 'Noto Sans', sans-serif;
  --tm-font-en: 'Archivo', var(--tm-font);
  --tm-radius: 0;
  --tm-border: 1px solid rgba(13,13,13,.14);
}

/* 고정 헤더 아래로 본문 시작 (SORI AI .sori-page padding-top 과 같은 값) */
body.tm-has-header { padding-top: calc(16px + 60px + 16px); }
@media (min-width: 640px) {
  body.tm-has-header { padding-top: calc(24px + 72px + 16px); }
}
body.tm-drawer-open { overflow: hidden; }

/* 쇼룸 기본 스타일과 섞이지 않도록 — 홈페이지 main.css 의 전역 초기화(* · img · button) 중 헤더·드로어에 필요한 것만.
   :where() 로 감싸 명시도를 홈페이지 원본과 같은 요소 선택자 수준(0,0,1)으로 둠 — 아래 .tm-* 규칙(padding 등)을 덮지 않도록.
   (예전엔 .tm-drawer button{padding:0} 이 .tm-drawer-toggle 의 padding:20px 4px · Archivo 를 덮어 접히는 항목 간격이 사라졌음) */
.tm-header, .tm-drawer { line-height: 1.65; -webkit-font-smoothing: antialiased; }
:where(.tm-header, .tm-drawer) * { box-sizing: border-box; margin: 0; padding: 0; }
:where(.tm-header, .tm-drawer) a { text-decoration: none; }
:where(.tm-header, .tm-drawer) img { max-width: 100%; display: block; }
:where(.tm-header, .tm-drawer) button { font-family: inherit; cursor: pointer; }

/* ---------- Header (floating card nav) ---------- */
.tm-header {
  position: fixed;
  top: 16px;
  left: 16px;
  right: 16px;
  z-index: 150;
  font-family: var(--tm-font);
}
@media (min-width: 640px) {
  .tm-header { top: 24px; left: 24px; right: 24px; }
}

.tm-bar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  height: 60px;
  padding: 0 0.75rem 0 1.4rem;
  border-radius: var(--tm-radius);
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: var(--tm-border);
  box-shadow: none;
  transition: height 0.25s ease, padding 0.25s ease;
}
@media (min-width: 640px) {
  .tm-bar { height: 72px; padding: 0 1rem 0 1.75rem; }
}
.tm-header.is-scrolled .tm-bar { height: 56px; }
/* 쇼룸 밤 모드: 어두운 벽 위에서 검은 글자가 읽히도록 */
:root[data-light="night"] .tm-bar { background: rgba(255,255,255,0.92); }

.tm-logo { display: block; flex-shrink: 0; }
.tm-logo img {
  display: block;
  height: 35px;
  width: auto;
  transition: height 0.25s ease;
}
@media (min-width: 640px) { .tm-logo img { height: 46px; } }
.tm-header.is-scrolled .tm-logo img { height: 38px; }

/* 헤더 중앙 빈 공간 — 자석 인력 파티클 (1024px 이상) */
.tm-particles {
  display: none;
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  align-self: stretch;
  pointer-events: none;
  z-index: 1;
}
@media (min-width: 1024px) {
  .tm-particles { display: block; }
}
.tm-particle {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  opacity: 0;
  animation: tm-particle-fly 7s ease-in infinite;
}
.tm-particle:nth-child(1)  { top: 14%; left: 2%;   width: 2px; height: 2px; background: var(--tm-amber-text);   animation-delay: 0s;    --fly-x: -50px;  --peak-o: 0.22; }
.tm-particle:nth-child(2)  { top: 62%; left: 9%;   width: 6px; height: 6px; background: var(--tm-primary-green); animation-delay: 0.5s;  --fly-x: -60px;  --peak-o: 0.32; }
.tm-particle:nth-child(3)  { top: 38%; left: 16%;  width: 3px; height: 3px; background: var(--tm-amber);        animation-delay: 1s;    --fly-x: -80px;  --peak-o: 0.18; }
.tm-particle:nth-child(4)  { top: 82%; left: 24%;  width: 5px; height: 5px; background: var(--tm-amber-text);   animation-delay: 1.5s;  --fly-x: -100px; --peak-o: 0.3; }
.tm-particle:nth-child(5)  { top: 10%; left: 32%;  width: 2px; height: 2px; background: var(--tm-primary-green); animation-delay: 2s;    --fly-x: -120px; --peak-o: 0.4; }
.tm-particle:nth-child(6)  { top: 55%; left: 39%;  width: 7px; height: 7px; background: var(--tm-amber);        animation-delay: 2.5s;  --fly-x: -140px; --peak-o: 0.2; }
.tm-particle:nth-child(7)  { top: 30%; left: 47%;  width: 3px; height: 3px; background: var(--tm-amber-text);   animation-delay: 3s;    --fly-x: -160px; --peak-o: 0.35; }
.tm-particle:nth-child(8)  { top: 75%; left: 54%;  width: 4px; height: 4px; background: var(--tm-primary-green); animation-delay: 3.5s;  --fly-x: -180px; --peak-o: 0.24; }
.tm-particle:nth-child(9)  { top: 18%; left: 61%;  width: 2px; height: 2px; background: var(--tm-amber);        animation-delay: 4s;    --fly-x: -195px; --peak-o: 0.38; }
.tm-particle:nth-child(10) { top: 45%; left: 69%;  width: 6px; height: 6px; background: var(--tm-amber-text);   animation-delay: 4.5s;  --fly-x: -210px; --peak-o: 0.2; }
.tm-particle:nth-child(11) { top: 85%; left: 76%;  width: 3px; height: 3px; background: var(--tm-primary-green); animation-delay: 5s;    --fly-x: -225px; --peak-o: 0.3; }
.tm-particle:nth-child(12) { top: 25%; left: 84%;  width: 5px; height: 5px; background: var(--tm-amber);        animation-delay: 5.5s;  --fly-x: -240px; --peak-o: 0.16; }
.tm-particle:nth-child(13) { top: 65%; left: 91%;  width: 4px; height: 4px; background: var(--tm-amber-text);   animation-delay: 6s;    --fly-x: -255px; --peak-o: 0.34; }
.tm-particle:nth-child(14) { top: 8%;  left: 97%;  width: 2px; height: 2px; background: var(--tm-primary-green); animation-delay: 6.5s;  --fly-x: -270px; --peak-o: 0.4; }

@keyframes tm-particle-fly {
  0%   { transform: translate(0, 0) scale(1); opacity: 0; }
  8%   { opacity: var(--peak-o, 0.3); }
  65%  { transform: translate(calc(var(--fly-x, -100px) * 0.55), -2px) scale(0.85); opacity: var(--peak-o, 0.3); }
  88%  { transform: translate(calc(var(--fly-x, -100px) * 0.9), -4px) scale(0.4); opacity: calc(var(--peak-o, 0.3) * 1.5); }
  100% { transform: translate(var(--fly-x, -100px), -4px) scale(0.15); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .tm-particle { animation: none; opacity: 0; }
}

.tm-bar-actions { display: flex; align-items: center; gap: 0.6rem; flex-shrink: 0; }

/* 상단 바 상시 노출 링크(Consulting/Solutions) — 900px 미만은 숨기고 드로어로 */
.tm-bar-nav {
  display: none;
  align-items: center;
  gap: 1.5rem;
  margin-right: 0.5rem;
}
@media (min-width: 900px) {
  .tm-bar-nav { display: flex; }
}
.tm-bar-nav a {
  font-family: var(--tm-font-en);
  font-weight: 700;
  font-size: 16px;
  color: var(--tm-ink);
  white-space: nowrap;
  padding: 6px 2px;
  border-bottom: 2px solid transparent;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.tm-bar-nav a:hover { color: var(--tm-primary-green); }
.tm-bar-nav a.active { color: var(--tm-primary-green); border-bottom-color: var(--tm-amber); }

.tm-cta {
  display: inline-flex;
  align-items: center;
  background: var(--tm-amber);
  color: var(--tm-primary-green);
  font-family: var(--tm-font-en);
  font-weight: 700;
  font-size: 13px;
  padding: 9px 16px;
  border-radius: var(--tm-radius);
  white-space: nowrap;
  transition: background 0.2s ease;
}
.tm-cta:hover { background: var(--tm-amber-hover); color: var(--tm-primary-green); }
@media (min-width: 640px) { .tm-cta { font-size: 15px; padding: 12px 28px; } }

.tm-trigger {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: var(--tm-radius);
  background: var(--tm-cream);
  border: var(--tm-border);
  flex-shrink: 0;
}
.tm-trigger-icon { position: relative; width: 18px; height: 13px; display: block; }
.tm-trigger-icon span {
  position: absolute;
  left: 0;
  width: 100%;
  height: 1.5px;
  background: var(--tm-ink);
  border-radius: 1px;
  transition: transform 0.25s ease, top 0.25s ease;
}
.tm-trigger-icon span:first-child { top: 0; }
.tm-trigger-icon span:last-child { top: 100%; margin-top: -1.5px; }
.tm-trigger[aria-expanded="true"] .tm-trigger-icon span:first-child {
  top: 50%; transform: translateY(-50%) rotate(45deg);
}
.tm-trigger[aria-expanded="true"] .tm-trigger-icon span:last-child {
  top: 50%; margin-top: -0.75px; transform: translateY(-50%) rotate(-45deg);
}

/* ---------- 우측 슬라이드 드로어 (backdrop 155 · 본체 160, 헤더 150 위) ---------- */
.tm-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 155;
  background: rgba(13,13,13,.4);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.35s cubic-bezier(.2,.8,.2,1), visibility 0.35s;
}
.tm-drawer-backdrop.open { opacity: 1; visibility: visible; }

.tm-drawer {
  position: fixed;
  right: 0;
  top: 0;
  z-index: 160;
  height: 100vh;
  width: 88vw;
  max-width: 440px;
  background: var(--tm-white);
  color: var(--tm-ink);
  border-left: var(--tm-border);
  box-shadow: none;
  border-radius: 0;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.35s cubic-bezier(.2,.8,.2,1);
  font-family: var(--tm-font);
  display: flex;
  flex-direction: column;
}
@media (min-width: 640px) {
  .tm-drawer { width: 440px; }
}
@media (max-width: 700px) {
  .tm-drawer { height: 100svh; }
}
.tm-drawer.open { transform: translateX(0); }

.tm-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 1.25rem 1.25rem 0;
  flex-shrink: 0;
}
.tm-drawer-logo { display: block; flex-shrink: 0; }
.tm-drawer-logo img { display: block; height: 20px; width: auto; }
.tm-drawer-head-actions { display: flex; align-items: center; gap: 0.6rem; flex-shrink: 0; }
.tm-drawer-close {
  width: 40px;
  height: 40px;
  border-radius: var(--tm-radius);
  background: var(--tm-cream);
  border: var(--tm-border);
  color: var(--tm-ink);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.tm-drawer-list { flex: 1; padding: 0.5rem 1.5rem 1.5rem; }

.tm-drawer-group { border-bottom: 1px solid rgba(13,13,13,.1); }
.tm-drawer-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: none;
  border: none;
  padding: 20px 4px;
  font-size: 21px;
  font-weight: 700;
  color: var(--tm-ink);
  font-family: var(--tm-font-en);
  transition: background 0.15s ease;
}
.tm-drawer-toggle:hover { background: var(--tm-cream); }
.tm-chevron { transition: transform 0.25s ease; flex-shrink: 0; color: var(--tm-ink); }
.tm-drawer-toggle[aria-expanded="true"] .tm-chevron { transform: rotate(180deg); }

.tm-drawer-sub {
  display: flex;
  flex-direction: column;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  padding-left: 1rem;
  transition: max-height 0.3s ease, opacity 0.25s ease, padding-bottom 0.3s ease;
}
.tm-drawer-sub.open { max-height: 400px; opacity: 1; padding-bottom: 12px; }
.tm-drawer-sub a {
  padding: 0.6rem 0.25rem;
  font-size: 16px;
  font-weight: 400;
  color: var(--tm-ink);
  opacity: 0.72;
}
.tm-drawer-sub a:hover { opacity: 1; color: var(--tm-primary-green); }
.tm-drawer-sub a.active { opacity: 1; color: var(--tm-amber-text); font-weight: 500; }

.tm-drawer-row {
  display: flex;
  align-items: center;
  padding: 20px 4px;
  font-size: 21px;
  font-weight: 700;
  font-family: var(--tm-font-en);
  color: var(--tm-ink);
  border-bottom: 1px solid rgba(13,13,13,.1);
  transition: background 0.15s ease;
}
.tm-drawer-row:hover { background: var(--tm-cream); color: var(--tm-ink); }
.tm-drawer-row.active, .tm-drawer-row.active:hover { color: var(--tm-amber-text); }
.tm-drawer-row-contact, .tm-drawer-row-contact:hover { color: var(--tm-amber-text); }

@media (prefers-reduced-motion: reduce) {
  .tm-header, .tm-bar, .tm-logo, .tm-drawer, .tm-drawer-backdrop, .tm-trigger-icon span, .tm-chevron, .tm-drawer-sub { transition: none; }
}

/* 키보드 포커스 표시 */
.tm-header *:focus-visible, .tm-drawer *:focus-visible {
  outline: 2px solid var(--tm-amber-hover);
  outline-offset: 2px;
}
