/* =========================================
   CI/CD Pipeline Reliability Diagnostics Tool
   Impeccable Design System — Zero-ornament minimalism
   ========================================= */

:root {
  --canvas: #ffffff;
  --ink: #000000;
  --ink-soft: #0f172a;
  --accent: #05805a;
  --accent-dark: #046a4a;
  --accent-light: #e6f5ef;
  --border: #e5e5e5;
  --border-focus: #05805a;
  --surface: #fafafa;
  --error: #dc2626;
  --grade-a-plus: #05805a;
  --grade-a: #16a34a;
  --grade-b-plus: #2563eb;
  --grade-b: #3b82f6;
  --grade-c: #eab308;
  --grade-d: #f97316;
  --grade-f: #dc2626;
  --radius: 4px;
  --font: 'Pretendard', -apple-system, system-ui, sans-serif;
  --mono: 'JetBrains Mono', monospace;
}

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  color: var(--ink-soft);
  background: var(--canvas);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* ---- Header ---- */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.logo { display: flex; align-items: center; gap: 8px; }
.logo-mark { font-size: 20px; color: var(--accent); }
.logo-text { font-size: 16px; font-weight: 700; color: var(--ink); }
.lang-toggle { display: flex; align-items: center; gap: 4px; }
.lang-btn {
  background: none; border: none; font-family: var(--font);
  font-size: 14px; font-weight: 400; color: var(--ink-soft);
  cursor: pointer; padding: 8px 12px; border-radius: var(--radius);
  transition: background 0.15s;
  min-height: 44px; min-width: 44px;
  display: inline-flex; align-items: center; justify-content: center;
}
.lang-btn.active { background: var(--accent); color: #fff; font-weight: 700; }
.lang-sep { color: var(--border); font-size: 14px; }

/* ---- Hero ---- */
.hero {
  position: relative;
  min-height: 420px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.hero-bg { position: absolute; inset: 0; }
.hero-img {
  width: 100%; height: 100%; object-fit: cover;
  animation: heroZoom 20s ease-in-out infinite alternate;
}
@keyframes heroZoom { from { transform: scale(1); } to { transform: scale(1.05); } }
.hero-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(5,128,90,0.85) 0%, rgba(4,106,74,0.7) 100%);
}
.hero-content {
  position: relative; z-index: 2;
  text-align: center; padding: 64px 24px;
  max-width: 640px;
  animation: fadeUp 0.8s ease-out;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}
