/* =========================================================
   ALTTO.ORG — Tools Directory  (Light Theme)
   style.css
   ========================================================= */

/* ---- Reset & Base ---- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Palette — Light */
  --c-bg: #f5f6fa;
  --c-surface: #ffffff;
  --c-surface-2: #f0f2f8;
  --c-border: #e4e7f0;
  --c-border-hv: #c8cde0;

  --c-text: #111827;
  --c-text-2: #4b5563;
  --c-text-3: #9ca3af;

  --c-accent: #4361ee;
  --c-accent-2: #7048e8;
  --c-accent-g: linear-gradient(135deg, #4361ee 0%, #7048e8 100%);

  /* Sizing */
  --radius-sm: 8px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 100px;

  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 40px;
  --space-2xl: 64px;

  --max-w: 1100px;

  --ff-display: 'Space Grotesk', sans-serif;
  --ff-body: 'Inter', sans-serif;

  --t-fast: 130ms ease;
  --t-base: 200ms ease;
  --t-slow: 320ms ease;

  /* Shadows */
  --shadow-xs: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.07), 0 1px 3px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.09), 0 2px 6px rgba(0, 0, 0, 0.05);
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--c-bg);
  color: var(--c-text);
  font-family: var(--ff-body);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.container {
  width: 100%;
  max-width: var(--max-w);
  margin-inline: auto;
  padding-inline: var(--space-lg);
}

.hidden {
  display: none !important;
}

/* =========================================================
   HEADER
   ========================================================= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--c-border);
  box-shadow: var(--shadow-xs);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 54px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.logo-mark {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  background: var(--c-accent-g);
  border-radius: var(--radius-sm);
  color: #fff;
  font-family: var(--ff-display);
  font-weight: 700;
  font-size: 14px;
  flex-shrink: 0;
}

.logo-mark.sm {
  width: 24px;
  height: 24px;
  font-size: 12px;
  border-radius: 6px;
}

.logo-text {
  font-family: var(--ff-display);
  font-weight: 700;
  font-size: 16px;
  color: var(--c-text);
  letter-spacing: -0.02em;
}

.logo-text.sm {
  font-size: 13px;
}

.logo-dot {
  color: var(--c-accent);
}

/* Image logo */
.logo-img {
  display: block;
  width: auto;
  height: 32px;
  object-fit: contain;
  flex-shrink: 0;
}

/* Site name text beside the logo */
.logo-name {
  font-family: var(--ff-display);
  font-size: 25px;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1;
  background: var(--c-accent-g);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  user-select: none;
}

.logo-name.sm {
  font-size: 18px;
}

.header-nav {
  display: flex;
  gap: var(--space-lg);
}

.nav-link {
  color: var(--c-text-2);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: color var(--t-fast);
}

.nav-link:hover {
  color: var(--c-text);
}

/* =========================================================
   HERO
   ========================================================= */
.hero {
  position: relative;
  padding-block: 52px 44px;
  overflow: hidden;
  text-align: center;
  background: #fff;
  border-bottom: 1px solid var(--c-border);
}

.hero-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 13px;
  background: rgba(67, 97, 238, 0.08);
  border: 1px solid rgba(67, 97, 238, 0.2);
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  color: var(--c-accent);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.hero-title {
  font-family: var(--ff-display);
  font-size: clamp(1.7rem, 4vw, 2.6rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.03em;
  color: var(--c-text);
  max-width: 600px;
}

.hero-accent {
  background: var(--c-accent-g);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: 15px;
  color: var(--c-text-2);
  max-width: 480px;
  line-height: 1.65;
}

/* Search */
.hero-search-wrap {
  width: 100%;
  max-width: 420px;
  margin-top: 4px;
}

.search-box {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 13px;
  width: 15px;
  height: 15px;
  color: var(--c-text-3);
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: 10px 16px 10px 38px;
  background: var(--c-bg);
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius-xl);
  color: var(--c-text);
  font-family: var(--ff-body);
  font-size: 13.5px;
  outline: none;
  transition: border-color var(--t-base), box-shadow var(--t-base);
  box-shadow: var(--shadow-xs);
}

.search-input::placeholder {
  color: var(--c-text-3);
}

.search-input:focus {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
  background: #fff;
}

/* Hero BG shapes */
.hero-bg-shapes {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
}

.shape {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.18;
}

.shape-1 {
  width: 480px;
  height: 280px;
  background: #4361ee;
  top: -120px;
  left: 50%;
  transform: translateX(-50%);
  animation: floatA 14s ease-in-out infinite alternate;
}

.shape-2 {
  width: 240px;
  height: 240px;
  background: #7048e8;
  bottom: -100px;
  left: 5%;
  animation: floatB 10s ease-in-out infinite alternate;
}

.shape-3 {
  width: 200px;
  height: 200px;
  background: #38bdf8;
  bottom: -80px;
  right: 5%;
  animation: floatA 12s ease-in-out infinite alternate-reverse;
}

