﻿/* ============================================================
   PocketTools — custom.css
   Brand variables + Bootstrap 5.3 overrides
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Fraunces:ital,opsz,wght@0,9..144,300;0,9..144,600;1,9..144,300&family=Instrument+Sans:wght@400;500;600&display=swap');

/* ── Light mode tokens ────────────────────────────────────── */
:root {
  --th-primary:         #e85d26;       /* warm amber-orange accent */
  --th-primary-hover:   #c94d1a;
  --th-primary-subtle:  #fff0ea;
  --th-surface:         #fafaf8;       /* warm off-white */
  --th-surface-2:       #f2f1ee;       /* card / input background */
  --th-surface-3:       #e8e6e1;       /* subtle dividers */
  --th-border:          #dddbd5;
  --th-text:            #1c1a18;
  --th-text-2:          #4a4845;       /* secondary text */
  --th-text-muted:      #857f78;
  --th-radius:          0.6rem;
  --th-radius-lg:       1rem;
  --th-shadow-sm:       0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --th-shadow:          0 4px 12px rgba(0,0,0,0.08), 0 2px 4px rgba(0,0,0,0.05);
  --th-shadow-lg:       0 12px 32px rgba(0,0,0,0.10), 0 4px 8px rgba(0,0,0,0.06);

  /* Typography */
  --th-font-body:       'Instrument Sans', system-ui, sans-serif;
  --th-font-display:    'Fraunces', Georgia, serif;
  --th-font-mono:       'DM Mono', 'Courier New', monospace;

  /* Transitions */
  --th-transition:      0.18s ease;
}

/* ── Dark mode tokens ─────────────────────────────────────── */
[data-bs-theme="dark"] {
  --th-primary:         #f07040;
  --th-primary-hover:   #e85d26;
  --th-primary-subtle:  #2a1a12;
  --th-surface:         #141210;
  --th-surface-2:       #1e1c19;
  --th-surface-3:       #2a2824;
  --th-border:          #333028;
  --th-text:            #f0ece6;
  --th-text-2:          #b8b2a8;
  --th-text-muted:      #7a746c;
  --th-shadow-sm:       0 1px 3px rgba(0,0,0,0.3);
  --th-shadow:          0 4px 12px rgba(0,0,0,0.4);
  --th-shadow-lg:       0 12px 32px rgba(0,0,0,0.5);
}

/* ── Base ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

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

body {
  font-family: var(--th-font-body);
  background-color: var(--th-surface);
  color: var(--th-text);
  font-size: 1rem;
  line-height: 1.6;
  transition: background-color var(--th-transition), color var(--th-transition);
}

/* ── Typography ───────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  font-family: var(--th-font-display);
  font-weight: 600;
  line-height: 1.2;
  color: var(--th-text);
}

.th-mono {
  font-family: var(--th-font-mono);
  font-size: 0.875rem;
}

/* ── Header ───────────────────────────────────────────────── */
.th-header {
  background-color: var(--th-surface);
  border-bottom: 1px solid var(--th-border);
  padding: 0.75rem 0;
  position: sticky;
  top: 0;
  z-index: 100;
  transition: background-color var(--th-transition), border-color var(--th-transition);
}

.th-header .th-logo {
  font-family: var(--th-font-display);
  font-weight: 600;
  font-size: 1.35rem;
  color: var(--th-text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.th-header .th-logo span {
  color: var(--th-primary);
}

.th-nav-link {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--th-text-2);
  text-decoration: none;
  padding: 0.35rem 0.65rem;
  border-radius: var(--th-radius);
  transition: color var(--th-transition), background-color var(--th-transition);
  white-space: nowrap;
}

.th-nav-link:hover {
  color: var(--th-text);
  background-color: var(--th-surface-2);
}

/* Theme toggle button */
.th-theme-toggle {
  background: var(--th-surface-2);
  border: 1px solid var(--th-border);
  border-radius: 2rem;
  padding: 0.3rem 0.65rem;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--th-text-2);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  transition: all var(--th-transition);
  line-height: 1;
}

