/* ==========================================================
   DAREKANI brand design system v1 (Phase 1 / 2026-09-29)
   Loaded after legacy site.css. This file owns semantic tokens
   and shared primitives; site.css remains legacy/page-specific.
   ========================================================== */

/* 1. Semantic tokens ---------------------------------------------------- */
:root,
html[data-brand="darekani"],
body[data-brand="darekani"] {
  color-scheme: light;
  --brand-primary: #078cf0;
  --brand-primary-strong: #056ec0;
  --brand-secondary: #14b866;
  --brand-secondary-strong: #087a43;
  --brand-accent: #ff8a00;
  --brand-accent-strong: #d66f00;
  --brand-background: #f5faff;
  --brand-surface: #ffffff;
  --brand-surface-muted: #f4fbf7;
  --brand-text: #063b72;
  --brand-text-muted: #52657a;
  --brand-border: #e6edf5;
  --brand-focus: #7c3aed;
  --brand-on-primary: #ffffff;
  --brand-radius-small: 12px;
  --brand-radius-medium: 16px;
  --brand-radius-large: 18px;
  --brand-shadow: 0 4px 16px rgba(6, 59, 114, .06);
  --brand-shadow-raised: 0 12px 28px rgba(6, 59, 114, .12);
  --brand-container: 1200px;
  --brand-gutter: 24px;
  --brand-header-height: 72px;
  --brand-space-1: 4px;
  --brand-space-2: 8px;
  --brand-space-3: 12px;
  --brand-space-4: 16px;
  --brand-space-5: 24px;
  --brand-space-6: 32px;
  --brand-space-7: 48px;
  --brand-space-8: 64px;

  /* Compatibility bridge for existing pages. */
  --blue-900: var(--brand-text);
  --blue-700: var(--brand-primary-strong);
  --blue-600: var(--brand-primary-strong);
  --blue-100: #cfeaff;
  --blue-50: #eaf6ff;
  --green: var(--brand-secondary-strong);
  --green-bg: #e8f9f0;
  --amber: var(--brand-accent);
  --line: var(--brand-border);
  --card: var(--brand-surface);
  --bg: var(--brand-background);
  --ink: var(--brand-text);
  --ink-2: var(--brand-text-muted);
}

html[data-brand="pro"],
body[data-brand="pro"] {
  color-scheme: light;
  --brand-primary: #0f6fcb;
  --brand-primary-strong: #0a579f;
  --brand-secondary: #d4af37;
  --brand-secondary-strong: #b48d20;
  --brand-accent: #e8c973;
  --brand-accent-strong: #d4af37;
  --brand-background: #f4f7fa;
  --brand-surface: #ffffff;
  --brand-surface-muted: #edf3f7;
  --brand-text: #031828;
  --brand-text-muted: #607486;
  --brand-border: #dce5ec;
  --brand-focus: #ffdf85;
  --brand-on-primary: #ffffff;
  --brand-radius-small: 6px;
  --brand-radius-medium: 10px;
  --brand-radius-large: 12px;
  --brand-shadow: 0 5px 18px rgba(3, 24, 40, .08);
  --brand-shadow-raised: 0 14px 32px rgba(3, 24, 40, .16);

  /* Compatibility bridge for existing PRO pages. */
  --blue-900: var(--brand-text);
  --blue-700: var(--brand-primary);
  --blue-600: var(--brand-primary);
  --blue-50: var(--brand-surface-muted);
  --line: var(--brand-border);
  --card: var(--brand-surface);
  --bg: var(--brand-background);
  --ink: var(--brand-text);
  --ink-2: var(--brand-text-muted);
}

/* 2. Base and layout ---------------------------------------------------- */
.container {
  width: min(100% - (2 * var(--brand-gutter)), var(--brand-container));
  max-width: none;
  margin-inline: auto;
  padding-inline: 0;
}

.brand-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--brand-gutter);
}

:where(a, button, input, select, textarea, summary):focus-visible {
  outline: 3px solid var(--brand-focus);
  outline-offset: 3px;
}

