/* Future Cards — shared micro-interactions only.
   IMPORTANT: This file does NOT define brand colors, fonts, spacing, or layout.
   All visual identity comes from brand.jsx tokens. This file only adds:
   - Page-level base reset (matches the original prototype)
   - Smooth-scroll behavior
   - Generic hover/transition affordances applied via classes
   - Page loader animation
   - Skeleton/loading shimmer for fake-async UI
   It must never override component-level styles defined inline in JSX. */

html, body, #root { margin: 0; padding: 0; min-height: 100%; }
html { scroll-behavior: smooth; }
body {
  font-family: "Lato", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f0eee9;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
* { box-sizing: border-box; }
input, button, select, textarea { font-family: inherit; }

/* Scrollbar polish — same values the prototype already uses. */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,0.12); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,0.22); }
::-webkit-scrollbar-track { background: transparent; }

/* Reusable affordance class — adds a subtle lift on hover.
   Components opt-in by adding className="fc-lift" alongside their inline styles. */
.fc-lift { transition: transform .18s cubic-bezier(.2,.7,.3,1), box-shadow .18s cubic-bezier(.2,.7,.3,1); }
.fc-lift:hover { transform: translateY(-2px); }
.fc-lift:active { transform: translateY(0); transition-duration: .08s; }

/* Pressable — for primary CTAs already styled inline. Adds tactile press feel. */
.fc-press { transition: transform .12s ease, opacity .12s ease, box-shadow .18s ease; }
.fc-press:hover { opacity: .94; }
.fc-press:active { transform: scale(.97); }

/* Soft underline for nav links that already get color from inline styles. */
.fc-underline { position: relative; }
.fc-underline::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -4px;
  height: 1.5px; background: currentColor; transform: scaleX(0); transform-origin: left;
  transition: transform .22s ease;
}
.fc-underline:hover::after { transform: scaleX(1); }

/* Page loader — top progress bar shown briefly between page navigations. */
.page-loader {
  position: fixed; top: 0; left: 0; right: 0; height: 2px; z-index: 9999;
  background: transparent; pointer-events: none; opacity: 0; transition: opacity .25s ease;
}
.page-loader.is-visible { opacity: 1; }
.page-loader__bar {
  height: 100%; width: 30%; background: #0B7470;
  animation: fc-loader 1.1s cubic-bezier(.4,0,.2,1) infinite;
  box-shadow: 0 0 8px rgba(11,116,112,0.5);
}
@keyframes fc-loader {
  0%   { transform: translateX(-100%); width: 30%; }
  50%  { width: 50%; }
  100% { transform: translateX(380%); width: 30%; }
}

/* Skeleton shimmer for fake loading states inside the dashboard. */
.fc-skeleton {
  background: linear-gradient(90deg, rgba(0,0,0,.04) 0%, rgba(0,0,0,.08) 50%, rgba(0,0,0,.04) 100%);
  background-size: 200% 100%;
  animation: fc-shimmer 1.4s ease-in-out infinite;
  border-radius: 6px;
}
@keyframes fc-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

/* Fade-in for section reveals as the user scrolls. JS toggles .is-visible. */
.fc-reveal { opacity: 0; transform: translateY(12px); transition: opacity .55s ease, transform .55s ease; }
.fc-reveal.is-visible { opacity: 1; transform: translateY(0); }

/* Soft focus ring for keyboard users — accessible without disturbing the design. */
:focus-visible {
  outline: 2px solid #0B7470;
  outline-offset: 2px;
  border-radius: 4px;
}

/* Modal / toast container helpers (used by dashboard fake actions). */
.fc-toast-stack {
  position: fixed; bottom: 84px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; z-index: 300; pointer-events: none;
}
.fc-toast {
  background: #1a1a1a; color: #fff; padding: 10px 16px; border-radius: 100px;
  font-size: 13px; font-weight: 600; box-shadow: 0 10px 30px rgba(0,0,0,.25);
  animation: fc-toast-in .25s ease both;
  pointer-events: auto;
}
@keyframes fc-toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fc-toast.is-leaving { animation: fc-toast-out .2s ease both; }
@keyframes fc-toast-out {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(8px); }
}

/* ============================================================
   Responsive overrides (mobile + tablet)
   Site is built with inline JSX styles, so we override via attribute
   selectors that match React's serialized style strings, plus a few
   class hooks (.fc-desktop-nav, .fc-mobile-menu-btn, .fc-pricing-table,
   .fc-bcard-mock, .fc-event-dash) that JSX adds explicitly.
   ============================================================ */

/* Default: hamburger button hidden on desktop */
.fc-mobile-menu-btn { display: none !important; }

/* Saudi Tech partner badge — co-branded endorsement next to FC logo */
.fc-partner-badge img { transition: opacity .18s ease; }
.fc-partner-badge:hover img { opacity: 0.85; }

