/*
  모든 페이지의 틀 — 헤더·내비·위치 표시·본문·카드·배지·알림·검색·바닥글 (docs/셸-설계.md 6.1)
  - 색·크기는 tokens.css 의 토큰을 var(--…) 로만 쓴다. 숫자는 0·%·fr 같은 낱말만.
  - 미디어 쿼리 폭은 tokens.css 맨 위 breakpoints 값만.
  - 조작 요소는 모두 :focus-visible 테두리(배경과 3:1 이상). 긴 낱말·숫자·주소는 줄을 바꿔 가로로 넘치지 않게.
*/

/* ── 기본 ── */

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

html {
  /* 붙박이 머리글에 가려지지 않게 — 페이지 안 # 링크로 옮겨 간 자리는 머리글 높이만큼 아래에 놓인다 */
  scroll-padding-top: var(--header-stick);
  /* 개인 설정 '화면 크기' — % 라 브라우저 기본 글자 크기(사용자 설정)에 곱해진다. 기본 100% = 지금 화면(설계 4.2) */
  font-size: var(--ui-scale);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* 스크롤 막대 자리를 늘 비워 둔다 — 검색 결과가 줄어 막대가 사라지거나 짧은 페이지로 옮길 때 본문이 옆으로 움직이지 않게
     (자리를 차지하는 막대를 쓰는 윈도 데스크톱. 화면 위에 겹쳐 그리는 휴대폰 막대에는 영향 없음) */
  scrollbar-gutter: stable;
}

body {
  display: flex;
  flex-direction: column;
  min-height: var(--page-min-height);
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-ui); /* 개인 설정 '글꼴' — 기본은 --font-sans */
  font-size: var(--font-size-md);
  line-height: var(--line-height-body);
  font-variant-numeric: tabular-nums;
  /* 한국어는 어절(띄어쓰기) 단위로 줄을 바꾸고, 그래도 안 들어가는 긴 글자(주소·숫자)는 아무 데서나 끊는다 */
  word-break: keep-all;
  overflow-wrap: anywhere;
}

[hidden] {
  display: none !important;
}

h1,
h2,
h3,
h4 {
  line-height: var(--line-height-tight);
}

a {
  /* 글 속 링크도 누르기 쉽게 위아래 여유를 준다(줄 간격은 그대로) */
  padding-block: var(--link-pad-block);
  color: var(--color-accent);
  text-decoration-line: underline;
  text-decoration-thickness: var(--underline-thickness);
  text-underline-offset: var(--underline-offset);
}

a:hover {
  text-decoration-thickness: var(--underline-thickness-hover);
}

/* 초점 표시 — 키보드로 옮겨 다닐 때 모든 조작 요소에 같은 테두리 */
:focus-visible {
  outline: var(--focus-width) solid var(--color-focus);
  outline-offset: var(--focus-offset);
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

input[type="text"],
input[type="search"],
#search-input {
  width: 100%;
  min-height: var(--tap-min);
  padding: 0 var(--space-3);
  border: var(--border-width) solid var(--color-input-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: var(--font-size-md);
  font-variant-numeric: tabular-nums;
}

code,
kbd,
pre {
  font-family: var(--font-mono);
}

pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

img,
svg {
  max-width: 100%;
}

table {
  border-collapse: collapse;
}

fieldset {
  min-width: 0;
}

/* ── 본문 바로가기 — 평소에는 화면 위로 숨고 초점을 받으면 보인다 ── */

.skip-link {
  position: absolute;
  top: var(--space-2);
  left: var(--space-2);
  z-index: var(--z-skip);
  display: inline-flex;
  align-items: center;
  min-height: var(--tap-min);
  padding: 0 var(--space-4);
  border-radius: var(--radius-md);
  background: var(--color-accent);
  color: var(--color-on-accent);
  font-weight: var(--font-weight-bold);
  text-decoration: none;
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

/* ── 머리글(2026-11-22 개편 2차 — PLAN 20.0, 작업화면-설계 6절) ──
   넓은 화면(48rem 이상)은 한 줄: 사이트 이름 · [사이트 도구 ▾] [사이트맵] [운영 문의] [광고 문의] ······ [검색] [언어] [화면 설정].
   '사이트 도구' 펼친 판은 머리글 아래 전체 폭(판의 기준 = .site-header)에 분야마다 한 칸.
   좁은 화면은 메뉴 넷이 '메뉴' 단추(details) 하나로 접히고, 펼치면 머리글 아래 세로 목록, 그 안의 '사이트 도구'는 아래로 이어서 펼쳐진다.
   작은 단추의 글자는 넓은 화면(64rem 이상)에서만 보이고, 좁은 화면은 아이콘만(이름은 낭독기가 읽는다). */

/* 머리글은 늘 맨 위에 붙어 있다(2026-11-22 사장님) — 작업 화면 페이지는 이 머리글 대신 자기 제목 막대를 쓴다.
   페이지 안 # 링크가 머리글 밑에 가려지지 않게 html 에 scroll-padding-top 을 둔다(아래). */
.site-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  display: grid;
  grid-template-rows: 1fr;
  min-height: var(--header-bar);
  border-bottom: var(--border-width) solid var(--color-header-line);
  background: var(--color-header-bg);
  backdrop-filter: var(--header-blur);
  transition: grid-template-rows var(--motion-med) var(--ease-out);
}

/* 머리글 숨기기(2026-11-22) — 숨기면 줄이 접혀 얇은 막대(--header-bar)만 남고, 막대 아래 가운데 '펼치기' 손잡이가 매달린다. 고른 상태는 화면 설정(prefs header)에 기억된다. */
:root[data-header="hidden"] {
  --header-stick: var(--header-bar);
}

:root[data-header="hidden"] .site-header {
  grid-template-rows: 0fr;
}

:root[data-header="hidden"] .site-header-inner {
  overflow: hidden;
  visibility: hidden;
}

.site-header-toggle {
  border: 0;
  background: none;
  font: inherit;
}

.site-header-toggle[hidden],
.site-header-handle[hidden] {
  display: none;
}

.site-header-toggle .site-header-chevron {
  width: var(--icon-size-sm);
  height: var(--icon-size-sm);
  rotate: 180deg;
}

.site-header-handle {
  position: absolute;
  top: 100%;
  left: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--header-handle-w);
  min-height: var(--header-handle-h);
  padding: 0 var(--space-3);
  border: var(--border-width) solid var(--color-header-line);
  border-top: 0;
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  background: var(--color-header-bg);
  color: var(--color-text);
  cursor: pointer;
  translate: -50% 0;
  visibility: hidden;
}

