:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-alt: #f1f5f9;
  --ink: #0f172a;
  --ink-muted: #475569;
  --ink-soft: #64748b;
  --border: #e2e8f0;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eff6ff;
  --accent: #059669;
  --accent-soft: #ecfdf5;
  --warn: #d97706;
  --danger: #dc2626;
  --radius: 14px;
  --shadow: 0 4px 20px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

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

a:hover {
  text-decoration: underline;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
}

/* Header */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.brand:hover {
  text-decoration: none;
}

.brand-badge {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: linear-gradient(135deg, #2563eb, #0f172a);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.95rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}

.nav-links a {
  color: var(--ink-muted);
  font-weight: 600;
  font-size: 0.93rem;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--primary);
  text-decoration: none;
}

/* 태블릿(761~1120px): 메뉴가 5개뿐이라 한 줄에 다 들어간다. 공용 v2.css의 칩 규칙
   (≤1120px — 다른 사이트는 링크가 16개라 필요)보다 우선해 한 줄 sticky 헤더를 유지한다. */
@media (min-width: 761px) and (max-width: 1120px) {
  header.site-header {
    position: sticky;
  }

  .site-header .header-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    min-height: 64px;
    gap: 16px;
    padding: 0 20px;
  }

  .site-header .nav-links {
    flex: 0 1 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 20px;
  }

  .site-header .nav-links a {
    padding: 0;
    border: 0;
    border-radius: 0;
    background: none;
    font-size: 0.93rem;
    line-height: 1.5;
    color: var(--ink-muted);
  }

  .site-header .nav-links a:hover {
    color: var(--primary);
  }

  .site-header .nav-links a.active {
    background: none;
    border: 0;
    color: var(--primary);
  }
}

/* Hero */
.hero {
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 60%, #1e3a8a 100%);
  color: #f8fafc;
  padding: 56px 0 48px;
}

.hero-pill {
  display: inline-block;
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid rgba(147, 197, 253, 0.35);
  color: #bfdbfe;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.hero h1 {
  margin: 0 0 12px;
  font-size: clamp(1.85rem, 3.5vw, 2.7rem);
  line-height: 1.2;
  letter-spacing: -0.03em;
}

.hero p {
  margin: 0;
  max-width: 680px;
  color: #cbd5e1;
  font-size: 1.05rem;
}

/* Cards Grid */
.section {
  padding: 40px 0;
}

.section-title {
  font-size: 1.45rem;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}

.section-sub {
  margin: 0 0 24px;
  color: var(--ink-muted);
}

.calc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}

.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.tool-card:hover {
  transform: translateY(-2px);
  border-color: #93c5fd;
}

.tool-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-soft);
  padding: 3px 10px;
  border-radius: 999px;
  margin-bottom: 10px;
}

.tool-card h2,
.tool-card h3 {
  margin: 0 0 8px;
  font-size: 1.18rem;
  color: var(--ink);
}

.tool-card p {
  margin: 0 0 18px;
  color: var(--ink-muted);
  font-size: 0.94rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.92rem;
  padding: 10px 16px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn:hover {
  background: var(--primary-dark);
  text-decoration: none;
}

.btn-outline {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
}

.btn-outline:hover {
  background: var(--surface-alt);
}

/* Calculator Layout */
.breadcrumb {
  padding: 16px 0 6px;
  font-size: 0.86rem;
  color: var(--ink-soft);
}

.page-intro {
  padding: 10px 0 24px;
}

.page-intro h1 {
  margin: 0 0 8px;
  font-size: clamp(1.65rem, 3vw, 2.25rem);
  line-height: 1.25;
  letter-spacing: -0.025em;
}

.page-intro p {
  margin: 0;
  color: var(--ink-muted);
  max-width: 780px;
}

.calc-workspace {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 860px) {
  .calc-workspace {
    grid-template-columns: 1fr;
  }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.panel h2 {
  margin: 0 0 16px;
  font-size: 1.15rem;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 6px;
  color: var(--ink);
}

.field-hint {
  font-weight: 500;
  color: var(--ink-soft);
  font-size: 0.82rem;
}

.field input[type="number"],
.field input[type="text"],
.field select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  font-size: 0.98rem;
  color: var(--ink);
  background: #fff;
}

.field input[type="range"] {
  width: 100%;
  margin-top: 6px;
  accent-color: var(--primary);
}

.field input:focus,
.field select:focus {
  outline: 2px solid #93c5fd;
  border-color: var(--primary);
}

/* Results */
.result-highlight {
  background: linear-gradient(135deg, #eff6ff, #ecfdf5);
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 16px;
}

.result-label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.result-value {
  font-size: clamp(1.8rem, 3.2vw, 2.35rem);
  font-weight: 800;
  color: var(--ink);
  line-height: 1.2;
  margin: 4px 0;
}

.result-sub {
  font-size: 0.9rem;
  color: var(--ink-muted);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.kpi-box {
  background: var(--surface-alt);
  border-radius: 10px;
  padding: 12px 14px;
}

.kpi-box .k-label {
  font-size: 0.8rem;
  color: var(--ink-soft);
  font-weight: 600;
}

.kpi-box .k-val {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--ink);
  margin-top: 2px;
}

.bar-wrap {
  margin-top: 14px;
}

.bar-row {
  margin-bottom: 10px;
}

.bar-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.84rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.bar-track {
  height: 10px;
  background: var(--surface-alt);
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.25s ease;
}

/* Editorial Content (AdSense Value Section) */
.article-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  margin-top: 28px;
  box-shadow: var(--shadow);
}

.article-box h2 {
  margin: 26px 0 10px;
  font-size: 1.32rem;
  letter-spacing: -0.015em;
}

.article-box h2:first-child {
  margin-top: 0;
}

.article-box h3 {
  margin: 18px 0 6px;
  font-size: 1.06rem;
}

.article-box p,
.article-box li {
  color: var(--ink-muted);
}

.article-box table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  font-size: 0.92rem;
}

