/* =========================================================
   Fixora — Global Stylesheet
   Modern blue/white palette, Inter font, mobile-first
   ========================================================= */

:root {
  --color-primary: #2563eb;
  --color-primary-dark: #1d4ed8;
  --color-primary-light: #60a5fa;
  --color-accent: #06b6d4;
  --color-violet: #7c3aed;
  --color-bg: #ffffff;
  --color-bg-soft: #f5f8ff;
  --color-bg-alt: #eef2ff;
  --color-surface: #ffffff;
  --color-surface-2: #f8fafc;
  --color-header-bg: rgba(255, 255, 255, 0.82);
  --color-text: #0f172a;
  --color-text-muted: #475569;
  --color-border: #e2e8f0;
  --color-success: #16a34a;
  --color-danger: #dc2626;
  --gradient-hero: linear-gradient(135deg, #eaf1ff 0%, #f7faff 45%, #e6f7ff 100%);
  --gradient-primary: linear-gradient(135deg, #2563eb 0%, #7c3aed 55%, #06b6d4 100%);
  --shadow-glow: 0 0 0 1px rgba(37, 99, 235, 0.08), 0 12px 32px rgba(37, 99, 235, 0.14);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 20px 45px rgba(37, 99, 235, 0.12);
  --container-width: 1160px;
  --font-main: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Space Grotesk", "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: light;
}

/* Dark theme: follows system preference by default, or explicit [data-theme] override.
   Deliberately a soft navy, not nearblack, per product direction ("not too dark"). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --color-primary: #5b8def;
    --color-primary-dark: #93b8ff;
    --color-primary-light: #7ea6f5;
    --color-accent: #22d3ee;
    --color-violet: #a78bfa;
    --color-bg: #121728;
    --color-bg-soft: #171e33;
    --color-bg-alt: #1b2340;
    --color-surface: #1a2138;
    --color-surface-2: #1e2740;
    --color-header-bg: rgba(18, 23, 40, 0.75);
    --color-text: #eaeefb;
    --color-text-muted: #9aa5c0;
    --color-border: rgba(255, 255, 255, 0.09);
    --gradient-hero: linear-gradient(135deg, #171f38 0%, #131a2e 45%, #16233c 100%);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 8px 28px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 20px 50px rgba(91, 141, 239, 0.28);
    --shadow-glow: 0 0 0 1px rgba(147, 184, 255, 0.14), 0 12px 32px rgba(91, 141, 239, 0.28);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --color-primary: #5b8def;
  --color-primary-dark: #93b8ff;
  --color-primary-light: #7ea6f5;
  --color-accent: #22d3ee;
  --color-violet: #a78bfa;
  --color-bg: #121728;
  --color-bg-soft: #171e33;
  --color-bg-alt: #1b2340;
  --color-surface: #1a2138;
  --color-surface-2: #1e2740;
  --color-header-bg: rgba(18, 23, 40, 0.75);
  --color-text: #eaeefb;
  --color-text-muted: #9aa5c0;
  --color-border: rgba(255, 255, 255, 0.09);
  --gradient-hero: linear-gradient(135deg, #171f38 0%, #131a2e 45%, #16233c 100%);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 28px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 20px 50px rgba(91, 141, 239, 0.28);
  --shadow-glow: 0 0 0 1px rgba(147, 184, 255, 0.14), 0 12px 32px rgba(91, 141, 239, 0.28);
  color-scheme: dark;
}

html {
  transition: background-color 0.25s ease;
}

body,
.card,
.tool-panel,
.site-header,
.faq-item,
.field input,
.field textarea,
.field select,
.stat-row .stat,
.pill,
.page-select-item,
.file-list-item {
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease, box-shadow 0.25s ease;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 90px;
}

body {
  margin: 0;
  font-family: var(--font-main);
  color: var(--color-text);
  background: var(--color-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

ul, ol {
  padding: 0;
  margin: 0;
  list-style: none;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  line-height: 1.25;
  margin: 0 0 0.6em;
  font-weight: 700;
  letter-spacing: -0.02em;
}

p {
  margin: 0 0 1em;
}

.container {
  width: 100%;
  max-width: var(--container-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* =========================================================
   Buttons
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.98rem;
  cursor: pointer;
  border: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.btn-primary {
  background: var(--gradient-primary);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.btn-secondary {
  background: var(--color-bg-alt);
  color: var(--color-primary-dark);
}

.btn-secondary:hover {
  background: #dfe8ff;
}

.btn-block {
  width: 100%;
}

/* =========================================================
   Header / Navigation
   ========================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--color-header-bg);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--color-border);
}

.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--color-text);
}

.nav-brand .brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-brand .brand-mark .brand-svg {
  width: 60%;
  height: 60%;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 28px;
}

.nav-links a {
  position: relative;
  font-weight: 500;
  font-size: 0.96rem;
  color: var(--color-text-muted);
  transition: color 0.15s ease;
}

.nav-links a::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: -4px;
  width: 0;
  height: 2px;
  background: var(--gradient-primary);
  border-radius: 2px;
  transition: width 0.2s ease;
}

.nav-links a:hover::after,
.nav-links a.active::after {
  width: 100%;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--color-primary-dark);
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
}

.nav-toggle span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--color-text);
  margin: 5px 0;
  transition: 0.2s ease;
}

@media (max-width: 860px) {
  .nav-toggle {
    display: block;
  }

  .nav-links {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    flex-direction: column;
    align-items: flex-start;
    padding: 16px 20px 24px;
    gap: 16px;
    display: none;
    box-shadow: var(--shadow-md);
  }

  .nav-links.open {
    display: flex;
  }
}

/* =========================================================
   Theme toggle
   ========================================================= */
.theme-toggle-item {
  display: flex;
  align-items: center;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-bg-soft);
  color: var(--color-text-muted);
  cursor: pointer;
  transition: border-color 0.2s ease, color 0.2s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s ease;
}

.theme-toggle:hover {
  color: var(--color-primary-dark);
  border-color: var(--color-primary-light);
  transform: rotate(-12deg) scale(1.08);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

.theme-toggle .icon-moon {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .theme-toggle .icon-sun { display: none; }
  :root:not([data-theme="light"]) .theme-toggle .icon-moon { display: block; }
}

:root[data-theme="dark"] .theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: block; }

/* =========================================================
   Hero
   ========================================================= */
.hero {
  background: var(--gradient-hero);
  background-size: 200% 200%;
  animation: heroGradientShift 14s ease infinite;
  padding: 72px 0 64px;
  text-align: center;
  overflow: hidden;
  position: relative;
}

.hero::before,
.hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  filter: blur(50px);
  opacity: 0.55;
  z-index: 0;
  pointer-events: none;
  animation: orbFloat 10s ease-in-out infinite;
}