:root[data-header="hidden"] .site-header-handle {
  visibility: visible;
}

.site-header-handle:hover {
  background: var(--color-surface-2);
}

.site-header-handle .site-header-chevron {
  width: var(--icon-size-sm);
  height: var(--icon-size-sm);
}

.site-header-inner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 var(--space-1); /* 좁은 화면은 한 줄(이름 · 검색 · 설정 · 메뉴)이라 간격을 좁힌다 — 넓은 화면은 아래에서 넓힘 */
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.site-name {
  order: 1;
  flex: 0 1 auto;
  min-width: min-content;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--tap-min);
  padding: 0;
  color: var(--color-text);
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--tracking-tight);
  text-decoration: none;
}

/* 좁은 화면은 머리글 줄을 낮춰 도구 페이지 첫 입력 칸이 첫 화면에 보이게 한다 — 넓은 화면(48rem 이상)에서 원래 높이 */
@media (min-width: 48rem) {
  .site-header-inner {
    gap: 0 var(--space-4);
  }

  .site-name {
    min-height: var(--header-h);
  }
}

.site-name:hover .site-logo {
  box-shadow: var(--shadow-md);
}

/* 글씨 로고 — 굵게, 글자 사이를 조여서, 파랑에서 보라로 흐르는 색(토큰 --wordmark-bg). 색 번짐을 못 그리는 환경(강제 색상)에서는 보통 글자색 */
.site-wordmark-six {
  font-weight: var(--font-weight-bold);
}

.site-wordmark {
  background: var(--wordmark-bg);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold); /* Sixverb — Six 만 더 굵게(.site-wordmark-six) */
  letter-spacing: var(--tracking-tight);
  line-height: var(--line-height-tight);
  white-space: nowrap;
}

@media (min-width: 48rem) {
  .site-wordmark {
    font-size: var(--font-size-xl);
  }
}

@media (forced-colors: active) {
  .site-wordmark {
    background: none;
    color: inherit;
  }
}

.site-logo {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: var(--logo-size);
  height: var(--logo-size);
  border-radius: var(--radius-md);
  background: var(--logo-bg);
  color: var(--color-on-logo);
  box-shadow: var(--shadow-sm);
}

/* 로고 안 여섯 동사 그림(+ − × ÷ 가위 붙이기)은 칸을 거의 채우고 선을 가늘게 */
.site-logo .icon {
  width: var(--logo-glyph);
  height: var(--logo-glyph);
  stroke-width: var(--logo-stroke);
}

.site-actions {
  order: 2; /* 좁은 화면: 이름 → 검색·설정 → '메뉴' 단추(한 줄). 넓은 화면은 아래에서 주 메뉴가 먼저 */
  flex: 0 1 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  margin-left: auto;
  gap: var(--space-1);
}

/* 머리글 작은 단추(검색 · 언어 · 화면 설정(.site-prefs-link — 개인 화면 설정, 설계 5.1)) — 모두 같은 모양, 누르는 칸 44px */
.site-action,
.site-prefs-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  min-width: var(--tap-min);
  min-height: var(--tap-min);
  padding: 0 var(--space-2);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  list-style: none;
  transition: background-color var(--motion-fast) var(--ease-out);
}

.site-action::-webkit-details-marker {
  display: none;
}

.site-action:hover,
.site-prefs-link:hover,
.lang-menu[open] > .site-action {
  background: var(--color-surface-2);
}

/* 지금 페이지 — 색만이 아니라 굵은 글자와 밑줄로도 표시(설정·검색 페이지 — 빌드가 aria-current 를 단다) */
.site-action[aria-current="page"],
.site-prefs-link[aria-current="page"] {
  background: var(--color-accent-soft);
  color: var(--color-accent);
  font-weight: var(--font-weight-bold);
  text-decoration: underline;
  text-decoration-thickness: var(--border-width-strong);
}

.site-action-text {
  position: absolute;
  width: var(--hidden-size);
  height: var(--hidden-size);
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (min-width: 64rem) {
  .site-action-text {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip-path: none;
  }
}

/* 주 메뉴 — 좁은 화면: '메뉴' 단추 하나(details.site-menu). 펼치면 머리글 아래 전체 폭의 세로 목록 */
.site-nav {
  order: 3;
  flex: 0 0 auto;
  min-width: 0;
}

@media (min-width: 48rem) {
  .site-nav {
    order: 2;
  }

  .site-actions {
    order: 3;
  }
}

/* 언어 — 좁은 화면(48rem 아래)은 머리글 단추를 감추고 '메뉴' 목록 맨 아래 칸(.site-nav-lang)에서 고른다. 넓은 화면은 그 반대 */
.site-actions > .lang-menu {
  display: none;
}

@media (min-width: 48rem) {
  .site-actions > .lang-menu {
    display: block;
  }

  .site-nav-lang {
    display: none;
  }
}

.site-nav-lang {
  margin-top: var(--space-1);
  padding-top: var(--space-2);
  border-top: var(--border-width) solid var(--color-header-line);
}

.site-nav-lang-title {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  padding: 0 var(--space-3);
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
}

.site-nav-lang-title svg {
  width: var(--icon-size-sm);
  height: var(--icon-size-sm);
}

.site-nav-lang-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-menu-trigger {
  color: var(--color-text);
}

.site-menu[open] > .site-menu-trigger {
  background: var(--color-surface-2);
}

.site-menu > .site-nav-list {
  position: absolute;
  top: 100%;
  right: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  max-height: var(--nav-panel-max-h);
  margin: 0;
  padding: var(--space-3) var(--gutter);
  overflow-y: auto;
  border-bottom: var(--border-width) solid var(--color-header-line);
  background: var(--color-surface);
  box-shadow: var(--shadow-lg);
  list-style: none;
  animation: nav-in var(--motion-med) var(--ease-out);
}

.nav-trigger,
.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  min-height: var(--tap-min);
  padding: 0 var(--space-3);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  list-style: none;
  user-select: none;
  transition:
    background-color var(--motion-fast) var(--ease-out),
    color var(--motion-fast) var(--ease-out);
}

.nav-trigger::-webkit-details-marker {
  display: none;
}

.nav-trigger:hover,
.nav-link:hover {
  background: var(--color-surface-2);
}

