@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
  :root {
    /* --- Light Mode Variables (Default) --- */
    --background: 0 0% 98%;
    --foreground: 240 10% 10%;

    --card: 0 0% 100%;
    --card-foreground: 240 10% 10%;

    --popover: 0 0% 100%;
    --popover-foreground: 240 10% 10%;

    --primary: 174 72% 40%;
    --primary-foreground: 0 0% 100%;

    --secondary: 240 5% 92%;
    --secondary-foreground: 240 10% 10%;

    --muted: 240 5% 94%;
    --muted-foreground: 240 5% 45%;

    --accent: 174 72% 40%;
    --accent-foreground: 0 0% 100%;

    --destructive: 0 84% 50%;
    --destructive-foreground: 0 0% 100%;

    --border: 240 6% 90%;
    --input: 240 5% 92%;
    --ring: 174 72% 40%;

    --radius: 0.75rem;

    /* Custom tokens */
    --glow-primary: 174 72% 40%;
    --surface-elevated: 0 0% 100%;
    --text-tertiary: 240 5% 55%;
  }

  .dark {
    /* --- Dark Mode Variables --- */
    --background: 0 0% 0%;
    --foreground: 0 0% 100%;

    --card: 240 6% 10%;
    --card-foreground: 0 0% 100%;

    --popover: 240 6% 10%;
    --popover-foreground: 0 0% 100%;

    --primary: 174 72% 56%;
    --primary-foreground: 0 0% 0%;

    --secondary: 240 4% 16%;
    --secondary-foreground: 0 0% 100%;

    --muted: 240 4% 16%;
    --muted-foreground: 240 5% 65%;

    --accent: 174 72% 56%;
    --accent-foreground: 0 0% 0%;

    --destructive: 0 84% 60%;
    --destructive-foreground: 0 0% 100%;

    --border: 0 0% 100% / 0.05;
    --input: 240 4% 16%;
    --ring: 174 72% 56%;

    /* Custom tokens */
    --glow-primary: 174 72% 56%;
    --surface-elevated: 240 6% 12%;
    --text-tertiary: 240 5% 45%;
  }
}

@layer base {
  * {
    @apply border-border;
  }

  html {
    scroll-behavior: smooth;
    scrollbar-gutter: stable;
  }

  body {
    @apply bg-background text-foreground font-sans antialiased selection:bg-primary/30 selection:text-foreground;
  }

  /* Fix browser autofill styling - maintain proper contrast */
  input:-webkit-autofill,
  input:-webkit-autofill:hover,
  input:-webkit-autofill:focus,
  input:-webkit-autofill:active,
  textarea:-webkit-autofill,
  textarea:-webkit-autofill:hover,
  textarea:-webkit-autofill:focus,
  textarea:-webkit-autofill:active,
  select:-webkit-autofill,
  select:-webkit-autofill:hover,
  select:-webkit-autofill:focus,
  select:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px hsl(var(--background)) inset !important;
    -webkit-text-fill-color: hsl(var(--foreground)) !important;
    caret-color: hsl(var(--foreground)) !important;
    transition: background-color 5000s ease-in-out 0s;
  }

  /* Dark mode autofill */
  .dark input:-webkit-autofill,
  .dark input:-webkit-autofill:hover,
  .dark input:-webkit-autofill:focus,
  .dark input:-webkit-autofill:active,
  .dark textarea:-webkit-autofill,
  .dark textarea:-webkit-autofill:hover,
  .dark textarea:-webkit-autofill:focus,
  .dark textarea:-webkit-autofill:active,
  .dark select:-webkit-autofill,
  .dark select:-webkit-autofill:hover,
  .dark select:-webkit-autofill:focus,
  .dark select:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 1000px hsl(var(--card)) inset !important;
    -webkit-text-fill-color: hsl(var(--foreground)) !important;
  }

  /* Ensure interactive elements have pointer cursor */
  button:not(:disabled),
  [type="button"]:not(:disabled),
  [type="submit"]:not(:disabled),
  [type="reset"]:not(:disabled),
  [role="button"]:not(:disabled),
  a[href],
  label[for],
  select:not(:disabled),
  summary {
    cursor: pointer;
  }

  /* Disabled elements should show not-allowed cursor */
  button:disabled,
  [type="button"]:disabled,
  [type="submit"]:disabled,
  [type="reset"]:disabled,
  input:disabled,
  select:disabled,
  textarea:disabled {
    cursor: not-allowed;
    opacity: 0.6;
  }

  /* Focus-visible styles for accessibility */
  :focus {
    outline: none;
  }

  :focus-visible {
    outline: 2px solid hsl(var(--primary) / 0.5);
    outline-offset: 2px;
  }

  /* Remove focus-visible outline on elements that have custom focus styles */
  button:focus-visible,
  [role="button"]:focus-visible,
  a:focus-visible {
    outline: none;
    box-shadow: 0 0 0 2px hsl(var(--background)), 0 0 0 4px hsl(var(--primary) / 0.5);
  }

  /* trix-editor already has a visible border from the form; suppress the global focus ring */
  trix-editor:focus,
  trix-editor:focus-visible {
    outline: none;
    box-shadow: none;
  }

  /* Skip link for keyboard navigation - hidden until focused */
  .skip-link {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .skip-link:focus {
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 999;
    width: auto;
    height: auto;
    padding: 0.5rem 1rem;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
    background-color: hsl(var(--primary));
    color: hsl(var(--primary-foreground));
    border-radius: 0.5rem;
    font-weight: 500;
    text-decoration: none;
    outline: 2px solid hsl(var(--primary));
    outline-offset: 2px;
  }
}

