/* NoCloud Tools — shared design system
   순수 정적. 외부 폰트/CSS 의존 없음(프라이버시·속도·무유지보수). */

:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f1f3f9;
  --text: #0f172a;
  --text-muted: #5b6677;
  --border: #e4e8f0;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eef0fe;
  --accent: #10b981;
  --accent-soft: #e7f8f1;
  --danger: #ef4444;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --maxw: 1080px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1020;
    --surface: #131a2c;
    --surface-2: #1b2438;
    --text: #e6eaf2;
    --text-muted: #9aa6bd;
    --border: #283248;
    --primary: #818cf8;
    --primary-hover: #a5b0ff;
    --primary-soft: #1e2540;
    --accent: #34d399;
    --accent-soft: #16302a;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35);
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  }
}
/* manual override via [data-theme] */
:root[data-theme="dark"] {
  --bg: #0b1020; --surface: #131a2c; --surface-2: #1b2438; --text: #e6eaf2;
  --text-muted: #9aa6bd; --border: #283248; --primary: #818cf8; --primary-hover: #a5b0ff;
  --primary-soft: #1e2540; --accent: #34d399; --accent-soft: #16302a;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 10px 30px rgba(0,0,0,.35);
}
:root[data-theme="light"] {
  --bg: #f6f7fb; --surface: #ffffff; --surface-2: #f1f3f9; --text: #0f172a;
  --text-muted: #5b6677; --border: #e4e8f0; --primary: #4f46e5; --primary-hover: #4338ca;
  --primary-soft: #eef0fe; --accent: #10b981; --accent-soft: #e7f8f1;
  --shadow: 0 1px 2px rgba(15,23,42,.04), 0 8px 24px rgba(15,23,42,.06);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  /* 한국어가 음절 단위로 끊기지 않고 단어 단위로 줄바꿈되게 함.
     긴 단어(URL 등)만 예외적으로 분리. */
  word-break: keep-all;
  overflow-wrap: break-word;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.25; letter-spacing: -.01em; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ---------- Header ---------- */
/* 헤더는 common.js 가 JS로 주입한다. 주입 전에 높이를 예약해 두지 않으면
   주입 순간 본문이 62px 아래로 튄다(로드 시 레이아웃 점프). 미리 공간을 잡아 둠. */
#app-header { min-height: 62px; }
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--border);
}
.site-header .bar {
  display: flex; align-items: center; gap: 16px;
  height: 62px; max-width: var(--maxw); margin: 0 auto; padding: 0 20px;
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; color: var(--text); font-size: 17px; }
.brand:hover { text-decoration: none; }
.brand .logo {
  width: 26px; height: 26px; border-radius: 7px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: grid; place-items: center; color: #fff; font-size: 14px;
}
.nav { display: flex; align-items: center; gap: 4px; margin-left: auto; }
.nav a {
  color: var(--text-muted); font-weight: 500; font-size: 14.5px;
  padding: 7px 11px; border-radius: 8px;
}
.nav a:hover { color: var(--text); background: var(--surface-2); text-decoration: none; }
.nav a.active { color: var(--primary); background: var(--primary-soft); }
.icon-btn {
  width: 38px; height: 38px; border-radius: 9px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-muted); cursor: pointer;
  display: grid; place-items: center; font-size: 16px;
}
.icon-btn:hover { color: var(--text); border-color: var(--text-muted); }
.nav-toggle { display: none; }

@media (max-width: 720px) {
  .nav { position: fixed; inset: 62px 0 auto 0; flex-direction: column; align-items: stretch;
    gap: 2px; background: var(--surface); border-bottom: 1px solid var(--border); padding: 10px 16px;
    margin: 0; box-shadow: var(--shadow); display: none; }
  .nav.open { display: flex; }
  .nav a { padding: 12px 10px; }
  .nav-toggle { display: grid; }
}

/* ---------- Hero ---------- */
/* 세로 패딩만 지정 — 좌우 패딩은 .container(0 20px)에서 상속받게 둔다.
   (shorthand padding 으로 좌우를 0 으로 덮어쓰면 모바일에서 내용이 화면 가장자리에 붙음) */
.hero { text-align: center; padding-top: 64px; padding-bottom: 28px; }
.hero h1 { font-size: clamp(30px, 5vw, 46px); margin: 0 0 14px; }
.hero p { font-size: clamp(16px, 2.4vw, 19px); color: var(--text-muted); max-width: 620px; margin: 0 auto; }
.badge {
  display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600;
  color: var(--accent); background: var(--accent-soft); padding: 6px 13px; border-radius: 999px;
  margin-bottom: 18px;
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }

/* ---------- Tool grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 18px; }
.tool-card {
  display: block; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow-sm);
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease; color: var(--text);
}
.tool-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--primary); text-decoration: none; }
.tool-card .tc-icon {
  width: 46px; height: 46px; border-radius: 11px; background: var(--primary-soft); color: var(--primary);
  display: grid; place-items: center; font-size: 22px; margin-bottom: 14px;
}
.tool-card h3 { margin: 0 0 6px; font-size: 17px; }
.tool-card p { margin: 0; color: var(--text-muted); font-size: 14px; }
.tool-card .tag { display:inline-block; margin-top:12px; font-size:12px; font-weight:600; color: var(--accent); }

/* ---------- Tool page ---------- */
.tool-head { padding: 40px 0 8px; }
.tool-head h1 { font-size: clamp(26px, 4vw, 36px); margin: 0 0 10px; }
.tool-head .lead { color: var(--text-muted); font-size: 17px; max-width: 680px; margin: 0; }
.breadcrumb { font-size: 13px; color: var(--text-muted); margin-bottom: 14px; }
.breadcrumb a { color: var(--text-muted); }