.nav-menu[open] > .nav-trigger {
  background: var(--color-accent-soft);
  color: var(--color-accent);
}

/* 지금 페이지 — 색만이 아니라 굵은 글자와 밑줄로도 표시 */
.nav-link[aria-current="page"] {
  background: var(--color-accent-soft);
  color: var(--color-accent);
  font-weight: var(--font-weight-bold);
  text-decoration: underline;
  text-decoration-thickness: var(--border-width-strong);
}

.nav-chevron {
  width: var(--icon-size-sm);
  height: var(--icon-size-sm);
  transition: scale var(--motion-fast) var(--ease-out);
}

.nav-menu[open] .nav-chevron {
  scale: 1 -1;
}

/* 넓은 화면 — '메뉴' 단추를 감추고 메뉴 넷을 한 줄로 편다(details 가 닫혀 있어도 속이 보이게 하는 ::details-content 를 아는 브라우저만; 모르면 좁은 화면 모양 그대로) */
@media (min-width: 48rem) {
  @supports selector(::details-content) {
    .site-nav {
      flex: 1 1 auto;
    }

    .site-menu > summary {
      display: none;
    }

    .site-menu::details-content {
      content-visibility: visible;
    }

    .site-menu > .site-nav-list {
      position: static;
      flex-direction: row;
      flex-wrap: wrap;
      max-height: none;
      padding: 0;
      overflow: visible;
      border: 0;
      background: none;
      box-shadow: none;
      animation: none;
    }
  }
}

/* 펼친 판 — 좁은 화면: '메뉴' 목록 안에서 아래로 이어서 펼친다 */
.nav-panel {
  margin-top: var(--space-1);
  padding-left: var(--space-3);
}

.nav-panel-inner {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.nav-cats {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-cat,
.nav-group {
  min-width: 0;
}

.nav-cat-head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--tap-min);
  color: var(--color-text);
  font-weight: var(--font-weight-bold);
  text-decoration: none;
}

.nav-cat-head:hover > span:last-child,
.nav-cat-head[aria-current="page"] > span:last-child {
  text-decoration: underline;
}

.nav-group-title {
  margin: var(--space-2) 0 var(--space-1);
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
}

.nav-tools {
  display: grid;
  gap: var(--space-1);
  margin: 0;
  padding: 0;
  list-style: none;
}

.nav-tools a {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: var(--tap-min);
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-md);
  color: var(--color-text);
  font-weight: var(--font-weight-bold);
  text-decoration: none;
}

.nav-tools a:hover {
  background: var(--color-surface-2);
}

.nav-tools a:hover .nav-tool-name,
.nav-tools a[aria-current="page"] .nav-tool-name {
  text-decoration: underline;
}

/* 도구 이름(브랜드)은 굵게, 설명 이름은 그 아래 작고 흐리게 */
.nav-tool-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.nav-tool-name {
  font-weight: var(--font-weight-bold);
}

.nav-tool-sub {
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-normal);
}

.nav-panel-foot {
  display: flex;
  justify-content: flex-end;
  margin: 0;
  font-size: var(--font-size-sm);
}

.nav-panel-foot a {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  min-height: var(--tap-min);
  color: var(--color-text);
  font-weight: var(--font-weight-bold);
  text-decoration: none;
}

.nav-panel-foot a:hover {
  text-decoration: underline;
}

@media (min-width: 48rem) {
  @supports selector(::details-content) {
    /* 펼친 판 — 머리글 아래 전체 폭(기준 = .site-header), 안쪽은 본문과 같은 최대폭 */
    .nav-panel {
      position: absolute;
      top: 100%;
      right: 0;
      left: 0;
      max-height: var(--nav-panel-max-h);
      margin: 0;
      padding: 0;
      overflow-y: auto;
      border-bottom: var(--border-width) solid var(--color-header-line);
      background: var(--color-surface);
      box-shadow: var(--shadow-lg);
      animation: nav-in var(--motion-med) var(--ease-out);
    }

    .nav-panel-inner {
      max-width: var(--content-max);
      margin: 0 auto;
      padding: var(--space-5) var(--gutter);
    }

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

@media (min-width: 64rem) {
  @supports selector(::details-content) {
    .nav-cats {
      grid-template-columns: repeat(4, minmax(0, 1fr));
    }
  }
}

/* 언어 판 — 언어 단추 바로 아래(top 을 정하지 않으면 단추 바로 다음 자리), 오른쪽 끝은 본문 오른쪽 끝(기준 = .site-header 전체 폭).
   아주 크게 키운 화면(브라우저 글자 24px × 화면 125%)에서도 화면 폭 안에 들어오게 폭을 제한한다. */
.lang-panel {
  position: absolute;
  right: max(var(--gutter), calc((100% - var(--content-max)) / 2 + var(--gutter)));
  min-width: min(var(--lang-panel-w), calc(100% - var(--gutter) * 2));
  max-width: calc(100% - var(--gutter) * 2);
  padding: var(--space-2);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-lg);
  animation: nav-in var(--motion-med) var(--ease-out);
}

.lang-panel ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.lang-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: var(--tap-min);
  padding: 0 var(--space-3);
  border-radius: var(--radius-md);
}

.lang-item[aria-current] {
  background: var(--color-accent-soft);
  color: var(--color-accent);
  font-weight: var(--font-weight-bold);
}

.is-soon {
  color: var(--color-text-muted);
}

@keyframes nav-in {
  from {
    opacity: 0;
    transform: translateY(calc(var(--space-2) * -1));
  }
}

/* 사이트맵 페이지 — 링크 목록(짧은 이름도 누르는 칸 24px 이상) */
.sitemap-list a {
  display: inline-flex;
  align-items: center;
  min-width: var(--tap-min);
  min-height: var(--tap-min);
}

/* ── 본문 ── */

.page {
  flex: 1 0 auto;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--space-3) var(--gutter) var(--space-7);
}

@media (min-width: 48rem) {
  .page {
    padding-top: var(--space-4);
  }
}

/* 본문 바로가기로 옮겨 온 초점(tabindex=-1)은 둘레 테두리를 그리지 않는다 — 누르는 요소가 아님(마우스로 본문을 눌러도 테두리 없음).
   키보드로 왔을 때(:focus-visible)만 본문 맨 위에 초점 색 선을 그어 초점이 본문으로 옮겨 왔음을 보인다(4단계 검토 — 예전에는 표시가 없었다). */