.hero::before {
  width: 340px;
  height: 340px;
  background: radial-gradient(circle, var(--color-primary-light), var(--color-violet) 75%);
  top: -70px;
  left: -50px;
  animation-delay: 0s;
}

.hero::after {
  width: 380px;
  height: 380px;
  background: radial-gradient(circle, var(--color-accent), var(--color-violet) 80%);
  bottom: -90px;
  right: -50px;
  animation-delay: -5s;
}

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

.hero > .container::before {
  content: "";
  position: absolute;
  inset: -40px -20px auto;
  height: 340px;
  background-image: radial-gradient(circle, var(--color-border) 1px, transparent 1.4px);
  background-size: 26px 26px;
  -webkit-mask-image: radial-gradient(ellipse 60% 100% at 50% 0%, #000 40%, transparent 90%);
  mask-image: radial-gradient(ellipse 60% 100% at 50% 0%, #000 40%, transparent 90%);
  opacity: 0.7;
  z-index: -1;
  pointer-events: none;
}

@keyframes heroGradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(30px, -20px) scale(1.08); }
}

.hero .eyebrow {
  display: inline-block;
  background: var(--color-surface);
  color: var(--color-primary-dark);
  border: 1px solid var(--color-border);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 20px;
  animation: fadeInUp 0.6s ease both;
}

