/* ============================================================
   CloudNova Hosting — Design System
   ============================================================
   Table of contents
   01. Design tokens (CSS variables)
   02. Reset & base
   03. Typography
   04. Layout helpers (container, section)
   05. Buttons
   06. Badges & pills
   07. Cards
   08. Forms & inputs
   09. Tables
   10. Alerts & toasts
   11. Utilities
   ============================================================ */

/* ------------------------------------------------------------
   01. Design tokens
   ------------------------------------------------------------ */
:root {
  /* Brand palette */
  --primary: #2563eb;
  --primary-600: #1d4ed8;
  --primary-700: #1e40af;
  --primary-050: #eff6ff;
  --primary-100: #dbeafe;
  --accent: #06b6d4;
  --accent-600: #0891b2;
  --secondary: #64748b;

  /* Surfaces */
  --background: #f8fafc;
  --surface: #ffffff;
  --surface-hover: #f1f5f9;
  --surface-navy: #0b1220;
  --surface-navy-2: #101b33;
  --surface-navy-3: #16223d;

  /* Text */
  --text: #0f172a;
  --text-2: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --on-dark: #f8fafc;
  --on-dark-muted: #94a3b8;

  /* Lines & borders */
  --border: #e2e8f0;
  --border-dark: rgba(148, 163, 184, .18);

  /* Status */
  --success: #10b981;
  --success-050: #ecfdf5;
  --warning: #f59e0b;
  --warning-050: #fffbeb;
  --danger: #ef4444;
  --danger-050: #fef2f2;

  /* Radii */
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-sm: 0 1px 3px rgba(16, 24, 40, .07), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow: 0 4px 12px rgba(16, 24, 40, .08);
  --shadow-md: 0 10px 24px rgba(16, 24, 40, .1);
  --shadow-lg: 0 24px 48px rgba(16, 24, 40, .14);
  --shadow-primary: 0 8px 24px rgba(37, 99, 235, .28);

  /* Typography */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* Spacing scale */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;
  --space-9: 96px;

  /* Motion */
  --ease: cubic-bezier(.4, 0, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --speed: 160ms;
  --speed-2: 240ms;

  /* Layout */
  --container: 1200px;
  --nav-height: 72px;
}

/* ------------------------------------------------------------
   02. Reset & base
   ------------------------------------------------------------ */
*,
*::before,
*::after {
  box-sizing: border-box;
}

* {
  margin: 0;
}

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

body {
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img,
svg,
video {
  display: block;
  max-width: 100%;
}

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

button {
  cursor: pointer;
  background: none;
  border: none;
}

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

a:hover {
  color: var(--primary-600);
}

p {
  overflow-wrap: break-word;
}

h1, h2, h3, h4, h5, h6 {
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -.02em;
  color: var(--text);
  text-wrap: balance;
}

:focus-visible {
  outline: 3px solid rgba(37, 99, 235, .45);
  outline-offset: 2px;
  border-radius: 4px;
}

::selection {
  background: var(--primary-100);
  color: var(--primary-700);
}

/* ------------------------------------------------------------
   03. Typography
   ------------------------------------------------------------ */
.display {
  font-size: clamp(2.4rem, 5vw, 3.8rem);
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: -.03em;
}

.h1 {
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 800;
}

.h2 {
  font-size: clamp(1.6rem, 3vw, 2.25rem);
  font-weight: 800;
}

.h3 {
  font-size: 1.3rem;
  font-weight: 700;
}

.h4 {
  font-size: 1.05rem;
  font-weight: 700;
}

.lead {
  font-size: 1.125rem;
  color: var(--text-2);
}

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

.text-sm {
  font-size: .875rem;
}

.text-xs {
  font-size: .8125rem;
}

.text-center {
  text-align: center;
}

.mono {
  font-family: var(--font-mono);
}

strong {
  font-weight: 600;
}

/* Section headings */
.section-head {
  max-width: 720px;
  margin-bottom: var(--space-7);
}

.section-head--center {
  margin-inline: auto;
  text-align: center;
}

.section-head__eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 14px;
  margin-bottom: var(--space-4);
  font-size: .8125rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--primary-600);
  background: var(--primary-050);
  border: 1px solid var(--primary-100);
  border-radius: var(--radius-full);
}

