/* NDT Foundry — 비파괴평가 지능형 에이전트 데모 */
:root {
  --bg: #0d1117;
  --bg-alt: #161b22;
  --surface: #21262d;
  --border: #30363d;
  --text: #e6edf3;
  --text-muted: #8b949e;
  --accent: #58a6ff;
  --accent-dim: #388bfd;
  --emphasis: #79c0ff;
  --success: #3fb950;
  --font-sans: "Noto Sans KR", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, monospace;
  --space: 1.25rem;
  --radius: 8px;
  --max-width: 720px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

.container {
  width: 100%;
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 var(--space);
}

.container-wide {
  max-width: 900px;
}

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(13, 17, 23, 0.9);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 0.75rem;
  padding-bottom: 0.75rem;
}

.logo {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.logo .tld {
  color: var(--accent);
  font-family: var(--font-mono);
  font-weight: 500;
}

.site-header nav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
}

.site-header nav a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
}

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

.site-header nav a.nav-active {
  color: var(--accent);
}

/* Hero */
.hero {
  padding: 3rem 0 3.5rem;
  border-bottom: 1px solid var(--border);
}

.hero h1 {
  margin: 0 0 1rem;
  font-size: clamp(1.75rem, 4vw, 2.25rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.03em;
}

.hero h1 strong {
  color: var(--emphasis);
}

.hero-tagline {
  margin: 0 0 0.75rem;
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 42ch;
}

.hero-domain {
  margin: 0;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.hero-domain code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  color: var(--accent);
  background: var(--surface);
  padding: 0.15em 0.5em;
  border-radius: 4px;
}

/* Sections */
.section {
  padding: 2.5rem 0;
}

.section.alt {
  background: var(--bg-alt);
}

.section h2 {
  margin: 0 0 1rem;
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -0.02em;
}

.section .lead {
  margin: 0 0 1rem;
  font-size: 1.05rem;
  color: var(--text-muted);
}

.section p {
  margin: 0 0 1rem;
}

.section p:last-child {
  margin-bottom: 0;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin: 1rem 0;
}

.card.highlight {
  border-color: var(--accent-dim);
  background: rgba(56, 139, 253, 0.06);
}

.card p {
  margin: 0;
}

/* Lists */
.role-list,
.diff-list {
  margin: 1rem 0;
  padding-left: 1.5rem;
}

.role-list li,
.diff-list li {
  margin-bottom: 0.5rem;
}

.section ul:not(.role-list):not(.diff-list) {
  margin: 1rem 0;
  padding-left: 1.5rem;
}

.section ul li {
  margin-bottom: 0.35rem;
}

/* Global / domain CTA */
.section.global {
  border-top: 1px solid var(--border);
}

.domain-cta {
  margin-top: 1rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border-radius: var(--radius);
  border-left: 3px solid var(--success);
}

/* Footer */
.site-footer {
  padding: 2rem 0;
  border-top: 1px solid var(--border);
  text-align: center;
}

.site-footer p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* 데모 페이지 */
.demo-main {
  min-height: 60vh;
}

.demo-hero {
  padding: 2rem 0 1.5rem;
  border-bottom: 1px solid var(--border);
}

.demo-hero h1 {
  margin: 0 0 0.5rem;
  font-size: clamp(1.5rem, 3.5vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.02em;
}

.demo-hero h1 strong {
  color: var(--emphasis);
}

.demo-tagline {
  margin: 0;
  font-size: 1rem;
  color: var(--text-muted);
}

.demo-flow-section {
  padding: 2rem 0;
}

.demo-flow-title {
  margin: 0 0 1.25rem;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
}

.flow-steps {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem 0.25rem;
  margin-bottom: 1rem;
}

.flow-step {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  padding: 0.6rem 0.9rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-width: 5rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.flow-step:hover {
  border-color: var(--accent);
  background: rgba(56, 139, 253, 0.08);
}
.flow-step--active {
  border-color: var(--accent);
  background: rgba(56, 139, 253, 0.12);
  box-shadow: 0 0 0 1px var(--accent-dim);
}

.flow-step-result {
  border-color: var(--success);
  background: rgba(63, 185, 80, 0.08);
}

.flow-num {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--accent);
}

.flow-step-result .flow-num {
  color: var(--success);
}

.flow-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
}

.flow-arrow {
  color: var(--text-muted);
  font-size: 1rem;
  padding: 0 0.15rem;
}

.flow-hint {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: center;
}

.demo-chat-section {
  padding: 0 0 3rem;
}

.persona-banner {
  padding: 0.5rem 1rem;
  background: var(--bg-alt);
  border-bottom: 1px solid var(--border);
  font-size: 0.9rem;
}
.persona-banner-label {
  color: var(--text-muted);
  margin-right: 0.5rem;
}
.persona-name {
  color: var(--emphasis);
  font-weight: 600;
}

.chat-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 320px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem;
  min-height: 200px;
  max-height: 50vh;
}