.hero h1 {
  font-size: clamp(2rem, 5vw, 3.2rem);
  max-width: 820px;
  margin: 0 auto 18px;
  animation: fadeInUp 0.6s ease 0.08s both;
}

.hero h1 span {
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero p.lead {
  font-size: 1.1rem;
  color: var(--color-text-muted);
  max-width: 640px;
  margin: 0 auto 34px;
  animation: fadeInUp 0.6s ease 0.16s both;
}

.hero-search-btn {
  animation: fadeInUp 0.6s ease 0.24s both;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin-top: 40px;
  flex-wrap: wrap;
  animation: fadeInUp 0.6s ease 0.3s both;
}

.hero-stats div {
  text-align: center;
}

.hero-stats strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.5rem;
  color: var(--color-primary-dark);
}

.hero-stats span {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

/* =========================================================
   Sections
   ========================================================= */
.section {
  padding: 64px 0;
}

.section-alt {
  background: var(--color-bg-soft);
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 36px;
  flex-wrap: wrap;
}

.section-head h2 {
  font-size: clamp(1.5rem, 3vw, 2.1rem);
  margin: 0;
}

.section-head p {
  color: var(--color-text-muted);
  margin: 6px 0 0;
  max-width: 560px;
}

.section-link {
  font-weight: 600;
  color: var(--color-primary-dark);
  white-space: nowrap;
}

/* =========================================================
   Card grids
   ========================================================= */
.grid {
  display: grid;
  gap: 22px;
  grid-template-columns: repeat(4, 1fr);
}

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

@media (max-width: 560px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 26px 22px;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.25s ease, border-color 0.25s ease;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
}

.card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-glow);
  border-color: transparent;
}

.card:hover .icon {
  transform: rotate(-6deg) scale(1.08);
  background: var(--gradient-primary);
  color: #fff;
}

.card .icon {
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--color-bg-alt);
  color: var(--color-primary-dark);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  margin-bottom: 6px;
  transition: transform 0.3s ease, background 0.3s ease;
}

.card h3 {
  font-size: 1.08rem;
  margin: 0;
}

.card p {
  color: var(--color-text-muted);
  font-size: 0.92rem;
  margin: 0;
  flex: 1;
}

.card .card-cta {
  font-weight: 600;
  font-size: 0.88rem;
  color: var(--color-primary-dark);
  margin-top: 6px;
}

.card[hidden] {
  display: none;
}

/* Guide / blog cards */
.guide-card .thumb {
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-sm);
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 1.8rem;
  margin-bottom: 4px;
}

.guide-card .meta {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-accent);
  font-weight: 700;
}

/* =========================================================
   Tool category groups (homepage)
   ========================================================= */
.tool-category {
  margin-bottom: 48px;
}

.tool-category:last-child {
  margin-bottom: 0;
}

.tool-category-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.tool-category-head .tcat-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--gradient-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex-shrink: 0;
}

.tool-category-head h3 {
  font-size: 1.15rem;
  margin: 0;
}

.tool-category-head .tcat-count {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  background: var(--color-bg-soft);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 2px 10px;
  margin-left: auto;
}

/* =========================================================
   Category pills (tools index / filters)
   ========================================================= */
.pill-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 30px;
}

