/**
 * UMG Ecosystem Design System — Shared Component Language
 * Version: 1.0.0 — Jul 7 2026
 * Owner: UMG Creative Director (Katib)
 *
 * Import AFTER tokens.css. Every component references --token vars,
 * never raw hex. Properties inherit this by setting [data-umg-theme].
 *
 * HARD RULES (enforced here structurally):
 * • Gold (#C8912E / --gold) is NEVER a button or CTA.
 * • Forest (#166534 / --forest) = all primary action buttons.
 * • Cream (#FAF8F3 / --cream) = secondary/ghost buttons.
 * • Red (#DC2626 / --red) = admin / destructive only. Never marketing.
 * • Minimum tap target: 44×44px on all interactive elements.
 * • Minimum contrast: 4.5:1 (text), 3:1 (UI components).
 */

/* ─────────────────────────────────────────────────────────────────────────
   BASE RESET + BODY
   ───────────────────────────────────────────────────────────────────────── */

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

body {
  font-family: var(--font-ui);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-primary, var(--ink));
  background-color: var(--surface-base, var(--cream));
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ─────────────────────────────────────────────────────────────────────────
   TYPOGRAPHY — ECOSYSTEM RULES
   ───────────────────────────────────────────────────────────────────────── */

/* Signature display: Amiri in every property hero */
.umg-display,
.umg-hero h1,
.umg-hero h2 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-snug);
  color: var(--text-primary, var(--ink));
}

/* UI type: Outfit everywhere else */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-ui);
  font-weight: var(--weight-semibold);
  line-height: var(--leading-snug);
  color: var(--text-primary, var(--ink));
}

h1 { font-size: var(--text-4xl); letter-spacing: var(--tracking-tight); }
h2 { font-size: var(--text-3xl); letter-spacing: var(--tracking-snug); }
h3 { font-size: var(--text-2xl); }
h4 { font-size: var(--text-xl); }
h5 { font-size: var(--text-lg); }
h6 { font-size: var(--text-md); }

p {
  font-family: var(--font-ui);
  font-size: var(--text-base);
  line-height: var(--leading-relaxed);
  color: var(--text-secondary, #4A6356);
  max-width: 68ch; /* Optimal reading line length */
}

/* Arabic companion type */
.umg-arabic,
[dir="rtl"] {
  font-family: var(--font-arabic);
  line-height: var(--leading-loose);
}

/* ─────────────────────────────────────────────────────────────────────────
   BUTTON SYSTEM — ONE SYSTEM ACROSS ALL PROPERTIES
   Gold is NEVER a button. Forest = primary. Cream = secondary.
   ───────────────────────────────────────────────────────────────────────── */

.umg-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 44px;    /* iOS/Android tap-target minimum */
  min-width: 44px;
  padding: var(--space-3) var(--space-6);
  font-family: var(--font-ui);
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  line-height: 1;
  letter-spacing: var(--tracking-normal);
  border-radius: var(--radius-md);
  border: 1.5px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition:
    background-color var(--duration-fast) var(--ease),
    border-color var(--duration-fast) var(--ease),
    color var(--duration-fast) var(--ease),
    box-shadow var(--duration-fast) var(--ease),
    transform var(--duration-fast) var(--ease);
  white-space: nowrap;
  user-select: none;
}

.umg-btn:focus-visible {
  outline: 3px solid var(--forest);
  outline-offset: 2px;
}

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

/* --- Primary (Forest) --- */
.umg-btn-primary {
  background-color: var(--forest);
  color: var(--cream);
  border-color: var(--forest);
}
.umg-btn-primary:hover {
  background-color: var(--forest-deep);
  border-color: var(--forest-deep);
  box-shadow: 0 4px 12px rgba(22, 101, 52, 0.30);
}

/* --- Secondary (Cream / ghost) --- */
.umg-btn-secondary {
  background-color: transparent;
  color: var(--forest);
  border-color: var(--forest);
}
.umg-btn-secondary:hover {
  background-color: rgba(22, 101, 52, 0.06);
}

/* --- Tertiary (Subtle) --- */
.umg-btn-tertiary {
  background-color: var(--stone);
  color: var(--ink);
  border-color: transparent;
}
.umg-btn-tertiary:hover {
  background-color: #D8D0C5;
}