.th-theme-toggle:hover {
  background: var(--th-surface-3);
  color: var(--th-text);
}

.th-icon-sun  { display: none; }
.th-icon-moon { display: inline; }
[data-bs-theme="dark"] .th-icon-sun  { display: inline; }
[data-bs-theme="dark"] .th-icon-moon { display: none; }

/* ── Breadcrumb ───────────────────────────────────────────── */
.th-breadcrumb {
  font-size: 0.8rem;
  color: var(--th-text-muted);
  padding: 0.75rem 0 0;
}

.th-breadcrumb a {
  color: var(--th-text-muted);
  text-decoration: none;
  transition: color var(--th-transition);
}

.th-breadcrumb a:hover { color: var(--th-primary); }
.th-breadcrumb .sep { margin: 0 0.4rem; opacity: 0.5; }

/* ── Page title ───────────────────────────────────────────── */
.th-page-title {
  padding: 1.25rem 0 0.5rem;
}

.th-page-title h1 {
  font-size: clamp(1.75rem, 4vw, 2.5rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  margin-bottom: 0.35rem;
  font-style: italic;
}

.th-page-title .subtitle {
  font-family: var(--th-font-body);
  font-size: 1rem;
  color: var(--th-text-2);
  font-weight: 400;
}

/* ── Ad slots ─────────────────────────────────────────────── */
.th-ad-slot {
  display: none; /* hidden during AdSense approval — remove this line when approved */
  /* background: var(--th-surface-2);
  border: 1px dashed var(--th-border);
  border-radius: var(--th-radius);
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--th-text-muted);
  font-size: 0.75rem;
  font-family: var(--th-font-mono);
  margin: 1.25rem 0;
  text-transform: uppercase;
  letter-spacing: 0.08em; */
}

/* ── Tool card / surface ──────────────────────────────────── */
.th-tool-card {
  background: var(--th-surface-2);
  border: 1px solid var(--th-border);
  border-radius: var(--th-radius-lg);
  padding: 1.5rem;
  box-shadow: var(--th-shadow-sm);
  transition: background-color var(--th-transition), border-color var(--th-transition);
}

/* ── Inputs / textareas ───────────────────────────────────── */
.th-textarea {
  width: 100%;
  background: var(--th-surface);
  border: 1.5px solid var(--th-border);
  border-radius: var(--th-radius);
  color: var(--th-text);
  font-family: var(--th-font-body);
  font-size: 0.975rem;
  line-height: 1.65;
  padding: 1rem 1.1rem;
  resize: vertical;
  transition: border-color var(--th-transition), box-shadow var(--th-transition);
  outline: none;
}

.th-textarea:focus {
  border-color: var(--th-primary);
  box-shadow: 0 0 0 3px rgba(232, 93, 38, 0.12);
}

.th-textarea::placeholder { color: var(--th-text-muted); }

/* ── Buttons ──────────────────────────────────────────────── */
.th-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--th-font-body);
  font-weight: 500;
  font-size: 0.875rem;
  padding: 0.5rem 1.1rem;
  border-radius: var(--th-radius);
  border: 1.5px solid transparent;
  cursor: pointer;
  transition: all var(--th-transition);
  text-decoration: none;
  white-space: nowrap;
}

.th-btn-primary {
  background: var(--th-primary);
  color: #fff;
  border-color: var(--th-primary);
}

