/* ============================================================
   HukhLatri — Design System v2.0
   Mobile-first, fully responsive
   ============================================================ */

/* ── DESIGN TOKENS ── */
:root {
  /* Brand */
  --orange: #FF6B35;
  --orange-dark: #E55A24;
  --orange-light: rgba(255,107,53,.1);

  /* Neutrals */
  --white: #FFFFFF;
  --off-white: #FAFAF8;
  --surface: #F5F5F2;
  --surface-hover: #EFEFE9;
  --border: #E8E8E4;
  --border-strong: #D0D0CA;

  /* Text */
  --text-primary: #1A1A18;
  --text-secondary: #4A4A44;
  --text-muted: #8A8A82;

  /* Shadows */
  --shadow-xs: 0 1px 2px rgba(0,0,0,.04);
  --shadow-sm: 0 1px 4px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 16px rgba(0,0,0,.08), 0 1px 4px rgba(0,0,0,.04);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.12), 0 4px 12px rgba(0,0,0,.06);

  /* Spacing */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-pill: 100px;

  /* Typography */
  --font-body: 'Inter', system-ui, -apple-system, sans-serif;
  --font-display: 'Space Grotesk', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

  /* Transitions */
  --t-fast: 120ms ease;
  --t-base: 200ms ease;
  --t-slow: 350ms ease;
}

/* ── BASE RESET ── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--off-white);
  color: var(--text-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img, video, svg { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: var(--font-body); border: none; background: none; }
input, textarea, select { font-family: var(--font-body); }

/* ── LAYOUT ── */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 16px;
}
@media (min-width: 640px)  { .container { padding: 0 24px; } }
@media (min-width: 1024px) { .container { padding: 0 32px; } }

/* ── SKIP LINK (a11y) ── */
.skip-link {
  position: absolute;
  top: -100%;
  left: 0;
  background: var(--orange);
  color: #fff;
  padding: 8px 16px;
  z-index: 9999;
  font-weight: 600;
  border-radius: 0 0 8px 0;
}
.skip-link:focus { top: 0; }

/* ============================================================
   HEADER
   ============================================================ */
.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  background: rgba(250,250,248,.96);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  will-change: transform;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 60px;
  gap: 16px;
}
@media (min-width: 768px) { .header-inner { height: 64px; gap: 24px; } }

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
  flex-shrink: 0;
  text-decoration: none;
}
@media (min-width: 480px) { .logo { font-size: 1.1rem; gap: 10px; } }

.logo-mark {
  background: var(--orange);
  color: #fff;
  border-radius: 8px;
  padding: 3px 7px;
  font-size: .8rem;
  font-weight: 800;
  font-family: var(--font-mono);
  flex-shrink: 0;
}
@media (min-width: 480px) { .logo-mark { padding: 4px 8px; font-size: .85rem; } }

/* Desktop nav */
.main-nav {
  display: none;
  align-items: center;
  gap: 2px;
}
@media (min-width: 768px) { .main-nav { display: flex; } }

.nav-link {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: background var(--t-fast), color var(--t-fast);
  white-space: nowrap;
}
@media (min-width: 1024px) { .nav-link { padding: 6px 14px; } }
.nav-link:hover, .nav-link.active {
  background: var(--orange-light);
  color: var(--orange);
}

/* Hamburger */
.hamburger {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  padding: 8px;
  flex-shrink: 0;
  transition: background var(--t-fast);
}
.hamburger:hover { background: var(--surface); }
.hamburger span {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--text-primary);
  border-radius: 2px;
  transition: transform var(--t-base), opacity var(--t-base);
  transform-origin: center;
}
.hamburger.open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.hamburger.open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

@media (min-width: 768px) { .hamburger { display: none; } }

/* Mobile nav drawer */
.mobile-nav-drawer {
  display: none;
  position: fixed;
  inset: 60px 0 0 0;
  background: var(--white);
  z-index: 199;
  overflow-y: auto;
  padding: 16px;
  border-top: 1px solid var(--border);
  animation: slideDown var(--t-base) ease forwards;
}
.mobile-nav-drawer.open { display: block; }
.mobile-nav-drawer .nav-link {
  display: block;
  width: 100%;
  padding: 13px 16px;
  border-radius: 10px;
  margin-bottom: 2px;
  font-size: .95rem;
}
.mobile-nav-drawer .nav-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 0;
}

@media (min-width: 768px) { .mobile-nav-drawer { display: none !important; } }

/* FIX: .main-nav needs its own open-state rule for pages using it directly
   as the mobile drawer (no separate .mobile-nav-drawer element present).
   Without this, toggling .open via JS had no visible effect below 768px. */
