/* ============================================================================
   PREMIUM EXPERIENCE LAYER (NON-DESTRUCTIVE)
   Purpose: Subtle polish with micro-interactions, depth transitions,
   typography rhythm, reduced-motion support, and desktop gutter tuning
   ============================================================================ */

:root {
  --ease-premium: cubic-bezier(.25, .1, .25, 1);
  --dur-fast: 150ms;
  --dur-base: 250ms;
  --dur-slow: 380ms;
  --elev-1: 0 2px 8px rgba(0, 0, 0, .06);
  --elev-2: 0 6px 20px rgba(0, 0, 0, .12);
}

/* ===== MOTION SAFETY ===== */
/* Respect user's motion preferences (WCAG 2.3.3) */
@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}

/* ===== BUTTONS & CTAs: HOVER/TAP ELEVATION AND SCALE ===== */
:where(.btn, .button, .cta, .btn-primary, .btn-secondary, .btn-primary-cta, .btn-signin-royal, .mobile-icon-btn) {
  transition: transform var(--dur-fast) var(--ease-premium),
              box-shadow var(--dur-base) var(--ease-premium),
              background-color var(--dur-fast) var(--ease-premium),
              border-color var(--dur-fast) var(--ease-premium);
  will-change: transform;
}

:where(.btn, .button, .cta, .btn-primary, .btn-secondary, .btn-primary-cta, .btn-signin-royal, .mobile-icon-btn):hover {
  transform: translateY(-1px);
  box-shadow: var(--elev-1);
}

:where(.btn, .button, .cta, .btn-primary, .btn-secondary, .btn-primary-cta, .btn-signin-royal, .mobile-icon-btn):active {
  transform: translateY(0);
  box-shadow: none;
}

/* ===== FOCUS RING (ACCESSIBLE, HIGH-CONTRAST) ===== */
/* WCAG 2.4.7: Focus Visible with ≥3:1 contrast */
:where(a, button, .btn, .card, .input, .mobile-nav-item, .nav-item, [tabindex]):focus-visible {
  outline: 2px solid rgba(56, 189, 248, .9); /* sky-400 */
  outline-offset: 2px;
  border-radius: 12px;
}

/* ===== CARDS / PANELS: SUBTLE DEPTH ON HOVER (DESKTOP ONLY) ===== */
@media (hover: hover) {
  :where(.card, .panel, .glass, .glass-card, .qs-card, .quick-start) {
    transition: box-shadow var(--dur-base) var(--ease-premium),
                transform var(--dur-base) var(--ease-premium);
  }

  :where(.card, .panel, .glass, .glass-card, .qs-card, .quick-start):hover {
    box-shadow: var(--elev-2);
    transform: translateY(-2px);
  }
}

/* ===== RIPPLE OPT-IN: [data-ripple] ===== */
[data-ripple] {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.ripple-ink {
  position: absolute;
  border-radius: 999px;
  pointer-events: none;
  opacity: .18;
  transform: translate(-50%, -50%) scale(0);
  filter: blur(.25px);
  background: currentColor;
  animation: ripple var(--dur-base) var(--ease-premium) forwards;
}

@keyframes ripple {
  to {
    transform: translate(-50%, -50%) scale(1);
    opacity: 0;
  }
}

/* ===== TYPOGRAPHY RHYTHM: UNIFY WEIGHTS & HEADING CLAMPS ===== */
:where(h1) {
  font-weight: 700;
  letter-spacing: -.015em;
  font-size: clamp(26px, 3.2vw, 44px);
}

:where(h2) {
  font-weight: 700;
  letter-spacing: -.01em;
  font-size: clamp(20px, 2.6vw, 32px);
}

:where(h3) {
  font-weight: 600;
  letter-spacing: -.005em;
  font-size: clamp(18px, 2.2vw, 26px);
}

:where(p, li) {
  line-height: 1.6;
}

/* ===== DESKTOP GUTTERS & READABLE LINE-LENGTH ===== */
/* 1280–1440px sweet spot for comfortable reading */
@media (min-width: 1280px) {
  :where(.container, .wrap, .page-width) {
    max-width: 1180px;
    margin-inline: auto;
    padding-inline: 24px;
  }
}

@media (min-width: 1440px) {
  :where(.container, .wrap, .page-width) {
    max-width: 1240px;
  }
}

/* Tool I/O comfortable width caps without breaking mobile rules */
:where(.tool-input, .tool-output, .editor, .generated-output, .input-section, .output-section) {
  max-width: 760px;
  margin-inline: auto;
}

/* ===== MICRO SPACING TWEAKS FOR CARD GRIDS (DESKTOP) ===== */
@media (min-width: 1024px) {
  :where(.quick-start-grid, .card-grid, .tool-grid) {
    gap: 18px;
  }
}

/* ===== OPTIONAL HERO BALANCING AT LARGE VIEWPORTS ===== */
.hero--balanced :where(h1) {
  font-size: clamp(28px, 3vw, 40px);
}

.hero--balanced :where(p) {
  font-size: clamp(15px, 1.6vw, 18px);
  opacity: .9;
}

/* ===== NAVIGATION ITEMS: SMOOTH TRANSITIONS ===== */
:where(.nav-item, .mobile-nav-item) {
  transition: background-color var(--dur-fast) var(--ease-premium),
              border-color var(--dur-fast) var(--ease-premium),
              color var(--dur-fast) var(--ease-premium),
              transform var(--dur-fast) var(--ease-premium);
}

/* ===== INPUT FIELDS: SUBTLE FOCUS GLOW ===== */
:where(input, textarea, select, .input) {
  transition: border-color var(--dur-fast) var(--ease-premium),
              box-shadow var(--dur-fast) var(--ease-premium);
}

:where(input, textarea, select, .input):focus {
  border-color: rgba(56, 189, 248, .6);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, .1);
}