.page:focus {
  outline: none;
}

.page:focus-visible {
  box-shadow: inset 0 var(--focus-width) 0 0 var(--color-focus);
}

.breadcrumb {
  margin: 0 0 var(--space-2);
  font-size: var(--font-size-sm);
}

.breadcrumb-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0 var(--space-1);
  margin: 0;
  padding: 0;
  color: var(--color-text-muted);
  list-style: none;
}

.breadcrumb-list li {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
}

.breadcrumb-list li + li::before {
  content: "›";
  content: "›" / "";
}

.breadcrumb-list a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: var(--target-min);
  min-height: var(--target-min);
  padding: 0;
}

.breadcrumb-list [aria-current="page"] {
  color: var(--color-text);
}

.page-title {
  margin: 0 0 var(--space-2);
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
}

.page-lead {
  max-width: var(--measure);
  margin: 0 0 var(--space-5);
  color: var(--color-text-muted);
  font-size: var(--font-size-lg);
  line-height: var(--line-height-snug);
}

.section {
  margin: var(--space-6) 0 0;
}

.section-title {
  margin: 0 0 var(--space-3);
  font-size: var(--font-size-xl);
}

/* 긴 글 — 홈 소개 줄·소개 페이지(PLAN 3.1·3.5)의 문단·목록·알림 상자·운영자 자리표시 상자.
   넓은 화면에서 한 줄이 너무 길어지지 않게 page-lead 와 같은 폭까지만. page-lead 가 있는 페이지에만 걸린다
   (도구·검색·이용약관·개인정보 페이지는 그대로이고, 분야 페이지의 개수 한 줄은 이 폭보다 짧아 달라지지 않는다).
   page-lead 뒤 본문의 알림 상자도 같은 폭 — 넓은 화면에서 상자만 오른쪽 끝까지 길게 뻗지 않게(그런 상자를 쓰던 요금제 페이지는
   2026-11-17 유료 요금제 철회로 지웠다 — M2. 규칙은 다음에 그런 상자를 둘 때를 위해 남긴다). */
.page-lead ~ p,
.page-lead ~ .notice,
.page-lead ~ .section > p,
.page-lead ~ .section > ul:not(.card-list),
.page-lead ~ .section > .placeholder {
  max-width: var(--measure);
}

/* ── 카드 — 제목 링크가 카드 전체를 덮어 어디를 눌러도 된다 ── */

.card-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--card-min)), 1fr));
  gap: var(--space-3);
  margin: 0;
  padding: 0;
  list-style: none;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  min-width: 0;
  padding: var(--space-5);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: var(--shadow-sm);
  transition:
    transform var(--motion-fast) var(--ease-out),
    box-shadow var(--motion-fast) var(--ease-out),
    border-color var(--motion-fast) var(--ease-out);
}

/* 링크가 있는 카드 — 살짝 떠오르고 테두리가 분야 색으로(분야를 모르면 입력 칸 테두리 색) */
.card:has(a[href]):hover {
  border-color: var(--cat, var(--color-input-border));
  box-shadow: var(--shadow-md);
  transform: translateY(var(--lift));
}

.card > .icon-tile {
  margin: 0 0 var(--space-2);
}

/* 준비 중 카드 — 아이콘 칸을 흐리게(글자는 그대로 — 대비 유지) */
.card:has(.badge-planned) > .icon-tile {
  opacity: var(--o-dim);
}

.card-title {
  margin: 0;
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-bold);
}

/* 카드 제목 — 카드 전체가 누르는 자리라 글자색, 밑줄은 카드에 올렸을 때·초점일 때만 */
/* 카드의 설명 이름 — 제목(브랜드) 아래 한 줄, 작고 흐리게 */
.card-sub {
  display: block;
  margin-top: var(--space-1);
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
}

/* 전체 도구(/c/) — 분야 구획마다 아이콘 + 분야 이름, 갈래 작은 제목, 도구 카드 */
.all-cat {
  margin-top: var(--space-6);
}

.all-cat-title {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.all-cat-title a {
  color: var(--color-text);
  text-decoration-line: none;
}

.all-cat-title a:hover {
  text-decoration-line: underline;
}

.all-cat-summary {
  margin: 0 0 var(--space-3);
  color: var(--color-text-muted);
}

/* 갈래는 가로로 나란히(한 갈래 = 한 칸), 그 칸 안에서 도구 카드는 세로로 쌓는다 */
.all-groups {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--card-min)), 1fr));
  gap: var(--space-4) var(--space-3);
  align-items: start;
}

.all-group {
  min-width: 0;
}

.all-group .card-list {
  grid-template-columns: minmax(0, 1fr);
}

.all-group-title {
  margin: 0 0 var(--space-2);
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
}

.card-title a {
  color: var(--color-text);
  text-decoration-line: none;
}

.card:hover .card-title a,
.card-title a:focus-visible {
  text-decoration-line: underline;
}

.card-title a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-1) var(--space-2);
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}

.card-summary {
  margin: 0;
  font-size: var(--font-size-sm);
}

/* ── 배지 ── */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 0 var(--space-2);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface-2);
  color: var(--color-text);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-badge);
  white-space: nowrap;
  vertical-align: middle;
}

/* (Pro 배지 .badge-pro 는 2026-11-17 유료 요금제 철회로 지웠다 — M1. 지금 배지는 '준비 중' 하나) */

/* 준비 중 — 흐린 글자 + 점선 테두리(색만으로 구분하지 않음) */
.badge-planned {
  border-style: dashed;
  border-color: var(--color-input-border);
  color: var(--color-text-muted);
}

/* ── 알림 ── */