.th-btn-primary:hover {
  background: var(--th-primary-hover);
  border-color: var(--th-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 3px 8px rgba(232, 93, 38, 0.25);
}

.th-btn-ghost {
  background: transparent;
  color: var(--th-text-2);
  border-color: var(--th-border);
}

.th-btn-ghost:hover {
  background: var(--th-surface-2);
  color: var(--th-text);
  border-color: var(--th-text-muted);
}

.th-btn:active { transform: translateY(0); }

/* ── Stat cards ───────────────────────────────────────────── */
.th-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.th-stat-card {
  background: var(--th-surface);
  border: 1px solid var(--th-border);
  border-radius: var(--th-radius);
  padding: 1rem 1rem 0.85rem;
  text-align: center;
  transition: all var(--th-transition);
  cursor: default;
}

.th-stat-card:hover {
  border-color: var(--th-primary);
  box-shadow: var(--th-shadow-sm);
  transform: translateY(-1px);
}

.th-stat-value {
  font-family: var(--th-font-display);
  font-size: 2rem;
  font-weight: 600;
  line-height: 1.1;
  color: var(--th-primary);
  letter-spacing: -0.04em;
  display: block;
  transition: all 0.25s ease;
}

.th-stat-label {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--th-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 0.2rem;
  display: block;
}

/* ── Keyword density table ────────────────────────────────── */
.th-kd-table {
  width: 100%;
  font-size: 0.875rem;
  border-collapse: collapse;
}

.th-kd-table th {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--th-text-muted);
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--th-border);
  text-align: left;
}

.th-kd-table td {
  padding: 0.45rem 0.75rem;
  border-bottom: 1px solid var(--th-surface-3);
  color: var(--th-text-2);
  font-family: var(--th-font-mono);
}

.th-kd-table tr:last-child td { border-bottom: none; }

.th-kd-bar-wrap {
  background: var(--th-surface-3);
  border-radius: 2px;
  height: 4px;
  width: 100%;
  max-width: 120px;
}

.th-kd-bar {
  background: var(--th-primary);
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s ease;
}

/* ── Section headers ──────────────────────────────────────── */
.th-section-header {
  font-family: var(--th-font-display);
  font-size: 1.35rem;
  font-weight: 600;
  font-style: italic;
  letter-spacing: -0.02em;
  margin-bottom: 0.75rem;
  color: var(--th-text);
}

/* ── FAQ accordion ────────────────────────────────────────── */
.th-faq .accordion-button {
  font-family: var(--th-font-body);
  font-weight: 500;
  font-size: 0.95rem;
  background-color: var(--th-surface-2);
  color: var(--th-text);
  border: none;
  box-shadow: none;
}

.th-faq .accordion-button:not(.collapsed) {
  background-color: var(--th-primary-subtle);
  color: var(--th-primary);
  box-shadow: none;
}

.th-faq .accordion-button::after {
  filter: none;
  opacity: 0.5;
}

.th-faq .accordion-button:not(.collapsed)::after {
  filter: none;
  opacity: 1;
}

.th-faq .accordion-item {
  background-color: var(--th-surface-2);
  border: 1px solid var(--th-border);
  margin-bottom: 0.5rem;
  border-radius: var(--th-radius) !important;
  overflow: hidden;
}

.th-faq .accordion-body {
  font-size: 0.925rem;
  color: var(--th-text-2);
  line-height: 1.7;
  background-color: var(--th-surface-2);
}

/* ── Related tool cards ───────────────────────────────────── */
.th-related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
}

.th-related-card {
  background: var(--th-surface-2);
  border: 1px solid var(--th-border);
  border-radius: var(--th-radius);
  padding: 1rem;
  text-decoration: none;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  transition: all var(--th-transition);
}

.th-related-card:hover {
  border-color: var(--th-primary);
  background: var(--th-primary-subtle);
  transform: translateY(-2px);
  box-shadow: var(--th-shadow);
}

.th-related-card .card-icon {
  font-size: 1.4rem;
  line-height: 1;
}

.th-related-card .card-name {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--th-text);
}

.th-related-card .card-desc {
  font-size: 0.775rem;
  color: var(--th-text-muted);
  line-height: 1.4;
}

/* ── Toast ────────────────────────────────────────────────── */
.th-toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.th-toast {
  background: var(--th-text);
  color: var(--th-surface);
  font-size: 0.875rem;
  font-weight: 500;
  padding: 0.65rem 1rem;
  border-radius: var(--th-radius);
  box-shadow: var(--th-shadow-lg);
  animation: toastIn 0.2s ease forwards;
  max-width: 280px;
}

