/* =========================================================
   Formix - 공통 스타일시트
   - CSS 변수 기반 라이트/다크 테마
   - 새 기능(도구) 페이지를 추가할 때도 이 파일 하나만 링크하면
     네비게이션/푸터/기본 타이포그래피가 자동으로 맞춰집니다.
   ========================================================= */

:root {
  --color-bg: #ffffff;
  --color-bg-elevated: #f6f7f9;
  --color-bg-inset: #eef0f3;
  --color-border: #e2e5ea;
  --color-text: #1a1d23;
  --color-text-muted: #5b6270;
  --color-accent: #2f6feb;
  --color-accent-hover: #245ac2;
  --color-accent-contrast: #ffffff;
  --color-danger: #d1453b;
  --color-success: #1f9d55;
  --color-warning: #b7791f;

  --json-key: #b3560c;
  --json-string: #1f9d55;
  --json-number: #2f6feb;
  --json-boolean: #8a3ffc;
  --json-null: #9aa1ac;
  --json-punct: var(--color-text-muted);
  --search-highlight-bg: #ffe58a;
  --search-highlight-text: #1a1d23;
  --search-highlight-active-bg: #ff9f43;

  --shadow-sm: 0 1px 2px rgba(20, 24, 32, 0.06);
  --shadow-md: 0 4px 16px rgba(20, 24, 32, 0.08);
  --radius-sm: 6px;
  --radius-md: 10px;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Pretendard", "Apple SD Gothic Neo",
    "Malgun Gothic", Roboto, Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;

  color-scheme: light;
}

:root[data-theme="dark"] {
  --color-bg: #14161a;
  --color-bg-elevated: #1b1e24;
  --color-bg-inset: #22262e;
  --color-border: #2c313a;
  --color-text: #e7e9ee;
  --color-text-muted: #9aa1ac;
  --color-accent: #5b8ef4;
  --color-accent-hover: #7ba2f6;
  --color-accent-contrast: #0b1220;
  --color-danger: #ef6a61;
  --color-success: #4cd07d;
  --color-warning: #e0ac4c;

  --json-key: #e0a458;
  --json-string: #4cd07d;
  --json-number: #7ba2f6;
  --json-boolean: #b892ff;
  --json-null: #6b7280;
  --json-punct: var(--color-text-muted);
  --search-highlight-bg: #6b5b1f;
  --search-highlight-text: #fff3c4;
  --search-highlight-active-bg: #b5791b;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.45);

  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  transition: background-color 0.15s ease, color 0.15s ease;
}

a {
  color: var(--color-accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

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

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

/* ---------- 헤더 / 네비게이션 ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--color-text);
}
.nav-brand:hover {
  text-decoration: none;
  color: var(--color-text);
}
.nav-brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--color-accent);
  color: var(--color-accent-contrast);
  font-size: 0.85rem;
  font-weight: 800;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 4px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  display: inline-block;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  font-size: 0.92rem;
  font-weight: 500;
}
.nav-links a:hover {
  background: var(--color-bg-elevated);
  color: var(--color-text);
  text-decoration: none;
}
.nav-links a[aria-current="page"] {
  color: var(--color-accent);
  background: var(--color-bg-elevated);
}

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

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-bg-elevated);
  color: var(--color-text);
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
}
.theme-toggle:hover {
  border-color: var(--color-accent);
}

/* ---------- 언어 선택 (테마 버튼 옆 국기 아이콘) ---------- */
.lang-switch {
  position: relative;
}
.lang-switch-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--color-border);
  background: var(--color-bg-elevated);
  cursor: pointer;
  font-size: 1.05rem;
  line-height: 1;
  padding: 0;
  overflow: hidden;
}
.lang-switch-toggle:hover {
  border-color: var(--color-accent);
}
/* 국기 이모지(유니코드) 대신 쓰는 실제 SVG 아이콘. Windows 글꼴은 국기 이모지를
   지원하지 않아 빈 사각형/글자로만 보이는 경우가 많아 이미지 파일로 대체함. */
