/* ════════════════════════════════════════════════
   style.css — QuickTools 메인 페이지 전용 스타일시트
   색상 변수(라이트/다크), 내비게이션, 히어로, 카드 그리드,
   카테고리 바, 모달, 반응형 레이아웃을 담당한다.
   ════════════════════════════════════════════════ */

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

/* ── 카드 | 카드 등장 애니메이션 ── */
@keyframes cardReveal {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.tool-card.reveal {
  animation: cardReveal 0.4s ease-out forwards;
}

/* ════════════════════════════════════════════════
   THEME | 색상 변수 (라이트모드 기본값)
   IMPORTANT: 색상 전체를 바꾸려면 이 :root 블록만 수정하면 된다.
   ════════════════════════════════════════════════ */
:root {
  --bg-primary: #f5f6fa;
  --bg-secondary: #fff;
  --bg-glass: rgba(255,255,255,0.75);
  --bg-card-glass: rgba(255,255,255,0.6);
  --text-primary: #1a1a2e;
  --text-secondary: #555;
  --text-light: #707070;
  --border-color: #e2e5ef;
  --shadow: rgba(0,0,0,0.06);
  --shadow-hover: rgba(0,0,0,0.12);
  --primary-color: #4a4a4f;
  --primary-light: rgba(74,74,79,0.08);
  --primary-glow: rgba(74,74,79,0.2);
  --gradient-primary: linear-gradient(135deg, #6b6b70, #1c1c1e);
  --btn-gradient: linear-gradient(135deg, #6b6b70, #1c1c1e);
  --transition: cubic-bezier(0.4, 0, 0.2, 1);
  --card-glow: rgba(74, 74, 79, 0.4);
  --card-glow-strong: rgba(74, 74, 79, 0.55);
}

/* ════════════════════════════════════════════════
   THEME | 다크모드 색상 변수 오버라이드
   ════════════════════════════════════════════════ */
html.dark-mode,
body.dark-mode {
  /* 순수 블랙(#18181b) 대신 네이비 틴트로 — 브랜드 다크 배경 방향에 맞춘다 */
  --bg-primary: #0d0f1c;
  --bg-secondary: #161a2e;
  --bg-glass: rgba(22,26,46,0.72);
  --bg-card-glass: rgba(28,32,54,0.6);
  --text-primary: #eaeaf2;
  --text-secondary: #a0a0b8;
  --text-light: #8686ab;
  --border-color: #2a2e48;
  --shadow: rgba(0,0,0,0.35);
  --shadow-hover: rgba(0,0,0,0.5);
  --primary-color: #b0b0b5;
  --primary-light: rgba(176,176,181,0.12);
  --primary-glow: rgba(176,176,181,0.3);
  --card-glow: rgba(176, 176, 181, 0.55);
  --card-glow-strong: rgba(176, 176, 181, 0.75);
  --btn-gradient: linear-gradient(135deg, #b0b0b5, #4a4a4f);
  --gradient-primary: linear-gradient(135deg, #b0b0b5, #4a4a4f);
}

/* ── 레이아웃 | 기본 body 레이아웃 ──
   테마: transition 줄이 다크/라이트 전환 시 부드럽게 배경·글자색을 바꿔준다 */
body {
  font-family: 'Inter', 'Segoe UI', -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
  -webkit-font-smoothing: antialiased;
}

body :where(*) {
  transition: background-color 0.3s ease, border-color 0.3s ease, color 0.3s ease;
}

/* 배경 장식 */
body::before {
  content: '';
  position: fixed;
  top: -30%;
  right: -15%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(74,74,79,0.07) 0%, transparent 65%);
  pointer-events: none;
}

body::after {
  content: '';
  position: fixed;
  bottom: -20%;
  left: -10%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(74,74,79,0.05) 0%, transparent 65%);
  pointer-events: none;
}

/* ══════════════════════════════════════
   HEADER/NAV | 상단 네비게이션 바
   ══════════════════════════════════════ */
.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 28px;
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 50;
  transition: background 0.3s, border-color 0.3s;
}

.nav-logo {
  display: inline-flex;
  align-items: center;
  line-height: 0;
  border-radius: 10px;
  transition: transform 0.25s var(--transition);
}

.nav-logo:hover {
  transform: scale(1.05);
}

.nav-logo img {
  display: block;
  width: 34px;
  height: 34px;
  border-radius: 9px;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: var(--text-light);
  pointer-events: none;
  transition: color 0.2s;
}

.search-wrap:focus-within .search-icon {
  color: var(--primary-color);
}

#tool-search {
  width: 300px;
  padding: 10px 30px 10px 38px;
  border: 1.5px solid var(--border-color);
  border-radius: 12px;
  font-size: 0.88rem;
  font-family: inherit;
  background: var(--bg-primary);
  color: var(--text-primary);
  outline: none;
  transition: all 0.25s var(--transition);
  text-overflow: ellipsis;
  overflow: hidden;
  white-space: nowrap;
}

#tool-search:focus {
  width: 320px;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px var(--primary-light);
}

