/* ==========================================================================
   Mohit Tools — Design System & Custom Properties
   Pure Static CSS paired with Tailwind CDN (class-based dark mode)
   ========================================================================== */

:root {
  --bg-page: #F8FAFC;
  --bg-surface: #FFFFFF;
  --bg-surface-muted: #F1F5F9;
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #64748B;
  --border-subtle: #E2E8F0;
  --border-strong: #CBD5E1;
  --accent-primary: #4F46E5;
  --accent-hover: #4338CA;
  --accent-tint: rgba(79, 70, 229, 0.08);
  --scrollbar-track: #F1F5F9;
  --scrollbar-thumb: #CBD5E1;
  --scrollbar-thumb-hover: #94A3B8;
  --focus-ring: rgba(79, 70, 229, 0.35);
}

html.dark {
  --bg-page: #09090B;
  --bg-surface: #18181B;
  --bg-surface-muted: #27272A;
  --text-primary: #F4F4F5;
  --text-secondary: #A1A1AA;
  --text-muted: #71717A;
  --border-subtle: #27272A;
  --border-strong: #3F3F46;
  --accent-primary: #6366F1;
  --accent-hover: #818CF8;
  --accent-tint: rgba(99, 102, 241, 0.14);
  --scrollbar-track: #09090B;
  --scrollbar-thumb: #27272A;
  --scrollbar-thumb-hover: #3F3F46;
  --focus-ring: rgba(99, 102, 241, 0.45);
}

/* Base Canvas & Optical Legibility */
html {
  scroll-behavior: smooth;
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: var(--bg-page);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

html.dark body {
  letter-spacing: 0.005em;
}

body {
  background-color: var(--bg-page);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: background-color 180ms cubic-bezier(0.16, 1, 0.3, 1),
              color 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

main {
  flex: 1 0 auto;
}

/* Balanced Display Headlines (prevent orphan trailing words) */
h1, h2, .text-balance {
  text-wrap: balance;
}

/* Tabular Figures for Telemetry, Counters, Binary Blocks & Specs */
.tabular-nums,
.font-mono {
  font-variant-numeric: tabular-nums;
}

/* Custom Precision Scrollbar */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
}

::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 9999px;
  border: 2px solid var(--scrollbar-track);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
}

/* Accessible Focus Rings */
:focus-visible {
  outline: 2px solid var(--accent-primary);
  outline-offset: 2px;
}

/* Precision Surface & Card Hover States (Compositor-Friendly) */
.mt-surface {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  transition: border-color 180ms cubic-bezier(0.16, 1, 0.3, 1),
              background-color 180ms cubic-bezier(0.16, 1, 0.3, 1),
              transform 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.mt-tool-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  transition: transform 180ms cubic-bezier(0.16, 1, 0.3, 1),
              border-color 180ms cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.mt-tool-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent-primary);
  box-shadow: 0 8px 24px -12px rgba(15, 23, 42, 0.12);
}

html.dark .mt-tool-card:hover {
  box-shadow: 0 10px 28px -12px rgba(0, 0, 0, 0.65);
}

.mt-tool-card:active {
  transform: translateY(0);
}

/* Subtle Nav Underline Affordance */
.mt-nav-link {
  position: relative;
}

.mt-nav-link::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: -4px;
  height: 1.5px;
  background-color: var(--accent-primary);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

.mt-nav-link:hover::after,
.mt-nav-link[aria-current="page"]::after {
  transform: scaleX(1);
}

/* AdSense-Safe Vertical Breathing Room (36px - 48px minimum clearance) */
.mt-adsense-buffer {
  margin-top: 2.5rem;
  margin-bottom: 2.5rem;
}

/* Smooth Disclosure / FAQ Accordion Chevron */
details summary {
  list-style: none;
  cursor: pointer;
}

details summary::-webkit-details-marker {
  display: none;
}

details[open] .mt-faq-chevron {
  transform: rotate(180deg);
}

.mt-faq-chevron {
  transition: transform 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* Subtle Grid Pattern for Technical Header Backdrops */
.mt-grid-backdrop {
  background-image:
    linear-gradient(to right, rgba(148, 163, 184, 0.08) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(148, 163, 184, 0.08) 1px, transparent 1px);
  background-size: 32px 32px;
}

html.dark .mt-grid-backdrop {
  background-image:
    linear-gradient(to right, rgba(63, 63, 70, 0.22) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(63, 63, 70, 0.22) 1px, transparent 1px);
}

/* Respect User Motion Preferences */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Reserve exact rendered navbar height (including 1px border-b) to prevent CLS */
#site-header {
  display: block;
  min-height: 65px;
}
@media (min-width: 640px) {
  #site-header {
    min-height: 65px;
  }
}