.hero-content h1 {
  font-size: 48px; font-weight: 700; color: #fff;
  line-height: 1.2; margin-bottom: 16px;
}
.hero-sub {
  font-size: 20px; color: rgba(255,255,255,0.9);
  margin-bottom: 32px; font-weight: 400;
}
.hero-cta {
  display: inline-block;
  padding: 16px 32px;
  background: #fff;
  color: var(--accent);
  font-family: var(--font);
  font-size: 16px;
  font-weight: 700;
  text-decoration: none;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.hero-cta:hover { transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.hero-cta:active { transform: translateY(0); }
.hero-credit {
  margin-top: 16px; font-size: 12px; color: rgba(255,255,255,0.6);
}
.hero-credit a {
  color: rgba(255,255,255,0.8);
  display: inline-block;
  padding: 4px 8px;
  min-height: 44px;
  min-width: 44px;
  line-height: 36px;
}

/* ---- Main Grid ---- */
.main-grid {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 24px;
  display: grid;
  grid-template-columns: 2fr 3fr;
  gap: 48px;
  align-items: start;
}

/* ---- Form Column ---- */
.form-col {
  position: sticky;
  top: 80px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  background: var(--canvas);
}
.form-progress {
  margin-bottom: 24px;
  position: relative;
  height: 32px;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
}
.progress-bar {
  position: absolute; top: 0; left: 0;
  height: 100%;
  background: var(--accent);
  border-radius: var(--radius);
  transition: width 0.4s ease;
}
.progress-text {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  height: 100%; font-size: 13px; font-weight: 700;
  color: var(--ink-soft);
}

.form-step {
  display: none;
  border: none;
  animation: fadeIn 0.3s ease;
}
.form-step.active { display: block; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.step-title {
  font-size: 18px; font-weight: 700;
  margin-bottom: 20px;
  display: flex; align-items: center; gap: 8px;
  color: var(--ink);
}
.step-icon { font-size: 20px; }

.field {
  margin-bottom: 16px;
}
.field label {
  display: block;
  font-size: 14px; font-weight: 700;
  color: var(--ink-soft);
  margin-bottom: 6px;
}
.field input[type="number"],
.field input[type="email"] {
  width: 100%;
  height: 48px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 16px;
  color: var(--ink-soft);
  background: var(--canvas);
  transition: border-color 0.15s;
}
.field input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-color: var(--border-focus);
}
.field input.error { border-color: var(--error); }
.field-hint {
  display: block;
  font-size: 12px; color: #6b7280;
  margin-top: 4px;
}
.field-error {
  display: block;
  font-size: 12px; color: var(--error);
  margin-top: 4px;
  min-height: 16px;
}

.step-nav {
  display: flex; gap: 12px;
  margin-top: 20px;
}
.btn-prev, .btn-next, .btn-calc {
  flex: 1;
  height: 48px;
  font-family: var(--font);
  font-size: 15px; font-weight: 700;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  background: var(--canvas);
  color: var(--ink-soft);
}
.btn-next, .btn-calc {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.btn-next:hover, .btn-calc:hover {
  background: var(--accent-dark);
}
.btn-prev:hover { background: var(--surface); }

.form-actions {
  margin-top: 16px;
}
.form-actions .btn-calc { width: 100%; }

/* ---- Results Column ---- */
.results-col {
  min-height: 400px;
}

/* Empty state */
.results-empty {
  text-align: center;
  padding: 64px 24px;
  animation: fadeIn 0.5s ease;
}
.empty-radar-svg {
  width: 200px; height: 200px;
  margin: 0 auto 24px;
}
.empty-radar-svg svg { width: 100%; height: 100%; }
.results-empty p {
  font-size: 16px; color: #6b7280;
  line-height: 1.6;
}

/* Skeleton */
.results-skeleton {
  padding: 24px;
  animation: pulse 1.5s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.skeleton {
  background: var(--surface);
  border-radius: var(--radius);
  margin-bottom: 16px;
}
.skeleton-grade { height: 120px; }
.skeleton-chart { height: 300px; }
.skeleton-bar { height: 48px; }
.skeleton-bar.short { width: 60%; }

/* Grade Hero */
.result-grade {
  text-align: center;
  padding: 48px 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 24px;
  animation: gradeIn 0.6s ease-out;
}
@keyframes gradeIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}
.grade-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 120px; height: 120px;
  border-radius: 50%;
  border: 4px solid var(--accent);
  margin-bottom: 16px;
}
.grade-letter {
  font-family: var(--mono);
  font-size: 48px;
  font-weight: 700;
  color: var(--accent);
}
.grade-info { margin-bottom: 8px; }
.grade-score {
  font-family: var(--mono);
  font-size: 48px;
  font-weight: 700;
  color: var(--ink);
}
.grade-max {
  font-family: var(--mono);
  font-size: 20px;
  color: #6b7280;
}
.grade-message {
  font-size: 16px;
  color: #6b7280;
}

/* Result sections */
.result-section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin-bottom: 24px;
  animation: sectionIn 0.5s ease-out;
}
@keyframes sectionIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}
.section-title {
  font-size: 20px; font-weight: 700;
  margin-bottom: 16px;
  color: var(--ink);
}

/* Radar */
.chart-container {
  max-width: 400px;
  margin: 0 auto;
}

/* DORA */
.dora-disclaimer {
  font-size: 12px; color: #6b7280;
  margin-bottom: 16px;
  padding: 8px 12px;
  background: var(--surface);
  border-radius: var(--radius);
  border-left: 3px solid var(--accent);
}
.dora-tiers { display: flex; flex-direction: column; gap: 8px; }
.dora-tier {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: background 0.15s;
}
.dora-tier.current {
  background: var(--accent-light);
  border-color: var(--accent);
}
.dora-tier-label {
  font-family: var(--mono);
  font-size: 14px; font-weight: 700;
  min-width: 60px;
  color: var(--ink-soft);
}
.dora-tier.current .dora-tier-label { color: var(--accent); }
.dora-tier-desc {
  font-size: 14px; color: #6b7280;
  flex: 1;
}
.dora-tier-marker {
  font-size: 12px; font-weight: 700;
  color: var(--accent);
  padding: 2px 8px;
  background: var(--accent-light);
  border-radius: var(--radius);
}

/* Tabs */
.tab-bar {
  display: flex; gap: 0;
  border-bottom: 2px solid var(--border);
  margin-bottom: 20px;
}
.tab-btn {
  flex: 1;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: 12px 16px;
  font-family: var(--font);
  font-size: 14px; font-weight: 700;
  color: #6b7280;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}
.tab-panel { display: none; animation: fadeIn 0.3s ease; }
.tab-panel.active { display: block; }

/* ROI */
.roi-sliders {
  display: flex; flex-direction: column; gap: 16px;
  margin-bottom: 24px;
}
.roi-slider-group {
  display: flex; align-items: center; gap: 12px;
}
.roi-slider-group label {
  min-width: 140px; font-size: 14px; font-weight: 700;
}
.roi-slider-group input[type="range"] {
  flex: 1; height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: var(--border);
  border-radius: 3px;
  outline: none;
}
.roi-slider-group input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
}
.roi-slider-group input[type="range"]::-moz-range-thumb {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--accent);
  cursor: pointer;
  border: none;
}
.roi-value {
  min-width: 60px;
  font-family: var(--mono);
  font-size: 14px; font-weight: 700;
  text-align: right;
  color: var(--ink-soft);
}
.roi-result {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px;
  margin-bottom: 16px;
}
.roi-card {
  padding: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  text-align: center;
}
.roi-label {
  display: block;
  font-size: 13px; color: #6b7280;
  margin-bottom: 8px;
}
.roi-value-big {
  display: block;
  font-family: var(--mono);
  font-size: 28px; font-weight: 700;
  color: var(--accent);
}
.roi-note {
  font-size: 12px; color: #6b7280;
}