@media (max-width: 767px) {
  .main-nav {
    display: none;
    position: fixed;
    inset: 60px 0 0 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    background: var(--white);
    z-index: 199;
    overflow-y: auto;
    padding: 16px;
    border-top: 1px solid var(--border);
  }
  .main-nav.open {
    display: flex;
    animation: slideDown var(--t-base) ease forwards;
  }
  .main-nav .nav-link {
    display: block;
    width: 100%;
    padding: 13px 16px;
    border-radius: 10px;
    font-size: .95rem;
  }
}

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

/* ============================================================
   HERO
   ============================================================ */
.hero {
  padding: 48px 0 56px;
  overflow: hidden;
}
@media (min-width: 768px) { .hero { padding: 64px 0 72px; } }
@media (min-width: 1024px) { .hero { padding: 80px 0 88px; } }

.hero-inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: 40px;
  align-items: center;
}
@media (min-width: 960px) {
  .hero-inner {
    grid-template-columns: 1fr 1fr;
    gap: 60px;
  }
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--orange-light);
  color: var(--orange);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  margin-bottom: 16px;
}
@media (min-width: 480px) { .hero-eyebrow { font-size: .8rem; margin-bottom: 20px; } }

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 7vw, 3.8rem);
  font-weight: 800;
  letter-spacing: -.03em;
  line-height: 1.1;
  margin-bottom: 16px;
}
@media (min-width: 480px) { .hero-title { margin-bottom: 20px; } }
.hero-title .hl { color: var(--orange); }

.hero-sub {
  font-size: .95rem;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 28px;
  max-width: 480px;
}
@media (min-width: 480px) { .hero-sub { font-size: 1.05rem; margin-bottom: 32px; } }

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* Hero visual card */
.hero-visual { position: relative; }

.tool-preview-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
@media (min-width: 960px) { .tool-preview-card { transform: rotate(2deg); } }

.tpc-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.tpc-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.tpc-dot.red    { background: #FF5F57; }
.tpc-dot.yellow { background: #FEBC2E; }
.tpc-dot.green  { background: #28C840; }
.tpc-title {
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--text-muted);
  margin-left: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tpc-body { padding: 16px; }
.tpc-textarea {
  width: 100%;
  height: 72px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font-family: var(--font-mono);
  font-size: .72rem;
  color: var(--text-secondary);
  resize: none;
  margin-bottom: 10px;
}
.tpc-stats {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: 6px;
}
.tpc-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px;
  text-align: center;
}
.tpc-stat strong {
  display: block;
  font-family: var(--font-display);
  font-size: .95rem;
  font-weight: 700;
  color: var(--orange);
}
.tpc-stat span { font-size: .58rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }

/* ============================================================
   SEARCH SECTION
   ============================================================ */
.search-section { padding: 12px 0 0; }
@media (min-width: 768px) { .search-section { padding: 20px 0 0; } }

.search-wrap {
  position: relative;
  max-width: 600px;
  margin: 0 auto;
}
.search-wrap svg {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  flex-shrink: 0;
}
#toolSearch {
  width: 100%;
  padding: 13px 14px 13px 44px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: .95rem;
  background: var(--white);
  color: var(--text-primary);
  outline: none;
  transition: border-color var(--t-base), box-shadow var(--t-base);
}
#toolSearch:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(255,107,53,.12);
}
@media (min-width: 768px) {
  #toolSearch { padding: 14px 16px 14px 48px; font-size: 1rem; }
  .search-wrap svg { left: 16px; }
}

.search-hint {
  text-align: center;
  font-size: .72rem;
  color: var(--text-muted);
  margin-top: 8px;
}
/* Hide keyboard shortcut hint on mobile (no keyboard) */
@media (max-width: 767px) { .search-hint { display: none; } }

.no-results { display: none; text-align: center; padding: 48px 16px; color: var(--text-muted); }
.no-results.visible { display: block; }

/* ============================================================
   TOOLS GRID
   ============================================================ */
.tools-section { padding: 40px 0 72px; }
@media (min-width: 768px) { .tools-section { padding: 48px 0 96px; } }

.tool-category { margin-bottom: 40px; }
@media (min-width: 768px) { .tool-category { margin-bottom: 56px; } }

.cat-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
@media (min-width: 768px) { .cat-header { margin-bottom: 20px; } }

.cat-icon { font-size: 1.3rem; }
.cat-title { font-family: var(--font-display); font-size: 1.15rem; font-weight: 700; }
@media (min-width: 768px) { .cat-title { font-size: 1.3rem; } }
.cat-count {
  font-size: .75rem;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  padding: 2px 10px;
  border-radius: var(--radius-pill);
}