.flag-icon {
  width: 20px;
  height: 15px;
  object-fit: cover;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.12);
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}
.flag-icon-toggle {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: none;
}
.lang-switch-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 30;
  min-width: 148px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}
.lang-switch-menu[hidden] {
  display: none;
}
.lang-switch-menu li + li {
  margin-top: 2px;
}
.lang-switch-menu a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--color-text);
  text-decoration: none;
  font-size: 0.88rem;
  white-space: nowrap;
}
.lang-switch-menu a:hover {
  background: var(--color-bg-inset);
}
.lang-switch-menu a[aria-current="true"] {
  color: var(--color-accent);
  font-weight: 700;
}

.nav-toggle {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-bg-elevated);
  color: var(--color-text);
  cursor: pointer;
}

/* ---------- 상단 메뉴: 도구 드롭다운 ---------- */
.nav-dropdown {
  position: relative;
}
/* 버튼과 드롭다운 메뉴 사이의 여백(8px)에서 마우스가 벗어난 것으로 잘못 판정되어
   메뉴가 깜빡이며 닫히지 않도록, 그 틈을 이어주는 보이지 않는 다리(bridge). */
.nav-dropdown::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 100%;
  height: 8px;
}
.nav-dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  color: var(--color-text-muted);
  font-size: 0.92rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
}
.nav-dropdown-toggle:hover {
  background: var(--color-bg-elevated);
  color: var(--color-text);
}
.nav-dropdown-toggle.is-active {
  color: var(--color-accent);
  background: var(--color-bg-elevated);
}
.nav-caret {
  font-size: 0.7em;
  transition: transform 0.15s ease;
}
.nav-dropdown-toggle[aria-expanded="true"] .nav-caret {
  transform: rotate(180deg);
}
.nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 30;
  min-width: 200px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--color-bg-elevated);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
}
.nav-dropdown-menu[hidden] {
  display: none;
}
/* 마우스를 올리면(hover) 바로 펼쳐지는 느낌을 주기 위한 살짝의 펼침 애니메이션.
   (CSS 트랜지션은 display:none ↔ block 사이를 지원하지 않으므로 애니메이션을 사용) */
@keyframes nav-dropdown-in {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
.nav-dropdown-menu:not([hidden]) {
  animation: nav-dropdown-in 0.15s ease;
}
@media (prefers-reduced-motion: reduce) {
  .nav-dropdown-menu:not([hidden]) {
    animation: none;
  }
}
.nav-dropdown-menu li + li {
  margin-top: 2px;
}
.nav-dropdown-menu a {
  display: block;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--color-text);
  text-decoration: none;
  font-size: 0.9rem;
  white-space: nowrap;
}
.nav-dropdown-menu a:hover {
  background: var(--color-bg-inset);
  text-decoration: none;
}
.nav-dropdown-menu a[aria-current="page"] {
  color: var(--color-accent);
  font-weight: 700;
}

/* ---------- 현재 위치 표시줄 (breadcrumb) ---------- */
.breadcrumb {
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-inset);
}
.breadcrumb-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  /* margin은 지정하지 않음: .container의 margin:0 auto가 그대로 적용되어
     본문(container)과 동일하게 가운데 정렬되도록 하기 위함(여기서 margin:0을
     주면 .container의 auto 중앙 정렬이 깨져 왼쪽 끝에 붙어버리는 문제가 있었음).
     좌우 padding도 0으로 둬서(위아래만 지정) .nav/.page-header/.section-tight 등
     사이트의 다른 .container 요소들과 동일한 좌측 시작 위치에 맞춤(그 요소들도
     각자의 padding 선언이 상하값만 가져 .container의 좌우 20px를 덮어써 0이 됨) */
  padding: 10px 0;
  list-style: none;
  font-size: 0.82rem;
  color: var(--color-text-muted);
}
.breadcrumb-list li {
  display: flex;
  align-items: center;
  gap: 6px;
}
.breadcrumb-list li:not(:first-child)::before {
  content: "›";
  color: var(--color-text-muted);
}
.breadcrumb-list a {
  color: var(--color-text-muted);
}
.breadcrumb-list a:hover {
  color: var(--color-accent);
  text-decoration: none;
}
.breadcrumb-list li[aria-current="page"] span {
  color: var(--color-text);
  font-weight: 600;
}
.breadcrumb-group {
  color: var(--color-text-muted);
}