@keyframes floatA {
  from {
    transform: translateX(-50%) translateY(0);
  }

  to {
    transform: translateX(-50%) translateY(-20px);
  }
}

@keyframes floatB {
  from {
    transform: translateY(0);
  }

  to {
    transform: translateY(-16px);
  }
}

/* =========================================================
   STATS BAR
   ========================================================= */
.stats-bar {
  background: #fff;
  border-bottom: 1px solid var(--c-border);
  padding-block: 12px;
}

.stats-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-xl);
}

.stat-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.stat-num {
  font-family: var(--ff-display);
  font-size: 18px;
  font-weight: 700;
  background: var(--c-accent-g);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--c-text-3);
}

.stat-divider {
  width: 1px;
  height: 24px;
  background: var(--c-border);
}

/* =========================================================
   FILTER SECTION
   ========================================================= */
.filter-section {
  padding-block: var(--space-md) 0;
  background: var(--c-bg);
}

.filter-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: var(--space-sm);
  scrollbar-width: none;
}

.filter-tabs::-webkit-scrollbar {
  display: none;
}

.filter-tab {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 14px;
  background: var(--c-surface);
  border: 1.5px solid var(--c-border);
  border-radius: 100px;
  color: var(--c-text-2);
  font-family: var(--ff-body);
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--t-base);
  white-space: nowrap;
  outline: none;
  box-shadow: var(--shadow-xs);
}

.filter-tab:hover {
  border-color: var(--c-border-hv);
  color: var(--c-text);
  background: var(--c-surface-2);
}

.filter-tab.active {
  background: var(--c-accent-g);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(67, 97, 238, 0.3);
}

.filter-tab .tab-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 17px;
  height: 17px;
  padding-inline: 4px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 100px;
  font-size: 10.5px;
  font-weight: 600;
}

.filter-tab.active .tab-count {
  background: rgba(255, 255, 255, 0.25);
}

/* =========================================================
   TOOLS SECTION
   ========================================================= */
.tools-section {
  padding-block: var(--space-md) var(--space-2xl);
  background: var(--c-bg);
}

/* Category group heading */
.cat-group-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  margin-top: 28px;
}

.cat-group-heading:first-child {
  margin-top: 12px;
}

.cat-icon-wrap {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: var(--radius-sm);
  font-size: 14px;
  flex-shrink: 0;
}

.cat-name {
  font-family: var(--ff-display);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--c-text);
}

.cat-count-badge {
  margin-left: auto;
  font-size: 11px;
  color: var(--c-text-3);
  font-weight: 500;
}

/* ---- COMPACT Grid ---- */
.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px;
}

/* =========================================================
   COMPACT TOOL CARD
   ========================================================= */
.tool-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--c-surface);
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius-md);
  text-decoration: none;
  color: var(--c-text);
  cursor: pointer;
  transition: border-color var(--t-base), box-shadow var(--t-base), transform var(--t-base);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  position: relative;
}

.tool-card:hover {
  border-color: var(--card-accent-color, var(--c-accent));
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

/* Favicon / icon */
.card-favicon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  flex-shrink: 0;
  object-fit: contain;
  background: var(--c-surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* img inside .card-favicon */
.card-favicon img {
  width: 24px;
  height: 24px;
  display: block;
}

/* Fallback emoji shown when img fails */
.card-favicon .fav-fallback {
  font-size: 19px;
  line-height: 1;
  display: none;
}

.card-favicon.fav-error img {
  display: none;
}

.card-favicon.fav-error .fav-fallback {
  display: block;
}

/* Text group */
.card-info {
  flex: 1;
  min-width: 0;
}

.card-name {
  font-size: 13px;
  font-weight: 600;
  /* Category-tinted color: each card sets --card-accent-color via JS */
  color: var(--card-accent-color, var(--c-accent));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.3;
}

.card-domain {
  font-size: 10.5px;
  font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
  color: var(--c-accent);
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
  letter-spacing: -0.01em;
}

/* Arrow */
.card-arrow {
  color: var(--c-text-3);
  flex-shrink: 0;
  transition: color var(--t-fast), transform var(--t-base);
  opacity: 0;
}

.tool-card:hover .card-arrow {
  opacity: 1;
  color: var(--card-accent-color, var(--c-accent));
  transform: translate(2px, -2px);
}

/* =========================================================
   LOADING & EMPTY
   ========================================================= */
.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-md);
  padding-block: var(--space-2xl);
  color: var(--c-text-3);
  font-size: 13px;
}