.article-box th,
.article-box td {
  border: 1px solid var(--border);
  padding: 10px 12px;
  text-align: left;
}

.article-box th {
  background: var(--surface-alt);
  color: var(--ink);
  font-weight: 700;
}

.callout {
  background: var(--primary-soft);
  border-left: 4px solid var(--primary);
  padding: 14px 16px;
  border-radius: 8px;
  margin: 16px 0;
  color: var(--ink);
  font-size: 0.95rem;
}

/* Footer */
.site-footer {
  margin-top: 56px;
  background: #0f172a;
  color: #94a3b8;
  padding: 36px 0;
  font-size: 0.9rem;
}

.footer-inner {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
}

.footer-links a {
  color: #cbd5e1;
}

.copy-toast {
  font-size: 0.85rem;
  color: var(--accent);
  font-weight: 700;
  margin-left: 10px;
}
/* ==========================================================================
   Alternate calculator layout — .workspace / .card / .form-grid
   Used by: ecommerce-roas-breakeven, mortgage-refinance-breakeven,
   overtime-hourly-salary, saas-ltv-cac, student-loan-payoff.
   Mirrors the .calc-workspace / .panel tone used by every other calculator.
   ========================================================================== */
.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 24px;
  align-items: start;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.card h2 {
  margin: 0 0 16px;
  font-size: 1.15rem;
  line-height: 1.35;
  letter-spacing: -0.015em;
}

/* Two-column input grid inside the input card */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 18px;
}

.form-grid .field {
  margin-bottom: 0;
  min-width: 0;
}

.form-grid .field.full {
  grid-column: 1 / -1;
}

.card .field label {
  margin-bottom: 6px;
}

.card .field small {
  display: block;
  margin-top: 5px;
  color: var(--ink-soft);
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.45;
}

/* Result card: headline block + KPI tiles + copy action */
.result-hero {
  background: linear-gradient(135deg, #eff6ff, #ecfdf5);
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  padding: 18px 20px;
  margin-bottom: 16px;
}

.kpi {
  background: var(--surface-alt);
  border-radius: 10px;
  padding: 12px 14px;
  min-width: 0;
}

.kpi-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-soft);
  line-height: 1.4;
}

.kpi-val {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.3;
  margin-top: 2px;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.copy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  font-size: 0.92rem;
  padding: 11px 16px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: background 0.15s ease;
}

.copy-btn:hover {
  background: var(--primary-dark);
}

.copy-btn + .copy-toast {
  display: block;
  margin: 8px 0 0;
  min-height: 1.2em;
}

/* Formula block inside the editorial article */
.formula-box {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  margin: 16px 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 0.88rem;
  line-height: 1.9;
  color: var(--ink);
  white-space: pre-line;
  overflow-x: auto;
}

@media (max-width: 860px) {
  .workspace {
    grid-template-columns: 1fr;
    gap: 20px;
  }
}

@media (max-width: 560px) {
  .card {
    padding: 20px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .kpi-grid {
    gap: 10px;
  }

  .kpi-val {
    font-size: 1.02rem;
  }

  .formula-box {
    font-size: 0.82rem;
    line-height: 1.8;
  }
}