/* 3. Shared components ------------------------------------------------- */
.brand-logo {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  gap: 3px;
  color: var(--brand-text);
}

.brand img.brand-logo__image,
.brand-logo__image {
  display: block;
  width: auto;
  height: 35px;
  max-width: 100%;
}

.brand-logo__tagline {
  display: block;
  color: inherit;
  font-size: .56rem;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: 0;
}

.ui-button {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px 20px;
  border: 1px solid transparent;
  border-radius: var(--brand-radius-small);
  font: 800 .95rem/1.35 var(--font-body);
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease, box-shadow .16s ease, transform .16s ease;
}

.ui-button:hover { transform: translateY(-1px); box-shadow: var(--brand-shadow); }
.ui-button:active { transform: translateY(0); }
.ui-button--primary { color: var(--brand-on-primary); background: var(--brand-primary-strong); }
.ui-button--primary:hover { color: var(--brand-on-primary); background: var(--brand-text); }
.ui-button--secondary { color: var(--brand-on-primary); background: var(--brand-secondary-strong); }
.ui-button--secondary:hover { color: var(--brand-on-primary); background: #065d35; }
.ui-button--accent { color: #2f2200; background: var(--brand-accent); }
.ui-button--accent:hover { color: #211700; background: var(--brand-accent-strong); }
.ui-button--outline { color: var(--brand-primary-strong); background: transparent; border-color: currentColor; }
.ui-button--outline:hover { color: var(--brand-text); background: color-mix(in srgb, var(--brand-primary) 7%, transparent); }
.ui-button--ghost { color: var(--brand-text); background: transparent; }
.ui-button--small { min-height: 40px; padding: 8px 15px; font-size: .85rem; }
.ui-button--large { min-height: 56px; padding: 14px 26px; font-size: 1.05rem; }
.ui-button--block { width: 100%; }
.ui-button[disabled], .ui-button[aria-disabled="true"] { opacity: .5; pointer-events: none; }

.ui-card {
  border: 1px solid var(--brand-border);
  border-radius: var(--brand-radius-medium);
  color: var(--brand-text);
  background: var(--brand-surface);
  box-shadow: var(--brand-shadow);
}

.ui-card--padding-small { padding: var(--brand-space-4); }
.ui-card--padding-medium { padding: var(--brand-space-5); }
.ui-card--padding-large { padding: var(--brand-space-6); }
.ui-card--interactive { transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease; }
.ui-card--interactive:hover { border-color: var(--brand-primary); box-shadow: var(--brand-shadow-raised); transform: translateY(-2px); }

.ui-section-title { max-width: 760px; margin-bottom: var(--brand-space-5); }
.ui-section-title--center { margin-inline: auto; text-align: center; }
.ui-section-title__eyebrow {
  margin: 0 0 var(--brand-space-2);
  color: var(--brand-primary-strong);
  font-size: .75rem;
  font-weight: 900;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.ui-section-title h1,
.ui-section-title h2,
.ui-section-title h3 { margin: 0; color: var(--brand-text); line-height: 1.35; }
.ui-section-title h1 { font-size: clamp(1.8rem, 3vw, 2.45rem); }
.ui-section-title h2 { font-size: clamp(1.55rem, 2.4vw, 2rem); }
.ui-section-title h3 { font-size: clamp(1.2rem, 1.8vw, 1.5rem); }
.ui-section-title h1::before,
.ui-section-title h2::before,
.ui-section-title h3::before { display: none; }
.ui-section-title__description { margin-top: var(--brand-space-3); color: var(--brand-text-muted); }
.ui-section-title__description > :first-child { margin-top: 0; }
.ui-section-title__description > :last-child { margin-bottom: 0; }

/* Header/footer shell shared by both brands. */
.brand-header { min-height: var(--brand-header-height); }
.brand-header__inner { min-height: var(--brand-header-height); height: auto; gap: var(--brand-space-5); }
.brand-header__home { flex: 0 1 auto; min-width: 0; }
.brand-header__nav { gap: var(--brand-space-1); }
.brand-header__nav a { border-radius: var(--brand-radius-small); }
.brand-header__nav .nav-cta { border-radius: var(--brand-radius-small); }

.brand-footer { margin-top: var(--brand-space-8); padding-block: var(--brand-space-7) var(--brand-space-6); }
.brand-footer__brand { display: flex; flex-wrap: wrap; align-items: center; gap: var(--brand-space-3); }
.brand-footer__descriptor { font-size: .72rem; font-weight: 500; }
.brand-footer__heading { color: #fff; font-size: .8rem; }
.brand-footer .brand-logo { color: #fff; }
.brand-footer .brand-logo__tagline { color: inherit; }

/* 4. Standard theme ---------------------------------------------------- */
body[data-brand="darekani"] .brand-header {
  border-bottom-color: var(--brand-border);
  background: rgba(255, 255, 255, .94);
}

body[data-brand="darekani"] .brand-footer { background: #063b72; }

/* 5. PRO theme --------------------------------------------------------- */
body[data-brand="pro"] { background: var(--brand-background); }
body[data-brand="pro"] .brand-header {
  border-bottom-color: rgba(255, 255, 255, .14);
  background: rgba(3, 24, 40, .97);
}
body[data-brand="pro"] .brand-header .brand-logo,
body[data-brand="pro"] .brand-header__nav a { color: #fff; }
body[data-brand="pro"] .brand-header .brand-logo__tagline { color: #c9d4dd; }
body[data-brand="pro"] .brand-header__nav a:hover { color: var(--brand-accent); background: rgba(255, 255, 255, .08); }
body[data-brand="pro"] .brand-header__nav .nav-cta-gold { color: #031828; background: linear-gradient(135deg, #f1d489, #c89b37); }
body[data-brand="pro"] .brand-footer { background: #031828; }
body[data-brand="pro"] .ui-button--secondary,
body[data-brand="pro"] .ui-button--accent { color: #031828; }
body[data-brand="pro"] .ui-button--secondary { background: var(--brand-secondary); }
body[data-brand="pro"] .ui-button--secondary:hover { background: var(--brand-secondary-strong); }

/* 6. Preview page (local/testing only) -------------------------------- */
.design-system-preview { padding-block: var(--brand-space-7); }
.design-system-preview__intro { margin-bottom: var(--brand-space-7); }
.design-system-preview__section { margin-top: var(--brand-space-7); }
.design-system-preview__swatches { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--brand-space-3); }
.design-system-preview__swatch { min-height: 108px; padding: var(--brand-space-4); border: 1px solid var(--brand-border); border-radius: var(--brand-radius-small); background: var(--brand-surface); }
.design-system-preview__swatch::before { content: ""; display: block; height: 44px; margin-bottom: var(--brand-space-2); border-radius: calc(var(--brand-radius-small) / 2); background: var(--swatch); }
.design-system-preview__actions { display: flex; flex-wrap: wrap; gap: var(--brand-space-3); }
.design-system-preview__cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--brand-space-5); }
.design-system-preview__cards h3 { margin: 0 0 var(--brand-space-2); }
.design-system-preview__cards p { margin: 0; color: var(--brand-text-muted); }
.design-system-preview__theme-switch { display: flex; gap: var(--brand-space-2); margin-top: var(--brand-space-5); }

/* 7. Responsive and motion -------------------------------------------- */
@media (max-width: 900px) {
  :root { --brand-gutter: 20px; }
  .brand-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 20px; }
  .design-system-preview__swatches { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .design-system-preview__cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 540px) {
  :root { --brand-gutter: 16px; --brand-header-height: 64px; }
  .brand-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
  .brand img.brand-logo__image,
  .brand-logo__image { width: auto; height: 31px; }
  .brand-logo__tagline { max-width: 176px; font-size: .5rem; }
  .design-system-preview { padding-block: var(--brand-space-6); }
  .design-system-preview__swatches { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .design-system-preview__actions { display: grid; grid-template-columns: 1fr; }
  .design-system-preview__cards { grid-template-columns: 1fr; }
  .design-system-preview__theme-switch { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