.chat-welcome {
  color: var(--text-muted);
  font-size: 0.95rem;
  text-align: center;
  padding: 1.5rem 1rem;
}

.chat-welcome-ex {
  margin-top: 0.75rem;
  font-size: 0.85rem;
  opacity: 0.9;
}

.chat-msg {
  margin-bottom: 1rem;
}

.chat-msg:last-child {
  margin-bottom: 0;
}

.chat-msg-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 0.25rem;
}

.chat-msg--user .chat-msg-label {
  color: var(--emphasis);
}

.chat-msg-body {
  font-size: 0.95rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-msg--user .chat-msg-body {
  background: var(--bg-alt);
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius);
  border-left: 3px solid var(--accent);
}

.chat-msg--loading .chat-msg-body {
  color: var(--text-muted);
  font-style: italic;
}

.chat-form {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
  border-top: 1px solid var(--border);
  background: var(--bg-alt);
}
.chat-attachments-wrap {
  padding: 0.5rem 1rem 0;
}
.chat-files-input {
  font-size: 0.85rem;
  color: var(--text-muted);
}
.chat-attachments-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.35rem;
  min-height: 0;
}
.chat-attachment-item {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.5rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.chat-attachment-item--image {
  flex-direction: column;
  align-items: flex-start;
  padding: 0.35rem;
}
.chat-attachment-thumb {
  display: block;
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 4px;
  background: var(--bg);
}
.chat-attachment-info {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
}
.chat-attachment-name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.chat-attachment-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 0.2rem;
  font-size: 1rem;
  line-height: 1;
}
.chat-attachment-remove:hover {
  color: #f85149;
}
.chat-form-row {
  display: flex;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
}
.chat-input {
  flex: 1;
  min-height: 44px;
  padding: 0.5rem 0.75rem;
  font-family: var(--font-sans);
  font-size: 0.95rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  resize: none;
}

.chat-input::placeholder {
  color: var(--text-muted);
}

.chat-input:focus {
  outline: none;
  border-color: var(--accent);
}

.chat-send {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--bg);
  background: var(--accent);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
}

.chat-send:hover:not(:disabled) {
  background: var(--accent-dim);
}

.chat-send:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.chat-error {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  color: #f85149;
  background: rgba(248, 81, 73, 0.1);
  border-top: 1px solid var(--border);
}

/* B-scan 시뮬레이션 */
.simulation-panel {
  margin-top: 2rem;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.simulation-title {
  margin: 0 0 0.5rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
}
.simulation-hint {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.simulation-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.5rem;
  margin-bottom: 1rem;
}
.simulation-controls label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.sim-input {
  width: 4.5rem;
  padding: 0.3rem 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
}
.sim-input:focus {
  outline: none;
  border-color: var(--accent);
}
.simulation-canvas-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
}
.bscan-canvas {
  display: block;
  max-width: 100%;
  height: auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* 소개 페이지 다이어그램 */
.diagram-section {
  padding: 2rem 0;
}

.diagram-wrap {
  margin: 1.5rem 0;
  overflow-x: auto;
}

.diagram {
  display: block;
  max-width: 100%;
  height: auto;
}

.diagram-agent {
  min-width: 320px;
}

.diagram-flow {
  min-width: 320px;
}

/* Responsive */
@media (max-width: 640px) {
  .site-header .container {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .site-header nav {
    margin-left: -0.25rem;
  }

  .hero {
    padding: 2rem 0 2.5rem;
  }

  .flow-steps {
    justify-content: flex-start;
  }

  .flow-step {
    min-width: 4rem;
    padding: 0.5rem 0.6rem;
  }

  .flow-label {
    font-size: 0.7rem;
  }
}

.hero-sub .hero-tagline {
  max-width: none;
}
