/* ============================================
   Ingress-NGINX → Gateway API Migration Readiness Checker
   Design System: Dark-first, Pretendard, Zero-decoration
   ============================================ */

/* --- Reset & Base --- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg-primary: #0A0A0A;
  --bg-secondary: #1A1A1A;
  --bg-card: #1F1F1F;
  --bg-input: #141414;
  --text-primary: #F5F5F5;
  --text-secondary: #A3A3A3;
  --text-tertiary: #8B8B8B;
  --accent: #06B6D4;
  --accent-hover: #0891B2;
  --danger: #EF4444;
  --danger-bg: #1C1111;
  --warning: #F59E0B;
  --warning-bg: #1C1A11;
  --success: #10B981;
  --success-bg: #111C15;
  --border: #2A2A2A;
  --border-light: #333333;
  --radius: 4px;
  --font-ko: 'Pretendard', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', monospace;
  --transition: 200ms ease;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  word-break: keep-all;
}

body {
  font-family: var(--font-ko);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

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

/* --- Animations --- */
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes countUp {
  from { opacity: 0.3; }
  to { opacity: 1; }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes slideDown {
  from { opacity: 0; max-height: 0; }
  to { opacity: 1; max-height: 600px; }
}

@keyframes gaugeAnimate {
  from { stroke-dashoffset: 534; }
}

@keyframes barGrow {
  from { width: 0 !important; }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* --- Buttons --- */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 14px 32px;
  background: var(--accent);
  color: #000;
  font-family: var(--font-ko);
  font-size: 16px;
  font-weight: 700;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition), transform 100ms ease;
  text-decoration: none;
  min-height: 48px;
}

.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }
.btn-primary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: transparent;
  color: var(--text-primary);
  font-family: var(--font-ko);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color var(--transition), background var(--transition);
  text-decoration: none;
  min-height: 44px;
}

.btn-secondary:hover { border-color: var(--accent); background: rgba(6, 182, 212, 0.05); }
.btn-secondary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-external {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  background: var(--accent);
  color: #000;
  font-family: var(--font-ko);
  font-size: 14px;
  font-weight: 700;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background var(--transition);
  text-decoration: none;
  min-height: 44px;
}

.btn-external:hover { background: var(--accent-hover); }

.btn-example {
  padding: 10px 16px;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-ko);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition);
  min-height: 44px;
}

.btn-example:hover { color: var(--text-primary); border-color: var(--text-secondary); }
.btn-example-danger { border-color: rgba(239, 68, 68, 0.3); color: var(--danger); }
.btn-example-danger:hover { border-color: var(--danger); }

.btn-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 0;
  background: transparent;
  color: var(--accent);
  font-family: var(--font-ko);
  font-size: 14px;
  font-weight: 500;
  border: none;
  cursor: pointer;
  transition: opacity var(--transition);
}

.btn-toggle:hover { opacity: 0.8; }
.btn-toggle .toggle-arrow { font-size: 10px; transition: transform var(--transition); }
.btn-toggle[aria-expanded="true"] .toggle-arrow { transform: rotate(180deg); }

/* --- Hero Section --- */
.hero-section {
  position: relative;
  min-height: 100vh;
  display: flex;
  align-items: center;
  overflow: hidden;
}

.hero-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(10, 10, 10, 0.92) 0%, rgba(10, 10, 10, 0.75) 100%);
  z-index: 1;
}

.hero-content {
  position: relative;
  z-index: 2;
  flex: 1;
  max-width: 640px;
  padding: 64px 48px;
  animation: fadeInUp 600ms ease both;
}

.hero-image-wrapper {
  position: relative;
  flex: 0 0 40%;
  min-height: 100vh;
  clip-path: polygon(8% 0, 100% 0, 100% 100%, 0% 100%);
}

.hero-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero-image-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, rgba(10, 10, 10, 0.6), transparent 40%);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius);
  color: var(--danger);
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 32px;
  animation: fadeIn 800ms ease 200ms both;
}

.badge-icon { font-size: 16px; }

.hero-headline {
  font-size: 48px;
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin-bottom: 24px;
  color: var(--text-primary);
}

.hero-sub {
  font-size: 18px;
  line-height: 1.7;
  color: var(--text-secondary);
  margin-bottom: 40px;
}

.hero-sub strong { color: var(--text-primary); font-weight: 700; }

.hero-stats {
  display: flex;
  gap: 32px;
  margin-bottom: 40px;
  animation: fadeInUp 600ms ease 300ms both;
}

.stat-item { display: flex; flex-direction: column; gap: 4px; }

