/* Tool - main.css
   원칙: 무채색 + primary 1색, 모션 1종(0.15s ease-out), 여백으로 구획.
   AI 슬롭 회피: 글래스모피즘/보라-핑크 그라데이션/hover scale 금지.
*/

:root {
  --c-bg: #fafaf9;
  --c-surface: #ffffff;
  --c-text: #1f1f1f;
  --c-text-soft: #5c5c5c;
  --c-text-faint: #9a9a9a;
  --c-border: #e6e4e1;
  --c-border-strong: #d6d3cf;
  --c-primary: #2b5fff;
  --c-primary-soft: #eaefff;
  --c-success: #1f7a3a;
  --c-warn: #b46900;
  --c-error: #b1281c;
  --c-code-bg: #f4f1ed;

  --radius: 8px;
  --radius-sm: 4px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow: 0 4px 16px rgba(0,0,0,0.06);

  --font-sans: -apple-system, BlinkMacSystemFont, "Pretendard", "Apple SD Gothic Neo",
               "Noto Sans KR", Roboto, sans-serif;
  --font-mono: "SF Mono", Menlo, Consolas, "Liberation Mono", "JetBrains Mono", monospace;

  /* 폼 컨트롤·스크롤바가 OS 다크모드를 따르도록 */
  color-scheme: light dark;
}

/* 다크모드 — OS 설정 자동 반응 (JS 없음, 순수 CSS).
   모바일에서 다크모드를 켜면 즉시 적용된다. 토큰만 덮어쓰므로 전 페이지 일괄 반영. */
@media (prefers-color-scheme: dark) {
  :root {
    --c-bg: #16181c;
    --c-surface: #1e2127;
    --c-text: #e7e7e8;
    --c-text-soft: #aab0b8;
    --c-text-faint: #71757d;
    --c-border: #2c2f36;
    --c-border-strong: #3b3f47;
    --c-primary: #6f97ff;
    --c-primary-soft: #1b2540;
    --c-success: #46c46e;
    --c-warn: #d99a2e;
    --c-error: #ff6f63;
    --c-code-bg: #23262d;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow: 0 4px 16px rgba(0,0,0,0.45);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

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

h1, h2, h3, h4 {
  margin: 0 0 0.5em 0;
  line-height: 1.3;
  font-weight: 700;
  color: var(--c-text);
}
h1 { font-size: 2rem; margin-top: 0.2em; }
h2 { font-size: 1.4rem; margin-top: 2em; }
h3 { font-size: 1.1rem; margin-top: 1.5em; }

p { margin: 0 0 1em 0; }

code, pre, kbd {
  font-family: var(--font-mono);
  font-size: 0.9em;
}
code {
  background: var(--c-code-bg);
  padding: 0.1em 0.35em;
  border-radius: var(--radius-sm);
}

/* ---------------- layout ---------------- */
.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}

.main {
  padding-top: 32px;
  padding-bottom: 64px;
  min-height: 60vh;
}

/* ---------------- header ---------------- */
.site-header {
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--c-text);
  font-weight: 700;
  font-size: 1.05rem;
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 22px; height: 22px;
  border-radius: 5px;
  background: var(--c-primary);
  display: inline-block;
}
.site-nav { display: flex; gap: 20px; }
.site-nav a {
  color: var(--c-text-soft);
  font-size: 0.94rem;
}
.site-nav a:hover { color: var(--c-text); text-decoration: none; }

/* ---------------- footer ---------------- */
.site-footer {
  background: var(--c-surface);
  border-top: 1px solid var(--c-border);
  margin-top: 64px;
  padding: 32px 0 40px;
  color: var(--c-text-soft);
  font-size: 0.9rem;
}
.footer-nav { display: flex; gap: 18px; flex-wrap: wrap; }
.footer-nav a { color: var(--c-text-soft); }
.site-footer .copy { margin-top: 16px; color: var(--c-text-faint); font-size: 0.85rem; }

/* ---------------- breadcrumb ---------------- */
.breadcrumb { font-size: 0.85rem; color: var(--c-text-faint); margin-bottom: 16px; }
.breadcrumb ol {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: wrap; gap: 6px;
}
.breadcrumb li::after { content: "/"; margin-left: 8px; color: var(--c-text-faint); }
.breadcrumb li:last-child::after { content: ""; }
.breadcrumb a { color: var(--c-text-soft); }

