/* =====================================================================
   Text Tools Pro — main.css
   - Neutral, color-blind safe palette (warm gray + muted slate-blue accent)
   - Eye-friendly low-contrast surfaces, large readable type
   - Fully responsive with container queries / clamp() fluid scale
   - WCAG AA color contrast on every text/background pair
   ===================================================================== */

/* -------- 1. Design tokens -------- */
:root {
  /* Type — Poppins for headings, Inter for body (pdfaid-style) */
  --ttp-font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji";
  --ttp-font-head: "Poppins", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --ttp-font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --ttp-size-xs: clamp(0.78rem, 0.76rem + 0.1vw, 0.84rem);
  --ttp-size-sm: clamp(0.88rem, 0.85rem + 0.15vw, 0.95rem);
  --ttp-size-md: clamp(1rem,    0.95rem + 0.25vw, 1.08rem);
  --ttp-size-lg: clamp(1.18rem, 1.1rem  + 0.4vw,  1.35rem);
  --ttp-size-xl: clamp(1.5rem,  1.3rem  + 1vw,   2rem);
  --ttp-size-2xl: clamp(2rem,   1.6rem  + 2vw,   3rem);

  /* Light palette — pdfaid.com identity: blue #2563EB on clean neutrals */
  --ttp-bg:        #f9fafb; /* gray-50 background */
  --ttp-surface:   #ffffff;
  --ttp-surface-2: #f3f4f6; /* gray-100 */
  --ttp-text:      #111827; /* gray-900 — primary text */
  --ttp-text-soft: #374151; /* gray-700 */
  --ttp-text-mute: #6b7280; /* gray-500 — secondary text */
  --ttp-border:    #d1d5db; /* gray-300 */
  --ttp-border-soft:#e5e7eb; /* gray-200 */
  --ttp-accent:    #2563eb; /* blue-600 — primary */
  --ttp-accent-2:  #1d4ed8; /* blue-700 hover */
  --ttp-accent-3:  #3b82f6; /* blue-500 lighter */
  --ttp-tint:      #eff6ff; /* blue-50 — soft tint */
  --ttp-tint-2:    #dbeafe; /* blue-100 */
  --ttp-success:   #16a34a;
  --ttp-danger:    #ef4444; /* red-500 */
  --ttp-warning:   #d97706;

  /* Layout */
  --ttp-radius:    10px;
  --ttp-radius-sm: 6px;
  --ttp-radius-lg: 16px;
  --ttp-shadow-1:  0 1px 2px rgba(17,24,39,.04), 0 1px 1px rgba(17,24,39,.03);
  --ttp-shadow-2:  0 4px 16px rgba(17,24,39,.05), 0 2px 4px rgba(17,24,39,.04);
  --ttp-shadow-3:  0 12px 32px rgba(17,24,39,.08);

  --ttp-container: 1200px;
  --ttp-gutter:    clamp(16px, 2vw, 28px);

  /* Motion */
  --ttp-ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --ttp-dur:  220ms;
}

h1, h2, h3, h4, h5, h6 { font-family: var(--ttp-font-head); }

/* -------- 2. Reset & base -------- */
*,
*::before,
*::after { box-sizing: border-box; }

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