.pill {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.pill.active,
.pill:hover {
  background: var(--gradient-primary);
  color: #fff;
  border-color: transparent;
}

/* =========================================================
   CTA band
   ========================================================= */
.cta-band {
  background: var(--gradient-primary);
  border-radius: var(--radius-lg);
  padding: 48px 32px;
  text-align: center;
  color: #fff;
  margin: 0 20px;
}

.cta-band h2 {
  color: #fff;
  margin-bottom: 10px;
}

.cta-band p {
  color: rgba(255, 255, 255, 0.9);
  max-width: 520px;
  margin: 0 auto 24px;
}

.cta-band .btn-secondary {
  background: var(--color-surface);
  color: var(--color-primary-dark);
}

/* =========================================================
   Footer
   ========================================================= */
.site-footer {
  background: #0b1220;
  color: #cbd5e1;
  padding: 56px 0 24px;
  margin-top: 40px;
}

.footer-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr 1fr;
  gap: 32px;
  margin-bottom: 40px;
}

@media (max-width: 760px) {
  .footer-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.footer-brand .nav-brand {
  color: #fff;
  margin-bottom: 12px;
}

.footer-brand p {
  color: #94a3b8;
  font-size: 0.92rem;
  max-width: 320px;
}

.footer-col h4 {
  color: #fff;
  font-size: 0.92rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 16px;
}

.footer-col li {
  margin-bottom: 10px;
}

.footer-col a {
  color: #94a3b8;
  font-size: 0.92rem;
  transition: color 0.15s ease;
}

.footer-col a:hover {
  color: #fff;
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 24px;
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.84rem;
  color: #64748b;
}

/* =========================================================
   Breadcrumb
   ========================================================= */
.breadcrumb {
  padding: 18px 0 0;
  font-size: 0.86rem;
  color: var(--color-text-muted);
}

.breadcrumb a {
  color: var(--color-text-muted);
}

.breadcrumb a:hover {
  color: var(--color-primary-dark);
}

.breadcrumb .sep {
  margin: 0 6px;
  color: var(--color-border);
}

/* Quick-jump chip back to a tool's category on the homepage */
.category-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--color-bg-soft);
  border: 1px solid var(--color-border);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-primary-dark);
  transition: background 0.15s ease, border-color 0.15s ease;
}

.category-chip:hover {
  background: var(--color-bg-alt);
  border-color: var(--color-primary-light);
}

/* =========================================================
   Tool page layout
   ========================================================= */
.tool-page-head {
  padding: 40px 0 12px;
  text-align: center;
}

.tool-page-head .icon-lg {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: var(--gradient-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  margin: 0 auto 18px;
  box-shadow: var(--shadow-glow);
  animation: fadeInUp 0.5s ease both, iconFloat 5s ease-in-out 0.5s infinite;
}

@keyframes iconFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.tool-page-head h1 {
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  margin-bottom: 8px;
}

.tool-page-head p {
  color: var(--color-text-muted);
  max-width: 600px;
  margin: 0 auto;
}

.tool-panel {
  position: relative;
  max-width: 760px;
  margin: 32px auto 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 32px;
  box-shadow: var(--shadow-md);
  overflow: hidden;
  animation: fadeInUp 0.5s ease both;
}

.tool-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gradient-primary);
  background-size: 200% 100%;
  animation: heroGradientShift 6s ease infinite;
}

.dropzone {
  border: 2px dashed var(--color-primary-light);
  border-radius: var(--radius-md);
  padding: 40px 20px;
  text-align: center;
  background: var(--color-bg-soft);
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.dropzone:hover {
  border-color: var(--color-primary);
  transform: translateY(-1px);
}

.dropzone.dragover {
  border-color: var(--color-primary);
  background: var(--color-bg-alt);
  transform: scale(1.01);
}

.dropzone .dz-icon {
  font-size: 2rem;
  margin-bottom: 10px;
}

.dropzone small {
  display: block;
  color: var(--color-text-muted);
  margin-top: 6px;
}

.field {
  margin-bottom: 18px;
}

.field label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 8px;
}

.field input[type="text"],
.field input[type="number"],
.field textarea,
.field select {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  font-family: var(--font-main);
  font-size: 0.98rem;
  background: var(--color-surface);
  color: var(--color-text);
}

.field textarea {
  resize: vertical;
  min-height: 140px;
}