@layer components {

  /* Glassmorphic navigation */
  .glass-nav {
    @apply backdrop-blur-xl border shadow-xl;
    background-color: hsl(var(--card) / 0.85);
    /* Light Default */
    border-color: hsl(var(--border));
  }

  .dark .glass-nav {
    @apply shadow-2xl;
    background-color: hsl(var(--card) / 0.6);
    /* Dark Override */
  }

  /* Nav link styling */
  .nav-link {
    @apply text-muted-foreground hover:text-foreground transition-colors duration-200 text-sm font-medium px-4 py-2 rounded-full;
  }

  .nav-link:hover {
    background-color: hsl(0 0% 0% / 0.05);
    /* Light Default (Dark overlay) */
  }

  .dark .nav-link:hover {
    background-color: hsl(0 0% 100% / 0.05);
    /* Dark Override (Light overlay) */
  }

  .nav-link-active {
    @apply text-foreground;
    background-color: hsl(0 0% 0% / 0.05);
    /* Light Default */
  }

  .dark .nav-link-active {
    background-color: hsl(0 0% 100% / 0.10);
    /* Dark Override */
  }

  /* Nav dropdown panel - solid background container */
  .nav-dropdown-panel {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 6px;
    min-width: 180px;
    border-radius: 12px;
    border: 1px solid hsl(var(--border));
    background-color: hsl(var(--card));
    box-shadow: 0 10px 40px -10px rgba(0, 0, 0, 0.2), 0 4px 12px -2px rgba(0, 0, 0, 0.1);
    animation: dropdownSlideIn 0.15s ease-out;
  }

  .dark .nav-dropdown-panel {
    background-color: #1a1a1f;
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.7), 0 8px 20px -4px rgba(0, 0, 0, 0.5);
  }

  @keyframes dropdownSlideIn {
    from {
      opacity: 0;
      transform: translateY(-4px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  /* Nav dropdown link */
  .nav-dropdown-link {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    text-decoration: none;
    color: hsl(var(--foreground) / 0.75);
    transition: all 0.15s ease;
  }

  .nav-dropdown-link:hover {
    color: hsl(var(--foreground));
    background-color: hsl(var(--muted) / 0.7);
  }

  .dark .nav-dropdown-link {
    color: rgba(255, 255, 255, 0.75);
  }

  .dark .nav-dropdown-link:hover {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.08);
  }

  .nav-dropdown-link.active {
    color: hsl(var(--primary));
    background-color: hsl(var(--primary) / 0.12);
  }

  .nav-dropdown-link.active:hover {
    background-color: hsl(var(--primary) / 0.18);
  }

  /* Dropdown icon */
  .dropdown-icon {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    opacity: 0.6;
  }

  .nav-dropdown-link:hover .dropdown-icon,
  .nav-dropdown-link.active .dropdown-icon {
    opacity: 1;
  }

  /* Interactive card hover effect */
  .card-hover {
    @apply transition-all duration-300 ease-out;
  }

  .card-hover:hover {
    @apply border-primary/30 -translate-y-1;
    box-shadow: 0 10px 40px -10px hsl(var(--primary) / 0.15),
                0 4px 6px -2px hsl(0 0% 0% / 0.05);
  }

  .dark .card-hover:hover {
    box-shadow: 0 10px 40px -10px hsl(var(--primary) / 0.2),
                0 0 0 1px hsl(var(--primary) / 0.1);
  }

  /* Gradient text effect */
  .text-gradient {
    @apply bg-gradient-to-r from-primary via-cyan-400 to-primary bg-clip-text text-transparent;
  }

  /* Tag/badge styling */
  .pill-badge {
    @apply inline-flex items-center px-3 py-1 rounded-full text-sm font-medium bg-primary/10 text-primary border border-primary/20;
  }

  /* Common component classes */
  .btn-primary {
    @apply inline-flex items-center justify-center gap-2 px-4 py-2.5 bg-primary text-primary-foreground font-medium rounded-lg transition-all duration-200 focus:outline-none disabled:opacity-50 disabled:pointer-events-none;
    box-shadow: 0 1px 2px hsl(var(--primary) / 0.2), inset 0 1px 0 hsl(0 0% 100% / 0.1);
  }

  .btn-primary:hover:not(:disabled) {
    @apply brightness-110 -translate-y-0.5;
    box-shadow: 0 4px 12px hsl(var(--primary) / 0.3), inset 0 1px 0 hsl(0 0% 100% / 0.1);
  }

  .btn-primary:active:not(:disabled) {
    @apply translate-y-0 brightness-95;
  }

  .btn-secondary {
    @apply inline-flex items-center justify-center gap-2 px-4 py-2.5 bg-secondary text-secondary-foreground font-medium rounded-lg border border-border transition-all duration-200 focus:outline-none disabled:opacity-50 disabled:pointer-events-none;
  }

  .btn-secondary:hover:not(:disabled) {
    @apply bg-muted border-primary/30 -translate-y-0.5;
  }

  .btn-ghost {
    @apply inline-flex items-center justify-center gap-2 px-4 py-2.5 text-foreground font-medium rounded-lg transition-all duration-200 focus:outline-none;
  }

  .btn-ghost:hover {
    @apply bg-muted/50;
  }

  .btn-outline {
    @apply inline-flex items-center justify-center gap-2 px-4 py-2.5 bg-transparent border border-border text-foreground font-medium rounded-lg transition-all duration-200 focus:outline-none disabled:opacity-50 disabled:pointer-events-none;
  }

  .btn-outline:hover:not(:disabled) {
    @apply bg-muted border-primary/50 text-primary;
  }

  .input-base {
    @apply w-full px-4 py-2.5 bg-card border border-border rounded-lg text-foreground placeholder:text-muted-foreground transition-all duration-200;
  }

  .input-base:focus {
    @apply outline-none border-primary/50 ring-2 ring-primary/20;
  }

  .input-base:hover:not(:focus):not(:disabled) {
    @apply border-border/80;
  }

  /* Custom checkbox styling */
  input[type="checkbox"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid hsl(var(--border));
    border-radius: 0.375rem;
    background-color: hsl(var(--background));
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    flex-shrink: 0;
  }

  input[type="checkbox"]:hover {
    border-color: hsl(var(--primary) / 0.5);
  }

  input[type="checkbox"]:focus {
    outline: none;
    border-color: hsl(var(--primary));
    box-shadow: 0 0 0 3px hsl(var(--primary) / 0.2);
  }

  input[type="checkbox"]:checked {
    background-color: hsl(var(--primary));
    border-color: hsl(var(--primary));
    background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='currentCorrection' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e");
    /* Note: 'fill=currentCorrection' is typo safety, usually white. Let's make it strict white. */
    background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e");
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
  }

  /* Custom radio button styling */
  input[type="radio"] {
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    width: 1.25rem;
    height: 1.25rem;
    border: 2px solid hsl(var(--border));
    border-radius: 50%;
    background-color: hsl(var(--background));
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
    flex-shrink: 0;
  }

  input[type="radio"]:hover {
    border-color: hsl(var(--primary) / 0.5);
  }

  input[type="radio"]:focus {
    outline: none;
    border-color: hsl(var(--primary));
    box-shadow: 0 0 0 3px hsl(var(--primary) / 0.2);
  }

  input[type="radio"]:checked {
    border-color: hsl(var(--primary));
    background-color: hsl(var(--background));
  }

  input[type="radio"]:checked::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 0.5rem;
    height: 0.5rem;
    border-radius: 50%;
    background-color: hsl(var(--primary));
  }

  /* Footer link styling */
  .footer-link {
    @apply text-muted-foreground hover:text-foreground transition-colors duration-200;
  }

  /* Tech tag */
  .tech-tag {
    @apply px-2 py-0.5 rounded-md text-xs font-medium bg-secondary text-muted-foreground;
  }

  /* Project card styling */
  .project-card {
    @apply bg-card border border-border rounded-xl p-6 card-hover;
  }

  /* Snippet card styling */
  .snippet-card {
    @apply bg-card border border-border rounded-lg p-4 card-hover flex items-center gap-3 text-sm;
  }

  /* Blog item styling */
  .blog-item {
    @apply flex items-center justify-between py-4 border-b border-border last:border-b-0 cursor-pointer;
  }

  .blog-item:hover .blog-title {
    @apply text-primary;
  }

  /* Section heading styling */
  .section-heading {
    @apply text-lg font-semibold text-foreground mb-6 flex items-center gap-2;
  }

  /* Spotlight gradient effect */
  .spotlight {
    background: radial-gradient(600px circle at var(--mouse-x, 50%) var(--mouse-y, 50%),
        hsl(var(--primary) / 0.06),
        transparent 40%);
  }
}