/* --- Ghost (Inverse, on dark surfaces) --- */
.umg-btn-ghost {
  background-color: rgba(250, 248, 243, 0.12);
  color: var(--cream);
  border-color: rgba(250, 248, 243, 0.30);
}
.umg-btn-ghost:hover {
  background-color: rgba(250, 248, 243, 0.20);
}

/* --- Danger (Admin/destructive ONLY — never marketing) --- */
.umg-btn-danger {
  background-color: var(--red);
  color: #FFFFFF;
  border-color: var(--red);
}
.umg-btn-danger:hover {
  background-color: #B91C1C;
}

/* --- Sizes --- */
.umg-btn-sm {
  min-height: 36px;
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-sm);
  border-radius: var(--radius-sm);
}
.umg-btn-lg {
  min-height: 52px;
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-lg);
  border-radius: var(--radius-lg);
}
.umg-btn-xl {
  min-height: 60px;
  padding: var(--space-4) var(--space-10);
  font-size: var(--text-xl);
  border-radius: var(--radius-lg);
}

/* --- Pill variant --- */
.umg-btn-pill {
  border-radius: var(--radius-pill);
}

/* --- Full width --- */
.umg-btn-full {
  width: 100%;
}

/* --- Disabled state --- */
.umg-btn:disabled,
.umg-btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* ─────────────────────────────────────────────────────────────────────────
   BADGE + TAG SYSTEM
   ───────────────────────────────────────────────────────────────────────── */

.umg-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-1) var(--space-3);
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  line-height: 1;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

/* Tier / status badge variants */
.umg-badge-forest   { background: rgba(22,101,52,0.12);  color: var(--forest); }
.umg-badge-gold     { background: var(--gold);            color: #FFFFFF;       } /* Heritage only */
.umg-badge-emerald  { background: rgba(6,95,70,0.12);    color: var(--emerald);}
.umg-badge-slate    { background: var(--slate);           color: var(--cream);  }
.umg-badge-stone    { background: var(--stone);           color: var(--ink);    }
.umg-badge-live     { background: var(--live-green);      color: #FFFFFF;       } /* LIVE status only */

/* ─────────────────────────────────────────────────────────────────────────
   CARD SYSTEM — 8-pt-star watermark is the signature interior texture
   ───────────────────────────────────────────────────────────────────────── */

.umg-card {
  position: relative;
  background: var(--surface-raised, #FFFFFF);
  border: 1px solid var(--border-subtle, var(--stone));
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow var(--duration-base) var(--ease);
}

/* The star watermark — applied as a CSS pseudo-element using inline SVG */
.umg-card::before {
  content: '';
  position: absolute;
  bottom: -40px;
  right: -40px;
  width: 160px;
  height: 160px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'%3E%3Cpolygon fill='%23166534' points='100,10 114.27,65.56 163.64,36.36 134.44,85.73 190,100 134.44,114.27 163.64,163.64 114.27,134.44 100,190 85.73,134.44 36.36,163.64 65.56,114.27 10,100 65.56,85.73 36.36,36.36 85.73,65.56'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  opacity: 0.06;
  pointer-events: none;
  z-index: 0;
}

/* Card content sits above the watermark */
.umg-card > * {
  position: relative;
  z-index: 1;
}

.umg-card:hover {
  box-shadow: var(--shadow-md);
}

/* Card variants */
.umg-card-elevated {
  box-shadow: var(--shadow-md);
}
.umg-card-elevated:hover {
  box-shadow: var(--shadow-lg);
}

.umg-card-hero {
  padding: var(--space-10) var(--space-8);
  border-radius: var(--radius-2xl);
}

/* ─────────────────────────────────────────────────────────────────────────
   CROSS-PROPERTY TOP NAV
   One shared nav language — never reinvent per property.
   ───────────────────────────────────────────────────────────────────────── */

.umg-nav {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: 0 var(--space-6);
  height: 64px;
  background: rgba(250, 248, 243, 0.92);
  backdrop-filter: blur(12px) saturate(1.5);
  -webkit-backdrop-filter: blur(12px) saturate(1.5);
  border-bottom: 1px solid var(--stone);
}

.umg-nav-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  text-decoration: none;
  flex-shrink: 0;
}

.umg-nav-seal {
  width: 36px;
  height: 36px;
  display: block;
}

.umg-nav-property-name {
  font-family: var(--font-ui);
  font-weight: var(--weight-semibold);
  font-size: var(--text-lg);
  color: var(--text-primary, var(--ink));
  letter-spacing: var(--tracking-snug);
}

.umg-nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-1);
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
}