/* ---------- 메인 레이아웃 ---------- */
main {
  min-height: 60vh;
}

.section {
  padding: 48px 0;
}
.section-tight {
  padding: 28px 0;
}

.hero {
  padding: 56px 0 32px;
  text-align: center;
}
.hero h1 {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin: 0 0 12px;
}
.hero p {
  color: var(--color-text-muted);
  font-size: 1.05rem;
  max-width: 640px;
  margin: 0 auto;
}

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

.page-header {
  padding: 40px 0 16px;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: 32px;
}
.page-header h1 {
  margin: 0 0 8px;
  font-size: 1.8rem;
}
.page-header p {
  color: var(--color-text-muted);
  margin: 0;
}

.prose h2 {
  font-size: 1.3rem;
  margin-top: 2em;
}
.prose h3 {
  font-size: 1.05rem;
}
.prose p,
.prose li {
  color: var(--color-text);
}
.prose ul {
  padding-left: 1.2em;
}
.prose section + section {
  margin-top: 1.6em;
}

/* ---------- 업데이트 소식 (changelog) ---------- */
.update-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.update-entry {
  padding: 20px 0;
  border-bottom: 1px solid var(--color-border);
}
.update-entry:first-of-type {
  padding-top: 0;
}
.update-date {
  margin: 0 0 6px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--color-accent);
  text-transform: uppercase;
}
.update-entry h2 {
  margin-top: 0 !important;
}

/* ---------- FAQ 아코디언 ---------- */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.faq-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg-elevated);
  padding: 4px 16px;
}
.faq-item summary {
  cursor: pointer;
  padding: 12px 0;
  font-weight: 700;
  color: var(--color-text);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.faq-item summary::-webkit-details-marker {
  display: none;
}
.faq-item summary::after {
  content: "+";
  flex: none;
  font-size: 1.2rem;
  color: var(--color-accent);
}
.faq-item[open] summary::after {
  content: "\2212";
}
.faq-item .faq-answer {
  padding: 0 0 14px;
  color: var(--color-text-muted);
}
.faq-item .faq-answer p {
  margin: 0;
}

/* ---------- 카드 그리드 (기능 목록) ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 18px;
}

.tool-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 22px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-bg-elevated);
  color: inherit;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.tool-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--color-accent);
  text-decoration: none;
}
.tool-card:hover h3 {
  color: var(--color-accent);
}
.tool-card:focus-visible {
  outline: 2px solid var(--color-accent);
  outline-offset: 2px;
}
.tool-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--color-bg-inset);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}
.tool-card h3 {
  margin: 0;
  font-size: 1.08rem;
  color: var(--color-text);
  transition: color 0.15s ease;
}
.tool-card p {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.92rem;
  flex: 1;
}
.tool-card .tag {
  align-self: flex-start;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--color-bg-inset);
  color: var(--color-text-muted);
}
.tool-card.is-soon {
  opacity: 0.6;
}
.tool-card.is-soon:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--color-border);
}

/* ---------- 버튼 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-bg-elevated);
  color: var(--color-text);
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover {
  border-color: var(--color-accent);
  text-decoration: none;
}
.btn-primary {
  background: var(--color-accent);
  border-color: var(--color-accent);
  color: var(--color-accent-contrast);
}
.btn-primary:hover {
  background: var(--color-accent-hover);
  border-color: var(--color-accent-hover);
}
.btn-sm {
  padding: 6px 10px;
  font-size: 0.82rem;
}
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- 배지/상태 ---------- */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
}
.status-pill.is-valid {
  background: rgba(31, 157, 85, 0.12);
  color: var(--color-success);
}
.status-pill.is-invalid {
  background: rgba(209, 69, 59, 0.12);
  color: var(--color-danger);
}
.status-pill.is-fixed {
  background: rgba(183, 121, 31, 0.14);
  color: var(--color-warning);
}
.status-pill.is-idle {
  background: var(--color-bg-inset);
  color: var(--color-text-muted);
}