.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: 2px solid var(--color-primary-light);
  outline-offset: 1px;
}

.row {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
}

.row .field {
  flex: 1;
  min-width: 140px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  font-size: 0.94rem;
}

.check-row input {
  width: 17px;
  height: 17px;
}

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.output-box {
  margin-top: 22px;
  background: var(--color-bg-soft);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 20px;
  min-height: 60px;
  font-size: 0.98rem;
  word-break: break-word;
}

.output-box:empty::before {
  content: "Your result will appear here.";
  color: var(--color-text-muted);
}

.stat-row {
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.stat-row .stat {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  min-width: 100px;
  text-align: center;
}

.stat-row .stat strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.3rem;
  color: var(--color-primary-dark);
}

.stat-row .stat span {
  font-size: 0.78rem;
  color: var(--color-text-muted);
}

.preview-img {
  max-width: 100%;
  border-radius: var(--radius-sm);
  margin-top: 16px;
  border: 1px solid var(--color-border);
}

.strength-meter {
  height: 8px;
  border-radius: 999px;
  background: var(--color-border);
  overflow: hidden;
  margin-top: 10px;
}

.strength-meter span {
  display: block;
  height: 100%;
  width: 0;
  transition: width 0.2s ease, background 0.2s ease;
}

.copy-note {
  font-size: 0.82rem;
  color: var(--color-success);
  margin-top: 8px;
  min-height: 1em;
}

/* =========================================================
   Page-select grid (PDF Splitter, PDF Rotator — click to select pages)
   ========================================================= */
.page-select-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 4px;
  flex-wrap: wrap;
}

.page-select-toolbar .psel-count {
  font-size: 0.86rem;
  color: var(--color-text-muted);
  margin-left: auto;
}

.page-select-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.page-select-item {
  position: relative;
  border: 2px solid var(--color-border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--color-surface);
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.page-select-item:hover {
  border-color: var(--color-primary-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.page-select-item.selected {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
}

/* "Remove" mode (PDF Splitter) — clicked pages are marked for deletion, shown in red */
.page-select-grid.mode-remove .page-select-item.selected {
  border-color: var(--color-danger);
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15);
}

.page-select-grid.mode-remove .page-select-item.selected .psel-badge {
  background: var(--color-danger);
}

.page-select-grid.mode-remove .page-select-item.selected .psel-label {
  color: var(--color-danger);
}

.page-select-grid.mode-remove .page-select-item.selected .psel-thumb-stage img {
  opacity: 0.45;
}

.page-select-item .psel-thumb-stage {
  aspect-ratio: 1 / 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--color-surface-2);
  border-bottom: 1px solid var(--color-border);
}

.page-select-item .psel-thumb-stage img {
  max-width: 92%;
  max-height: 92%;
  width: auto;
  height: auto;
  display: block;
  transition: transform 0.25s ease;
}

.page-select-item .psel-label {
  padding: 6px 4px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-text-muted);
}

.page-select-item.selected .psel-label {
  color: var(--color-primary-dark);
}

.page-select-item .psel-badge {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-surface);
  border: 2px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  color: transparent;
  transition: all 0.15s ease;
}

.page-select-item.selected .psel-badge {
  background: var(--gradient-primary);
  border-color: transparent;
  color: #fff;
}

.page-select-item .psel-rotation {
  position: absolute;
  top: 6px;
  left: 6px;
  background: rgba(11, 18, 32, 0.75);
  color: #fff;
  font-size: 0.7rem;
  padding: 2px 6px;
  border-radius: 5px;
  display: none;
  z-index: 2;
}

.page-select-item.rotated .psel-rotation {
  display: block;
}