/* ISMS-P */
.isms-cards { display: flex; flex-direction: column; gap: 12px; }
.isms-card {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  border-left: 3px solid var(--accent);
}
.isms-card-title {
  font-family: var(--mono);
  font-size: 14px; font-weight: 700;
  color: var(--accent);
  margin-bottom: 4px;
}
.isms-card-body {
  font-size: 14px; color: var(--ink-soft);
}
.isms-note {
  margin-top: 12px; font-size: 12px; color: #6b7280;
}

/* Action buttons */
.result-actions {
  display: flex; flex-direction: column; gap: 12px;
  animation: sectionIn 0.5s ease-out;
}
.btn-action {
  width: 100%;
  height: 48px;
  font-family: var(--font);
  font-size: 15px; font-weight: 700;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.15s;
}
.btn-action:hover { background: var(--accent-dark); }
.btn-action.secondary {
  background: var(--canvas);
  color: var(--ink-soft);
  border: 1px solid var(--border);
}
.btn-action.secondary:hover { background: var(--surface); }
.btn-cta-external {
  display: block;
  width: 100%;
  text-align: center;
  padding: 16px 32px;
  font-family: var(--font);
  font-size: 15px; font-weight: 700;
  background: var(--ink);
  color: #fff;
  text-decoration: none;
  border-radius: var(--radius);
  transition: background 0.15s;
}
.btn-cta-external:hover { background: var(--accent-dark); }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 200;
  animation: fadeIn 0.2s ease;
}
.modal {
  background: var(--canvas);
  border-radius: var(--radius);
  padding: 32px;
  width: 90%; max-width: 440px;
  position: relative;
}
.modal h2 {
  font-size: 20px; font-weight: 700;
  margin-bottom: 20px;
}
.modal-close {
  position: absolute; top: 12px; right: 16px;
  background: none; border: none;
  font-size: 24px; cursor: pointer;
  color: #6b7280;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
}
.modal-state .field { margin-bottom: 16px; }
.modal-state .btn-action { margin-top: 8px; }
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin: 16px auto;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.success-text { color: var(--accent); font-weight: 700; margin-bottom: 12px; }
.error-text { color: var(--error); font-weight: 700; margin-bottom: 12px; }

/* ---- Toast ---- */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #fff;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 14px;
  z-index: 300;
  animation: toastIn 0.3s ease;
}
@keyframes toastIn {
  from { opacity: 0; transform: translateX(-50%) translateY(12px); }
  to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ---- Footer CTA ---- */
.footer-cta {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 64px 24px;
  animation: sectionIn 0.6s ease-out;
}
.footer-cta-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 48px;
  align-items: center;
}
.footer-cta-image img {
  width: 100%;
  border-radius: var(--radius);
  display: block;
}
.footer-cta-image .hero-credit {
  font-size: 11px; color: #9ca3af; margin-top: 4px;
}
.footer-cta-content h2 {
  font-size: 32px; font-weight: 700;
  margin-bottom: 16px;
  line-height: 1.3;
}
.footer-cta-content p {
  font-size: 16px; color: #6b7280;
  margin-bottom: 24px;
}
.footer-cta-content .btn-cta-external {
  width: auto; display: inline-block;
}

/* ---- Footer ---- */
.footer {
  text-align: center;
  padding: 24px;
  font-size: 13px;
  color: #9ca3af;
  border-top: 1px solid var(--border);
}
.footer a {
  color: #6b7280;
  display: inline-block;
  padding: 4px 2px;
  min-height: 44px;
  line-height: 36px;
}

/* Screen reader only */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); border: 0;
}

.hidden { display: none !important; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .hero-content h1 { font-size: 32px; }
  .hero-sub { font-size: 16px; }
  .main-grid {
    grid-template-columns: 1fr;
    gap: 24px;
    padding: 24px 16px;
  }
  .form-col { position: static; }
  .footer-cta-inner {
    grid-template-columns: 1fr;
  }
  .footer-cta-content h2 { font-size: 24px; }
  .result-grade { padding: 32px 16px; }
  .grade-badge { width: 96px; height: 96px; }
  .grade-letter { font-size: 36px; }
  .grade-score { font-size: 36px; }
  .roi-result { grid-template-columns: 1fr; }
  .roi-slider-group { flex-wrap: wrap; }
  .roi-slider-group label { min-width: 100%; }
}

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

/* Focus styles */
*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