.section-head__eyebrow--light {
  color: var(--accent);
  background: rgba(6, 182, 212, .08);
  border-color: rgba(6, 182, 212, .25);
}

.section-head__title {
  margin-bottom: var(--space-3);
}

.section-head__title--light {
  color: var(--on-dark);
}

.section-head__desc {
  color: var(--muted);
  font-size: 1.0625rem;
}

.section-head__desc--light {
  color: var(--on-dark-muted);
}

/* ------------------------------------------------------------
   04. Layout helpers
   ------------------------------------------------------------ */
.container {
  width: 100%;
  max-width: var(--container);
  margin-inline: auto;
  padding-inline: var(--space-5);
}

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

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

.section--navy {
  background: var(--surface-navy);
}

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

.section--gradient {
  background:
    radial-gradient(900px 400px at 85% -10%, rgba(37, 99, 235, .14), transparent 60%),
    radial-gradient(700px 380px at 10% 110%, rgba(6, 182, 212, .1), transparent 60%),
    var(--surface-navy);
}

.split {
  display: grid;
  grid-template-columns: 1.05fr .95fr;
  gap: var(--space-8);
  align-items: center;
}

.split--reverse .split__media {
  order: -1;
}

@media (max-width: 992px) {
  .split {
    grid-template-columns: 1fr;
    gap: var(--space-6);
  }

  .split--reverse .split__media {
    order: 0;
  }
}

.bento {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: var(--space-5);
}

@media (max-width: 992px) {
  .bento {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 576px) {
  .bento {
    grid-template-columns: 1fr;
  }
}

/* ------------------------------------------------------------
   05. Buttons
   ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 12px 22px;
  font-size: .9375rem;
  font-weight: 600;
  line-height: 1.2;
  border-radius: var(--radius);
  border: 1px solid transparent;
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: all var(--speed-2) var(--ease);
  text-decoration: none;
}

.btn .icon {
  flex-shrink: 0;
}

.btn:active {
  transform: translateY(1px);
}

.btn--sm {
  padding: 8px 14px;
  font-size: .875rem;
  border-radius: var(--radius-sm);
}

.btn--lg {
  padding: 15px 28px;
  font-size: 1rem;
  border-radius: var(--radius);
}

.btn--block {
  width: 100%;
}

.btn--primary {
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow-primary);
}

.btn--primary:hover {
  background: var(--primary-600);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(37, 99, 235, .35);
}

.btn--accent {
  background: var(--accent);
  color: #062a31;
  box-shadow: 0 8px 24px rgba(6, 182, 212, .3);
}

.btn--accent:hover {
  background: var(--accent-600);
  color: #fff;
  transform: translateY(-1px);
}

.btn--outline {
  border-color: var(--border);
  background: var(--surface);
  color: var(--text);
}

.btn--outline:hover {
  border-color: var(--primary);
  color: var(--primary);
  background: var(--primary-050);
}

.btn--ghost {
  background: transparent;
  color: var(--text-2);
}

.btn--ghost:hover {
  background: var(--surface-hover);
  color: var(--text);
}

.btn--outline-light {
  border-color: var(--border-dark);
  color: var(--on-dark);
  background: transparent;
}

.btn--outline-light:hover {
  border-color: var(--on-dark);
  color: var(--on-dark);
  background: rgba(255, 255, 255, .06);
}

.btn--white {
  background: #fff;
  color: var(--primary-700);
}

.btn--white:hover {
  background: var(--primary-050);
  color: var(--primary-700);
  transform: translateY(-1px);
}

.btn--danger {
  background: var(--danger-050);
  color: var(--danger);
  border-color: rgba(239, 68, 68, .25);
}

.btn--danger:hover {
  background: var(--danger);
  color: #fff;
}

.btn[disabled],
.btn.is-loading {
  opacity: .7;
  pointer-events: none;
}

.btn.is-loading .btn__label {
  visibility: hidden;
}

.btn.is-loading::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, .4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.btn.is-loading {
  position: relative;
}

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

/* Icon-only button */
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  color: var(--text-2);
  transition: all var(--speed) var(--ease);
}