.notice {
  margin: var(--space-4) 0;
  padding: var(--space-3) var(--space-4);
  border: var(--border-width) solid var(--color-border);
  border-left-width: var(--bar-width);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.notice > :first-child {
  margin-top: 0;
}

.notice > :last-child {
  margin-bottom: 0;
}

.notice-info {
  border-color: var(--color-accent);
  background: var(--color-accent-soft);
}

.notice-warn {
  border-color: var(--color-warn-text);
  background: var(--color-warn-bg);
}

/* 법적 문구 자리표시 — 아직 쓰지 않은 칸임이 한눈에 보이게 */
.placeholder {
  margin: var(--space-4) 0;
  padding: var(--space-5) var(--space-4);
  border: var(--border-width-strong) dashed var(--color-input-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  color: var(--color-text-muted);
}

.placeholder > :first-child {
  margin-top: 0;
}

.placeholder > :last-child {
  margin-bottom: 0;
}

/* (요금표 .plan-table 은 2026-11-17 유료 요금제 철회로 요금제 페이지와 함께 지웠다 — M2) */

/* ── 검색(/search/ — 3단계 PLAN 3.4) — 제목 아래 검색 칸(.search-box > label + #search-input), 상태줄 #search-status, 결과 #search-results(카드 목록).
   입력 칸 모양은 위 '기본'의 #search-input 규칙. 동작은 /shell/search-page.js. ── */

.search-box {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  max-width: var(--measure);
  margin: 0 0 var(--space-4);
}

.search-box label {
  font-weight: var(--font-weight-bold);
}

#search-status {
  margin: 0 0 var(--space-3);
  color: var(--color-text-muted);
}

/* ── 바닥글 ── */

.site-footer {
  padding: var(--space-5) var(--gutter) var(--space-6);
  border-top: var(--border-width) solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}

/* 헤더(.site-header-inner)·본문(.page)과 같은 왼쪽 끝 — 그쪽은 최대폭 안에 좌우 여백이 들어 있어, 여기서는 여백만큼 뺀다 */
.site-footer > * {
  max-width: calc(var(--content-max) - var(--gutter) * 2);
  margin-right: auto;
  margin-left: auto;
}

.site-footer-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-5);
}

@media (min-width: 48rem) {
  .site-footer-inner {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr);
  }
}

.site-footer-brand p {
  max-width: var(--measure);
  margin: var(--space-2) 0 0;
}

.site-footer-title {
  margin: 0 0 var(--space-2);
  color: var(--color-text);
  font-weight: var(--font-weight-bold);
}

.site-footer-nav ul {
  flex-direction: column;
}

.site-footer-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-1) var(--space-4);
  margin-top: 0;
  margin-bottom: 0;
  padding: 0;
  list-style: none;
}

.site-footer-nav a {
  display: inline-flex;
  align-items: center;
  min-height: var(--target-min);
  padding: 0;
}

.site-footer-note {
  margin-top: var(--space-3);
  margin-bottom: 0;
}

/* ── 선 아이콘과 분야 색 칸(2026-11-22 — 직접 그린 아이콘, site/shell/icons.js) ──
   아이콘은 글자색(currentColor)으로 그리고, 칸(.icon-tile)은 data-cat 의 분야 색(선)과 옅은 면을 쓴다. 분야를 모르면 사이트 강조색. */

.icon {
  flex: none;
  width: var(--icon-size);
  height: var(--icon-size);
  fill: none;
  stroke: currentColor;
  stroke-width: var(--icon-stroke);
  stroke-linecap: round;
  stroke-linejoin: round;
}

[data-cat] {
  --cat: var(--color-accent);
  --cat-soft: var(--color-accent-soft);
}

[data-cat="science"] {
  --cat: var(--color-cat-science);
  --cat-soft: var(--color-cat-science-soft);
}

[data-cat="info"] {
  --cat: var(--color-cat-info);
  --cat-soft: var(--color-cat-info-soft);
}

[data-cat="work"] {
  --cat: var(--color-cat-work);
  --cat-soft: var(--color-cat-work-soft);
}

[data-cat="media"] {
  --cat: var(--color-cat-media);
  --cat-soft: var(--color-cat-media-soft);
}

[data-cat="files"] {
  --cat: var(--color-cat-files);
  --cat-soft: var(--color-cat-files-soft);
}

[data-cat="automation"] {
  --cat: var(--color-cat-automation);
  --cat-soft: var(--color-cat-automation-soft);
}

[data-cat="make"] {
  --cat: var(--color-cat-make);
  --cat-soft: var(--color-cat-make-soft);
}

.icon-tile {
  display: inline-grid;
  flex: none;
  place-items: center;
  width: var(--icon-tile);
  height: var(--icon-tile);
  border-radius: var(--radius-lg);
  background: var(--cat-soft);
  color: var(--cat);
}

.icon-tile .icon {
  width: var(--icon-size-lg);
  height: var(--icon-size-lg);
}

.icon-tile-sm {
  width: var(--icon-tile-sm);
  height: var(--icon-tile-sm);
  border-radius: var(--radius-md);
}

.icon-tile-sm .icon {
  width: var(--icon-size);
  height: var(--icon-size);
}

/* 큰 칸(도구 페이지 머리) — 좁은 화면은 보통 칸 크기(제목 옆에 나란히), 48rem 이상에서 키운다 */
@media (min-width: 48rem) {
  .icon-tile-lg {
    width: var(--icon-tile-lg);
    height: var(--icon-tile-lg);
    border-radius: var(--radius-xl);
  }

  .icon-tile-lg .icon {
    width: var(--icon-size-xl);
    height: var(--icon-size-xl);
  }
}

/* ── 단추(홈) ── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--btn-h);
  padding: 0 var(--space-5);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-pill);
  font-weight: var(--font-weight-bold);
  text-decoration: none;
  transition:
    transform var(--motion-fast) var(--ease-out),
    box-shadow var(--motion-fast) var(--ease-out),
    background-color var(--motion-fast) var(--ease-out);
}

.btn:hover {
  transform: translateY(var(--lift));
  box-shadow: var(--shadow-md);
}

.btn-primary {
  border-color: var(--color-accent);
  background: var(--color-accent);
  color: var(--color-on-accent);
  box-shadow: var(--shadow-md);
}

.btn-primary:hover {
  box-shadow: var(--shadow-lg);
}

.btn-ghost {
  background: var(--color-surface);
  color: var(--color-text);
}

/* ── 홈(2026-11-22 — 포토피아 첫 화면 벤치마킹) — 본문(.page-home)은 폭 제한 없이 띠를 펼치고, 띠 안 .wrap 이 최대폭을 지킨다 ── */

.page-home {
  max-width: none;
  padding: 0 0 var(--space-7);
}

.wrap {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

.hero {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding: var(--hero-pad-top) 0 var(--hero-pad-bottom);
  background: var(--color-hero-bg);
  color: var(--color-hero-text);
}

.hero-inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: var(--space-7);
}