#tool-search::placeholder {
  color: var(--text-light);
  font-size: 0.84rem;
}

.search-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-light);
  font-size: 0.85rem;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  transition: color 0.15s;
}

.search-clear:hover {
  color: var(--text-primary);
}

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border: 1.5px solid var(--border-color);
  border-radius: 10px;
  background: var(--bg-primary);
  cursor: pointer;
  transition: all 0.25s var(--transition);
  color: var(--text-secondary);
}

.icon-btn:hover {
  border-color: var(--primary-color);
  background: var(--primary-light);
  color: var(--primary-color);
}

.theme-icon {
  width: 18px;
  height: 18px;
}

.lang-select {
  position: relative;
}

.lang-toggle {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 160px;
  padding: 6px;
  border: 1.5px solid var(--border-color);
  border-radius: 12px;
  background: var(--bg-secondary);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 24px var(--shadow-hover);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: all 0.2s var(--transition);
  z-index: 200;
}

.lang-select.open .lang-toggle {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.lang-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 9px 10px;
  border-radius: 8px;
  transition: all 0.2s var(--transition);
}

.lang-option:hover {
  background: var(--primary-light);
  color: var(--primary-color);
}

.lang-option.active {
  color: var(--primary-color);
}

.lang-option .lang-check {
  opacity: 0;
  color: var(--primary-color);
}

.lang-option.active .lang-check {
  opacity: 1;
}

.main-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
}

/* ══════════════════════════════════════
   LAYOUT | 컴팩트 페이지 헤드
   기존 마케팅 히어로(배지·설명문·CTA·신뢰배지·value-strip)를 걷어내고
   h1 한 줄만 남겨 스크롤 없이 바로 도구 목록이 보이도록 했다.
   ══════════════════════════════════════ */
/* width:100% 필수 — .main-container가 flex column이라 이게 없으면
   margin:0 auto가 cross축 auto마진으로 해석돼 폭이 내용에 맞게 줄어든다. */
.page-head {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 32px 18px;
}

.page-title {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.8px;
  color: var(--text-primary);
  line-height: 1.3;
}

.gradient-text {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ══════════════════════════════════════
   LAYOUT | 2단 셸 (사이드바 + 콘텐츠)
   데스크톱은 좌측 사이드바 고정, 900px 이하에서는 아래 미디어쿼리가
   같은 DOM을 상단 가로 스크롤 칩 바로 전환한다.
   ══════════════════════════════════════ */
.home-shell {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 32px 48px;
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 36px;
  align-items: start;
}

.home-content {
  min-width: 0; /* grid 자식이 내용 폭에 밀려 넘치지 않도록 */
}

/* ── 카테고리 사이드바 ── */
.cat-sidebar {
  position: sticky;
  top: 88px; /* sticky nav-bar 높이 + 여백 */
}

.sidebar-heading {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.2px;
  color: var(--text-light);
  margin-bottom: 12px;
  padding-left: 12px;
}

/* ══════════════════════════════════════
   CARD | 섹션 제목 & 추천(featured) 도구 섹션
   ══════════════════════════════════════ */
.section-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 20px;
  padding-left: 4px;
}

/* 셸 도입 후 각 섹션은 콘텐츠 컬럼 폭을 그대로 따르므로
   기존의 max-width/좌우 패딩은 제거하고 세로 리듬만 남긴다. */
.featured-section {
  margin: 0 0 36px;
}

.featured-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.all-tools-section {
  margin: 0;
}

/* ══════════════════════════════════════
   CARD | 최근 사용한 도구 섹션
   app.js가 tools-grid의 실제 카드를 복제해 채운다.
   기록이 없으면 [hidden] 상태로 남아 렌더링되지 않는다.
   ══════════════════════════════════════ */
.recent-section {
  margin-bottom: 36px;
}

.recent-section[hidden] {
  display: none;
}