.btn-icon:hover {
  background: var(--surface-hover);
  color: var(--text);
}

/* Link with arrow */
.link-arrow {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-weight: 600;
  font-size: .9375rem;
}

.link-arrow .icon {
  transition: transform var(--speed-2) var(--ease);
}

.link-arrow:hover .icon {
  transform: translateX(4px);
}

/* ------------------------------------------------------------
   06. Badges & pills
   ------------------------------------------------------------ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .03em;
  border-radius: var(--radius-full);
  text-transform: uppercase;
}

.badge--primary {
  background: var(--primary-050);
  color: var(--primary-700);
  border: 1px solid var(--primary-100);
}

.badge--accent {
  background: rgba(6, 182, 212, .1);
  color: var(--accent-600);
  border: 1px solid rgba(6, 182, 212, .3);
}

.badge--success {
  background: var(--success-050);
  color: #047857;
  border: 1px solid rgba(16, 185, 129, .25);
}

.badge--warning {
  background: var(--warning-050);
  color: #b45309;
  border: 1px solid rgba(245, 158, 11, .3);
}

.badge--danger {
  background: var(--danger-050);
  color: #b91c1c;
  border: 1px solid rgba(239, 68, 68, .25);
}

.badge--dark {
  background: rgba(255, 255, 255, .08);
  color: var(--on-dark);
  border: 1px solid var(--border-dark);
}

.badge--dot::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ------------------------------------------------------------
   07. Cards
   ------------------------------------------------------------ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  transition: all var(--speed-2) var(--ease);
}

.card--hover:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-100);
}

.card__body {
  padding: var(--space-5);
}

.card__title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: var(--space-2);
}

.card__text {
  color: var(--muted);
  font-size: .9375rem;
}

/* Feature icon chip */
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 46px;
  height: 46px;
  border-radius: var(--radius);
  color: var(--primary);
  background: var(--primary-050);
  border: 1px solid var(--primary-100);
  flex-shrink: 0;
}

.chip--accent {
  color: var(--accent-600);
  background: rgba(6, 182, 212, .08);
  border-color: rgba(6, 182, 212, .25);
}

.chip--success {
  color: #047857;
  background: var(--success-050);
  border-color: rgba(16, 185, 129, .25);
}

.chip--navy {
  color: var(--accent);
  background: rgba(6, 182, 212, .08);
  border-color: var(--border-dark);
}

.chip--lg {
  width: 56px;
  height: 56px;
}

/* ------------------------------------------------------------
   08. Forms & inputs
   ------------------------------------------------------------ */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: var(--space-4);
}

.field__label {
  font-size: .875rem;
  font-weight: 600;
  color: var(--text-2);
}

.field__hint {
  font-size: .8125rem;
  color: var(--muted);
}

.field__error {
  display: none;
  font-size: .8125rem;
  color: var(--danger);
}

.field--invalid .field__error {
  display: block;
}

.field--invalid .input,
.field--invalid .select {
  border-color: var(--danger);
  box-shadow: 0 0 3px rgba(239, 68, 68, .12);
}

.input,
.select,
.textarea {
  width: 100%;
  padding: 11px 14px;
  font-size: .9375rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: all var(--speed) var(--ease);
}

.input::placeholder,
.textarea::placeholder {
  color: var(--muted-2);
}

.input:hover,
.select:hover,
.textarea:hover {
  border-color: var(--muted-2);
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 3px rgba(37, 99, 235, .14);
}

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

.select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 40px;
  cursor: pointer;
}

/* Checkbox & radio */
.check {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: .9rem;
  cursor: pointer;
}

.check input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

/* Segmented control (billing toggle) */
.billing-toggle {
  position: relative;
  display: inline-flex;
  padding: 4px;
  background: var(--surface-hover);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  gap: 2px;
}

.billing-toggle__btn {
  position: relative;
  z-index: 1;
  padding: 9px 20px;
  font-size: .875rem;
  font-weight: 600;
  color: var(--muted);
  border-radius: var(--radius-sm);
  transition: color var(--speed-2) var(--ease);
}