.umg-nav-link {
  font-family: var(--font-ui);
  font-weight: var(--weight-medium);
  font-size: var(--text-sm);
  color: var(--text-secondary, #4A6356);
  text-decoration: none;
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  transition: color var(--duration-fast), background-color var(--duration-fast);
}

.umg-nav-link:hover {
  color: var(--forest);
  background-color: rgba(22, 101, 52, 0.06);
}

.umg-nav-link.active {
  color: var(--forest);
  font-weight: var(--weight-semibold);
}

.umg-nav-cta {
  margin-left: auto;
  flex-shrink: 0;
}

/* ─────────────────────────────────────────────────────────────────────────
   FORM CONTROLS
   ───────────────────────────────────────────────────────────────────────── */

.umg-label {
  display: block;
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--text-primary, var(--ink));
  margin-bottom: var(--space-2);
}

.umg-input {
  display: block;
  width: 100%;
  min-height: 44px;
  padding: var(--space-3) var(--space-4);
  font-family: var(--font-ui);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--text-primary, var(--ink));
  background-color: var(--surface-raised, #FFFFFF);
  border: 1.5px solid var(--border-default);
  border-radius: var(--radius-md);
  transition:
    border-color var(--duration-fast) var(--ease),
    box-shadow var(--duration-fast) var(--ease);
}

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

.umg-input:hover {
  border-color: var(--border-strong);
}

.umg-input:focus {
  outline: none;
  border-color: var(--forest);
  box-shadow: 0 0 0 3px rgba(22, 101, 52, 0.15);
}

.umg-input:disabled {
  background-color: var(--stone);
  opacity: 0.6;
  cursor: not-allowed;
}

.umg-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%230F1F17'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 16px;
  padding-right: var(--space-10);
}

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

/* Field group */
.umg-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}

.umg-field-hint {
  font-size: var(--text-sm);
  color: var(--text-muted);
  line-height: var(--leading-snug);
}

.umg-field-error {
  font-size: var(--text-sm);
  color: var(--red);
  line-height: var(--leading-snug);
}

/* ─────────────────────────────────────────────────────────────────────────
   HERO SECTION — Amiri display + ecosystem grammar
   ───────────────────────────────────────────────────────────────────────── */

.umg-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: var(--space-24) var(--space-6);
  background-color: var(--cream);
  position: relative;
  overflow: hidden;
}

/* Tessellation field behind hero */
.umg-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'%3E%3Cpolygon fill='%23166534' points='100,10 114.27,65.56 163.64,36.36 134.44,85.73 190,100 134.44,114.27 163.64,163.64 114.27,134.44 100,190 85.73,134.44 36.36,163.64 65.56,114.27 10,100 65.56,85.73 36.36,36.36 85.73,65.56'/%3E%3C/svg%3E");
  background-size: 48px 48px;
  background-repeat: repeat;
  opacity: 0.035;
  pointer-events: none;
}

.umg-hero > * { position: relative; z-index: 1; }

.umg-hero-eyebrow {
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  letter-spacing: var(--tracking-widest);
  text-transform: uppercase;
  color: var(--forest);
  margin-bottom: var(--space-4);
}

.umg-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(var(--text-3xl), 5vw, var(--text-6xl));
  font-weight: 700;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-snug);
  color: var(--ink);
  max-width: 900px;
  margin-bottom: var(--space-6);
}

.umg-hero-sub {
  font-family: var(--font-ui);
  font-size: clamp(var(--text-lg), 2vw, var(--text-xl));
  font-weight: var(--weight-normal);
  line-height: var(--leading-relaxed);
  color: var(--text-secondary, #4A6356);
  max-width: 60ch;
  margin-bottom: var(--space-10);
}

/* ─────────────────────────────────────────────────────────────────────────
   SECTION DIVIDER — Khatim accent
   ───────────────────────────────────────────────────────────────────────── */

.umg-divider {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin: var(--space-12) 0;
}

.umg-divider::before,
.umg-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--stone);
}