.page-select-skeleton {
  aspect-ratio: 3 / 4;
  background: linear-gradient(90deg, var(--color-bg-soft) 25%, var(--color-border) 50%, var(--color-bg-soft) 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.2s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

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

/* =========================================================
   Multi-file list (PDF Merger, Image to PDF, etc.)
   ========================================================= */
.file-list {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-list-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
}

.file-list-item .file-thumb {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  border: 1px solid var(--color-border);
  object-fit: cover;
  background: var(--color-bg-soft);
  flex-shrink: 0;
}

.file-list-item .file-name {
  flex: 1;
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-list-item .file-meta {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.file-list-item .file-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.file-list-item button {
  background: var(--color-bg-alt);
  border: none;
  border-radius: 6px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--color-primary-dark);
}

.file-list-item button:hover {
  background: #dfe8ff;
}

.file-list-item button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* =========================================================
   Color swatch (Color Converter)
   ========================================================= */
.color-swatch {
  width: 100%;
  height: 90px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  margin-top: 6px;
}

/* Related tools / articles */
.related {
  margin-top: 56px;
}

/* =========================================================
   Blog / article layout
   ========================================================= */
.article-head {
  padding: 44px 0 0;
}

.article-head .meta {
  font-size: 0.85rem;
  color: var(--color-text-muted);
  margin-bottom: 12px;
}

.article-head h1 {
  font-size: clamp(1.8rem, 4.5vw, 2.6rem);
  max-width: 780px;
}

.article-hero-img {
  width: 100%;
  aspect-ratio: 21 / 9;
  border-radius: var(--radius-lg);
  background: var(--gradient-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 2.4rem;
  margin: 26px 0 10px;
}

.article-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 48px;
  align-items: start;
  padding: 30px 0 70px;
}

@media (max-width: 860px) {
  .article-layout {
    grid-template-columns: 1fr;
  }
}

.toc {
  position: sticky;
  top: 90px;
  background: var(--color-bg-soft);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 20px;
}

.toc h4 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  margin-bottom: 12px;
}

.toc li {
  margin-bottom: 10px;
}

.toc a {
  font-size: 0.9rem;
  color: var(--color-text);
}

.toc a:hover {
  color: var(--color-primary-dark);
}

.article-body {
  max-width: 720px;
  font-size: 1.05rem;
  color: #1e293b;
}

.article-body h2 {
  font-size: 1.4rem;
  margin-top: 2em;
}

.article-body h3 {
  font-size: 1.15rem;
  margin-top: 1.6em;
}

.article-body ul,
.article-body ol {
  margin: 0 0 1.2em 1.3em;
  list-style: disc;
}

.article-body ol {
  list-style: decimal;
}

.article-body li {
  margin-bottom: 0.5em;
}

.article-body .tip-box {
  background: var(--color-bg-alt);
  border-left: 4px solid var(--color-primary);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin: 1.6em 0;
  font-size: 0.96rem;
}

.article-body a {
  color: var(--color-primary-dark);
  text-decoration: underline;
}

/* =========================================================
   Static content pages (privacy / terms / about / contact)
   ========================================================= */
.page-content {
  max-width: 800px;
  margin: 0 auto;
  padding: 50px 20px 80px;
}

.page-content h1 {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
}

.page-content h2 {
  font-size: 1.3rem;
  margin-top: 1.8em;
}

.page-content p,
.page-content li {
  color: var(--color-text-muted);
}

.page-content ul {
  list-style: disc;
  margin-left: 1.3em;
  margin-bottom: 1.2em;
}

.page-content li {
  margin-bottom: 0.5em;
}

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 40px;
  align-items: start;
}

@media (max-width: 700px) {
  .contact-grid {
    grid-template-columns: 1fr;
  }
}

.info-card {
  background: var(--color-bg-soft);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 24px;
}

.info-card h3 {
  font-size: 1rem;
}

.info-card p {
  font-size: 0.94rem;
}

/* =========================================================
   404 / empty states
   ========================================================= */
.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--color-text-muted);
}

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

.fade-in {
  animation: fadeInUp 0.5s ease both;
}