.tools-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 480px) { .tools-grid { grid-template-columns: repeat(2,1fr); } }
@media (min-width: 768px) { .tools-grid { grid-template-columns: repeat(3,1fr); gap: 14px; } }
@media (min-width: 1024px) { .tools-grid { grid-template-columns: repeat(auto-fill,minmax(240px,1fr)); } }

.tool-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  transition: border-color var(--t-base), box-shadow var(--t-base), transform var(--t-base);
  display: flex;
  flex-direction: column;
  gap: 0;
  text-decoration: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}
@media (min-width: 768px) { .tool-card { padding: 20px; } }
@media (hover: hover) {
  .tool-card:hover {
    border-color: var(--orange);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
  }
}
.tool-card:active { transform: scale(.98); }

.tc-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 10px;
}
.tc-icon { font-size: 1.4rem; line-height: 1; }
.tc-badge {
  font-size: .62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--orange-light);
  color: var(--orange);
}
.tc-name {
  font-family: var(--font-display);
  font-size: .92rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--text-primary);
}
@media (min-width: 768px) { .tc-name { font-size: .98rem; } }
.tc-desc {
  font-size: .8rem;
  color: var(--text-muted);
  line-height: 1.5;
  flex: 1;
  margin-bottom: 12px;
}
.tc-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .8rem;
  font-weight: 600;
  color: var(--orange);
  margin-top: auto;
  transition: gap var(--t-fast);
}
@media (hover: hover) { .tc-link:hover { gap: 8px; } }

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: 600;
  font-size: .88rem;
  border: 2px solid transparent;
  transition: background var(--t-base), border-color var(--t-base), transform var(--t-fast), box-shadow var(--t-base);
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
@media (min-width: 480px) { .btn { padding: 11px 22px; font-size: .9rem; } }

.btn:active { transform: scale(.97); }

.btn-primary {
  background: var(--orange);
  color: #fff;
  border-color: var(--orange);
}
@media (hover: hover) {
  .btn-primary:hover {
    background: var(--orange-dark);
    border-color: var(--orange-dark);
    box-shadow: 0 4px 12px rgba(255,107,53,.35);
  }
}

.btn-ghost {
  background: transparent;
  color: var(--text-secondary);
  border-color: var(--border);
}
@media (hover: hover) {
  .btn-ghost:hover {
    border-color: var(--orange);
    color: var(--orange);
  }
}

.btn-full { width: 100%; }

.btn-sm { padding: 7px 14px; font-size: .82rem; }

/* ============================================================
   AD SLOTS
   ============================================================ */
.ad-wrapper { text-align: center; padding: 8px 0; }
.ad-slot {
  min-height: 90px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
}
.ad-slot::after {
  content: 'Advertisement';
  font-size: .72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ============================================================
   STATS STRIP
   ============================================================ */
.stats-strip {
  background: var(--text-primary);
  color: #fff;
  padding: 36px 0;
}
@media (min-width: 768px) { .stats-strip { padding: 48px 0; } }

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2,1fr);
  gap: 24px;
  text-align: center;
}
@media (min-width: 640px) { .stats-grid { grid-template-columns: repeat(4,1fr); gap: 32px; } }

.stat-item strong {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 5vw, 2.4rem);
  font-weight: 800;
  color: var(--orange);
}
.stat-item span { font-size: .85rem; color: rgba(255,255,255,.55); }

/* ============================================================
   TOOL PAGE — HERO BANNER
   ============================================================ */
.tool-page-hero {
  background: var(--text-primary);
  color: #fff;
  padding: 32px 0 28px;
}
@media (min-width: 768px) { .tool-page-hero { padding: 44px 0 40px; } }

.breadcrumb {
  font-size: .75rem;
  color: rgba(255,255,255,.45);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
}
@media (min-width: 768px) { .breadcrumb { font-size: .8rem; } }
.breadcrumb a { color: rgba(255,255,255,.65); }
.breadcrumb a:hover { color: var(--orange); }

.tool-page-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 5vw, 2.8rem);
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.15;
  margin-bottom: 8px;
}
@media (min-width: 768px) { .tool-page-title { margin-bottom: 10px; } }

.tool-page-desc {
  font-size: .9rem;
  color: rgba(255,255,255,.65);
  max-width: 600px;
  line-height: 1.6;
}
@media (min-width: 768px) { .tool-page-desc { font-size: 1rem; } }