/* Products dropdown — desktop nav hover menu */
.fc-dd-item:hover { background: rgba(11,116,112,0.06); }
.fc-dd-item:active { background: rgba(11,116,112,0.10); }
.fc-dd-item:focus-visible { outline: none; background: rgba(11,116,112,0.08); }

/* Mobile drawer: tactile press on items */
.fc-drawer-item:hover { background: rgba(11,116,112,0.06); }
.fc-drawer-item:active { background: rgba(11,116,112,0.12); transform: scale(0.99); }
.fc-drawer-item:focus-visible { outline: none; background: rgba(11,116,112,0.08); }

/* Tablet: collapse very wide grids to 2 columns */
@media (max-width: 980px) {
  [style*="grid-template-columns: repeat(4"],
  [style*="grid-template-columns: repeat(3"] {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

/* ---------- Mobile breakpoint ---------- */
@media (max-width: 720px) {
  /* Collapse all inline-styled grids to a single column.
     This handles hero, products, footer, stats, how-it-works,
     pricing tiers, contact form, and event-dash overview. */
  [style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    gap: 20px !important;
  }
  /* The pricing comparison table opts out of stacking — it stays
     3-col with horizontal scroll. We mark it explicitly in JSX. */
  .fc-pricing-table,
  .fc-pricing-table [style*="grid-template-columns"] {
    grid-template-columns: 1.6fr 1fr 1fr !important;
    min-width: 520px;
  }
  .fc-pricing-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* BCard builder theme swatches: stay 6-col so they're tappable
     thumbnails, not full-width blocks. */
  .fc-theme-grid {
    grid-template-columns: repeat(6, 1fr) !important;
    gap: 8px !important;
  }

  /* Tame headlines */
  [style*="font-size: 76px"] { font-size: 40px !important; letter-spacing: -1px !important; line-height: 1.05 !important; }
  [style*="font-size: 72px"] { font-size: 38px !important; letter-spacing: -1px !important; line-height: 1.05 !important; }
  [style*="font-size: 64px"] { font-size: 36px !important; letter-spacing: -1px !important; }
  [style*="font-size: 56px"] { font-size: 30px !important; letter-spacing: -0.6px !important; line-height: 1.1 !important; }
  [style*="font-size: 52px"] { font-size: 28px !important; letter-spacing: -0.4px !important; line-height: 1.15 !important; }
  [style*="font-size: 44px"] { font-size: 26px !important; letter-spacing: -0.4px !important; }
  [style*="font-size: 26px"] { font-size: 20px !important; }
  [style*="font-size: 24px"] { font-size: 19px !important; }
  [style*="font-size: 19px"] { font-size: 16px !important; }
  [style*="font-size: 18px"] { font-size: 15px !important; }
  [style*="font-size: 17px"] { font-size: 15px !important; }

  /* Reduce horizontal padding on hero/section containers */
  [style*="padding: 18px 40px"] { padding-left: 16px !important; padding-right: 16px !important; }
  [style*="padding: 40px 40px"] { padding-left: 18px !important; padding-right: 18px !important; }
  [style*="padding: 60px 40px"] { padding-left: 18px !important; padding-right: 18px !important; }
  [style*="padding: 80px 40px"] { padding: 56px 18px !important; }
  [style*="padding: 80px 40px 60px"] { padding: 48px 18px 36px !important; }
  [style*="padding: 80px 40px 40px"] { padding: 48px 18px 28px !important; }
  [style*="padding: 80px 40px 20px"] { padding: 48px 18px 16px !important; }
  [style*="padding: 100px 40px"] { padding: 64px 18px !important; }
  [style*="padding: 100px 40px 60px"] { padding: 56px 18px 36px !important; }
  [style*="padding: 40px 40px 80px"] { padding: 28px 18px 56px !important; }
  [style*="padding: 0 40px 100px"] { padding: 0 18px 64px !important; }
  [style*="padding: 60px 40px 100px"] { padding: 40px 18px 64px !important; }
  [style*="padding: 60px 40px 32px"] { padding: 40px 18px 24px !important; }
  [style*="padding: 80px 60px"] { padding: 48px 22px !important; }

  /* ---------- Top nav: replace desktop links with hamburger ---------- */
  .fc-nav-row {
    gap: 12px !important;
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
  .fc-desktop-nav,
  .fc-desktop-only { display: none !important; }
  .fc-mobile-menu-btn { display: inline-flex !important; }

  /* Logo row + partner badge: tighten gaps, shrink badge, and hide the
     "Future Cards" wordmark on phones so the FC icon + Saudi Tech mark
     + hamburger all fit comfortably without horizontal overflow. */
  .fc-nav-row { flex-wrap: nowrap !important; }
  .fc-nav-row .fc-logo-row { gap: 8px !important; min-width: 0; flex-shrink: 1; }
  .fc-nav-row .fc-logo-name { display: none !important; }
  .fc-nav-row .fc-partner-badge {
    padding-inline-start: 8px !important;
    margin-inline-start: 2px !important;
    height: 28px !important;
    flex-shrink: 0;
  }
  .fc-nav-row .fc-partner-badge.is-en img { height: 20px !important; }
  .fc-nav-row .fc-partner-badge.is-ar img { height: 26px !important; }
  .fc-mobile-menu-btn { flex-shrink: 0 !important; margin-inline-start: auto; }

  /* Hero visual: shrink stage heights */
  [style*="height: 640px"] { height: 460px !important; }
  [style*="height: 560px"] { height: 420px !important; }

  /* Big rounded CTA card */
  [style*="border-radius: 32px"][style*="padding"] { border-radius: 22px !important; }

  /* Stats row: when collapsed, remove side dividers */
  [style*="border-inline-start: 1px solid"] {
    border-inline-start: none !important;
    border-top: 1px solid rgba(0,0,0,0.06);
  }

  /* Wide gaps shrink */
  [style*="gap: 60px"] { gap: 28px !important; }
  [style*="gap: 80px"] { gap: 32px !important; }
  [style*="gap: 40px"] { gap: 20px !important; }

  /* Tilt-card stacks scale down so rotated cards still fit */
  [style*="transform: rotate(-7deg)"],
  [style*="transform: rotate(5deg)"],
  [style*="transform: rotate(-4deg)"],
  [style*="transform: rotate(8deg)"],
  [style*="transform: rotate(3deg)"] {
    transform: scale(0.7) rotate(var(--r, 0deg)) !important;
  }
  [style*="transform: rotate(-7deg)"] { --r: -7deg; }
  [style*="transform: rotate(5deg)"]  { --r: 5deg; }
  [style*="transform: rotate(-4deg)"] { --r: -4deg; }
  [style*="transform: rotate(8deg)"]  { --r: 8deg; }
  [style*="transform: rotate(3deg)"]  { --r: 3deg; }

  /* CTA & footer button rows: full-width buttons on mobile */
  button { max-width: 100%; }

  /* ---------- Footer: clean stacked layout ---------- */
  footer { padding: 40px 18px 28px !important; }
  /* Footer columns container: stack with consistent spacing */
  footer > div > div[style*="grid-template-columns"] {
    grid-template-columns: 1fr !important;
    gap: 28px !important;
    margin-bottom: 28px !important;
  }
  /* Footer brand block: keep description readable, not capped */
  footer p { max-width: 100% !important; }
  /* Bottom legal row: stack & start-aligned */
  footer [style*="justify-content: space-between"][style*="flex-wrap: wrap"] {
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    gap: 8px !important;
  }

  /* Prefs toggle bottom offset */
  .fc-toast-stack { bottom: 76px; }

  /* ---------- Dashboard frame (dashboard.html) ---------- */
  /* Hide sidebar entirely on mobile — replaced by bottom tab bar */
  .fc-dash-sidebar { display: none !important; }
  /* Header: drop search bar & upgrade pill text, tighten padding */
  .fc-dash-header {
    padding: 10px 14px !important;
    gap: 10px !important;
  }
  .fc-dash-search { display: none !important; }
  /* Compact upgrade pill on mobile: keep visible, drop label text. */
  .fc-dash-upgrade {
    padding: 7px 10px !important;
    font-size: 0 !important;
    gap: 0 !important;
  }
  .fc-dash-upgrade svg { width: 14px !important; height: 14px !important; }
  /* Reserve space at bottom for the tab bar (60px + safe-area) */
  .fc-dash-content { padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)) !important; }
  /* PrefsToggle floats above tabs */
  .fc-toast-stack { bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }

  /* When viewing the bcard/event applet on mobile, drop the inner
     forced height so content scrolls naturally with the page. */
  .fc-dash-applet { height: auto !important; min-height: 0 !important; }

  /* event-dash.jsx now ships its own mobile layout (different render
     path), so the desktop fc-event-* selectors don't fire here. */
}

/* Very small phones */
@media (max-width: 380px) {
  [style*="font-size: 76px"] { font-size: 32px !important; }
  [style*="font-size: 72px"] { font-size: 30px !important; }
  [style*="font-size: 64px"] { font-size: 28px !important; }
  [style*="font-size: 56px"] { font-size: 26px !important; }

  /* Tighter Saudi Tech mark on very small phones */
  .fc-nav-row .fc-partner-badge.is-en img { height: 18px !important; }
  .fc-nav-row .fc-partner-badge.is-ar img { height: 24px !important; }
}