.recent-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

/* 최근 카드는 전체 그리드 카드보다 한 톤 낮게 — 목록이 아니라 바로가기라는 신호 */
.recent-grid .tool-card {
  padding: 14px 16px;
  gap: 12px;
  border-radius: 14px;
}

.recent-grid .tool-desc {
  display: none;
}

.recent-grid .tool-icon-wrap {
  width: 34px;
  height: 34px;
  border-radius: 9px;
}

.recent-grid .tool-icon-wrap svg {
  width: 17px;
  height: 17px;
}

/* ══════════════════════════════════════
   FILTER | 섹션 헤더 행 & 카테고리 바
   ══════════════════════════════════════ */
.section-header-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 16px;
}

.section-header-row .section-title {
  margin-bottom: 0;
}

.section-tool-count {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-light);
}

/* ── 카테고리 바 (데스크톱: 사이드바 세로 리스트) ──
   모바일에서는 아래 미디어쿼리가 같은 요소를 가로 스크롤 칩 바로 되돌린다. */
.category-bar {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 0;
  margin: 0;
}

.cat-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border: none;
  border-radius: 9px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.2s var(--transition), color 0.2s var(--transition);
}

.cat-btn:hover {
  background: var(--primary-light);
  color: var(--primary-color);
}

.cat-btn.active {
  background: var(--primary-light);
  color: var(--text-primary);
  font-weight: 700;
  box-shadow: inset 2px 0 0 var(--primary-color);
}

.cat-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 18px;
  padding: 0 5px;
  background: rgba(0,0,0,0.06);
  border-radius: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  transition: background 0.25s var(--transition);
  flex-shrink: 0;
}

.cat-btn.active .cat-count {
  background: var(--primary-glow);
  color: var(--text-primary);
}

.dark-mode .cat-count {
  background: rgba(255,255,255,0.1);
}

.dark-mode .cat-btn.active .cat-count {
  background: rgba(255,255,255,0.18);
}

/* ══════════════════════════════════════
   CARD | 도구 그리드 & 카드 컴포넌트
   ══════════════════════════════════════ */
/* 도트그리드(.dot-grid-bg)가 카드 사이 여백에 비치도록 안쪽 패딩과
   테두리를 준다. 도트 색은 seo.css에서 --border-color를 참조하므로
   라이트/다크 모두 자동으로 맞는 톤이 된다. */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin: 0;
  padding: 18px;
  border: 1px solid var(--border-color);
  border-radius: 18px;
}

.tool-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 22px;
  background: var(--bg-card-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.3s var(--transition), box-shadow 0.25s ease, border-color 0.25s ease;
  box-shadow: 0 2px 8px var(--shadow);
  overflow: hidden;
  cursor: pointer;
}

/* ── 카테고리 시그니처 글로우 ──
   data-cat 속성(기존 필터 로직이 이미 쓰는 값)을 그대로 재사용해 카드마다
   별도 클래스 없이 카테고리 색을 결정한다. accent-*/tool-icon-wrap 색과 동일한
   hex를 사용해 카드 전체의 색 아이덴티티가 하나로 통일되게 한다. */
.tool-card[data-cat="time"]   { --cat-glow: rgba(249,115,22,0.22); }
.tool-card[data-cat="random"] { --cat-glow: rgba(139,92,246,0.22); }
.tool-card[data-cat="text"]   { --cat-glow: rgba(79,125,243,0.22); }
.tool-card[data-cat="calc"]   { --cat-glow: rgba(16,185,129,0.22); }
.tool-card[data-cat="design"] { --cat-glow: rgba(236,72,153,0.22); }

/* 다크모드는 배경이 어두워 더 강한 글로우가 자연스럽게 보인다 */
html.dark-mode .tool-card[data-cat="time"],
body.dark-mode .tool-card[data-cat="time"]   { --cat-glow: rgba(249,115,22,0.45); }
html.dark-mode .tool-card[data-cat="random"],
body.dark-mode .tool-card[data-cat="random"] { --cat-glow: rgba(139,92,246,0.45); }
html.dark-mode .tool-card[data-cat="text"],
body.dark-mode .tool-card[data-cat="text"]   { --cat-glow: rgba(79,125,243,0.45); }
html.dark-mode .tool-card[data-cat="calc"],
body.dark-mode .tool-card[data-cat="calc"]   { --cat-glow: rgba(16,185,129,0.45); }
html.dark-mode .tool-card[data-cat="design"],
body.dark-mode .tool-card[data-cat="design"] { --cat-glow: rgba(236,72,153,0.45); }