/* ============================================================
   TOOL WORKSPACE
   ============================================================ */
.tool-workspace { padding: 24px 0 56px; }
@media (min-width: 768px) { .tool-workspace { padding: 32px 0 72px; } }

.tool-panel {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
@media (min-width: 768px) { .tool-panel { padding: 28px; } }

.tool-label {
  display: block;
  font-size: .78rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.tool-textarea {
  width: 100%;
  padding: 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: .84rem;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--off-white);
  resize: vertical;
  outline: none;
  transition: border-color var(--t-base), box-shadow var(--t-base);
  min-height: 100px;
}
@media (min-width: 768px) { .tool-textarea { padding: 14px; font-size: .88rem; } }
.tool-textarea:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(255,107,53,.1);
}

.tool-input {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  color: var(--text-primary);
  background: var(--white);
  outline: none;
  transition: border-color var(--t-base), box-shadow var(--t-base);
  -webkit-appearance: none;
  appearance: none;
}
@media (min-width: 768px) { .tool-input { padding: 11px 14px; font-size: .92rem; } }
.tool-input:focus {
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(255,107,53,.1);
}

.tool-select {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  color: var(--text-primary);
  background: var(--white);
  outline: none;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238A8A82' stroke-width='2.5'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  transition: border-color var(--t-base);
}
@media (min-width: 768px) { .tool-select { padding: 11px 36px 11px 14px; font-size: .92rem; } }
.tool-select:focus { border-color: var(--orange); }

.tool-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}
@media (min-width: 768px) { .tool-btn-row { gap: 10px; margin-top: 16px; } }

/* Make buttons full-width on tiny screens */
@media (max-width: 400px) {
  .tool-btn-row { flex-direction: column; }
  .tool-btn-row .btn { width: 100%; }
}

.result-box {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  font-family: var(--font-mono);
  font-size: .82rem;
  line-height: 1.65;
  color: var(--text-primary);
  min-height: 56px;
  word-break: break-all;
  overflow-wrap: anywhere;
}
@media (min-width: 768px) { .result-box { padding: 16px; font-size: .88rem; } }

/* Stat cards */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(2,1fr);
  gap: 10px;
  margin-bottom: 16px;
}
@media (min-width: 480px)  { .stat-grid { grid-template-columns: repeat(3,1fr); } }
@media (min-width: 640px)  { .stat-grid { grid-template-columns: repeat(4,1fr); gap: 12px; } }
@media (min-width: 768px)  { .stat-grid { grid-template-columns: repeat(auto-fill,minmax(120px,1fr)); margin-bottom: 20px; } }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 10px;
  text-align: center;
}
@media (min-width: 768px) { .stat-card { padding: 14px; } }

.stat-num {
  display: block;
  font-family: var(--font-display);
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--orange);
}
@media (min-width: 768px) { .stat-num { font-size: 1.5rem; } }
.stat-lbl {
  display: block;
  font-size: .65rem;
  color: var(--text-muted);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: .05em;
}

/* Info section */
.tool-info-section {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
@media (min-width: 768px) { .tool-info-section { padding: 28px; } }

.tool-info-section h2 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
  margin: 24px 0 10px;
  color: var(--text-primary);
}
@media (min-width: 768px) { .tool-info-section h2 { font-size: 1.15rem; } }
.tool-info-section h2:first-child { margin-top: 0; }

.tool-info-section h3 {
  font-family: var(--font-display);
  font-size: .95rem;
  font-weight: 600;
  margin: 18px 0 8px;
  color: var(--text-primary);
}

.tool-info-section p {
  color: var(--text-secondary);
  line-height: 1.75;
  margin-bottom: 12px;
  font-size: .92rem;
}
@media (min-width: 768px) { .tool-info-section p { font-size: .95rem; } }

.tool-info-section ul,
.tool-info-section ol {
  color: var(--text-secondary);
  padding-left: 20px;
  margin-bottom: 12px;
  font-size: .92rem;
}
@media (min-width: 768px) { .tool-info-section ul, .tool-info-section ol { font-size: .95rem; } }
.tool-info-section li { margin-bottom: 6px; line-height: 1.65; }

.tool-info-section code {
  font-family: var(--font-mono);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: .85em;
}

.tool-info-section pre {
  overflow-x: auto;
  margin: 16px 0;
}

/* ============================================================
   INLINE TOOL GRIDS (used inside tool panels)
   ============================================================ */
.inline-two-col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 560px) { .inline-two-col { grid-template-columns: 1fr 1fr; } }

.inline-three-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
@media (min-width: 560px) { .inline-three-col { grid-template-columns: repeat(3,1fr); } }

