/* ===== ImageForge - common design (STEP 1) ===== */
:root {
  --bg: #070b16;
  --bg-2: #0d1326;
  --surface: #121a30;
  --surface-2: #19223d;
  --border: #243055;
  --text: #e8ebf5;
  --text-dim: #9aa4c4;
  --accent: #8b5cf6;
  --accent-2: #a78bfa;
  --accent-soft: rgba(139, 92, 246, 0.15);
  --radius: 14px;
  --shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  --header-h: 64px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; scroll-padding-top: calc(var(--header-h) + 12px); }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Pretendard", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

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

/* ===== Header ===== */
.site-header {
  position: sticky; top: 0; z-index: 50;
  height: var(--header-h);
  background: rgba(7, 11, 22, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-inner { height: 100%; display: flex; align-items: center; justify-content: space-between; gap: 16px; }

.logo { display: inline-flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: 0.04em; }
.logo-mark {
  display: inline-grid; place-items: center;
  width: 32px; height: 32px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), #6d28d9);
  font-size: 13px; color: #fff; letter-spacing: 0;
}
.logo-text { font-size: 17px; }

.main-nav { display: flex; gap: 6px; margin-left: auto; margin-right: 8px; }
.main-nav a {
  padding: 8px 14px; border-radius: 10px; color: var(--text-dim); font-size: 15px; font-weight: 500;
  transition: color .15s, background .15s;
}
.main-nav a:hover { color: var(--text); background: var(--surface); }

.header-actions { display: flex; align-items: center; gap: 10px; }
.lang-switch { display: inline-flex; padding: 3px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; }
.lang-btn { background: transparent; border: 0; padding: 6px 12px; border-radius: 8px; font-size: 13px; color: var(--text-dim); }
.lang-btn.active { background: var(--accent); color: #fff; font-weight: 600; }

.menu-toggle {
  display: none; width: 40px; height: 40px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border);
  flex-direction: column; align-items: center; justify-content: center; gap: 4px;
}
.menu-toggle span { display: block; width: 18px; height: 2px; background: var(--text); border-radius: 2px; }

/* ===== Hero ===== */
.hero {
  padding: 88px 0 56px;
  text-align: center;
  background: radial-gradient(ellipse 60% 50% at 50% 0%, rgba(139, 92, 246, 0.22), transparent 70%);
}
.eyebrow {
  display: inline-block; padding: 5px 14px; margin-bottom: 20px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-2);
  font-size: 13px; font-weight: 600;
}
.hero-title { font-size: clamp(34px, 6vw, 60px); line-height: 1.12; font-weight: 800; letter-spacing: -0.02em; }
.hero-desc { max-width: 620px; margin: 20px auto 0; color: var(--text-dim); font-size: 17px; }

.search-box { position: relative; max-width: 560px; margin: 36px auto 0; }
.search-box input {
  width: 100%; height: 54px; padding: 0 48px 0 50px;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  font: inherit; font-size: 16px; box-shadow: var(--shadow);
  transition: border-color .15s, box-shadow .15s;
  -webkit-appearance: none; appearance: none;
}
.search-box input::placeholder { color: var(--text-dim); }
.search-box input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }
.search-box input::-webkit-search-cancel-button { display: none; }
.search-icon { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); color: var(--text-dim); pointer-events: none; }
.search-clear {
  position: absolute; right: 10px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px; border-radius: 8px; border: 0;
  background: var(--surface-2); color: var(--text-dim); font-size: 20px; line-height: 1;
}
.search-clear:hover { color: var(--text); }

/* ===== Sections ===== */
.section { padding: 40px 0; }
.section-head { margin-bottom: 22px; }
.section-head h2 { font-size: 24px; font-weight: 700; letter-spacing: -0.01em; }
.section-head p { margin-top: 4px; color: var(--text-dim); font-size: 15px; }

/* ===== Tool cards ===== */
.tool-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.tool-card {
  position: relative; display: flex; flex-direction: column; gap: 12px;
  padding: 22px; min-height: 176px; text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow);
  transition: border-color .15s, transform .15s, background .15s;
}
.tool-card:hover { border-color: var(--accent); background: var(--surface-2); transform: translateY(-2px); }
.tool-icon {
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px;
  background: var(--accent-soft); color: var(--accent-2);
}
.tool-icon svg { width: 24px; height: 24px; }
.tool-name { font-size: 18px; font-weight: 700; }
.tool-desc { color: var(--text-dim); font-size: 14.5px; flex: 1; }
.tool-badge {
  position: absolute; top: 18px; right: 18px;
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: var(--surface-2); color: var(--text-dim); border: 1px solid var(--border);
}

.empty-state { text-align: center; padding: 48px 20px; color: var(--text-dim); background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); }
.empty-title { color: var(--text); font-weight: 700; font-size: 18px; margin-bottom: 4px; }