@media (min-width: 64rem) {
  .hero-inner {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}

.hero-copy {
  min-width: 0;
}

/* 처음 열 때 글이 차례로 살짝 떠오른다 */
.hero-copy > * {
  animation: rise var(--motion-reveal) var(--ease-out) both;
}

.hero-copy > :nth-child(2) {
  animation-delay: var(--delay-1);
}

.hero-copy > :nth-child(3) {
  animation-delay: var(--delay-2);
}

.hero-copy > :nth-child(4) {
  animation-delay: var(--delay-3);
}

.hero-copy > :nth-child(5) {
  animation-delay: var(--delay-4);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(var(--reveal-shift));
  }
}

.hero-kicker {
  display: inline-flex;
  margin: 0 0 var(--space-4);
  padding: var(--space-1) var(--space-3);
  border: var(--border-width) solid var(--color-hero-chip-line);
  border-radius: var(--radius-pill);
  background: var(--color-hero-chip);
  color: var(--color-hero-muted);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
}

.hero-title {
  margin: 0 0 var(--space-4);
  color: var(--color-hero-text);
  font-size: var(--font-size-hero);
  font-weight: var(--font-weight-bold);
  line-height: var(--line-height-hero);
  letter-spacing: var(--tracking-tight);
  text-wrap: balance;
}

.hero-lead {
  max-width: var(--hero-copy-max);
  margin: 0 0 var(--space-5);
  color: var(--color-hero-muted);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin: 0 0 var(--space-5);
}

.hero-points {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-5);
  margin: 0;
  padding: 0;
  color: var(--color-hero-muted);
  font-size: var(--font-size-sm);
  list-style: none;
}

.hero-points li {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.hero-points .icon {
  color: var(--color-accent);
}

/* 첫 화면 오른쪽 — 빈 타일에서 여섯 동사가 하나씩 나타난다(무에서 유). 칸은 처음부터 자리를 차지해 글이 밀리지 않는다 */
.hero-art {
  justify-self: center;
  width: 100%;
  max-width: var(--hero-verbs-max);
}

.hero-verbs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
  padding: var(--space-4);
  border: var(--border-width) solid var(--color-hero-chip-line);
  border-radius: var(--radius-xl);
  background: var(--color-hero-chip);
  box-shadow: var(--shadow-lg);
}

.verb {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  aspect-ratio: 1;
  border: var(--border-width) solid var(--color-hero-chip-line);
  border-radius: var(--radius-lg);
  background: var(--color-hero-bg);
  color: var(--color-hero-text);
  animation: verb-in var(--motion-verb) var(--ease-out) both;
}

.verb:nth-child(1) {
  animation-delay: var(--delay-v1);
}

.verb:nth-child(2) {
  animation-delay: var(--delay-v2);
}

.verb:nth-child(3) {
  animation-delay: var(--delay-v3);
}

.verb:nth-child(4) {
  animation-delay: var(--delay-v4);
}

.verb:nth-child(5) {
  animation-delay: var(--delay-v5);
}

.verb:nth-child(6) {
  animation-delay: var(--delay-v6);
}

.verb-icon {
  width: var(--icon-size-xl);
  height: var(--icon-size-xl);
}

.verb-name {
  color: var(--color-hero-muted);
  font-size: var(--font-size-sm);
}

@keyframes verb-in {
  from {
    opacity: 0;
    transform: scale(0.8);
  }
}

/* ── 도구 배너(홈 — Sonar·Next 소개 배너식): 왼쪽 이름·한 줄 소개·열기, 오른쪽 큰 실제 화면 ── */
.banner-list {
  display: grid;
  gap: var(--space-5);
  margin: 0 0 var(--space-7);
  padding: 0;
  list-style: none;
}

.banner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-5);
  align-items: center;
  padding: var(--space-5);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-xl);
  background: var(--color-surface);
  box-shadow: var(--shadow-md);
}

@media (min-width: 64rem) {
  .banner {
    grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
    padding: var(--space-6);
  }

  .banner:nth-child(even) .banner-body {
    order: 2;
  }
}

.banner-body {
  min-width: 0;
}

.banner-kind {
  margin: 0 0 var(--space-2);
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}

.banner-brand {
  margin: 0;
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  letter-spacing: var(--tracking-tight);
  line-height: var(--line-height-tight);
}

.banner-sub {
  margin: var(--space-1) 0 0;
  color: var(--color-text-muted);
}

.banner-tagline {
  margin: var(--space-3) 0 var(--space-4);
  font-size: var(--font-size-lg);
}

.banner-actions {
  margin: 0;
}

/* 열기 단추가 배너 전체를 덮는다 — 사진을 눌러도 열린다 */
.banner-open::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: var(--radius-xl);
}

.banner-shot {
  min-width: 0;
  overflow: hidden;
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface-2);
  box-shadow: var(--shadow-lg);
}

.banner-img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: var(--thumb-aspect);
}

.more-title {
  margin-top: var(--space-6);
}

/* ── 템플릿 화면(포토피아식 — 전체 도구·분야 페이지·홈의 그 밖의 도구): 왼쪽 분류 · 위 탭과 검색 · 카드 격자 ── */
.page-tpl {
  max-width: var(--tpl-max);
}

.tpl {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--space-4);
}

@media (min-width: 48rem) {
  .tpl {
    grid-template-columns: var(--tpl-side-w) minmax(0, 1fr);
    gap: var(--space-6);
    align-items: start;
  }

  .tpl-side {
    position: sticky;
    top: calc(var(--header-stick) + var(--space-4));
  }
}

.tpl-side {
  min-width: 0;
}

.tpl-cat-item {
  min-width: 0;
}

.tpl-row {
  margin-top: var(--space-4);
}

.tpl-cats,
.tpl-groups {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* 좁은 화면 — 분야가 가로로 나란히(갈래는 숨김) */
.tpl-cats {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.tpl-groups {
  display: none;
}

@media (min-width: 48rem) {
  .tpl-cats {
    display: block;
    padding: var(--space-3);
    border: var(--border-width) solid var(--color-border);
    border-radius: var(--radius-lg);
    background: var(--color-surface);
  }

  .tpl-groups {
    display: block;
    margin: 0 0 var(--space-2) var(--space-4);
  }
}

.tpl-cat,
.tpl-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: var(--target-min);
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-md);
  color: var(--color-text);
  text-decoration: none;
}

.tpl-cat {
  min-height: var(--tap-min);
  border: var(--border-width) solid var(--color-border);
  font-weight: var(--font-weight-bold);
}

.tpl-group {
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}

@media (min-width: 48rem) {
  .tpl-cat {
    min-height: var(--target-min);
    border-color: transparent;
  }
}