.card-accent {
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  border-radius: 4px 0 0 4px;
  transition: width 0.3s var(--transition);
}

.accent-blue   { background: linear-gradient(180deg, #4f7df3, #6e8efb); }
.accent-green  { background: linear-gradient(180deg, #34d399, #10b981); }
.accent-orange { background: linear-gradient(180deg, #fb923c, #f97316); }
.accent-pink   { background: linear-gradient(180deg, #f472b6, #ec4899); }
.accent-purple { background: linear-gradient(180deg, #a78bfa, #8b5cf6); }
.accent-red    { background: linear-gradient(180deg, #f87171, #ef4444); }

.tool-card:hover,
.tool-card:focus-visible {
  transform: translateY(-4px);
  border-color: var(--primary-color);
  box-shadow: 0 12px 32px var(--shadow-hover), 0 0 26px var(--cat-glow, var(--card-glow-strong));
}

.tool-card:hover .card-accent,
.tool-card:focus-visible .card-accent {
  width: 6px;
}

.tool-card:active {
  transform: translateY(-1px);
  border-color: var(--primary-color);
  box-shadow: 0 6px 16px var(--shadow-hover), 0 0 18px var(--cat-glow, var(--card-glow));
}

.tool-card.hidden-card {
  display: none;
}

/* ── 칩 | 대표(featured) 도구 바로가기 — 아이콘+제목만 있는 작은 필 형태 ── */
.tool-chip {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 18px 8px 8px;
  border-radius: 100px;
}

.tool-chip:hover,
.tool-chip:focus-visible {
  transform: translateY(-2px);
}

.tool-chip .tool-icon-wrap {
  width: 34px;
  height: 34px;
}

.tool-chip .tool-icon-wrap svg {
  width: 18px;
  height: 18px;
}

.tool-chip-title {
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: -0.2px;
  white-space: nowrap;
}

.tool-icon-wrap {
  position: relative;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: transform 0.3s var(--transition);
}

/* 아이콘 뒤 은은한 글로우 — currentColor를 그대로 써서 카테고리별 색상 클래스
   (.tool-icon-wrap.blue 등)가 이미 지정한 color를 그대로 물려받는다. */
.tool-icon-wrap::before {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  background: radial-gradient(circle, currentColor 0%, transparent 68%);
  opacity: 0.22;
  filter: blur(5px);
  z-index: -1;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.tool-card:hover .tool-icon-wrap {
  transform: scale(1.08);
}

.tool-card:hover .tool-icon-wrap::before {
  opacity: 0.38;
}

.tool-icon-wrap svg {
  width: 24px;
  height: 24px;
}

.tool-icon-wrap.blue   { background: rgba(79,125,243,0.12); color: #4f7df3; }
.tool-icon-wrap.green  { background: rgba(16,185,129,0.12); color: #10b981; }
.tool-icon-wrap.orange { background: rgba(249,115,22,0.12); color: #f97316; }
.tool-icon-wrap.pink   { background: rgba(236,72,153,0.12); color: #ec4899; }
.tool-icon-wrap.purple { background: rgba(139,92,246,0.12); color: #8b5cf6; }
.tool-icon-wrap.red    { background: rgba(239,68,68,0.12); color: #ef4444; }

.tool-info {
  flex: 1;
  min-width: 0;
}

.tool-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: -0.3px;
}

.tool-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.4;
  font-weight: 400;
}

/* 배경 없이 별 아이콘만 — 카드의 실제 우측 하단 코너에 바짝 붙인다.
   설명이 짧아 카드가 낮은 경우(예: 2줄 설명) 화살표(.tool-arrow)와 겹칠
   여지가 있어 크기를 줄이고 카드 하단에 더 가깝게 당겨, 가장 낮은 카드에서도
   화살표와 안 겹치는 여유를 만든다. */
.favorite-btn {
  position: absolute;
  right: 10px;
  bottom: 6px;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-light);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  z-index: 3;
  filter: drop-shadow(0 1px 2px var(--shadow));
  transition: color 0.2s ease, transform 0.15s ease;
}

.favorite-btn:hover {
  color: #f59e0b;
  transform: scale(1.15);
}

.favorite-btn.active {
  color: #f59e0b;
}

/* 최근/즐겨찾기 섹션은 카드 자체가 훨씬 낮아(64px 고정) 화살표 아래 남는
   공간이 22px 남짓뿐이다 — 배지를 그만큼 더 작고 코너에 바짝 붙여야
   화살표와 겹치지 않는다. */
.recent-grid .favorite-btn,
.favorites-grid .favorite-btn {
  width: 14px;
  height: 14px;
  right: 6px;
  bottom: 2px;
  font-size: 0.68rem;
}

.tool-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 6px;
  text-transform: uppercase;
}

.tool-badge.new {
  background: linear-gradient(135deg, #34d399, #10b981);
  color: #fff;
  box-shadow: 0 2px 8px rgba(16,185,129,0.3);
}

.tool-badge.hot {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #1a1a2e;
  box-shadow: 0 2px 8px rgba(245,158,11,0.3);
}

/* 종이접기 모서리가 있는 카드에서는 배지를 접힌 모서리 왼쪽으로 밀어 겹치지 않게 한다 */
.fold-corner .tool-badge {
  right: calc(var(--fold-size) + 8px);
}

.tool-arrow {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: var(--text-light);
  transition: all 0.3s var(--transition);
}

.tool-arrow svg {
  width: 20px;
  height: 20px;
}

.tool-card:hover .tool-arrow {
  color: var(--primary-color);
  transform: translateX(3px);
}

/* ══════════════════════════════════════
   Search Hints
   ══════════════════════════════════════ */
.search-hints {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}

.search-hint-label {
  font-size: 0.72rem;
  color: var(--text-light);
  font-weight: 500;
  margin-right: 2px;
  flex-shrink: 0;
}

.search-hint-chip {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-secondary);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 4px 12px;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.search-hint-chip:hover {
  border-color: var(--primary-color);
  color: var(--primary-color);
  background: var(--primary-light);
}

/* ══════════════════════════════════════
   No Results
   ══════════════════════════════════════ */
.no-results {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-light);
  font-size: 0.9rem;
  max-width: 1200px;
  margin: 0 auto;
}

.no-results-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.no-results-sub {
  font-size: 0.82rem;
  color: var(--text-light);
  margin-bottom: 16px;
}

.no-results-suggestions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
}

.no-result-link {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--primary-color);
  background: var(--primary-light);
  border: 1px solid var(--primary-color);
  border-radius: 20px;
  padding: 5px 14px;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.no-result-link:hover {
  background: var(--primary-color);
  color: #fff;
}

.no-results-reset {
  font-size: 0.8rem;
  color: var(--text-light);
  background: none;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 6px 14px;
  cursor: pointer;
  font-family: inherit;
  transition: color 0.15s, border-color 0.15s;
}

.no-results-reset:hover {
  color: var(--text-primary);
  border-color: var(--text-secondary);
}

/* ══════════════════════════════════════
   Ad Placeholder
   ══════════════════════════════════════ */
.ad-placeholder {
  max-width: 1200px;
  margin: 40px auto 0;
  padding: 0 24px;
  min-height: 0;
}

/* ══════════════════════════════════════
   CTA Section
   ══════════════════════════════════════ */
.cta-section {
  text-align: center;
  padding: 56px 24px;
  max-width: 720px;
  margin: 0 auto;
}

.cta-section h2 {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 12px;
  letter-spacing: -0.5px;
}

.cta-section p {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ══════════════════════════════════════
   MODAL | 도움말 모달 (단축키 가이드)
   ══════════════════════════════════════ */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeBg 0.2s ease;
  padding: 20px;
}

@keyframes fadeBg {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-box {
  background: var(--bg-secondary);
  color: var(--text-primary);
  border-radius: 20px;
  padding: 28px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
  animation: modalIn 0.35s var(--transition);
  border: 1px solid var(--border-color);
  position: relative;
  overflow: hidden;
}

.modal-box::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: var(--gradient-primary);
}

@keyframes modalIn {
  from { transform: translateY(24px) scale(0.95); opacity: 0; }
  to   { transform: translateY(0) scale(1); opacity: 1; }
}

.modal-box h2 {
  margin-bottom: 18px;
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.shortcuts {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.shortcut-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.88rem;
  padding: 8px 12px;
  background: var(--bg-primary);
  border-radius: 10px;
  transition: background 0.2s;
}

.shortcut-item:hover {
  background: var(--primary-light);
}

.shortcut-item kbd {
  background: var(--gradient-primary);
  color: #fff;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.72rem;
  font-weight: 700;
  font-family: 'Inter', monospace;
  box-shadow: 0 2px 6px var(--primary-glow);
  letter-spacing: 0.3px;
}

.shortcut-item span {
  color: var(--text-secondary);
  font-weight: 500;
}

.modal-close-btn {
  width: 100%;
  background: var(--btn-gradient);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 12px;
  font-size: 0.92rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.25s;
  box-shadow: 0 3px 10px var(--primary-glow);
}

.modal-close-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px var(--primary-glow);
}

/* ══════════════════════════════════════
   Scrollbar
   ══════════════════════════════════════ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-color); border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

::selection {
  background: var(--primary-glow);
  color: var(--text-primary);
}

/* ══════════════════════════════════════
   Focus Accessibility
   ══════════════════════════════════════ */
*:focus-visible {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* ══════════════════════════════════════
   LAYOUT | 반응형
   ~900px  : 사이드바 → 상단 가로 스크롤 칩 바 (같은 DOM, CSS만 전환)
   ~640px  : 모바일 세부 조정
   ══════════════════════════════════════ */

/* ── 태블릿 이하: 사이드바를 가로 스크롤 칩 바로 전환 ── */
@media (max-width: 900px) {
  .home-shell {
    grid-template-columns: minmax(0, 1fr);
    gap: 20px;
    padding: 0 20px 40px;
  }

  /* 스크롤을 따라오도록 상단에 고정. 가로 스크롤 영역이 되므로
     좌우 패딩을 음수 마진으로 상쇄해 화면 끝까지 흐르게 한다. */
  .cat-sidebar {
    position: sticky;
    top: 62px;
    z-index: 5;
    margin: 0 -20px;
    padding: 10px 0 12px;
    background: var(--bg-glass);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border-color);
  }

  /* 모바일에서는 "카테고리" 제목 없이 칩만 보여준다 */
  .sidebar-heading {
    display: none;
  }

  .category-bar {
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    scroll-snap-type: x proximity;
    padding: 0 20px;
    /* 가로 스크롤바는 숨기고 스와이프만 남긴다 */
    scrollbar-width: none;
    -ms-overflow-style: none;
  }

  .category-bar::-webkit-scrollbar {
    display: none;
  }

  .cat-btn {
    flex: 0 0 auto;
    width: auto;
    scroll-snap-align: start;
    padding: 7px 14px;
    border: 1.5px solid var(--border-color);
    border-radius: 100px;
    background: var(--bg-secondary);
    font-size: 0.8rem;
  }

  .cat-btn.active {
    background: var(--btn-gradient);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 3px 12px var(--primary-glow);
  }

  .cat-btn.active .cat-count {
    background: rgba(255,255,255,0.25);
    color: #fff;
  }

  .page-head {
    padding: 20px 20px 14px;
  }

  .tools-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ── 모바일 ── */
@media (max-width: 640px) {
  :root {
    --dot-gap: 18px;
    --fold-size: 11px;
  }

  .page-head {
    padding: 18px 16px 12px;
  }

  .page-title {
    font-size: 1.25rem;
  }

  .home-shell {
    padding: 0 16px 36px;
    gap: 16px;
  }

  .cat-sidebar {
    margin: 0 -16px;
  }

  .category-bar {
    padding: 0 16px;
  }

  .featured-section {
    margin-bottom: 28px;
  }

  .featured-grid {
    gap: 10px;
  }

  .tool-chip {
    flex: 1 1 auto;
    justify-content: center;
  }

  .recent-section {
    margin-bottom: 28px;
  }

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

  .tools-grid {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 12px;
  }

  .tool-card {
    padding: 16px 18px;
  }

  .nav-bar {
    padding: 12px 16px;
  }

  #tool-search {
    width: 90px;
    font-size: 0.8rem;
    padding: 9px 26px 9px 32px;
  }

  #tool-search:focus {
    width: 140px;
  }

  .nav-right {
    gap: 5px;
  }

  .nav-logo img {
    width: 28px;
    height: 28px;
  }

  .lang-toggle {
    min-width: 140px;
    right: -4px;
  }

  .lang-option {
    padding: 8px 8px;
    font-size: 0.8rem;
  }

  .cta-section {
    padding: 40px 20px;
  }

  .cta-section h2 {
    font-size: 1.2rem;
  }
}

/* 모바일 가로 스크롤 방지 — 배경 장식(fixed blob)이 뷰포트 밖으로 넘쳐도 가로 스크롤이 생기지 않게 한다 */
html { overflow-x: hidden; }