/* ---------- 푸터 ---------- */
.site-footer {
  border-top: 1px solid var(--color-border);
  padding: 28px 0;
  margin-top: 48px;
  color: var(--color-text-muted);
  font-size: 0.88rem;
}
.footer-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}
.footer-links {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.footer-links a {
  color: var(--color-text-muted);
}
.footer-links a:hover {
  color: var(--color-accent);
}

/* ---------- 유틸리티 ---------- */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.skip-link {
  position: absolute;
  left: -999px;
  top: auto;
  background: var(--color-accent);
  color: #fff;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  z-index: 100;
}
.skip-link:focus {
  left: 12px;
  top: 12px;
}

@media (max-width: 720px) {
  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-bg);
    border-bottom: 1px solid var(--color-border);
    flex-direction: column;
    align-items: stretch;
    padding: 8px 20px 16px;
    display: none;
    box-shadow: var(--shadow-md);
  }
  .nav-links.is-open {
    display: flex;
  }
  .nav-links a {
    padding: 10px 8px;
  }
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  .site-header {
    position: sticky;
  }

  /* 모바일에서는 드롭다운을 펼친 목록 형태로 표시 */
  .nav-dropdown-toggle {
    width: 100%;
    justify-content: space-between;
    padding: 10px 8px;
  }
  .nav-dropdown-menu {
    position: static;
    box-shadow: none;
    border: none;
    background: transparent;
    padding: 0 0 0 12px;
    margin-top: 2px;
  }
  .nav-dropdown-menu a {
    padding: 8px;
  }

  .breadcrumb-list {
    padding: 8px 0;
  }
}

/* ---------- 쿠키/광고 동의 배너 (EEA·영국·스위스 방문자 대상) ---------- */
.consent-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 60;
  padding: 16px;
  transform: translateY(100%);
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
  pointer-events: none;
}
.consent-banner.is-visible {
  transform: translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.consent-banner-inner {
  max-width: 920px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-bg-elevated);
  box-shadow: var(--shadow-md);
}
.consent-banner-text {
  flex: 1 1 420px;
  margin: 0;
  font-size: 0.86rem;
  color: var(--color-text-muted);
}
.consent-banner-text a {
  color: var(--color-accent);
  font-weight: 700;
}
.consent-banner-actions {
  display: flex;
  gap: 8px;
  flex: none;
  flex-wrap: wrap;
}

.footer-settings-btn {
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: var(--color-text-muted);
  cursor: pointer;
  text-decoration: none;
}
.footer-settings-btn:hover {
  color: var(--color-accent);
  text-decoration: underline;
}

/* 방명록 (guestbook.html) */
.gb-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
}
.gb-nickname-input {
  flex: 0 1 160px;
  padding: 9px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 14px;
}
.gb-message-input {
  flex: 1 1 260px;
  padding: 9px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg);
  color: var(--color-text);
  font-size: 14px;
}
.gb-submit-status {
  flex-basis: 100%;
  font-size: 13px;
  color: var(--color-text-muted);
}
.gb-submit-status.is-success {
  color: var(--color-success);
}
.gb-submit-status.is-error {
  color: var(--color-danger);
}
.gb-list {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.gb-entry {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--color-border);
  font-size: 14px;
}
.gb-entry:last-child {
  border-bottom: none;
}
.gb-entry-name {
  font-weight: 700;
  color: var(--color-accent);
  flex-shrink: 0;
}
.gb-entry-message {
  flex: 1 1 auto;
  word-break: break-word;
}
.gb-entry-time {
  flex-basis: 100%;
  font-size: 12px;
  color: var(--color-text-muted);
}
.gb-status {
  padding: 16px 14px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 14px;
}