.th-toast.success { border-left: 3px solid #22c55e; }
.th-toast.error   { border-left: 3px solid #ef4444; }
.th-toast.info    { border-left: 3px solid var(--th-primary); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(1rem); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ── Footer ───────────────────────────────────────────────── */
.th-footer {
  background: var(--th-surface-2);
  border-top: 1px solid var(--th-border);
  padding: 2.5rem 0 1.5rem;
  margin-top: 3rem;
  transition: background-color var(--th-transition), border-color var(--th-transition);
}

.th-footer-logo {
  font-family: var(--th-font-display);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--th-text);
  text-decoration: none;
}

.th-footer-logo span { color: var(--th-primary); }

.th-footer-tagline {
  font-size: 0.825rem;
  color: var(--th-text-muted);
  margin-top: 0.3rem;
}

.th-footer-heading {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--th-text-muted);
  margin-bottom: 0.75rem;
}

.th-footer-link {
  display: block;
  font-size: 0.85rem;
  color: var(--th-text-2);
  text-decoration: none;
  padding: 0.2rem 0;
  transition: color var(--th-transition);
}

.th-footer-link:hover { color: var(--th-primary); }

.th-footer-bottom {
  border-top: 1px solid var(--th-border);
  margin-top: 2rem;
  padding-top: 1.25rem;
  font-size: 0.8rem;
  color: var(--th-text-muted);
}

/* ── Utility classes ──────────────────────────────────────── */
.text-primary-th { color: var(--th-primary) !important; }
.bg-surface-2    { background-color: var(--th-surface-2) !important; }

/* ── Responsive tweaks ────────────────────────────────────── */
@media (max-width: 576px) {
  .th-stat-value    { font-size: 1.6rem; }
  .th-tool-card     { padding: 1rem; }
  .th-related-grid  { grid-template-columns: repeat(2, 1fr); }
}

/* ── Animate stat number change ───────────────────────────── */
@keyframes statPop {
  0%   { transform: scale(1); }
  40%  { transform: scale(1.12); }
  100% { transform: scale(1); }
}

.th-stat-value.updated {
  animation: statPop 0.3s ease;
}

/* ── Section divider ──────────────────────────────────────── */
.th-divider {
  border: none;
  border-top: 1px solid var(--th-border);
  margin: 2rem 0;
}

/* ── Homepage hero ────────────────────────────────────────── */
.th-hero {
  padding: 4rem 0 3rem;
  text-align: center;
}
.th-hero h1 {
  font-family: var(--th-font-display);
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1.1;
  color: var(--th-text);
  margin-bottom: 0.75rem;
}
.th-hero h1 span { color: var(--th-primary); }
.th-hero .lead {
  font-size: 1.1rem;
  color: var(--th-text-2);
  max-width: 520px;
  margin: 0 auto 2rem;
  line-height: 1.6;
}
.th-search-bar {
  display: flex; gap: 0; max-width: 480px; margin: 0 auto;
  border: 2px solid var(--th-border);
  border-radius: var(--th-radius-lg);
  overflow: hidden;
  background: var(--th-surface);
  transition: border-color var(--th-transition);
}
.th-search-bar:focus-within { border-color: var(--th-primary); }
.th-search-bar input {
  flex: 1; border: none; outline: none;
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  background: transparent;
  color: var(--th-text);
  font-family: var(--th-font-body);
}
.th-search-bar input::placeholder { color: var(--th-text-muted); }
.th-search-bar button {
  padding: 0.75rem 1.25rem;
  background: var(--th-primary); border: none;
  color: #fff; font-size: 1rem; cursor: pointer;
  transition: background var(--th-transition);
}
.th-search-bar button:hover { background: var(--th-primary-hover); }

/* ── Category section header ──────────────────────────────── */
.th-cat-header {
  display: flex; align-items: center;
  justify-content: space-between; flex-wrap: wrap;
  gap: 0.5rem; margin-bottom: 1rem;
}
.th-cat-title {
  font-family: var(--th-font-display);
  font-size: 1.4rem; font-weight: 600;
  letter-spacing: -0.03em; color: var(--th-text);
  display: flex; align-items: center; gap: 0.5rem;
}
.th-cat-link {
  font-size: 0.82rem; color: var(--th-primary);
  text-decoration: none; font-weight: 600;
  transition: opacity var(--th-transition);
}
.th-cat-link:hover { opacity: 0.75; }

/* ── Tool directory grid ──────────────────────────────────── */
.th-dir-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 0.65rem;
}
.th-dir-card {
  background: var(--th-surface-2);
  border: 1px solid var(--th-border);
  border-radius: var(--th-radius-lg);
  padding: 1rem 0.9rem;
  text-decoration: none;
  display: flex; flex-direction: column; gap: 0.35rem;
  transition: all var(--th-transition);
}
.th-dir-card:hover {
  border-color: var(--th-primary);
  background: var(--th-primary-subtle);
  transform: translateY(-2px);
  box-shadow: var(--th-shadow);
}
.th-dir-card .dc-icon { font-size: 1.6rem; line-height: 1; }
.th-dir-card .dc-name {
  font-size: 0.875rem; font-weight: 600;
  color: var(--th-text); line-height: 1.3;
}
.th-dir-card .dc-desc {
  font-size: 0.75rem; color: var(--th-text-muted); line-height: 1.4;
}