.stat-number {
  font-size: 28px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--accent);
  animation: countUp 800ms ease 400ms both;
}

.stat-label { font-size: 13px; color: var(--text-tertiary); }

.hero-trust {
  display: flex;
  gap: 16px;
  margin-top: 24px;
  animation: fadeIn 800ms ease 600ms both;
}

.trust-badge {
  font-size: 13px;
  color: var(--text-tertiary);
}

.btn-arrow { font-size: 20px; transition: transform var(--transition); }
.btn-primary:hover .btn-arrow { transform: translateY(2px); }

/* --- Features Section --- */
.features-section {
  padding: 96px 0;
  border-top: 1px solid var(--border);
}

.section-title {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 48px;
  letter-spacing: -0.01em;
}

.feature-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.feature-item {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  padding: 32px 0;
  border-bottom: 1px solid var(--border);
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 500ms ease, transform 500ms ease;
}

.feature-item.visible {
  opacity: 1;
  transform: translateY(0);
}

.feature-icon-wrap {
  flex-shrink: 0;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.feature-text h3 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 4px;
}

.feature-text p {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* --- Editor Section --- */
.editor-section {
  padding: 96px 0;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.editor-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 24px;
}

.editor-header .section-title { margin-bottom: 0; }

.editor-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.editor-wrapper {
  position: relative;
  display: flex;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 320px;
  transition: border-color var(--transition);
}

.editor-wrapper:focus-within {
  border-color: var(--accent);
}

.line-numbers {
  flex-shrink: 0;
  width: 48px;
  padding: 16px 8px;
  background: rgba(255, 255, 255, 0.02);
  border-right: 1px solid var(--border);
  color: var(--text-tertiary);
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.6;
  text-align: right;
  user-select: none;
  overflow: hidden;
  white-space: pre;
}

.yaml-editor {
  flex: 1;
  padding: 16px;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.6;
  resize: none;
  outline: none;
  tab-size: 2;
  min-height: 320px;
}

.yaml-editor::placeholder { color: var(--text-tertiary); }

.editor-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  flex-wrap: wrap;
  gap: 12px;
}

.editor-status {
  font-size: 13px;
  color: var(--text-tertiary);
}

.editor-error {
  margin-top: 12px;
  padding: 12px 16px;
  background: var(--danger-bg);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius);
  color: var(--danger);
  font-size: 14px;
  font-family: var(--font-mono);
  animation: fadeIn 200ms ease;
}

.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid transparent;
  border-top-color: #000;
  border-radius: 50%;
  animation: spin 600ms linear infinite;
}

/* --- Results Section --- */
.results-section {
  padding: 96px 0;
  animation: fadeInUp 600ms ease;
}

.result-hero {
  display: flex;
  align-items: center;
  gap: 48px;
  margin-bottom: 48px;
  padding: 48px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.score-gauge-wrapper {
  flex-shrink: 0;
  width: 200px;
  height: 200px;
}

.score-gauge { width: 100%; height: 100%; }

#score-arc {
  transition: stroke-dashoffset 1000ms ease;
}

.score-info { flex: 1; }

.grade-badge {
  display: inline-block;
  padding: 6px 16px;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-mono);
  border-radius: var(--radius);
  margin-bottom: 12px;
}

.grade-ready { background: var(--success-bg); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.3); }
.grade-caution { background: var(--warning-bg); color: var(--warning); border: 1px solid rgba(245, 158, 11, 0.3); }
.grade-not-ready { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.3); }
.grade-unknown { background: var(--bg-secondary); color: var(--text-tertiary); border: 1px solid var(--border); }

.grade-label {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.score-summary {
  font-size: 15px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
}

/* --- Score Breakdown --- */
.score-breakdown {
  margin-bottom: 48px;
  overflow: hidden;
  animation: slideDown 300ms ease;
}

.breakdown-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 0;
  position: relative;
}

.breakdown-bar::before {
  content: attr(data-label);
  width: 140px;
  flex-shrink: 0;
  font-size: 14px;
  color: var(--text-secondary);
}

.breakdown-fill {
  flex: 1;
  height: 8px;
  background: var(--accent);
  border-radius: 2px;
  animation: barGrow 600ms ease;
}

.breakdown-value {
  width: 32px;
  text-align: right;
  font-size: 14px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-primary);
}

/* --- Risk List --- */
.result-block {
  margin-bottom: 40px;
}

.block-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.risk-list {
  display: flex;
  flex-direction: column;
}

.risk-item {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  animation: fadeInUp 400ms ease both;
}

.risk-severity {
  flex-shrink: 0;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-mono);
  border-radius: var(--radius);
  min-width: 72px;
  text-align: center;
}