/* ===== About ===== */
.about-card { padding: 32px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.about-card h2 { font-size: 24px; margin-bottom: 10px; }
.about-card p { color: var(--text-dim); max-width: 760px; }

/* ===== Footer ===== */
.site-footer { margin-top: 56px; border-top: 1px solid var(--border); background: rgba(7, 11, 22, 0.7); }
.footer-inner { display: flex; justify-content: space-between; gap: 24px; padding-top: 36px; padding-bottom: 24px; flex-wrap: wrap; }
.footer-brand p { margin-top: 10px; color: var(--text-dim); font-size: 14px; max-width: 360px; }
.footer-nav { display: flex; gap: 20px; align-items: flex-start; }
.footer-nav a { color: var(--text-dim); font-size: 14px; }
.footer-nav a:hover { color: var(--text); }
.footer-bottom { padding-bottom: 28px; color: var(--text-dim); }
.footer-bottom small { font-size: 13px; }

/* ===== Toast ===== */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 12px 20px; border-radius: 12px;
  background: var(--surface-2); border: 1px solid var(--accent);
  color: var(--text); font-size: 14px; box-shadow: var(--shadow); z-index: 100;
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
  .tool-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 720px) {
  :root { --header-h: 60px; }
  .menu-toggle { display: inline-flex; }
  .main-nav {
    position: absolute; top: var(--header-h); left: 0; right: 0;
    flex-direction: column; gap: 2px; margin: 0; padding: 10px 16px 14px;
    background: var(--bg-2); border-bottom: 1px solid var(--border);
    display: none;
  }
  .main-nav.open { display: flex; }
  .main-nav a { padding: 12px 14px; }
  .logo-text { font-size: 15px; }
  .lang-btn { padding: 6px 9px; font-size: 12px; }
  .hero { padding: 56px 0 36px; }
  .hero-desc { font-size: 15.5px; }
  .section { padding: 28px 0; }
  .tool-grid { grid-template-columns: 1fr; gap: 14px; }
  .tool-card { min-height: 0; }
  .about-card { padding: 22px; }
  .footer-inner { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

/* ===== STEP 4: favorites, recent list, current page ===== */
.main-nav a[aria-current="page"] { color: var(--text); background: var(--surface); }

.section-head-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; }
.link-btn { padding: 6px 4px; background: transparent; border: 0; color: var(--text-dim); font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover { color: var(--text); }

.tool-card-wrap { position: relative; display: flex; }
.tool-card-wrap .tool-card { flex: 1; min-width: 0; }
.fav-btn {
  position: absolute; top: 14px; right: 14px;
  display: grid; place-items: center; width: 36px; height: 36px;
  background: transparent; border: 0; border-radius: 10px; color: var(--text-dim);
  transition: color .15s, background .15s;
}
.fav-btn svg { width: 22px; height: 22px; }
.fav-btn:hover { color: #fbbf24; background: var(--surface-2); }
.fav-btn.active { color: #fbbf24; }
.fav-btn.active svg { fill: currentColor; }


/* ===== STEP 5: language blocks, guide, legal pages, ad slots ===== */
html[lang="ko"] [data-lang-block="en"],
html[lang="en"] [data-lang-block="ko"] { display: none !important; }

.guide { margin-top: 44px; max-width: 820px; }
.guide h2 { font-size: 20px; margin: 28px 0 12px; }
.guide h2:first-child { margin-top: 0; }
.guide ol { padding-left: 22px; display: grid; gap: 8px; color: var(--text); }
.guide h3 { font-size: 16px; margin: 18px 0 6px; }
.guide p, .guide li { color: var(--text-dim); line-height: 1.75; }
.guide li { color: var(--text); }

.legal { max-width: 820px; margin: 8px 0 0; padding: 8px 0 24px; }
.legal ul + p, .legal ol + p { margin-top: 14px; }
.legal h1 { font-size: 30px; line-height: 1.25; margin-bottom: 14px; }
.legal h2 { font-size: 19px; margin: 30px 0 10px; }
.legal p, .legal li { color: var(--text-dim); line-height: 1.8; }
.legal ul { padding-left: 22px; display: grid; gap: 8px; margin-top: 8px; }
.legal li strong { color: var(--text); }
.legal a { color: var(--accent-2); text-decoration: underline; text-underline-offset: 3px; }
.legal .lead { color: var(--text); font-size: 17px; margin-bottom: 8px; }
.legal .meta-line { font-size: 13px; color: var(--text-dim); margin-bottom: 10px; }
.legal .tool-list a { text-decoration: none; }
.legal .tool-list strong { color: var(--text); }
.contact-card {
  margin: 18px 0 6px; padding: 18px 20px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); box-shadow: var(--shadow); display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: baseline;
}
.contact-label { color: var(--text-dim); font-size: 14px; }
.contact-mail { font-size: 18px; font-weight: 700; word-break: break-all; }

/* Ad slots: always in normal page flow, never fixed/sticky/overlay, always labeled, and
   separated from the tools by generous space. Hidden (no space used) until ads exist. */
.ad-slot { margin: 48px 0 8px; max-width: 820px; clear: both; }
.ad-slot[hidden] { display: none !important; }
.ad-slot .ad-label { display: block; margin-bottom: 6px; font-size: 12px; color: var(--text-dim); letter-spacing: .04em; }
.ad-slot .ad-box { min-height: 0; }
.ad-slot.is-preview .ad-box {
  min-height: 120px; display: flex; align-items: center; justify-content: center; text-align: center;
  border: 1px dashed var(--border); border-radius: var(--radius); color: var(--text-dim); font-size: 14px; padding: 12px;
}
@media (max-width: 640px) {
  .ad-slot { margin: 40px 0 8px; }
  .legal h1 { font-size: 25px; }
}

[hidden] { display: none !important; }