/* Scroll-reveal: elements start hidden, animate in via .in-view (added by main.js) */
[data-js] .reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* Stagger children of a revealed grid */
[data-js] .grid.reveal-group .card {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.5s ease, transform 0.5s ease;
}

.grid.reveal-group.in-view .card {
  opacity: 1;
  transform: translateY(0);
}

.grid.reveal-group.in-view .card:nth-child(1) { transition-delay: 0.03s; }
.grid.reveal-group.in-view .card:nth-child(2) { transition-delay: 0.07s; }
.grid.reveal-group.in-view .card:nth-child(3) { transition-delay: 0.11s; }
.grid.reveal-group.in-view .card:nth-child(4) { transition-delay: 0.15s; }
.grid.reveal-group.in-view .card:nth-child(5) { transition-delay: 0.19s; }
.grid.reveal-group.in-view .card:nth-child(6) { transition-delay: 0.23s; }
.grid.reveal-group.in-view .card:nth-child(7) { transition-delay: 0.27s; }
.grid.reveal-group.in-view .card:nth-child(8) { transition-delay: 0.31s; }
.grid.reveal-group.in-view .card:nth-child(n+9) { transition-delay: 0.34s; }

/* Printing never waits on scroll-triggered JS — force everything visible */
@media print {
  [data-js] .reveal,
  [data-js] .grid.reveal-group .card {
    opacity: 1 !important;
    transform: none !important;
  }
}

/* Button shine sweep on hover */
.btn-primary {
  position: relative;
  overflow: hidden;
}

.btn-primary::before {
  content: "";
  position: absolute;
  top: 0;
  left: -75%;
  width: 50%;
  height: 100%;
  background: linear-gradient(120deg, transparent, rgba(255, 255, 255, 0.35), transparent);
  transform: skewX(-20deg);
  transition: left 0.5s ease;
}

.btn-primary:hover::before {
  left: 125%;
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

/* Skip link for accessibility */
.skip-link {
  position: absolute;
  left: -999px;
  top: auto;
  background: var(--color-primary);
  color: #fff;
  padding: 10px 16px;
  border-radius: 0 0 8px 0;
  z-index: 999;
}

.skip-link:focus {
  left: 0;
  top: 0;
}

/* =========================================================
   Command Palette (⌘K search popup)
   ========================================================= */
.cmdk-trigger {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--color-bg-soft);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 7px 12px 7px 14px;
  font-family: var(--font-main);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--color-text-muted);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.cmdk-trigger:hover {
  border-color: var(--color-primary-light);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.08);
}

.cmdk-trigger .cmdk-hint {
  font-family: monospace;
  font-size: 0.72rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 5px;
  padding: 1px 6px;
  color: var(--color-text-muted);
}

@media (max-width: 860px) {
  .cmdk-trigger .cmdk-hint { display: none; }
}

.cmdk-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 12vh 20px 20px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.cmdk-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.cmdk-box {
  width: 100%;
  max-width: 560px;
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: 0 30px 70px rgba(15, 23, 42, 0.35);
  overflow: hidden;
  transform: translateY(-12px) scale(0.98);
  transition: transform 0.18s ease;
}

.cmdk-overlay.open .cmdk-box {
  transform: translateY(0) scale(1);
}

.cmdk-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
}

.cmdk-input-row .cmdk-icon {
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.cmdk-input-row input {
  flex: 1;
  border: none;
  outline: none;
  font-size: 1.05rem;
  font-family: var(--font-main);
  background: transparent;
  color: var(--color-text);
}

.cmdk-results {
  max-height: 50vh;
  overflow-y: auto;
  padding: 8px;
}

.cmdk-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 0.92rem;
}

.cmdk-item .cmdk-item-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--color-bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.cmdk-item .cmdk-item-text {
  flex: 1;
  min-width: 0;
}

.cmdk-item .cmdk-item-name {
  font-weight: 600;
  color: var(--color-text);
}

.cmdk-item .cmdk-item-type {
  font-size: 0.76rem;
  color: var(--color-text-muted);
}