.tpl-cat:hover,
.tpl-group:hover {
  background: var(--color-surface-2);
  color: var(--color-text);
}

.tpl-cat[aria-current="page"],
.tpl-group[aria-current="true"] {
  border-color: var(--color-accent);
  background: var(--color-surface-2);
  color: var(--color-text);
  font-weight: var(--font-weight-bold);
}

.tpl-cat-name {
  min-width: 0;
  overflow-wrap: anywhere;
}

.tpl-lead {
  margin-bottom: 0;
}

.tpl-count {
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  font-variant-numeric: tabular-nums;
}

.tpl-main {
  min-width: 0;
}

.tpl-main > .page-title {
  margin-top: 0;
}

.tpl-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin: var(--space-4) 0 var(--space-2);
  border-bottom: var(--border-width) solid var(--color-border);
}

.tpl-tabs {
  display: flex;
  gap: var(--space-4);
}

.tpl-tabs[hidden],
.tpl-searchbox[hidden] {
  display: none;
}

/* 탭 — 고른 탭은 밑줄 */
.tpl-tab {
  min-height: var(--tap-min);
  margin-bottom: calc(var(--border-width-strong) * -1);
  padding: 0 var(--space-1);
  border: 0;
  border-bottom: var(--border-width-strong) solid transparent;
  background: none;
  color: var(--color-text-muted);
  font: inherit;
  font-weight: var(--font-weight-bold);
  cursor: pointer;
}

.tpl-tab:hover {
  color: var(--color-text);
}

.tpl-tab[aria-pressed="true"] {
  border-bottom-color: var(--color-accent);
  color: var(--color-text);
  font-weight: var(--font-weight-bold);
}

.tpl-searchbox {
  flex: 1 1 var(--tpl-search-min);
  max-width: var(--tpl-search-max);
  margin-bottom: var(--space-2);
}

.tpl-search {
  box-sizing: border-box;
  width: 100%;
  min-height: var(--tap-min);
  padding: 0 var(--space-3);
  border: var(--border-width) solid var(--color-input-border);
  border-radius: var(--radius-md);
  background: var(--color-bg);
  color: var(--color-text);
  font: inherit;
}

.tpl-search::placeholder {
  color: var(--color-text-muted);
  opacity: 1;
}

.tpl-status {
  margin: 0 0 var(--space-3);
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}

.tpl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--tpl-card-min)), 1fr));
  gap: var(--space-4);
  margin: 0 0 var(--space-5);
  padding: 0;
  list-style: none;
}

.tpl-card {
  position: relative;
  min-width: 0;
}

.tpl-card[hidden] {
  display: none;
}

.tpl-thumb {
  display: block;
  overflow: hidden;
  margin-bottom: var(--space-2);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface-2);
  transition: border-color var(--motion-fast) var(--ease-out);
}

.tpl-card:hover .tpl-thumb {
  border-color: var(--color-accent);
}

.tpl-img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: var(--thumb-aspect);
}

.tpl-name {
  margin: 0;
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-bold);
}

/* 이름 링크가 카드 전체를 덮는다 */
.tpl-name a {
  color: var(--color-text);
  text-decoration: none;
}

.tpl-name a::after {
  content: "";
  position: absolute;
  inset: 0;
}

.tpl-name a:hover {
  text-decoration: underline;
}

.tpl-sub,
.tpl-meta {
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}

.tpl-meta {
  margin-top: var(--space-1);
}

/* 홈의 띠(도구·쓰는 법·분야) */
.page-home > .band {
  margin: 0;
  padding: var(--space-7) 0 0;
}

.page-home .section-title {
  font-size: var(--font-size-2xl);
  letter-spacing: var(--tracking-tight);
}

.section-lead {
  margin: 0 0 var(--space-4);
  color: var(--color-text-muted);
}

.section-foot {
  margin: var(--space-5) 0 0;
  color: var(--color-text-muted);
}

/* 내려 보면 나타나기(site-ui.js 가 화면 밖 띠에만 is-waiting 을 붙였다가 뗀다 — 움직임 줄이기면 붙이지 않음) */
.reveal {
  transition:
    opacity var(--motion-reveal) var(--ease-out),
    transform var(--motion-reveal) var(--ease-out);
}

.reveal.is-waiting {
  opacity: 0;
  transform: translateY(var(--reveal-shift));
}

/* 분야 거르기 칩(자바스크립트가 켤 때만 보임) */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0 0 var(--space-5);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--tap-min);
  padding: 0 var(--space-4);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-pill);
  background: var(--color-surface);
  color: var(--color-text);
  font-weight: var(--font-weight-bold);
  cursor: pointer;
  transition:
    background-color var(--motion-fast) var(--ease-out),
    border-color var(--motion-fast) var(--ease-out);
}

.chip:hover {
  border-color: var(--color-input-border);
}

.chip[aria-pressed="true"] {
  border-color: var(--color-text);
  background: var(--color-text);
  color: var(--color-bg);
}

.chip-count {
  display: inline-grid;
  place-items: center;
  min-width: var(--chip-count-w);
  padding: 0 var(--space-1);
  border-radius: var(--radius-pill);
  background: var(--color-surface-2);
  color: var(--color-text);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
}

.chip[aria-pressed="true"] .chip-count {
  background: var(--color-bg);
  color: var(--color-text);
}

/* 이렇게 씁니다 — 세 단계 */
.steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--step-min)), 1fr));
  gap: var(--space-4);
  margin: 0;
  padding: 0;
  list-style: none;
}

.step {
  position: relative;
  padding: var(--space-5);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.step-num {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  display: grid;
  place-items: center;
  width: var(--step-num);
  height: var(--step-num);
  border-radius: 50%;
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
}

.step-icon {
  width: var(--icon-tile);
  height: var(--icon-tile);
  padding: var(--space-2);
  border-radius: var(--radius-lg);
  background: var(--color-accent-soft);
  color: var(--color-accent);
}

.step h3 {
  margin: var(--space-3) 0 var(--space-1);
  font-size: var(--font-size-lg);
}

.step p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
}