/* ---------------- hero ---------------- */
.hero {
  padding: 48px 0 16px;
  text-align: left;
  border-bottom: 1px solid var(--c-border);
  margin-bottom: 36px;
}
.hero h1 { font-size: 2.25rem; margin-bottom: 12px; }
.hero p { color: var(--c-text-soft); font-size: 1.05rem; }

/* ---------------- tool grid ---------------- */
.tool-group { margin-top: 36px; }
.tool-group h2 { margin-bottom: 16px; font-size: 1.15rem; color: var(--c-text-soft); font-weight: 600; }

.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}
.tool-grid.wide { gap: 16px; }

.tool-card {
  display: block;
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 18px 18px 20px;
  color: var(--c-text);
  transition: border-color 0.15s ease-out;
}
.tool-card:hover {
  border-color: var(--c-border-strong);
  text-decoration: none;
}
.tool-card h3 { margin-top: 0; margin-bottom: 6px; font-size: 1.02rem; }
.tool-card p { color: var(--c-text-soft); font-size: 0.9rem; margin: 0; line-height: 1.5; }
.tool-card .cat-tag {
  display: inline-block;
  font-size: 0.7rem;
  color: var(--c-text-faint);
  background: var(--c-code-bg);
  padding: 2px 8px;
  border-radius: 999px;
  margin-bottom: 8px;
  letter-spacing: 0.02em;
}

/* ---------------- tool page ---------------- */
.tool-ui {
  background: var(--c-surface);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  padding: 20px;
  margin: 20px 0 24px;
}
.tool-doc h2 { margin-top: 2em; font-size: 1.2rem; }
.tool-doc p, .tool-doc li { color: var(--c-text); }

/* ---------------- forms ---------------- */
button, .btn {
  font: inherit;
  background: var(--c-primary);
  color: #fff;
  border: 1px solid var(--c-primary);
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: opacity 0.15s ease-out;
}
button:hover, .btn:hover { opacity: 0.92; }
button:disabled { opacity: 0.5; cursor: not-allowed; }

.btn-secondary {
  background: var(--c-surface);
  color: var(--c-text);
  border-color: var(--c-border-strong);
}

input[type="text"], input[type="password"], input[type="number"], select, textarea {
  font: inherit;
  background: var(--c-surface);
  color: var(--c-text);
  border: 1px solid var(--c-border-strong);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
}
textarea { width: 100%; font-family: var(--font-mono); font-size: 0.88rem; }

.field { margin-bottom: 12px; }
.field label { display: block; font-size: 0.85rem; color: var(--c-text-soft); margin-bottom: 4px; }

/* ---------------- alerts/notes ---------------- */
.note {
  background: var(--c-primary-soft);
  border: 1px solid #cdd9ff;
  color: #1a3da6;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  margin: 12px 0;
}
.note.warn { background: #fff6e3; border-color: #ffd58a; color: #7a4d00; }
.note.error { background: #ffefed; border-color: #ffb7af; color: #8a1d10; }

/* ---------------- responsive ---------------- */
@media (max-width: 640px) {
  .hero h1 { font-size: 1.7rem; }
  .site-nav { gap: 12px; }
  .site-nav a { font-size: 0.88rem; }
}

/* 쿠키 사용 안내 배너 (cookie-notice.js 가 동적 삽입) */
.cookie-banner {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  display: flex; gap: 12px; align-items: center; justify-content: center; flex-wrap: wrap;
  padding: 12px 16px;
  background: var(--c-surface); border-top: 1px solid var(--c-border);
  box-shadow: var(--shadow); font-size: 0.88rem;
}
.cookie-banner p { margin: 0; color: var(--c-text-soft); }
.cookie-banner button {
  padding: 7px 18px; border: 1px solid var(--c-primary); background: var(--c-primary);
  color: #fff; border-radius: var(--radius-sm); cursor: pointer; font-weight: 600;
}

/* 쿠키 정책 표 */
.cookie-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; margin: 12px 0; }
.cookie-table th, .cookie-table td {
  text-align: left; padding: 8px 10px; border: 1px solid var(--c-border); vertical-align: top;
}
.cookie-table th { background: var(--c-code-bg); color: var(--c-text-soft); font-weight: 600; }

/* 다크모드: 하드코딩 밝은 색 컴포넌트 가독성 보정 */
@media (prefers-color-scheme: dark) {
  .note { border-color: var(--c-border-strong); color: var(--c-text); }
  .note.warn  { background: #3a2e12; border-color: #6b4e1a; color: #f0cf8a; }
  .note.error { background: #3a1f1c; border-color: #6b2e26; color: #ff9d92; }
}