.cmdk-item.active {
  background: var(--color-bg-alt);
}

.cmdk-item.active .cmdk-item-icon {
  background: var(--gradient-primary);
  color: #fff;
}

.cmdk-empty {
  padding: 30px 20px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: 0.9rem;
}


/* =========================================================
   Toast notifications
   ========================================================= */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

@media (max-width: 640px) {
  .toast-container {
    left: 16px;
    right: 16px;
    bottom: 16px;
  }
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #0b1220;
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  font-weight: 500;
  transform: translateY(16px);
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast .toast-icon {
  color: var(--color-accent);
  flex-shrink: 0;
}

/* =========================================================
   Cookie / privacy banner
   ========================================================= */
.cookie-banner {
  position: fixed;
  left: 20px;
  right: 20px;
  bottom: -120px;
  max-width: 720px;
  margin: 0 auto;
  background: #0b1220;
  color: #e2e8f0;
  border-radius: var(--radius-lg);
  padding: 18px 22px;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  z-index: 900;
  transition: bottom 0.4s ease;
}

.cookie-banner.show {
  bottom: 20px;
}

.cookie-banner p {
  margin: 0;
  font-size: 0.86rem;
  color: #cbd5e1;
  flex: 1;
  min-width: 220px;
}

.cookie-banner a {
  color: #fff;
  text-decoration: underline;
}

.cookie-banner .btn {
  flex-shrink: 0;
  padding: 9px 18px;
  font-size: 0.86rem;
}

/* =========================================================
   Back-to-top button
   ========================================================= */
.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 90px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--gradient-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  box-shadow: var(--shadow-md);
  z-index: 800;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.back-to-top.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.back-to-top:hover {
  box-shadow: var(--shadow-lg);
  transform: translateY(-3px);
}

@media (max-width: 640px) {
  .back-to-top {
    right: 16px;
    bottom: 76px;
    width: 40px;
    height: 40px;
  }
}

/* =========================================================
   Hero cursor-glow
   ========================================================= */
.hero-glow {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
  background: radial-gradient(
    320px circle at var(--gx, 50%) var(--gy, 50%),
    rgba(37, 99, 235, 0.16),
    transparent 70%
  );
}

.hero-glow.active {
  opacity: 1;
}

/* =========================================================
   Output-box completion flash
   ========================================================= */
@keyframes outputFlash {
  0% { box-shadow: 0 0 0 0 rgba(37, 99, 235, 0.35); }
  100% { box-shadow: 0 0 0 10px rgba(37, 99, 235, 0); }
}

.output-box.flash {
  animation: outputFlash 0.7s ease-out;
}

/* =========================================================
   How-to steps + FAQ (tool pages)
   ========================================================= */
.howto {
  margin-top: 48px;
}
.howto h2, .faq h2 {
  font-size: 1.3rem;
  margin-bottom: 16px;
}
.howto-steps {
  list-style: none;
  counter-reset: howto;
  display: grid;
  gap: 14px;
  padding: 0;
}
.howto-steps li {
  counter-increment: howto;
  display: flex;
  gap: 14px;
  align-items: flex-start;
  font-size: 0.95rem;
  line-height: 1.55;
}
.howto-steps li::before {
  content: counter(howto);
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.faq {
  margin-top: 40px;
}
.faq-item {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
  overflow: hidden;
}
.faq-item summary {
  padding: 14px 18px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.95rem;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.faq-item summary::-webkit-details-marker {
  display: none;
}
.faq-item summary::after {
  content: "+";
  font-size: 1.2rem;
  color: var(--color-text-muted);
  flex-shrink: 0;
  transition: transform 0.15s ease;
}
.faq-item[open] summary::after {
  transform: rotate(45deg);
}
.faq-item p {
  padding: 0 18px 16px;
  margin: 0;
  color: var(--color-text-muted);
  font-size: 0.92rem;
  line-height: 1.6;
}