/* ============================================================
   BLOG STYLES
   ============================================================ */
.blog-post {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 0 72px;
}
@media (min-width: 768px) { .blog-post { padding: 48px 0 88px; } }

.blog-post h1 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem,4vw,2.6rem);
  font-weight: 800;
  letter-spacing: -.02em;
  line-height: 1.2;
  margin-bottom: 14px;
}
.blog-post h2 {
  font-family: var(--font-display);
  font-size: clamp(1.15rem,3vw,1.45rem);
  font-weight: 700;
  margin: 36px 0 12px;
  color: var(--text-primary);
}
.blog-post h3 {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  margin: 24px 0 8px;
}
.blog-post p {
  color: var(--text-secondary);
  line-height: 1.85;
  margin-bottom: 16px;
  font-size: .98rem;
}
@media (min-width: 768px) { .blog-post p { font-size: 1.02rem; margin-bottom: 18px; } }
.blog-post ul, .blog-post ol {
  color: var(--text-secondary);
  line-height: 1.85;
  padding-left: 20px;
  margin-bottom: 16px;
  font-size: .98rem;
}
@media (min-width: 768px) { .blog-post ul, .blog-post ol { font-size: 1.02rem; } }
.blog-post li { margin-bottom: 7px; }
.blog-post strong { color: var(--text-primary); }

.blog-post table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0;
  font-size: .84rem;
  display: block;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
@media (min-width: 640px) { .blog-post table { display: table; font-size: .9rem; } }
.blog-post th {
  background: var(--surface);
  padding: 9px 12px;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid var(--border);
  color: var(--text-secondary);
  white-space: nowrap;
}
.blog-post td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
}
@media (min-width: 640px) {
  .blog-post th { padding: 10px 14px; }
  .blog-post td { padding: 10px 14px; }
}

.blog-post code {
  font-family: var(--font-mono);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  font-size: .84em;
}

.blog-post pre {
  background: #1E1E2E;
  border-radius: var(--radius-sm);
  padding: 16px;
  overflow-x: auto;
  margin: 20px 0;
  -webkit-overflow-scrolling: touch;
}
.blog-post pre code {
  background: none;
  border: none;
  padding: 0;
  color: #CDD6F4;
  font-size: .85rem;
}

/* Post meta */
.post-meta {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 28px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--border);
}
@media (min-width: 768px) { .post-meta { gap: 16px; margin-bottom: 36px; padding-bottom: 24px; } }

.post-cat {
  background: var(--orange-light);
  color: var(--orange);
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  white-space: nowrap;
}
.post-date { font-size: .8rem; color: var(--text-muted); }

/* Callout box */
.callout {
  background: var(--orange-light);
  border-left: 4px solid var(--orange);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  padding: 14px 16px;
  margin: 20px 0;
}
@media (min-width: 768px) { .callout { padding: 16px 20px; } }
.callout p { margin: 0; font-size: .92rem; }

/* CTA box */
.cta-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 16px;
  margin: 28px 0;
  text-align: center;
}
@media (min-width: 768px) { .cta-box { padding: 24px; margin: 36px 0; } }
.cta-box h3 {
  margin: 0 0 6px;
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 700;
}
.cta-box p { margin: 0 0 14px; font-size: .88rem; color: var(--text-secondary); }

/* Back link */
.back-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: .82rem;
  text-decoration: none;
  margin-bottom: 20px;
  transition: color var(--t-fast);
}
.back-link:hover { color: var(--orange); }

/* Related posts */
.related-posts { margin-top: 48px; padding-top: 36px; border-top: 1px solid var(--border); }
@media (min-width: 768px) { .related-posts { margin-top: 56px; padding-top: 40px; } }
.related-posts h2 { font-family: var(--font-display); font-size: 1.2rem; font-weight: 700; margin-bottom: 16px; }
@media (min-width: 768px) { .related-posts h2 { margin-bottom: 20px; } }

.related-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 560px) { .related-grid { grid-template-columns: 1fr 1fr; gap: 16px; } }

.related-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-decoration: none;
  display: block;
  transition: border-color var(--t-base), box-shadow var(--t-base);
  -webkit-tap-highlight-color: transparent;
}
@media (hover: hover) { .related-card:hover { border-color: var(--orange); box-shadow: var(--shadow-sm); } }
.rc-cat { font-size: .7rem; color: var(--orange); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 5px; }
.rc-title { font-family: var(--font-display); font-size: .9rem; font-weight: 600; color: var(--text-primary); line-height: 1.35; }