body {
  margin: 0;
  font-family: var(--ttp-font-sans);
  font-size: var(--ttp-size-md);
  line-height: 1.65;
  color: var(--ttp-text);
  background: var(--ttp-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img, svg, video, canvas { max-width: 100%; height: auto; display: block; }
img { font-style: italic; background-color: var(--ttp-surface-2); }

a { color: var(--ttp-accent); text-decoration: underline; text-underline-offset: 0.18em; text-decoration-thickness: 1px; transition: color var(--ttp-dur) var(--ttp-ease); }
a:hover { color: var(--ttp-accent-2); }
a:focus-visible { outline: 2px solid var(--ttp-accent); outline-offset: 3px; border-radius: 3px; }

h1, h2, h3, h4, h5, h6 { font-weight: 600; line-height: 1.25; margin: 0 0 0.6em; color: var(--ttp-text); letter-spacing: -0.01em; }
h1 { font-size: var(--ttp-size-2xl); }
h2 { font-size: var(--ttp-size-xl); }
h3 { font-size: var(--ttp-size-lg); }

p, ul, ol { margin: 0 0 1em; }

hr { border: 0; border-top: 1px solid var(--ttp-border); margin: 2em 0; }

code, pre, kbd { font-family: var(--ttp-font-mono); font-size: 0.92em; }
code { background: var(--ttp-surface-2); padding: 0.1em 0.4em; border-radius: 4px; }
pre { background: var(--ttp-surface-2); padding: 1em; overflow-x: auto; border-radius: var(--ttp-radius); }

::selection { background: var(--ttp-accent); color: #fff; }

/* a11y */
.screen-reader-text {
  position: absolute !important;
  clip: rect(1px,1px,1px,1px);
  width: 1px; height: 1px; overflow: hidden;
  padding: 0; margin: -1px; border: 0;
}
.skip-link {
  position: absolute; left: -9999px; top: 1em;
  background: var(--ttp-accent); color: #fff;
  padding: 0.7em 1.2em; border-radius: var(--ttp-radius);
  z-index: 9999; text-decoration: none;
}
.skip-link:focus { left: 1em; }

/* -------- 3. Layout helpers -------- */
.ttp-container { max-width: var(--ttp-container); margin: 0 auto; padding: 0 var(--ttp-gutter); }
.ttp-layout { display: grid; gap: 2rem; grid-template-columns: minmax(0,1fr); padding: 2rem 0; }
@media (min-width: 960px) {
  .ttp-layout { grid-template-columns: minmax(0,1fr) 300px; }
}
.ttp-layout-narrow { max-width: 760px; margin: 0 auto; padding: 0 var(--ttp-gutter) 3rem; }

.ttp-prose { max-width: 72ch; }
.ttp-prose h2 { margin-top: 1.6em; }
.ttp-prose h3 { margin-top: 1.2em; }
.ttp-prose p, .ttp-prose ul, .ttp-prose ol { font-size: var(--ttp-size-md); }

/* -------- 4. Header / nav -------- */
.site-header { position: sticky; top: 0; z-index: 50; background: rgba(255, 255, 255, 0.96); backdrop-filter: saturate(160%) blur(10px); border-bottom: 1px solid var(--ttp-border-soft); }

.ttp-headbar { padding: 0; }
.ttp-headbar-inner {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 10px;
  min-height: 64px;
  padding: 8px var(--ttp-gutter);
}
.ttp-branding {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  margin-right: 4px;
  min-width: 0;
}
.ttp-branding .custom-logo-link img { max-height: 40px; width: auto; }
.ttp-branding .site-title {
  font-family: var(--ttp-font-head);
  font-size: 1.3rem;
  font-weight: 700;
  margin: 0;
  white-space: nowrap;
  line-height: 1.1;
  color: var(--ttp-accent);
  text-decoration: none;
}
.ttp-branding a.site-title:hover { color: var(--ttp-accent-2); }
.ttp-branding .site-description { display: none; }

/* The inline nav grows to fill space between logo and actions */
.ttp-mainnav { flex: 1 1 auto; min-width: 0; background: transparent; border: 0; }
.ttp-mainnav .ttp-menu {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-wrap: nowrap; gap: 2px;
  overflow-x: auto;
  scrollbar-width: thin;
}
.ttp-mainnav .ttp-menu::-webkit-scrollbar { height: 4px; }
.ttp-mainnav .ttp-menu::-webkit-scrollbar-thumb { background: var(--ttp-border); border-radius: 4px; }
.ttp-mainnav .ttp-menu a {
  display: inline-block;
  padding: 10px 12px;
  color: var(--ttp-text-soft);
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 500;
  border-radius: 8px;
  white-space: nowrap;
  transition: background 150ms ease, color 150ms ease;
}
.ttp-mainnav .ttp-menu a:hover { color: var(--ttp-accent); background: var(--ttp-tint); }
.ttp-mainnav .ttp-menu .current-menu-item > a,
.ttp-mainnav .ttp-menu .current_page_item > a {
  color: var(--ttp-accent);
  background: var(--ttp-tint);
}

/* Right side actions */
.ttp-headbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin-left: auto;
}

/* Unified icon buttons (dark mode, language, search, menu) — all identical box */
.ttp-iconbtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 42px;
  min-width: 42px;
  padding: 0 8px;
  border: 1px solid var(--ttp-border-soft);
  border-radius: 10px;
  background: var(--ttp-surface);
  color: var(--ttp-text-soft);
  cursor: pointer;
  transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
  font: inherit;
}
.ttp-iconbtn:hover { background: var(--ttp-tint); color: var(--ttp-accent); border-color: var(--ttp-tint-2); }
.ttp-iconbtn svg { display: block; }
.ttp-iconbtn .ttp-icon-moon { display: none; }
body.ttp-mode-dark .ttp-iconbtn .ttp-icon-sun,
body.ttp-theme-dark .ttp-iconbtn .ttp-icon-sun { display: none; }
body.ttp-mode-dark .ttp-iconbtn .ttp-icon-moon,
body.ttp-theme-dark .ttp-iconbtn .ttp-icon-moon { display: block; }

/* Mobile: collapse nav into menu drawer */
.ttp-menu-toggle { display: none; }
@media (max-width: 900px) {
  .ttp-menu-toggle { display: inline-flex; }
  .ttp-headbar-inner { min-height: 56px; }
  .ttp-headbar-actions { gap: 6px; flex-wrap: nowrap; }
  .ttp-mainnav {
    position: absolute;
    top: 100%; left: 0; right: 0;
    background: var(--ttp-surface);
    border-bottom: 1px solid var(--ttp-border-soft);
    box-shadow: 0 8px 24px rgba(17,24,39,0.1);
    display: none;
    flex: none;
    max-height: 80vh;
    overflow-y: auto;
  }
  .ttp-mainnav.open { display: block; }
  .ttp-mainnav .ttp-menu {
    flex-direction: column;
    padding: 12px var(--ttp-gutter);
    overflow-x: visible;
    gap: 2px;
  }
  .ttp-mainnav .ttp-menu a {
    padding: 12px 14px;
    border-radius: 8px;
    width: 100%;
  }
  /* Slightly smaller icon buttons on phones */
  .ttp-iconbtn { height: 40px; min-width: 40px; }
}
@media (max-width: 480px) {
  .ttp-iconbtn { height: 38px; min-width: 38px; padding: 0 6px; }
  .ttp-headbar-actions { gap: 4px; }
  .ttp-branding .site-title { font-size: 1.1rem; }
}

/* Search bar (collapsed) */
.ttp-searchbar { display: none; border-top: 1px solid var(--ttp-border-soft); padding: 12px 0; background: var(--ttp-surface); }
.ttp-searchbar.open { display: block; }
.ttp-searchform { display: flex; gap: 8px; }
.ttp-searchform input[type=search] {
  flex: 1; height: 44px; padding: 0 14px;
  border: 1px solid var(--ttp-border); border-radius: var(--ttp-radius);
  background: var(--ttp-surface); color: var(--ttp-text);
  font: inherit;
}
.ttp-searchform input[type=search]:focus { outline: none; border-color: var(--ttp-accent); box-shadow: 0 0 0 3px rgba(37,99,235,0.15); }

/* Breadcrumbs */
.ttp-breadcrumbs { padding: 10px 0; border-top: 1px solid var(--ttp-border-soft); }
.ttp-breadcrumbs ol { list-style: none; margin: 0 auto; padding: 0 var(--ttp-gutter); max-width: var(--ttp-container); display: flex; flex-wrap: wrap; gap: 8px; font-size: 0.85rem; color: var(--ttp-text-mute); }
.ttp-breadcrumbs li { display: flex; align-items: center; }
.ttp-breadcrumbs li + li::before { content: "›"; margin: 0 6px; color: var(--ttp-text-mute); }
.ttp-breadcrumbs a { color: var(--ttp-text-soft); }

/* -------- 5. Buttons -------- */
.ttp-btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: var(--ttp-surface-2);
  color: var(--ttp-text);
  font: inherit; font-weight: 500; font-size: 0.94rem;
  text-decoration: none;
  cursor: pointer;
  transition: background 180ms ease, border-color 180ms ease, color 180ms ease, transform 120ms ease, box-shadow 180ms ease;
}
.ttp-btn:hover { background: var(--ttp-tint); color: var(--ttp-accent); }
.ttp-btn:active { transform: translateY(1px); }
.ttp-btn:focus-visible { outline: 2px solid var(--ttp-accent); outline-offset: 2px; }
.ttp-btn-primary { background: var(--ttp-accent); color: #fff; border-color: var(--ttp-accent); box-shadow: 0 2px 6px rgba(37,99,235,0.18); }
.ttp-btn-primary:hover { background: var(--ttp-accent-2); border-color: var(--ttp-accent-2); color: #fff; box-shadow: 0 4px 12px rgba(37,99,235,0.25); }
.ttp-btn-ghost { background: transparent; border-color: var(--ttp-border); }
.ttp-btn-ghost:hover { background: var(--ttp-tint); color: var(--ttp-accent); border-color: var(--ttp-tint-2); }
.ttp-btn-outline { background: transparent; color: var(--ttp-accent); border-color: var(--ttp-accent); }
.ttp-btn-outline:hover { background: var(--ttp-accent); color: #fff; }
.ttp-btn-sm { padding: 6px 10px; font-size: 0.82rem; }

/* -------- 6. Hero -------- */
.ttp-hero { padding: clamp(48px, 8vw, 96px) 0 clamp(32px, 6vw, 72px); text-align: center; }
.ttp-hero-title { font-size: clamp(2rem, 4vw + 1rem, 3.4rem); line-height: 1.1; letter-spacing: -0.02em; margin-bottom: 0.4em; }
.ttp-hero-sub { font-size: var(--ttp-size-lg); color: var(--ttp-text-soft); max-width: 60ch; margin: 0 auto 1.5em; }
.ttp-hero-search {
  display: flex; gap: 8px; max-width: 600px; margin: 0 auto 1.5em;
}
.ttp-hero-search input {
  flex: 1; height: 52px; padding: 0 18px;
  border: 1px solid var(--ttp-border);
  border-radius: var(--ttp-radius);
  background: var(--ttp-surface);
  color: var(--ttp-text);
  font: inherit; font-size: 1rem;
}
.ttp-hero-search input:focus { outline: none; border-color: var(--ttp-accent); box-shadow: 0 0 0 3px rgba(37,99,235,0.15); }
.ttp-hero-trust { font-size: 0.82rem; color: var(--ttp-text-mute); display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.ttp-hero-trust .ttp-dot { opacity: 0.5; }

/* -------- 7. Tools section -------- */
.ttp-tools-section { padding: clamp(24px,4vw,48px) 0; }
.ttp-tools-group { margin-bottom: 3rem; }
.ttp-group-header { margin-bottom: 1.2rem; }
.ttp-group-title { margin-bottom: 0.2em; }
.ttp-group-desc { color: var(--ttp-text-soft); margin: 0; max-width: 65ch; }

.ttp-tools-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.ttp-tool-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 12px;
  padding: 12px 14px;
  min-height: 0;
  background: var(--ttp-surface);
  border: 1px solid var(--ttp-border-soft);
  border-radius: 12px;
  color: var(--ttp-text);
  text-decoration: none;
  cursor: pointer;
  text-align: left;
  font: inherit;
  width: 100%;
  transition: border-color 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}
.ttp-tool-card:hover, .ttp-tool-card:focus-visible {
  border-color: var(--ttp-accent);
  box-shadow: 0 6px 16px -6px rgba(37,99,235,0.18);
  transform: translateY(-2px);
  outline: none;
}
.ttp-tool-card.active { border-color: var(--ttp-accent); background: var(--ttp-tint); }
.ttp-tool-icon {
  font-family: var(--ttp-font-mono);
  font-size: 0.95rem;
  color: #fff;
  background: var(--ttp-accent);
  width: 40px; height: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 10px;
  line-height: 1;
  font-weight: 700;
  flex-shrink: 0;
}
.ttp-tool-name { font-weight: 500; font-size: 1rem; line-height: 1.3; flex: 1 1 auto; }
.ttp-tool-tag {
  font-size: 0.68rem; color: var(--ttp-text-mute);
  text-transform: uppercase; letter-spacing: 0.06em;
  font-weight: 600;
  flex-shrink: 0;
}

/* Colorful icon badges (cycling palette, convertcase.net-style) */
.ttp-tools-grid .ttp-tool-card:nth-child(8n+1) .ttp-tool-icon { background: #ef4444; }
.ttp-tools-grid .ttp-tool-card:nth-child(8n+2) .ttp-tool-icon { background: #16a34a; }
.ttp-tools-grid .ttp-tool-card:nth-child(8n+3) .ttp-tool-icon { background: #0ea5e9; }
.ttp-tools-grid .ttp-tool-card:nth-child(8n+4) .ttp-tool-icon { background: #8b5cf6; }
.ttp-tools-grid .ttp-tool-card:nth-child(8n+5) .ttp-tool-icon { background: #d97706; }
.ttp-tools-grid .ttp-tool-card:nth-child(8n+6) .ttp-tool-icon { background: #0d9488; }
.ttp-tools-grid .ttp-tool-card:nth-child(8n+7) .ttp-tool-icon { background: #db2777; }
.ttp-tools-grid .ttp-tool-card:nth-child(8n+8) .ttp-tool-icon { background: #2563eb; }

/* -------- 8. Content sections -------- */
.ttp-content-section { padding: clamp(32px, 5vw, 72px) 0; }
.ttp-content-section .ttp-prose { margin: 0 auto; }
.ttp-page-header { padding: 24px 0 12px; }
.ttp-page-title { margin: 0; }

/* -------- 9. Posts grid -------- */
.ttp-posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}
.ttp-post-card {
  background: var(--ttp-surface);
  border: 1px solid var(--ttp-border-soft);
  border-radius: var(--ttp-radius);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: border-color var(--ttp-dur), transform var(--ttp-dur), box-shadow var(--ttp-dur);
}
.ttp-post-card:hover { border-color: var(--ttp-accent); box-shadow: var(--ttp-shadow-2); transform: translateY(-2px); }
.ttp-card-thumb { display: block; aspect-ratio: 16/9; overflow: hidden; }
.ttp-card-thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform 400ms var(--ttp-ease); }
.ttp-post-card:hover .ttp-card-thumb img { transform: scale(1.03); }
.ttp-card-body { padding: 1rem 1.1rem 1.2rem; }
.ttp-card-title { font-size: var(--ttp-size-lg); margin-bottom: 0.4em; }
.ttp-card-title a { color: inherit; text-decoration: none; }
.ttp-card-title a:hover { color: var(--ttp-accent); }
.ttp-card-meta { color: var(--ttp-text-mute); font-size: 0.82rem; margin-bottom: 0.6em; }
.ttp-card-excerpt p { font-size: 0.92rem; color: var(--ttp-text-soft); margin: 0 0 0.8em; }
.ttp-card-more { font-size: 0.88rem; font-weight: 500; }

/* -------- 10. Single article -------- */
.ttp-single-article, .ttp-page-article {
  background: var(--ttp-surface);
  border: 1px solid var(--ttp-border-soft);
  border-radius: var(--ttp-radius-lg);
  padding: clamp(1.5rem, 3vw, 2.5rem);
  margin-bottom: 2rem;
}
.ttp-entry-title { font-size: clamp(1.6rem, 3vw, 2.4rem); }
.ttp-entry-meta { color: var(--ttp-text-mute); font-size: 0.85rem; margin: 0 0 1.5em; }
.ttp-meta-sep { margin: 0 6px; }
.ttp-entry-thumb { margin: 0 0 1.5em; border-radius: var(--ttp-radius); overflow: hidden; }
.ttp-entry-content > * + * { margin-top: 1em; }
.ttp-entry-content img { border-radius: var(--ttp-radius); }
.ttp-entry-footer { margin-top: 2rem; padding-top: 1.2rem; border-top: 1px solid var(--ttp-border-soft); }
.ttp-tags-label { color: var(--ttp-text-mute); }
.ttp-related { margin-top: 2.5rem; }
.ttp-related-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.ttp-related-card { background: var(--ttp-surface); border: 1px solid var(--ttp-border-soft); border-radius: var(--ttp-radius); padding: 1rem; text-decoration: none; color: inherit; transition: border-color var(--ttp-dur); }
.ttp-related-card:hover { border-color: var(--ttp-accent); }
.ttp-related-card h3 { font-size: 1rem; margin: 0.6em 0 0; }

/* -------- 11. Sidebar / widgets -------- */
.ttp-sidebar .widget {
  background: var(--ttp-surface);
  border: 1px solid var(--ttp-border-soft);
  border-radius: var(--ttp-radius);
  padding: 1.2rem 1.2rem;
  margin-bottom: 1.5rem;
}
.widget-title { font-size: 1rem; margin: 0 0 0.8em; }
.widget ul { list-style: none; padding: 0; margin: 0; }
.widget ul li { padding: 6px 0; border-bottom: 1px solid var(--ttp-border-soft); }
.widget ul li:last-child { border-bottom: 0; }

/* -------- 12. Footer -------- */
.site-footer {
  background: var(--ttp-surface-2);
  border-top: 1px solid var(--ttp-border-soft);
  margin-top: clamp(40px, 6vw, 80px);
}
.ttp-footer-widgets { padding: 2rem 0; border-bottom: 1px solid var(--ttp-border-soft); }
.ttp-footer-main { padding: 2.5rem 0 1.5rem; }
.ttp-footer-grid {
  display: grid;
  gap: 2rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}
.ttp-footer-title { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ttp-text-mute); margin-bottom: 1em; font-weight: 700; }
.ttp-footer-links { list-style: none; margin: 0; padding: 0; }
.ttp-footer-links li { margin-bottom: 0.5em; }
.ttp-footer-links a { color: var(--ttp-text-soft); text-decoration: none; font-size: 0.92rem; transition: color 150ms ease; }
.ttp-footer-links a:hover { color: var(--ttp-accent); }
.ttp-footer-bottom { padding: 1rem 0 1.5rem; border-top: 1px solid var(--ttp-border-soft); }
.ttp-copy { margin: 0; font-size: 0.82rem; color: var(--ttp-text-mute); text-align: center; }
.ttp-security-badge { margin-top: 1em; text-align: center; }
.ttp-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 6px 12px;
  background: var(--ttp-tint);
  border: 1px solid var(--ttp-tint-2);
  border-radius: 999px;
  color: var(--ttp-accent);
}
.ttp-badge::before {
  content: '';
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--ttp-accent);
}

/* -------- 13. Ads -------- */
.ttp-ad {
  margin: 1.5rem auto;
  text-align: center;
  max-width: var(--ttp-container);
  padding: 0 var(--ttp-gutter);
  min-height: 50px;
}
.ttp-ad::before {
  content: "Advertisement";
  display: block;
  font-size: 0.68rem;
  color: var(--ttp-text-mute);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 6px;
}

/* -------- 14. Forms -------- */
.ttp-textarea, .ttp-input, input[type=text], input[type=email], input[type=search], input[type=url], input[type=number], textarea, select {
  width: 100%;
  padding: 10px 14px;
  font: inherit;
  font-size: var(--ttp-size-md);
  background: var(--ttp-surface);
  color: var(--ttp-text);
  border: 1px solid var(--ttp-border);
  border-radius: var(--ttp-radius);
  transition: border-color var(--ttp-dur), box-shadow var(--ttp-dur);
}
.ttp-textarea { font-family: var(--ttp-font-mono); line-height: 1.5; min-height: 200px; resize: vertical; }
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--ttp-accent); box-shadow: 0 0 0 3px rgba(37,99,235,0.15); }

label { display: inline-block; font-weight: 500; font-size: 0.92rem; color: var(--ttp-text-soft); margin-bottom: 0.3em; }

.ttp-alert { padding: 12px 16px; border-radius: var(--ttp-radius); margin: 1rem 0; border: 1px solid var(--ttp-border); background: var(--ttp-surface-2); }
.ttp-alert-ok  { border-color: #b6cdb6; background: #ecf5ec; color: #2c4f2c; }
.ttp-alert-err { border-color: #d8b6ad; background: #f7e9e5; color: #6a2f24; }

/* -------- 15. 404 -------- */
.ttp-404 { text-align: center; padding: 4rem 0; }
.ttp-404-code { font-size: clamp(4rem, 14vw, 10rem); line-height: 1; margin: 0; color: var(--ttp-accent); letter-spacing: -0.04em; font-weight: 700; }
.ttp-404-title { font-size: 1.5rem; margin: 0.5em 0 0.3em; }
.ttp-404-desc { color: var(--ttp-text-soft); max-width: 50ch; margin: 0 auto 2em; }
.ttp-404-search { max-width: 460px; margin: 1.5em auto 0; }

/* -------- 16. Pagination -------- */
.pagination, .navigation.pagination { margin: 2rem 0; }
.pagination .nav-links { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.pagination .page-numbers {
  padding: 8px 14px; border: 1px solid var(--ttp-border-soft);
  border-radius: var(--ttp-radius); text-decoration: none;
  color: var(--ttp-text-soft);
}
.pagination .page-numbers.current { background: var(--ttp-accent); color: #fff; border-color: var(--ttp-accent); }
.pagination .page-numbers:hover:not(.current) { border-color: var(--ttp-accent); color: var(--ttp-accent); }

/* -------- 17. Comments -------- */
.ttp-comments-area { margin-top: 2rem; padding: 1.5rem; background: var(--ttp-surface); border: 1px solid var(--ttp-border-soft); border-radius: var(--ttp-radius); }
.ttp-comments-title { margin-top: 0; }
.ttp-comment-list { list-style: none; padding: 0; }
.ttp-comment-list .comment-body { padding: 1em 0; border-top: 1px solid var(--ttp-border-soft); }
.comment-form input, .comment-form textarea { width: 100%; }
.comment-form p { margin-bottom: 1em; }

/* -------- 18. Print -------- */
@media print {
  .site-header, .site-footer, .ttp-ad, .ttp-iconbtn, .ttp-mainnav, .ttp-sidebar { display: none !important; }
  body { background: #fff; color: #000; }
  a { color: #000; text-decoration: underline; }
}

/* -------- 19. Reduce motion -------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}

/* -------- 20. RTL fixes -------- */
html[dir="rtl"] body { direction: rtl; text-align: right; }
html[dir="rtl"] .ttp-lang-menu { left: 0; right: auto; }
html[dir="rtl"] .ttp-breadcrumbs li + li::before { content: "‹"; }
html[dir="rtl"] .ttp-topbar-actions { margin-left: 0; margin-right: auto; }
html[dir="rtl"] .ttp-cc-buttons { direction: rtl; }
html[dir="rtl"] .ttp-cc-bar { flex-direction: row-reverse; }
html[dir="rtl"] .ttp-cc-textarea { text-align: right; }
html[dir="rtl"] .ttp-counts { direction: rtl; }
html[dir="rtl"] .ttp-cat-card { text-align: right; }
html[dir="rtl"] .ttp-tool-card { flex-direction: row-reverse; text-align: right; }
html[dir="rtl"] .ttp-prose { text-align: right; }
html[dir="rtl"] .ttp-prose ul, html[dir="rtl"] .ttp-prose ol { padding-right: 1.5em; padding-left: 0; }
html[dir="rtl"] .ttp-menu { direction: rtl; }
html[dir="rtl"] .ttp-footer-grid { direction: rtl; text-align: right; }

/* Ensure mobile menu doesn't break when RTL */
html[dir="rtl"] .ttp-cc-actions { flex-direction: row-reverse; }
html[dir="rtl"] .ttp-cc-icon svg { transform: scaleX(-1); }
html[dir="rtl"] .ttp-cc-btn { flex-direction: row-reverse; text-align: right; }

/* Critical: never let translated content overflow the viewport */
html, body { overflow-x: hidden; max-width: 100%; }
.ttp-cc-hero, .ttp-content-section, .ttp-container { max-width: 100%; overflow-x: clip; }

/* ---- Google Translate cleanup removed (now using real URL routing) ---- */

/* =====================================================================
   Language switcher dropdown
   ===================================================================== */
.ttp-langswitch { position: relative; }
.ttp-lang-menu {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: min(420px, 94vw);
  max-height: 72vh;
  overflow-y: auto;
  background: var(--ttp-surface);
  border: 1px solid var(--ttp-border);
  border-radius: 14px;
  box-shadow: 0 16px 40px rgba(15,23,42,0.16);
  padding: 10px;
  z-index: 80;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.98);
  transition: opacity 160ms ease, transform 160ms ease, visibility 160ms;
}
.ttp-langswitch.open .ttp-lang-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}
.ttp-lang-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}
.ttp-lang-item {
  display: flex !important;
  flex-direction: row !important;
  align-items: center !important;
  gap: 10px;
  width: 100%;
  padding: 9px 11px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 9px;
  text-decoration: none;
  color: var(--ttp-text);
  transition: background 150ms ease, border-color 150ms ease;
}
.ttp-lang-item:hover { background: var(--ttp-tint); border-color: var(--ttp-tint-2); }
.ttp-lang-item.active { background: var(--ttp-tint); border-color: var(--ttp-accent); }
.ttp-lang-flag { display: inline-flex; align-items: center; flex-shrink: 0; }
.ttp-lang-flag .ttp-flag { width: 28px; }
.ttp-lang-textcol { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.25; min-width: 0; }
.ttp-lang-native { font-size: 0.92rem; font-weight: 600; color: var(--ttp-text); }
.ttp-lang-en { font-size: 0.68rem !important; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ttp-text-mute); margin-top: 1px; }

.ttp-flag {
  width: 22px;
  height: auto;
  display: block;
  border-radius: 3px;
  overflow: hidden;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.08);
  flex-shrink: 0;
}
.ttp-lang-current-flag { display: inline-flex; align-items: center; }
.ttp-lang-current-flag .ttp-flag { width: 22px; }
.ttp-lang-btn { gap: 5px; padding: 0 10px; min-width: 42px; width: auto; }
.ttp-lang-caret { color: var(--ttp-text-mute); transition: transform 180ms ease; }
.ttp-langswitch.open .ttp-lang-caret { transform: rotate(180deg); }

@media (max-width: 600px) {
  .ttp-lang-list { grid-template-columns: 1fr !important; }
  .ttp-lang-menu { width: min(300px, 92vw); right: -40px; }
}
html[dir="rtl"] .ttp-lang-menu { left: 0; right: auto; }
html[dir="rtl"] .ttp-lang-item { text-align: right; }

/* =====================================================================
   Dropdown navigation (convertcase.net-style submenus)
   ===================================================================== */
.ttp-mainnav .ttp-menu { overflow: visible; }
.ttp-has-sub { position: relative; }
.ttp-sub-toggle { display: inline-flex !important; align-items: center; gap: 4px; }
.ttp-sub-caret { transition: transform 180ms ease; flex-shrink: 0; }
.ttp-has-sub:hover > .ttp-sub-toggle .ttp-sub-caret,
.ttp-has-sub.open > .ttp-sub-toggle .ttp-sub-caret { transform: rotate(180deg); }

.ttp-submenu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 240px;
  max-height: 70vh;
  overflow-y: auto;
  background: var(--ttp-surface);
  border: 1px solid var(--ttp-border);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(15,23,42,0.14);
  padding: 8px;
  margin: 0;
  list-style: none;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 160ms ease, transform 160ms ease, visibility 160ms;
  z-index: 70;
}
.ttp-has-sub:hover > .ttp-submenu,
.ttp-has-sub.open > .ttp-submenu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.ttp-submenu li { margin: 0; }
.ttp-submenu a {
  display: block !important;
  padding: 9px 12px !important;
  border-radius: 8px;
  font-size: 0.9rem !important;
  font-weight: 400 !important;
  color: var(--ttp-text-soft) !important;
  white-space: nowrap;
}
.ttp-submenu a:hover { background: var(--ttp-tint) !important; color: var(--ttp-accent) !important; }
.ttp-sub-all a {
  font-weight: 600 !important;
  color: var(--ttp-accent) !important;
  border-bottom: 1px solid var(--ttp-border-soft);
  border-radius: 8px 8px 0 0;
  margin-bottom: 4px;
}

/* Mobile: submenus become expandable inline blocks */
@media (max-width: 900px) {
  .ttp-submenu {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border: none;
    border-left: 2px solid var(--ttp-border-soft);
    border-radius: 0;
    margin: 4px 0 8px 14px;
    padding: 0 0 0 8px;
    max-height: none;
    display: none;
  }
  .ttp-has-sub.open > .ttp-submenu { display: block; }
  .ttp-submenu a { white-space: normal; }
}

/* RTL submenu alignment */
html[dir="rtl"] .ttp-submenu { left: auto; right: 0; }
html[dir="rtl"] .ttp-submenu a { text-align: right; }