/* ── Stats strip ──────────────────────────────────────────── */
.th-stats-strip {
  display: flex; gap: 2rem; flex-wrap: wrap;
  justify-content: center;
  padding: 1.5rem 0; border-top: 1px solid var(--th-border);
  border-bottom: 1px solid var(--th-border);
  margin: 2rem 0;
}
.th-strip-stat { text-align: center; }
.th-strip-num {
  font-family: var(--th-font-display);
  font-size: 2rem; font-weight: 600;
  font-style: italic; letter-spacing: -0.05em;
  color: var(--th-primary); line-height: 1;
}
.th-strip-lbl {
  font-size: 0.72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--th-text-muted); margin-top: 0.2rem;
}

/* ── Category index page ──────────────────────────────────── */
.th-cat-hero {
  padding: 2.5rem 0 2rem;
  border-bottom: 1px solid var(--th-border);
  margin-bottom: 2rem;
}
.th-cat-hero h1 {
  font-family: var(--th-font-display);
  font-size: clamp(2rem, 5vw, 3rem);
  font-weight: 600; letter-spacing: -0.04em;
  color: var(--th-text); margin-bottom: 0.5rem;
}
.th-cat-hero h1 .icon { margin-right: 0.4rem; }
.th-cat-hero p {
  color: var(--th-text-2); font-size: 1rem;
  max-width: 560px; line-height: 1.6;
}

/* ── About / static pages ─────────────────────────────────── */
.th-prose {
  max-width: 680px;
}
.th-prose p {
  color: var(--th-text-2); line-height: 1.75;
  margin-bottom: 1rem; font-size: 0.975rem;
}
.th-prose h2 {
  font-family: var(--th-font-display);
  font-size: 1.5rem; font-weight: 600;
  letter-spacing: -0.03em; color: var(--th-text);
  margin: 2rem 0 0.75rem;
}
.th-prose a { color: var(--th-primary); }
.th-prose ul {
  padding-left: 1.25rem; color: var(--th-text-2);
  font-size: 0.975rem; line-height: 1.75;
}
.th-prose ul li { margin-bottom: 0.3rem; }

/* ── 404 page ─────────────────────────────────────────────── */
.th-404 {
  min-height: 60vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; padding: 3rem 1rem;
}
.th-404-code {
  font-family: var(--th-font-display);
  font-size: clamp(5rem, 20vw, 10rem);
  font-weight: 600; font-style: italic;
  letter-spacing: -0.06em; line-height: 1;
  color: var(--th-primary); opacity: 0.2;
}
.th-404 h1 {
  font-family: var(--th-font-display);
  font-size: 2rem; font-weight: 600;
  letter-spacing: -0.03em; margin-bottom: 0.75rem;
}
.th-404 p { color: var(--th-text-2); margin-bottom: 1.5rem; }