/* ── 도구 페이지 머리·틀·배치(2026-11-22 — 표준 · 넓게 · 작업 집중) ──
   배치는 <html data-layout>(화면 설정 '도구 화면 배치' — prefs.js). 64rem 아래 좁은 화면은 모두 '표준'과 같다.
   광고 자리는 공개 주소에서 늘 숨김. <html data-ads>(지금은 이 PC 미리보기의 'preview' 뿐 — site-ui.js)일 때만 자리가 생긴다:
   표준 = 도구 아래 가로 줄 · 넓게 = 오른쪽 세로 줄(300px, 위에 붙음) · 작업 집중 = 오른쪽 좁은 세로 줄(160px) + 도구 설명 접음. */

.tool-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: var(--space-3) var(--space-4);
  margin: 0 0 var(--space-2);
}

@media (min-width: 48rem) {
  .tool-head {
    margin-bottom: var(--space-4);
  }
}

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

/* 좁은 화면(48rem 아래)은 아이콘 칸을 빼고 글이 전체 폭을 쓴다 — 큰 기능 문장이 두 줄로 끝나 첫 입력 칸이 첫 화면에 보이게(e2e 좁은 휴대폰 첫 화면) */
.tool-head > .icon-tile {
  display: none;
}

@media (min-width: 48rem) {
  .tool-head > .icon-tile {
    display: inline-grid;
  }
}

.tool-sub {
  display: block;
  margin-top: var(--space-1);
  color: var(--color-text-muted);
  font-size: var(--font-size-md);
  font-weight: var(--font-weight-bold);
  letter-spacing: normal;
}

.tool-head .page-title {
  margin-bottom: var(--space-1);
  font-size: var(--font-size-xl);
  letter-spacing: var(--tracking-tight);
}

@media (min-width: 48rem) {
  .tool-head .page-title {
    margin-bottom: var(--space-2);
    font-size: var(--font-size-2xl);
  }
}

.layout-switch {
  display: none;
  gap: var(--space-1);
  padding: var(--space-1);
  border: var(--border-width) solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

@media (min-width: 64rem) {
  .layout-switch {
    display: inline-flex;
  }
}

.layout-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: var(--tap-min);
  padding: 0 var(--space-3);
  border: 0;
  border-radius: var(--radius-md);
  background: none;
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-bold);
  cursor: pointer;
}

.layout-btn:hover {
  background: var(--color-surface-2);
  color: var(--color-text);
}

.layout-btn[aria-pressed="true"] {
  background: var(--color-accent-soft);
  color: var(--color-accent);
  font-weight: var(--font-weight-bold);
}

.tool-frame {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: var(--space-5);
}

.tool-frame-body {
  min-width: 0;
}

.ad-slot {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
  min-height: var(--ad-below-min);
  padding: var(--space-3);
  border: var(--border-width-strong) dashed var(--color-input-border);
  border-radius: var(--radius-md);
  background: var(--color-surface-2);
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  text-align: center;
}

.ad-slot-label {
  font-weight: var(--font-weight-bold);
}

.ad-slot-note {
  font-size: var(--font-size-xs);
}

.ad-below {
  margin: var(--space-5) 0 0;
}

:root[data-ads] .ad-below {
  display: flex;
}

@media (min-width: 64rem) {
  :root[data-ads][data-layout="wide"] .tool-frame {
    grid-template-columns: minmax(0, 1fr) var(--ad-rail);
  }

  :root[data-ads][data-layout="focus"] .tool-frame {
    grid-template-columns: minmax(0, 1fr) var(--ad-rail-narrow);
  }

  :root[data-ads][data-layout="wide"] .ad-below,
  :root[data-ads][data-layout="focus"] .ad-below {
    display: none;
  }

  :root[data-ads][data-layout="wide"] .ad-rail,
  :root[data-ads][data-layout="focus"] .ad-rail {
    position: sticky;
    top: var(--space-4);
    display: flex;
    min-height: var(--ad-rail-min);
  }

  :root[data-layout="focus"] .tool-frame-about {
    display: none;
  }
}

/* ── 움직임 줄이기 — 기기 설정(prefers-reduced-motion)·화면 설정 '줄이기'. 그림은 마지막 모습(곡선 다 그림·공 내려앉음)으로 멈춘다.
   선택자는 하나씩 적는다(시험이 움직임 선언마다 두 끄는 규칙을 선택자 글자 그대로 찾는다 — tests/site/tokens.test.js 움직임) ── */
@media (prefers-reduced-motion: reduce) {
  :root:not([data-motion="allow"]) .nav-panel,
  :root:not([data-motion="allow"]) .site-menu > .site-nav-list,
  :root:not([data-motion="allow"]) .lang-panel,
  :root:not([data-motion="allow"]) .hero-copy > *,
  :root:not([data-motion="allow"]) .verb {
    animation: none;
  }

  :root:not([data-motion="allow"]) .site-action,
  :root:not([data-motion="allow"]) .site-prefs-link,
  :root:not([data-motion="allow"]) .site-header,
  :root:not([data-motion="allow"]) .nav-trigger,
  :root:not([data-motion="allow"]) .nav-link,
  :root:not([data-motion="allow"]) .nav-chevron,
  :root:not([data-motion="allow"]) .card,
  :root:not([data-motion="allow"]) .tpl-thumb,
  :root:not([data-motion="allow"]) .btn,
  :root:not([data-motion="allow"]) .reveal,
  :root:not([data-motion="allow"]) .chip {
    transition: none;
  }
}

:root[data-motion="reduce"] .nav-panel,
:root[data-motion="reduce"] .site-menu > .site-nav-list,
:root[data-motion="reduce"] .lang-panel,
:root[data-motion="reduce"] .hero-copy > *,
:root[data-motion="reduce"] .verb {
  animation: none;
}

:root[data-motion="reduce"] .site-action,
:root[data-motion="reduce"] .site-prefs-link,
:root[data-motion="reduce"] .site-header,
:root[data-motion="reduce"] .nav-trigger,
:root[data-motion="reduce"] .nav-link,
:root[data-motion="reduce"] .nav-chevron,
:root[data-motion="reduce"] .card,
:root[data-motion="reduce"] .tpl-thumb,
:root[data-motion="reduce"] .btn,
:root[data-motion="reduce"] .reveal,
:root[data-motion="reduce"] .chip {
  transition: none;
}

/* ── 화면에서만 숨김(화면 낭독기는 읽음) ── */

.visually-hidden {
  position: absolute !important;
  width: var(--hidden-size) !important;
  height: var(--hidden-size) !important;
  margin: calc(var(--hidden-size) * -1) !important;
  padding: 0 !important;
  border: 0 !important;
  overflow: hidden !important;
  clip: rect(0 0 0 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
}