/* ===== LOADING STATES: SMOOTH OPACITY TRANSITIONS ===== */
:where([aria-busy="true"], .loading) {
  opacity: 0.6;
  pointer-events: none;
  transition: opacity var(--dur-base) var(--ease-premium);
}

/* ===== MODAL & DRAWER TRANSITIONS ===== */
:where(.modal, .drawer, .mobile-drawer-panel) {
  transition: transform var(--dur-base) var(--ease-premium),
              opacity var(--dur-base) var(--ease-premium);
}

/* ===== TOAST NOTIFICATIONS: SLIDE-IN ANIMATION ===== */
:where(.toast, .notification) {
  animation: slideInRight var(--dur-base) var(--ease-premium);
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* ===== AVATAR & PROFILE ELEMENTS: SMOOTH HOVER ===== */
:where(.avatar, .mobile-avatar-circle, .avatar-circle) {
  transition: transform var(--dur-fast) var(--ease-premium),
              box-shadow var(--dur-fast) var(--ease-premium);
}

:where(.avatar, .mobile-avatar-circle, .avatar-circle):hover {
  transform: scale(1.05);
  box-shadow: 0 4px 12px rgba(0, 0, 0, .15);
}

/* ===== BADGE ELEMENTS: SUBTLE PULSE (OPT-IN) ===== */
.badge--pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: .7;
  }
}

/* ===== LINK HOVER STATES: SMOOTH COLOR TRANSITIONS ===== */
:where(a) {
  transition: color var(--dur-fast) var(--ease-premium),
              opacity var(--dur-fast) var(--ease-premium);
}

/* ===== SKELETON LOADING (OPT-IN) ===== */
.skeleton {
  background: linear-gradient(90deg,
    rgba(255, 255, 255, 0.1) 25%,
    rgba(255, 255, 255, 0.2) 50%,
    rgba(255, 255, 255, 0.1) 75%
  );
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% {
    background-position: 200% 0;
  }
  100% {
    background-position: -200% 0;
  }
}

/* ===== PERFORMANCE OPTIMIZATIONS ===== */
/* Promote frequently animated elements to their own layers */
:where(.btn:hover, .card:hover, [data-ripple]) {
  will-change: transform;
}

/* Clean up will-change after animations complete */
:where(.btn, .card, [data-ripple]):not(:hover):not(:active) {
  will-change: auto;
}

/* ===== PILL BADGES ===== */
.pill{display:inline-flex;align-items:center;padding:4px 10px;border-radius:999px;font-size:.8rem;background:rgba(255,255,255,.4);backdrop-filter:blur(6px)}
.pill-pro{background:linear-gradient(90deg,#4f8bff,#2ecbff);color:#fff}
.pill-soft{background:rgba(255,255,255,.35)}

/* ---- Soft-gated nav items ---- */
.nav-disabled {
  opacity: 0.55;
  pointer-events: auto; /* allow click to trigger interceptor */
  cursor: not-allowed;
  filter: saturate(0.7);
  transition: opacity .15s ease;
}
.nav-disabled:hover { opacity: 0.65; }

/* ---- Hide star FAB (temporary) ---- */
.fab, [data-fab], #fab, .floating-star, .star-fab {
  display: none !important;
}

/* Glassmorphic toast for "Coming Soon" messages */
.toast-soon {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.95), rgba(255, 255, 255, 0.85));
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.5);
  color: #1a1a1a;
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0.3px;
  border-radius: 14px;
  padding: 18px 28px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12),
              inset 0 1px 0 rgba(255, 255, 255, 0.6);
  opacity: 0;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 9999;
  /* Black to grey gradient effect on text */
  text-shadow: 1px 1px 2px rgba(102, 102, 102, 0.3);
}

.toast-soon.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* ===== Rewards FAB Kill-Switch (temporary until Quills launches) ===== */
.no-fab [data-fab="rewards"],
.no-fab .fab-rewards,
.no-fab #rewards-fab,
.no-fab .rewards-fab,
.no-fab .fab.fab--rewards,
.no-fab .fab[data-feature="rewards"],
/* defensive: if we don't set no-fab, still nuke by default */
[data-fab="rewards"],
.fab-rewards,
#rewards-fab,
.rewards-fab,
.fab.fab--rewards,
.fab[data-feature="rewards"] {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ===== Trial Chip & Subtext Styles ===== */
.chip {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  backdrop-filter: blur(12px);
  background: rgba(255, 255, 255, 0.6);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.06);
}

.chip-trial {
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.chip-label {
  font-weight: 600;
}

.subtext {
  font-size: 12px;
  opacity: 0.8;
  margin-top: 4px;
}