.panel {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow-sm); margin: 18px 0;
}

/* Dropzone */
.dropzone {
  border: 2px dashed var(--border); border-radius: var(--radius); background: var(--surface-2);
  padding: 44px 24px; text-align: center; cursor: pointer; transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.drag { border-color: var(--primary); background: var(--primary-soft); }
.dropzone .dz-icon { font-size: 38px; margin-bottom: 10px; }
.dropzone h3 { margin: 0 0 6px; font-size: 18px; }
.dropzone p { margin: 0; color: var(--text-muted); font-size: 14px; }
.dropzone input[type=file] { display: none; }

/* Controls */
.controls { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-end; margin-top: 6px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.field input[type=number], .field select {
  height: 40px; padding: 0 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); font-size: 14px; min-width: 130px; font-family: inherit;
}
.field input:focus, .field select:focus { outline: 2px solid var(--primary); outline-offset: 1px; }
.range-row { display: flex; align-items: center; gap: 12px; }
input[type=range] { accent-color: var(--primary); width: 200px; }
.checkline { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 44px; padding: 0 20px; border-radius: var(--radius-sm); border: 1px solid transparent;
  background: var(--primary); color: #fff; font-weight: 600; font-size: 15px; cursor: pointer;
  font-family: inherit; transition: background .12s, opacity .12s;
}
.btn:hover { background: var(--primary-hover); text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn.secondary:hover { background: var(--surface-2); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }

/* Result / preview */
.preview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 18px; }
@media (max-width: 640px) { .preview-grid { grid-template-columns: 1fr; } }
.preview-box { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; background: var(--surface-2); }
.preview-box .ph { padding: 8px 12px; font-size: 12px; font-weight: 600; color: var(--text-muted); border-bottom: 1px solid var(--border); display:flex; justify-content:space-between; }
.preview-box .pimg {
  min-height: 180px; display: grid; place-items: center; padding: 12px;
  background-image: linear-gradient(45deg,#0001 25%,transparent 25%),linear-gradient(-45deg,#0001 25%,transparent 25%),linear-gradient(45deg,transparent 75%,#0001 75%),linear-gradient(-45deg,transparent 75%,#0001 75%);
  background-size: 20px 20px; background-position: 0 0,0 10px,10px -10px,-10px 0;
}
.preview-box .pimg img { max-height: 320px; width: auto; border-radius: 4px; }

.stat-row { display: flex; gap: 22px; flex-wrap: wrap; margin-top: 14px; font-size: 14px; }
.stat-row b { color: var(--text); }
.saved { color: var(--accent); font-weight: 700; }

.note { font-size: 13px; color: var(--text-muted); }
.progress { height: 8px; background: var(--surface-2); border-radius: 999px; overflow: hidden; margin-top: 14px; }
.progress > i { display: block; height: 100%; width: 0; background: var(--primary); transition: width .2s; }

.alert { padding: 12px 14px; border-radius: var(--radius-sm); font-size: 14px; margin-top: 14px; }
.alert.warn { background: #fff7ed; color: #9a3412; border: 1px solid #fed7aa; }
.alert.err { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
:root[data-theme="dark"] .alert.warn { background: #2a1c0f; color: #fdba74; border-color: #4a2f12; }
:root[data-theme="dark"] .alert.err { background: #2a1414; color: #fca5a5; border-color: #4a1d1d; }

/* ---------- How-to / content ---------- */
.prose { max-width: 760px; }
.prose h2 { font-size: 22px; margin: 36px 0 12px; }
.prose h3 { font-size: 17px; margin: 22px 0 8px; }
.prose p, .prose li { color: var(--text); }
.prose ul, .prose ol { padding-left: 20px; }
.faq dt { font-weight: 700; margin-top: 16px; }
.faq dd { margin: 4px 0 0; color: var(--text-muted); }

/* ---------- Ad slots ---------- */
.ad-slot { margin: 26px auto; max-width: var(--maxw); text-align: center; min-height: 90px; }
.ad-ph {
  border: 1px dashed var(--border); border-radius: var(--radius-sm); color: var(--text-muted);
  font-size: 12px; padding: 28px 12px; background: var(--surface-2);
}

/* ---------- Footer ---------- */
.site-footer { border-top: 1px solid var(--border); margin-top: 56px; background: var(--surface); }
.site-footer .ft { display: flex; flex-wrap: wrap; gap: 28px; padding: 36px 0; }
.site-footer .ft-col { min-width: 150px; }
.site-footer h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin: 0 0 10px; }
.site-footer a { display: block; color: var(--text-muted); font-size: 14px; padding: 3px 0; }
.site-footer a:hover { color: var(--text); }
.site-footer .ft-brand { max-width: 280px; }
.site-footer .copy { border-top: 1px solid var(--border); padding: 16px 0; font-size: 13px; color: var(--text-muted); }

.section { padding-top: 26px; padding-bottom: 26px; }
.section h2 { font-size: 24px; margin: 0 0 6px; }
.section .sub { color: var(--text-muted); margin: 0 0 20px; }
.sr-only { position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden; clip:rect(0,0,0,0); border:0; }