/* Ad block inside blog */
.ad-block {
  text-align: center;
  margin: 24px 0;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
}
.ad-block span { font-size: .72rem; color: var(--text-muted); font-family: monospace; }

/* ============================================================
   FOOTER
   ============================================================ */
.site-footer {
  background: var(--text-primary);
  color: rgba(255,255,255,.8);
  padding: 48px 0 0;
}
@media (min-width: 768px) { .site-footer { padding: 56px 0 0; } }

.footer-inner {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  padding-bottom: 36px;
}
@media (min-width: 768px) {
  .footer-inner {
    grid-template-columns: 1fr 2fr;
    gap: 48px;
    padding-bottom: 48px;
  }
}

.footer-brand .logo { color: #fff; margin-bottom: 10px; }
.footer-tagline { font-size: .83rem; color: rgba(255,255,255,.45); line-height: 1.65; max-width: 280px; }

.footer-links {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (min-width: 480px) { .footer-links { gap: 32px; } }

.footer-col h4 {
  font-family: var(--font-display);
  font-size: .75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: rgba(255,255,255,.35);
  margin-bottom: 12px;
}
.footer-col ul { list-style: none; }
.footer-col li { margin-bottom: 8px; }
.footer-col a {
  color: rgba(255,255,255,.6);
  font-size: .84rem;
  transition: color var(--t-fast);
  line-height: 1.4;
}
.footer-col a:hover { color: var(--orange); }

.footer-bottom {
  border-top: 1px solid rgba(255,255,255,.08);
  padding: 18px 0;
}
.footer-bottom p { font-size: .78rem; color: rgba(255,255,255,.3); text-align: center; }

/* ============================================================
   STATIC PAGE LAYOUTS (About, Privacy, Terms, Contact)
   ============================================================ */
.static-content {
  max-width: 820px;
  margin: 0 auto;
  padding: 32px 0 72px;
}
@media (min-width: 768px) { .static-content { padding: 48px 0 88px; } }

/* ============================================================
   BLOG INDEX PAGE
   ============================================================ */
.blog-hero {
  background: var(--text-primary);
  color: #fff;
  padding: 40px 0 36px;
}
@media (min-width: 768px) { .blog-hero { padding: 52px 0 44px; } }
.blog-hero h1 {
  font-family: var(--font-display);
  font-size: clamp(1.8rem,5vw,3rem);
  font-weight: 800;
  letter-spacing: -.02em;
  margin-bottom: 8px;
}
.blog-hero p { color: rgba(255,255,255,.6); font-size: .95rem; max-width: 520px; line-height: 1.6; }

.cat-filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 24px 0 4px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 4px;
}
.cat-filters::-webkit-scrollbar { display: none; }

.cat-btn {
  padding: 6px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  background: var(--white);
  color: var(--text-secondary);
  transition: all var(--t-fast);
  white-space: nowrap;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}
.cat-btn.active, .cat-btn:hover {
  background: var(--orange);
  color: #fff;
  border-color: var(--orange);
}

.posts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  padding: 24px 0 72px;
}
@media (min-width: 560px) { .posts-grid { grid-template-columns: repeat(2,1fr); } }
@media (min-width: 1024px) { .posts-grid { grid-template-columns: repeat(3,1fr); gap: 20px; padding: 32px 0 96px; } }

.post-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color var(--t-base), box-shadow var(--t-base), transform var(--t-base);
  text-decoration: none;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
}
@media (hover: hover) {
  .post-card:hover {
    border-color: var(--orange);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
  }
}
.pc-cat { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--orange); }
.pc-title { font-family: var(--font-display); font-size: .98rem; font-weight: 700; line-height: 1.3; color: var(--text-primary); }
.pc-desc { font-size: .82rem; color: var(--text-muted); line-height: 1.6; flex: 1; }
.pc-meta { display: flex; gap: 10px; font-size: .75rem; color: var(--text-muted); margin-top: 4px; flex-wrap: wrap; }

/* ============================================================
   UTILITY CLASSES
   ============================================================ */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}
.text-orange { color: var(--orange); }
.text-muted  { color: var(--text-muted); }
.font-mono   { font-family: var(--font-mono); }
.font-display{ font-family: var(--font-display); }

/* Focus visible (a11y) */
:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 2px;
}

/* ============================================================
   FORMULA BOXES
   ============================================================ */