.billing-toggle__btn:hover {
  color: var(--text);
}

.billing-toggle__btn.is-active {
  color: var(--primary-700);
}

.billing-toggle__glider {
  position: absolute;
  top: 4px;
  left: 4px;
  height: calc(100% - 8px);
  background: var(--surface);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-sm);
  transition: transform var(--speed-2) var(--ease), width var(--speed-2) var(--ease);
  z-index: 0;
}

/* ------------------------------------------------------------
   09. Tables
   ------------------------------------------------------------ */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: .9375rem;
  min-width: 640px;
}

.table th,
.table td {
  padding: 14px 18px;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.table th {
  font-size: .8125rem;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface-hover);
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table tbody tr:hover {
  background: var(--surface-hover);
}

.table .num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.table .is-muted {
  color: var(--muted);
}

/* ------------------------------------------------------------
   10. Alerts & toasts
   ------------------------------------------------------------ */
.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid;
  font-size: .9rem;
  margin-bottom: var(--space-4);
}

.alert .icon {
  flex-shrink: 0;
  margin-top: 2px;
}

.alert--success {
  background: var(--success-050);
  border-color: rgba(16, 185, 129, .3);
  color: #065f46;
}

.alert--warning {
  background: var(--warning-050);
  border-color: rgba(245, 158, 11, .3);
  color: #92400e;
}

.alert--danger {
  background: var(--danger-050);
  border-color: rgba(239, 68, 68, .3);
  color: #991b1b;
}

.alert--info {
  background: var(--primary-050);
  border-color: var(--primary-100);
  color: var(--primary-700);
}

/* Toast stack */
.toast-stack {
  position: fixed;
  top: 84px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 18px;
  min-width: 260px;
  max-width: 360px;
  background: var(--surface-navy);
  color: var(--on-dark);
  border: 1px solid var(--border-dark);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: .9rem;
  pointer-events: auto;
  animation: toast-in var(--speed-2) var(--ease-out);
}

.toast.is-hiding {
  animation: toast-out var(--speed-2) var(--ease) forwards;
}

.toast .icon {
  flex-shrink: 0;
}

.toast--success .icon {
  color: var(--success);
}

.toast--warning .icon {
  color: var(--warning);
}

.toast--danger .icon {
  color: var(--danger);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(24px) scale(.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes toast-out {
  to {
    opacity: 0;
    transform: translateX(24px) scale(.97);
  }
}

/* ------------------------------------------------------------
   11. Utilities
   ------------------------------------------------------------ */
.u-flex {
  display: flex;
}

.u-flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.u-flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.u-gap-2 {
  gap: var(--space-2);
}

.u-gap-3 {
  gap: var(--space-3);
}

.u-gap-4 {
  gap: var(--space-4);
}

.u-grid-2 {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-5);
}

.u-grid-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-5);
}

.u-grid-4 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-5);
}

.u-mt-2 {
  margin-top: var(--space-2);
}

.u-mt-3 {
  margin-top: var(--space-3);
}

.u-mt-4 {
  margin-top: var(--space-4);
}

.u-mt-5 {
  margin-top: var(--space-5);
}

.u-mt-6 {
  margin-top: var(--space-6);
}

.u-mt-7 {
  margin-top: var(--space-7);
}

.u-mb-4 {
  margin-bottom: var(--space-4);
}

.u-mb-5 {
  margin-bottom: var(--space-5);
}

.u-mb-6 {
  margin-bottom: var(--space-6);
}

.u-mb-7 {
  margin-bottom: var(--space-7);
}

.u-hidden {
  display: none !important;
}

@media (max-width: 992px) {
  .u-grid-4,
  .u-grid-3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 576px) {
  .u-grid-4,
  .u-grid-3,
  .u-grid-2 {
    grid-template-columns: 1fr;
  }
}

/* Reveal-on-scroll */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity .7s var(--ease-out), transform .7s var(--ease-out);
}

.reveal.is-visible {
  opacity: 1;
  transform: none;
}

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

  *,
  *::before,
  *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }

  .reveal {
    opacity: 1;
    transform: none;
  }
}
