/*
 * EXCON Global Frontend Design System
 * Branch: refactor/frontend-design-v1
 * This layer provides shared tokens and components while legacy page CSS
 * is migrated incrementally.
 */

:root {
  color-scheme: light;

  --ex-color-navy-950: #071a2b;
  --ex-color-navy-900: #0b253a;
  --ex-color-navy-800: #123b57;
  --ex-color-navy-700: #185273;
  --ex-color-orange-600: #e95f21;
  --ex-color-orange-500: #f1692f;
  --ex-color-orange-100: #fff0e8;

  --ex-color-text: #17212b;
  --ex-color-text-muted: #65717d;
  --ex-color-heading: #0b253a;
  --ex-color-surface: #ffffff;
  --ex-color-surface-soft: #f5f7f9;
  --ex-color-border: #dfe5ea;
  --ex-color-border-strong: #c9d2da;
  --ex-color-success: #18794e;
  --ex-color-danger: #c2362b;

  --ex-font-sans: "Pretendard", "Noto Sans KR", "Noto Sans",
    Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;

  --ex-container: 1280px;
  --ex-gutter: clamp(16px, 3vw, 32px);
  --ex-section-space: clamp(56px, 7vw, 96px);

  --ex-radius-sm: 6px;
  --ex-radius-md: 10px;
  --ex-radius-lg: 16px;
  --ex-radius-xl: 24px;
  --ex-radius-pill: 999px;

  --ex-shadow-sm: 0 1px 3px rgba(7, 26, 43, 0.08);
  --ex-shadow-md: 0 12px 32px rgba(7, 26, 43, 0.10);
  --ex-shadow-lg: 0 24px 64px rgba(7, 26, 43, 0.15);

  --ex-transition: 180ms ease;
  --ex-focus-ring: 0 0 0 3px rgba(241, 105, 47, 0.24);

  /* Legacy aliases used by existing components. */
  --line: var(--ex-color-border);
  --brand: var(--ex-color-orange-500);
  --brand-dark: var(--ex-color-orange-600);
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 320px;
  background: var(--ex-color-surface);
  color: var(--ex-color-text);
  font-family: var(--ex-font-sans);
  font-size: 16px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

a {
  color: inherit;
}

img {
  height: auto;
}

::selection {
  background: var(--ex-color-orange-100);
  color: var(--ex-color-navy-950);
}

:where(a, button, input, select, textarea, [tabindex]):focus-visible {
  outline: none;
  box-shadow: var(--ex-focus-ring);
}

/* Layout */
.container,
.ex-container {
  width: min(100%, var(--ex-container));
  margin-inline: auto;
  padding-inline: var(--ex-gutter);
}

.ex-section {
  padding-block: var(--ex-section-space);
}

.ex-section--soft {
  background: var(--ex-color-surface-soft);
}

.ex-stack {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.ex-cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}

/* Typography */
.ex-eyebrow {
  margin: 0 0 10px;
  color: var(--ex-color-orange-600);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.ex-heading {
  margin: 0;
  color: var(--ex-color-heading);
  font-size: clamp(28px, 4vw, 48px);
  font-weight: 800;
  line-height: 1.16;
  letter-spacing: -0.035em;
}

.ex-heading--section {
  font-size: clamp(24px, 3vw, 36px);
}

.ex-lead {
  max-width: 720px;
  margin: 16px 0 0;
  color: var(--ex-color-text-muted);
  font-size: clamp(16px, 1.6vw, 19px);
  line-height: 1.7;
}

/* Buttons */
.ex-btn,
.btn {
  min-height: 44px;
  padding: 11px 18px;
  border: 1px solid transparent;
  border-radius: var(--ex-radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--ex-color-surface);
  color: var(--ex-color-navy-900);
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition:
    background-color var(--ex-transition),
    border-color var(--ex-transition),
    color var(--ex-transition),
    box-shadow var(--ex-transition),
    transform var(--ex-transition);
}

.ex-btn:hover,
.btn:hover {
  transform: translateY(-1px);
}

.ex-btn--primary,
.btn.primary {
  border-color: var(--ex-color-orange-500);
  background: var(--ex-color-orange-500);
  color: #fff;
}

.ex-btn--primary:hover,
.btn.primary:hover {
  border-color: var(--ex-color-orange-600);
  background: var(--ex-color-orange-600);
}

.ex-btn--secondary {
  border-color: var(--ex-color-navy-900);
  background: var(--ex-color-navy-900);
  color: #fff;
}

.ex-btn--outline {
  border-color: var(--ex-color-border-strong);
  background: transparent;
}

.ex-btn--outline:hover {
  border-color: var(--ex-color-navy-800);
  color: var(--ex-color-navy-800);
}

/* Forms */
.ex-field {
  display: grid;
  gap: 8px;
}

.ex-label {
  color: var(--ex-color-navy-900);
  font-size: 14px;
  font-weight: 700;
}

.ex-input,
.ex-select,
.ex-textarea {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border: 1px solid var(--ex-color-border-strong);
  border-radius: var(--ex-radius-md);
  background: var(--ex-color-surface);
  color: var(--ex-color-text);
  transition:
    border-color var(--ex-transition),
    box-shadow var(--ex-transition);
}

.ex-textarea {
  min-height: 140px;
  resize: vertical;
}

.ex-input::placeholder,
.ex-textarea::placeholder {
  color: #929ca5;
}

.ex-input:hover,
.ex-select:hover,
.ex-textarea:hover {
  border-color: #9ba9b4;
}

.ex-input:focus,
.ex-select:focus,
.ex-textarea:focus {
  border-color: var(--ex-color-orange-500);
  outline: none;
  box-shadow: var(--ex-focus-ring);
}

.ex-help {
  color: var(--ex-color-text-muted);
  font-size: 13px;
}

.ex-error {
  color: var(--ex-color-danger);
  font-size: 13px;
  font-weight: 600;
}

/* Surfaces */
.ex-card {
  border: 1px solid var(--ex-color-border);
  border-radius: var(--ex-radius-lg);
  background: var(--ex-color-surface);
  box-shadow: var(--ex-shadow-sm);
  overflow: hidden;
  transition:
    border-color var(--ex-transition),
    box-shadow var(--ex-transition),
    transform var(--ex-transition);
}

.ex-card--interactive:hover {
  border-color: var(--ex-color-border-strong);
  box-shadow: var(--ex-shadow-md);
  transform: translateY(-3px);
}

.ex-card__body {
  padding: clamp(18px, 2.5vw, 28px);
}

.ex-badge {
  width: fit-content;
  padding: 5px 9px;
  border-radius: var(--ex-radius-pill);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--ex-color-orange-100);
  color: var(--ex-color-orange-600);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.2;
}

/* Responsive helpers */
.ex-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: clamp(16px, 2vw, 28px);
}

@media (max-width: 767px) {
  :root {
    --ex-section-space: 48px;
  }

  body {
    font-size: 15px;
  }

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

  .ex-btn,
  .btn {
    min-height: 46px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