.risk-severity.high { background: var(--danger-bg); color: var(--danger); }
.risk-severity.medium { background: var(--warning-bg); color: var(--warning); }
.risk-severity.low { background: rgba(6, 182, 212, 0.1); color: var(--accent); }

.risk-details { flex: 1; }
.risk-name { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.risk-desc { font-size: 14px; color: var(--text-secondary); line-height: 1.5; margin-bottom: 4px; }
.risk-action { font-size: 13px; color: var(--accent); }

/* --- Estimate Card --- */
.estimate-card {
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.estimate-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.estimate-row:last-child { border-bottom: none; }

.estimate-label { font-size: 14px; color: var(--text-secondary); }
.estimate-value { font-size: 16px; font-weight: 700; font-family: var(--font-mono); }

/* --- Action List --- */
.action-list {
  list-style: none;
  counter-reset: action;
}

.action-item {
  counter-increment: action;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--border);
  animation: fadeInUp 400ms ease both;
}

.action-item::before {
  content: counter(action);
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--text-secondary);
}

.action-text { font-size: 15px; line-height: 1.5; }

/* --- Result Actions --- */
.result-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 48px;
  padding-top: 32px;
  border-top: 1px solid var(--border);
}

/* --- CTA Section --- */
.cta-section {
  padding: 96px 0;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
}

.cta-section .container {
  display: flex;
  align-items: center;
  gap: 48px;
}

.cta-content { flex: 1; }

.cta-headline {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 16px;
  letter-spacing: -0.01em;
}

.cta-desc {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 32px;
}

.btn-cta { font-size: 18px; padding: 16px 40px; }

.cta-image-wrapper {
  flex: 0 0 360px;
  height: 280px;
  border-radius: var(--radius);
  overflow: hidden;
}

.cta-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* --- Footer --- */
.site-footer {
  padding: 32px 0;
  border-top: 1px solid var(--border);
}

.footer-content {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
}

.footer-brand {
  font-weight: 700;
  font-size: 14px;
  color: var(--text-primary);
}

.footer-copy {
  font-size: 13px;
  color: var(--text-tertiary);
}

.footer-link {
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  margin-left: auto;
  padding: 8px 4px;
  display: inline-block;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

.footer-link:hover { text-decoration: underline; }

/* --- Toast --- */
.toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  padding: 12px 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-primary);
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 200ms ease, transform 200ms ease;
  z-index: 1000;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

/* --- Empty State --- */
.empty-state {
  color: var(--text-tertiary);
  font-size: 14px;
  padding: 16px 0;
}

/* --- Responsive --- */
@media (max-width: 1023px) {
  .hero-section { flex-direction: column; }
  .hero-content { padding: 48px 24px; max-width: 100%; }
  .hero-image-wrapper {
    flex: none;
    min-height: 240px;
    max-height: 360px;
    clip-path: polygon(0 4%, 100% 0, 100% 100%, 0% 100%);
  }
  .hero-image-overlay { background: linear-gradient(to top, rgba(10, 10, 10, 0.6), transparent 40%); }
  .hero-headline { font-size: 36px; }
  .hero-stats { gap: 24px; }
  .stat-number { font-size: 24px; }

  .result-hero { flex-direction: column; align-items: flex-start; gap: 24px; padding: 32px 24px; }
  .score-gauge-wrapper { width: 160px; height: 160px; }

  .cta-section .container { flex-direction: column; }
  .cta-image-wrapper { flex: none; width: 100%; height: 200px; }
}

@media (max-width: 767px) {
  .hero-headline { font-size: 28px; }
  .hero-sub { font-size: 16px; }
  .hero-stats { flex-direction: column; gap: 12px; }
  .hero-trust { flex-direction: column; gap: 8px; }

  .section-title { font-size: 24px; }
  .editor-header { flex-direction: column; }
  .editor-actions { width: 100%; }
  .editor-wrapper { min-height: 240px; }
  .editor-footer { flex-direction: column; align-items: stretch; }
  .btn-primary { width: 100%; justify-content: center; }

  .result-hero { padding: 24px 16px; }
  .score-gauge-wrapper { width: 140px; height: 140px; }

  .cta-headline { font-size: 24px; }
  .cta-image-wrapper { height: 160px; }

  .footer-content { flex-direction: column; align-items: flex-start; gap: 8px; }
  .footer-link { margin-left: 0; }

  .result-actions { flex-direction: column; }
  .result-actions .btn-secondary,
  .result-actions .btn-external { width: 100%; justify-content: center; }
}