.umg-divider-star {
  width: 20px;
  height: 20px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 200'%3E%3Cpolygon fill='%23C8912E' points='100,10 114.27,65.56 163.64,36.36 134.44,85.73 190,100 134.44,114.27 163.64,163.64 114.27,134.44 100,190 85.73,134.44 36.36,163.64 65.56,114.27 10,100 65.56,85.73 36.36,36.36 85.73,65.56'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  opacity: 0.6;
  flex-shrink: 0;
}

/* ─────────────────────────────────────────────────────────────────────────
   NOTIFICATION / TOAST SYSTEM
   ───────────────────────────────────────────────────────────────────────── */

.umg-toast {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  line-height: var(--leading-snug);
}

.umg-toast-success { background: var(--forest);   color: var(--cream); }
.umg-toast-info    { background: var(--slate);    color: var(--cream); }
.umg-toast-warning { background: var(--gold);     color: #FFFFFF;      }
.umg-toast-error   { background: var(--red);      color: #FFFFFF;      }

/* ─────────────────────────────────────────────────────────────────────────
   HELP MODE BANNER — Admin only, never marketing
   Per spec: sticky red 44px top bar.
   ───────────────────────────────────────────────────────────────────────── */

.umg-help-mode-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 44px;
  z-index: var(--z-help-mode);
  background-color: var(--red);
  color: #FFFFFF;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-5);
  font-family: var(--font-ui);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
}

.umg-help-mode-banner + * {
  padding-top: 44px;
}

/* ─────────────────────────────────────────────────────────────────────────
   TIER / PLAN COMPARISON CARDS
   Per Ummah One spec: no gold CTAs, forest-primary, honest status tags
   ───────────────────────────────────────────────────────────────────────── */

.umg-tier-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
  padding: var(--space-8);
  border-radius: var(--radius-xl);
  border: 1.5px solid var(--stone);
  background: var(--cream);
  position: relative;
  overflow: hidden;
}

.umg-tier-card.featured {
  border-color: var(--forest);
  background: #FFFFFF;
  box-shadow: var(--shadow-md);
}

.umg-tier-name {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--ink);
}

.umg-tier-price {
  font-size: var(--text-4xl);
  font-weight: var(--weight-bold);
  color: var(--ink);
}

.umg-tier-price-note {
  font-size: var(--text-sm);
  color: var(--text-muted);
}

.umg-tier-features {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.umg-tier-feature {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

/* ─────────────────────────────────────────────────────────────────────────
   LAYOUT UTILITIES
   ───────────────────────────────────────────────────────────────────────── */

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

.umg-container-narrow {
  max-width: 720px;
}

.umg-container-wide {
  max-width: 1400px;
}

.umg-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-6); }
.umg-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-6); }
.umg-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-6); }

/* Responsive grid collapse */
@media (max-width: 768px) {
  .umg-grid-2,
  .umg-grid-3,
  .umg-grid-4 {
    grid-template-columns: 1fr;
  }
}

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

/* ─────────────────────────────────────────────────────────────────────────
   FOOTER
   ───────────────────────────────────────────────────────────────────────── */

.umg-footer {
  padding: var(--space-16) var(--space-6) var(--space-8);
  background-color: var(--ink);
  color: var(--cream);
}

.umg-footer a {
  color: rgba(250, 248, 243, 0.6);
  text-decoration: none;
  font-size: var(--text-sm);
  transition: color var(--duration-fast);
}

.umg-footer a:hover {
  color: var(--cream);
}

.umg-footer-tagline {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  color: var(--gold);
  margin-bottom: var(--space-6);
}

/* ─────────────────────────────────────────────────────────────────────────
   ACCESSIBILITY UTILITIES
   ───────────────────────────────────────────────────────────────────────── */

.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;
}

/* Focus-visible ring — forest for all interactive elements */
:focus-visible {
  outline: 3px solid var(--forest);
  outline-offset: 2px;
  border-radius: 2px;
}

/* ─────────────────────────────────────────────────────────────────────────
   MOBILE RESPONSIVE ADJUSTMENTS
   ───────────────────────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .umg-container {
    padding: 0 var(--space-4);
  }

  .umg-hero {
    padding: var(--space-16) var(--space-4);
  }

  .umg-nav {
    padding: 0 var(--space-4);
    height: 56px;
  }

  .umg-nav-links {
    display: none; /* Collapsed on mobile — use hamburger */
  }
}