@layer utilities {
  /* ============================================
   * TURBO DRIVE - Progress Bar Styling
   * ============================================ */
  .turbo-progress-bar {
    height: 2px;
    background: linear-gradient(90deg, hsl(var(--primary)), hsl(var(--primary) / 0.6));
  }

  /* ============================================
   * ANIMATION SYSTEM (Industry Standard Pattern)
   * - First visit: Entrance animations play
   * - Subsequent navigation: Instant, no animations
   * ============================================ */

  /* Page entrance animations - only on first visit */
  .animate-fade-in {
    animation: fadeIn 0.3s ease-out forwards;
    opacity: 0;
  }

  .animate-fade-in-delay-1 {
    animation: fadeIn 0.3s ease-out 0.05s forwards;
    opacity: 0;
  }

  .animate-fade-in-delay-2 {
    animation: fadeIn 0.3s ease-out 0.1s forwards;
    opacity: 0;
  }

  .animate-fade-in-delay-3 {
    animation: fadeIn 0.3s ease-out 0.15s forwards;
    opacity: 0;
  }

  @keyframes fadeIn {
    from {
      opacity: 0;
      transform: translateY(8px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  /* Fade in with upward movement - for staggered lists */
  .animate-fade-in-up {
    animation: fadeInUp 0.4s ease-out forwards;
    opacity: 0;
  }

  @keyframes fadeInUp {
    from {
      opacity: 0;
      transform: translateY(16px);
    }
    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  /* Modal/dialog entrance animation - always plays (user-triggered) */
  .animate-modal-in {
    animation: modalIn 0.2s ease-out forwards;
  }

  @keyframes modalIn {
    from {
      opacity: 0;
      transform: scale(0.95);
    }
    to {
      opacity: 1;
      transform: scale(1);
    }
  }

  /* Subtle glow effect for accents */
  .animate-glow {
    animation: glow 2s ease-in-out infinite alternate;
  }

  @keyframes glow {
    from {
      box-shadow: 0 0 20px -10px hsl(var(--primary));
    }
    to {
      box-shadow: 0 0 30px -10px hsl(var(--primary));
    }
  }

  /* ============================================
   * DISABLE PAGE ANIMATIONS
   * Applied after first visit for snappy navigation
   * Note: Modal animations still work (user-triggered)
   * ============================================ */
  html.no-animate .animate-fade-in,
  html.no-animate .animate-fade-in-delay-1,
  html.no-animate .animate-fade-in-delay-2,
  html.no-animate .animate-fade-in-delay-3,
  html.no-animate .animate-fade-in-up,
  html.no-animate .stagger-children > *,
  html[data-turbo-preview] .animate-fade-in,
  html[data-turbo-preview] .animate-fade-in-delay-1,
  html[data-turbo-preview] .animate-fade-in-delay-2,
  html[data-turbo-preview] .animate-fade-in-delay-3,
  html[data-turbo-preview] .animate-fade-in-up,
  html[data-turbo-preview] .stagger-children > * {
    animation: none;
    opacity: 1;
    transform: none;
  }

  /* ============================================
   * REDUCED MOTION - Accessibility
   * Respects user's OS preference
   * ============================================ */
  @media (prefers-reduced-motion: reduce) {
    .animate-fade-in,
    .animate-fade-in-delay-1,
    .animate-fade-in-delay-2,
    .animate-fade-in-delay-3,
    .animate-fade-in-up,
    .animate-modal-in,
    .animate-glow,
    .stagger-children > * {
      animation: none;
      opacity: 1;
      transform: none;
    }

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

  /* Theme-aware visibility classes */
  /* Default is Light (so .dark-only should be hidden). .dark is Dark Mode. */

  /* Show only in dark mode (hide in light) */
  .dark-only {
    display: none;
  }

  .dark .dark-only {
    display: block;
  }

  /* Show only in light mode (hide in dark) */
  .light-only {
    display: block;
  }

  .dark .light-only {
    display: none;
  }

  /* Inline variants */
  .dark-only-inline {
    display: none;
  }

  .dark .dark-only-inline {
    display: inline;
  }

  .light-only-inline {
    display: inline;
  }

  .dark .light-only-inline {
    display: none;
  }

  /* Flex variants */
  .dark-only-flex {
    display: none;
  }

  .dark .dark-only-flex {
    display: flex;
  }

  .light-only-flex {
    display: flex;
  }

  .dark .light-only-flex {
    display: none;
  }

  /* Custom scrollbar */
  .scrollbar-primary::-webkit-scrollbar {
    width: 6px;
    height: 6px;
  }

  .scrollbar-primary::-webkit-scrollbar-track {
    background: transparent;
  }

  .scrollbar-primary::-webkit-scrollbar-thumb {
    background: hsl(var(--muted-foreground) / 0.3);
    border-radius: 3px;
  }

  .scrollbar-primary::-webkit-scrollbar-thumb:hover {
    background: hsl(var(--muted-foreground) / 0.5);
  }

  /* Thin scrollbar for Firefox */
  .scrollbar-thin {
    scrollbar-width: thin;
    scrollbar-color: hsl(var(--muted-foreground) / 0.3) transparent;
  }

  /* Smooth hover transitions for all interactive elements */
  .interactive-hover {
    @apply transition-all duration-200 ease-out;
  }

  .interactive-hover:hover {
    @apply -translate-y-0.5;
  }

  /* Subtle text shadow for headings in dark mode */
  .dark .heading-glow {
    text-shadow: 0 0 40px hsl(var(--primary) / 0.15);
  }

  /* Glass card effect */
  .glass-card {
    @apply backdrop-blur-md border border-border/50 shadow-xl;
    background: linear-gradient(
      135deg,
      hsl(var(--card) / 0.8) 0%,
      hsl(var(--card) / 0.6) 100%
    );
  }

  .dark .glass-card {
    background: linear-gradient(
      135deg,
      hsl(var(--card) / 0.6) 0%,
      hsl(var(--card) / 0.4) 100%
    );
  }

  /* Shimmer loading effect */
  .shimmer {
    background: linear-gradient(
      90deg,
      hsl(var(--muted)) 0%,
      hsl(var(--muted-foreground) / 0.1) 50%,
      hsl(var(--muted)) 100%
    );
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
  }

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

  /* Subtle pulse for notifications/badges */
  .pulse-subtle {
    animation: pulse-subtle 2s ease-in-out infinite;
  }

  @keyframes pulse-subtle {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.7; }
  }

  /* Stagger children animation helper */
  .stagger-children > * {
    animation: fadeIn 0.3s ease-out forwards;
    opacity: 0;
  }

  .stagger-children > *:nth-child(1) { animation-delay: 0ms; }
  .stagger-children > *:nth-child(2) { animation-delay: 50ms; }
  .stagger-children > *:nth-child(3) { animation-delay: 100ms; }
  .stagger-children > *:nth-child(4) { animation-delay: 150ms; }
  .stagger-children > *:nth-child(5) { animation-delay: 200ms; }
  .stagger-children > *:nth-child(6) { animation-delay: 250ms; }
  .stagger-children > *:nth-child(7) { animation-delay: 300ms; }
  .stagger-children > *:nth-child(8) { animation-delay: 350ms; }

  /* Better line clamping with fade */
  .line-clamp-fade {
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
    position: relative;
  }

  .line-clamp-fade::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: 0;
    width: 30%;
    height: 1.5em;
    background: linear-gradient(to right, transparent, hsl(var(--card)));
    pointer-events: none;
  }

  /* Gradient border effect */
  .gradient-border {
    position: relative;
    background: hsl(var(--card));
    border-radius: var(--radius);
  }

  .gradient-border::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: inherit;
    padding: 1px;
    background: linear-gradient(135deg, hsl(var(--primary) / 0.3), transparent 50%, hsl(var(--primary) / 0.1));
    -webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    pointer-events: none;
  }

  /* Section divider with gradient */
  .section-divider {
    height: 1px;
    background: linear-gradient(
      90deg,
      transparent 0%,
      hsl(var(--border)) 20%,
      hsl(var(--primary) / 0.3) 50%,
      hsl(var(--border)) 80%,
      transparent 100%
    );
  }

  /* Glow on hover */
  .hover-glow {
    @apply transition-all duration-300;
  }

  .hover-glow:hover {
    box-shadow: 0 0 20px hsl(var(--primary) / 0.15);
  }

  .dark .hover-glow:hover {
    box-shadow: 0 0 30px hsl(var(--primary) / 0.2);
  }

  /* Text link with underline animation */
  .link-underline {
    @apply relative inline-block;
  }

  .link-underline::after {
    content: '';
    @apply absolute bottom-0 left-0 w-0 h-px bg-primary transition-all duration-300;
  }

  .link-underline:hover::after {
    @apply w-full;
  }

  /* Badge with pulse animation for notifications */
  .badge-pulse {
    @apply relative;
  }

  .badge-pulse::after {
    content: '';
    @apply absolute -top-0.5 -right-0.5 w-2.5 h-2.5 rounded-full bg-primary;
    animation: badge-ping 1.5s cubic-bezier(0, 0, 0.2, 1) infinite;
  }

  @keyframes badge-ping {
    0% {
      transform: scale(1);
      opacity: 1;
    }
    75%, 100% {
      transform: scale(2);
      opacity: 0;
    }
  }

  /* Smooth scroll padding for anchor links */
  [id] {
    scroll-margin-top: 6rem;
  }

  /* Cloudflare Turnstile responsive container */
  .turnstile-container {
    max-width: 100%;
  }

  .turnstile-container iframe,
  .turnstile-container .cf-turnstile {
    max-width: 100% !important;
    transform-origin: left top;
  }

  @media (max-width: 350px) {
    .turnstile-container .cf-turnstile {
      transform: scale(0.9);
    }
  }

  /* Sortable drag-and-drop styles */
  .sortable-ghost {
    opacity: 0.4;
    background: hsl(var(--primary) / 0.1);
    border-radius: 0.5rem;
  }

  .sortable-chosen {
    background: hsl(var(--card));
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
    border-radius: 0.5rem;
  }

  .sortable-drag {
    opacity: 1 !important;
  }
}