.formula-box {
  background: #1E1E2E;
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin: 16px 0;
  font-family: var(--font-mono);
  font-size: .84rem;
  color: #CDD6F4;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
@media (min-width: 768px) { .formula-box { padding: 16px 20px; font-size: .9rem; } }

/* ============================================================
   PRINT STYLES
   ============================================================ */
@media print {
  .site-header, .hamburger, .ad-block, .ad-wrapper,
  .hero-visual, .search-section, .cta-box, .related-posts,
  .site-footer { display: none !important; }
  body { background: white; color: black; }
  .blog-post { max-width: 100%; padding: 0; }
}

/* ============================================================
   ENHANCED STYLES v3.0 — YouTube Tools + Fixes
   ============================================================ */

/* ── Fix: tc-badge variants ── */
.tc-badge--new { background: rgba(99,102,241,.12); color: #6366F1; }
.tc-badge--yt  { background: rgba(255,0,0,.1);     color: #FF0000; }
.tc-badge--hot { background: rgba(239,68,68,.1);   color: #EF4444; }
.tc-badge--pro { background: rgba(16,185,129,.1);  color: #059669; }

/* ── Fix: Tool panel on mobile — remove overflow issues ── */
.tool-panel { overflow: visible; }

/* ── Fix: Textarea min-height responsive ── */
@media (max-width: 480px) { .tool-textarea { min-height: 80px; font-size: .82rem; } }

/* ── Fix: Stat cards on very small screens ── */
@media (max-width: 360px) { .stat-grid { grid-template-columns: 1fr 1fr; } }

/* ── Fix: Advanced tool category badge spacing ── */
.cat-header .cat-count { margin-left: auto; }

/* ── Fix: Tool info section spacing ── */
.tool-info-section h2:first-child { margin-top: 0; }
.tool-info-section table {
  width: 100%; border-collapse: collapse;
  font-size: .85rem; margin: 14px 0;
  display: block; overflow-x: auto; -webkit-overflow-scrolling: touch;
}
@media (min-width: 640px) { .tool-info-section table { display: table; } }
.tool-info-section th {
  background: var(--surface); padding: 8px 12px;
  text-align: left; border-bottom: 2px solid var(--border);
  font-weight: 700; color: var(--text-secondary); white-space: nowrap;
}
.tool-info-section td { padding: 8px 12px; border-bottom: 1px solid var(--border); color: var(--text-secondary); }

/* ── YouTube Tool Styles ── */
.yt-input-wrap {
  display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 14px;
}
.yt-input-wrap .tool-input { flex: 1; min-width: 0; }

.yt-result-card {
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; background: var(--white);
  box-shadow: var(--shadow-sm); margin-top: 16px;
}
.yt-thumb-wrap {
  position: relative; background: #000; aspect-ratio: 16/9;
  display: flex; align-items: center; justify-content:center;
}
.yt-thumb-wrap img { width: 100%; height: 100%; object-fit: cover; display: block; }
.yt-play-icon {
  position: absolute; width: 56px; height: 56px;
  background: rgba(255,0,0,.9); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.yt-play-icon::after { content:''; border-left:20px solid #fff; border-top:12px solid transparent; border-bottom:12px solid transparent; margin-left:4px; }

.yt-info { padding: 16px 20px; }
.yt-title { font-family: var(--font-display); font-size: 1rem; font-weight: 700; margin-bottom: 8px; color: var(--text-primary); line-height: 1.4; }
.yt-meta { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--text-muted); margin-bottom: 12px; }
.yt-meta span { display: flex; align-items: center; gap: 4px; }
.yt-desc { font-size: .85rem; color: var(--text-secondary); line-height: 1.65; max-height: 80px; overflow: hidden; position: relative; }
.yt-desc::after { content:''; position: absolute; bottom:0; left:0; right:0; height:30px; background: linear-gradient(transparent, var(--white)); }

/* Download button grid */
.dl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px,1fr)); gap: 8px; margin-top: 12px; }
.dl-btn { padding: 9px 14px; border: 1.5px solid var(--border); border-radius: 8px; font-size: .8rem; font-weight: 600; display: flex; align-items: center; gap: 6px; justify-content: center; cursor: pointer; transition: all var(--t-fast); background: var(--white); color: var(--text-primary); text-decoration: none; }
.dl-btn:hover { border-color: var(--orange); color: var(--orange); }
.dl-btn.primary { background: var(--orange); border-color: var(--orange); color: #fff; }
.dl-btn.primary:hover { background: var(--orange-dark); border-color: var(--orange-dark); }
.dl-btn .sz { font-size: .7rem; font-weight: 400; color: inherit; opacity: .7; }

/* Transcript styles */
.transcript-wrap { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.transcript-toolbar { display: flex; gap: 8px; padding: 10px 14px; background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap; align-items: center; }
.transcript-body { max-height: 420px; overflow-y: auto; padding: 0; }
.transcript-seg { display: flex; gap: 12px; padding: 8px 16px; border-bottom: 1px solid var(--border); cursor: pointer; transition: background var(--t-fast); font-size: .88rem; line-height: 1.6; }
.transcript-seg:hover { background: var(--orange-light); }
.ts-time { font-family: var(--font-mono); font-size: .72rem; color: var(--orange); font-weight: 600; min-width: 44px; margin-top: 3px; flex-shrink: 0; }
.ts-text { color: var(--text-secondary); }

/* Tag chip */
.tag-chip { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-pill); font-size: .76rem; font-weight: 600; color: var(--text-secondary); cursor: pointer; transition: all var(--t-fast); }
.tag-chip:hover { border-color: var(--orange); color: var(--orange); background: var(--orange-light); }
.tag-chip .tag-x { font-size: .65rem; opacity: .6; }

/* Error / notice banners */
.yt-notice {
  padding: 12px 16px; border-radius: 10px; margin: 12px 0;
  font-size: .85rem; display: flex; align-items: flex-start; gap: 10px;
}
.yt-notice.error   { background: rgba(220,38,38,.07); border: 1px solid rgba(220,38,38,.2); color: #991B1B; }
.yt-notice.warning { background: rgba(245,158,11,.07); border: 1px solid rgba(245,158,11,.2); color: #92400E; }
.yt-notice.info    { background: rgba(99,102,241,.07); border: 1px solid rgba(99,102,241,.2); color: #3730A3; }
.yt-notice.success { background: rgba(5,150,105,.07);  border: 1px solid rgba(5,150,105,.2); color: #065F46; }

/* Blog post card image placeholder */
.pc-thumb { width: 100%; aspect-ratio: 16/9; background: linear-gradient(135deg, var(--orange-light), rgba(99,102,241,.08)); border-radius: 8px; margin-bottom: 12px; display: flex; align-items: center; justify-content: center; font-size: 2rem; }

/* Fix: homepage stat strip number size on mobile */
@media (max-width: 360px) { .stat-item strong { font-size: 1.5rem; } }

/* Fix: footer on mobile */
@media (max-width: 360px) { .footer-links { grid-template-columns: 1fr; } }

/* Tab component (reusable) */
.tab-bar { display: flex; border: 1.5px solid var(--border); border-radius: 10px; overflow: hidden; margin-bottom: 20px; }
.tab-bar button { flex: 1; padding: 10px 8px; border: none; background: var(--surface); color: var(--text-secondary); font-family: var(--font-display); font-weight: 700; font-size: .84rem; cursor: pointer; transition: all var(--t-fast); border-left: 1px solid var(--border); }
.tab-bar button:first-child { border-left: none; }
.tab-bar button.active { background: var(--orange); color: #fff; }
@media (min-width: 480px) { .tab-bar button { font-size: .9rem; } }

/* ── Spinner utility ── */
@keyframes hl-spin { to { transform: rotate(360deg); } }
.hl-spinner { width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--orange); border-radius: 50%; animation: hl-spin .7s linear infinite; }

/* ── Scrollbar styling ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* ============================================================
   FEEDBACK WIDGET — "Was this helpful?"
   ============================================================ */
.feedback-widget {
  margin-top: 24px; padding: 20px 24px; border: 1px solid var(--border);
  border-radius: var(--radius); background: var(--surface);
  text-align: center;
}
.feedback-widget .fb-question {
  font-family: var(--font-display); font-weight: 700; font-size: .95rem;
  color: var(--text-primary); margin-bottom: 12px;
}
.feedback-widget .fb-buttons { display: flex; gap: 10px; justify-content: center; }
.feedback-widget .fb-btn {
  padding: 8px 20px; border: 1.5px solid var(--border); border-radius: var(--radius-pill);
  background: var(--white); font-size: .85rem; font-weight: 600; cursor: pointer;
  color: var(--text-secondary); transition: all var(--t-fast);
}
.feedback-widget .fb-btn:hover { border-color: var(--orange); color: var(--orange); background: var(--orange-light); }
.feedback-widget .fb-btn.selected { background: var(--orange); border-color: var(--orange); color: #fff; }
.feedback-widget .fb-thanks {
  font-size: .88rem; color: var(--text-secondary); display: flex;
  align-items: center; justify-content: center; gap: 8px;
}
.feedback-widget .fb-thanks .fb-check {
  width: 22px; height: 22px; border-radius: 50%; background: #059669;
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: .7rem; flex-shrink: 0;
}