.spinner {
  width: 30px;
  height: 30px;
  border: 3px solid var(--c-border);
  border-top-color: var(--c-accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.no-results {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  padding-block: var(--space-2xl);
  color: var(--c-text-3);
  text-align: center;
}

.no-results svg {
  width: 36px;
  height: 36px;
  opacity: 0.35;
}

.no-results p {
  font-size: 14px;
}

.btn-reset {
  padding: 7px 18px;
  background: var(--c-surface);
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius-xl);
  color: var(--c-text-2);
  font-family: var(--ff-body);
  font-size: 12.5px;
  cursor: pointer;
  transition: all var(--t-base);
}

.btn-reset:hover {
  background: var(--c-surface-2);
  color: var(--c-text);
}

/* =========================================================
   FOOTER
   ========================================================= */
.site-footer {
  border-top: 1px solid var(--c-border);
  padding-block: var(--space-md);
  background: var(--c-surface);
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  flex-wrap: wrap;
}

.footer-logo {
  display: flex;
  align-items: center;
  gap: 7px;
}

.footer-nav {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.footer-nav-link {
  font-size: 12.5px;
  color: var(--c-text-2);
  text-decoration: none;
  font-weight: 500;
  transition: color var(--t-fast);
}

.footer-nav-link:hover {
  color: var(--c-accent);
}

.footer-copy {
  font-size: 12px;
  color: var(--c-text-3);
}

.footer-email {
  color: var(--c-accent);
  text-decoration: none;
  font-weight: 500;
}

.footer-email:hover {
  text-decoration: underline;
}

/* =========================================================
   LEGAL / CONTACT PAGES
   ========================================================= */
.page-wrap {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.page-main {
  flex: 1;
  padding-block: var(--space-2xl) var(--space-2xl);
}

.page-header {
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--c-border);
}

.page-header .page-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 12px;
  background: rgba(67, 97, 238, 0.08);
  border: 1px solid rgba(67, 97, 238, 0.2);
  border-radius: 100px;
  font-size: 11px;
  font-weight: 600;
  color: var(--c-accent);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.page-title {
  font-family: var(--ff-display);
  font-size: clamp(1.5rem, 3.5vw, 2.2rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--c-text);
  line-height: 1.2;
}

.page-updated {
  font-size: 12.5px;
  color: var(--c-text-3);
  margin-top: 6px;
}

/* Prose content */
.prose {
  max-width: 720px;
}

.prose h2 {
  font-family: var(--ff-display);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--c-text);
  margin-top: 2rem;
  margin-bottom: 0.6rem;
  letter-spacing: -0.02em;
}

.prose p {
  font-size: 14.5px;
  color: var(--c-text-2);
  line-height: 1.75;
  margin-bottom: 1rem;
}

.prose ul,
.prose ol {
  padding-left: 1.5rem;
  margin-bottom: 1rem;
}

.prose li {
  font-size: 14.5px;
  color: var(--c-text-2);
  line-height: 1.75;
  margin-bottom: 0.25rem;
}

.prose a {
  color: var(--c-accent);
  text-decoration: none;
  font-weight: 500;
}

.prose a:hover {
  text-decoration: underline;
}

.prose strong {
  color: var(--c-text);
  font-weight: 600;
}

/* Contact Form */
.contact-card {
  background: var(--c-surface);
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  max-width: 560px;
  box-shadow: var(--shadow-sm);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: var(--space-md);
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--c-text);
}

.form-input,
.form-textarea {
  padding: 10px 14px;
  background: var(--c-bg);
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius-md);
  color: var(--c-text);
  font-family: var(--ff-body);
  font-size: 13.5px;
  outline: none;
  transition: border-color var(--t-base), box-shadow var(--t-base);
  width: 100%;
}

.form-input:focus,
.form-textarea:focus {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgba(67, 97, 238, 0.1);
  background: #fff;
}

.form-textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.6;
}

.btn-submit {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 24px;
  background: var(--c-accent-g);
  border: none;
  border-radius: var(--radius-xl);
  color: #fff;
  font-family: var(--ff-body);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--t-base), transform var(--t-fast);
  box-shadow: 0 2px 10px rgba(67, 97, 238, 0.3);
}

.btn-submit:hover {
  opacity: 0.92;
  transform: translateY(-1px);
}

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

.contact-alt {
  margin-top: var(--space-lg);
  padding-top: var(--space-lg);
  border-top: 1px solid var(--c-border);
  font-size: 13.5px;
  color: var(--c-text-2);
}

.contact-alt a {
  color: var(--c-accent);
  font-weight: 500;
  text-decoration: none;
}

.contact-alt a:hover {
  text-decoration: underline;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */
@media (min-width: 900px) {
  .tools-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  }
}

@media (max-width: 640px) {
  .container {
    padding-inline: var(--space-md);
  }

  .hero {
    padding-block: 36px 32px;
  }

  .hero-title {
    font-size: 1.6rem;
  }

  .hero-sub {
    font-size: 13.5px;
  }

  .tools-grid {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }

  .stats-inner {
    gap: var(--space-lg);
  }

  .stat-num {
    font-size: 16px;
  }

  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
  }
}

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

  .stat-divider {
    display: none;
  }

  .stats-inner {
    flex-wrap: wrap;
    gap: var(--space-md);
  }
}

/* =========================================================
   ANIMATION
   ========================================================= */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.anim-in {
  animation: fadeInUp 280ms ease both;
}