/* ==========================================================
   ToolVault — Design System
   Palette: warm paper + electric indigo + citrus lime + coral
   Type: Space Grotesk (display) / Inter (body) / IBM Plex Mono (data)
   ========================================================== */
:root {
  --primary: #5B4FE9;
  --primary-dark: #4636C7;
  --accent-lime: #D6F04C;
  --accent-lime-ink: #4B5400;
  --accent-coral: #FF6B5B;
  --accent-coral-ink: #7A1F14;

  --bg: #FBFAF6;
  --surface: #FFFFFF;
  --surface-2: #F3F1EA;
  --text: #16151F;
  --text-muted: #6E6D7C;
  --border: #E7E4DA;
  --success: #16a34a;
  --error: #dc2626;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(22,21,31,.05);
  --shadow: 0 4px 16px rgba(22,21,31,.06), 0 1px 3px rgba(22,21,31,.05);
  --shadow-lg: 0 16px 40px rgba(22,21,31,.12);

  --font-display: 'Space Grotesk', 'Segoe UI', sans-serif;
  --font-body: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', 'SFMono-Regular', Consolas, monospace;

  --ease: cubic-bezier(.22,1,.36,1);
}

[data-theme="dark"] {
  --bg: #101019;
  --surface: #191823;
  --surface-2: #21202D;
  --text: #F4F2ED;
  --text-muted: #9B99AA;
  --border: #2C2A3A;
  --shadow: 0 4px 20px rgba(0,0,0,.35), 0 1px 3px rgba(0,0,0,.3);
  --shadow-lg: 0 20px 50px rgba(0,0,0,.45);
}

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

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  transition: background .3s var(--ease), color .3s var(--ease);
}
a { color: var(--primary); text-decoration: none; transition: color .15s var(--ease); }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
h1,h2,h3,h4,h5 { font-family: var(--font-display); line-height: 1.15; margin: 0 0 .5em; letter-spacing: -.01em; font-weight: 600; }
.container { max-width: 1180px; margin: 0 auto; padding: 0 20px; }

:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 20px; border-radius: 999px; font-weight: 600; font-size: .92rem; font-family: var(--font-body); border: 1px solid transparent; cursor: pointer; text-decoration: none; transition: transform .18s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease), border-color .18s var(--ease); }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 1px 0 rgba(0,0,0,.05); }
.btn-primary:hover { background: var(--primary-dark); text-decoration: none; transform: translateY(-1px); box-shadow: 0 8px 20px rgba(91,79,233,.28); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); text-decoration: none; border-color: var(--text-muted); }
.btn-sm { padding: 7px 14px; font-size: .82rem; }
.btn-block { width: 100%; }
.btn-danger { background: var(--accent-coral); color: #fff; }
.btn-danger:hover { background: var(--accent-coral-ink); }
.btn::after { content: '→'; display: inline-block; transition: transform .18s var(--ease); opacity: .85; }
.btn-ghost::after, .btn-danger::after, .btn-sm::after { content: none; }

/* ---------- Header ---------- */
.site-header { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--border); }
.header-inner { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; gap: 24px; }
.logo-text { font-family: var(--font-display); font-size: 1.4rem; font-weight: 700; color: var(--text); letter-spacing: -.02em; }
.logo-text::before { content: '◆ '; color: var(--primary); }
.main-nav { display: flex; gap: 26px; flex: 1; }
.main-nav a { color: var(--text); font-weight: 500; font-size: .93rem; position: relative; padding: 4px 0; }
.main-nav a::after { content: ''; position: absolute; left: 0; bottom: 0; width: 0; height: 2px; background: var(--primary); transition: width .2s var(--ease); }
.main-nav a:hover { text-decoration: none; }
.main-nav a:hover::after { width: 100%; }
.header-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn { background: none; border: none; font-size: 1.1rem; cursor: pointer; padding: 7px; border-radius: 999px; transition: background .15s var(--ease), transform .15s var(--ease); }
.icon-btn:hover { background: var(--surface-2); transform: rotate(-8deg); }
.mobile-only { display: none; }
.avatar-sm { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; display: inline-block; vertical-align: middle; margin-right: 6px; }
.user-menu { position: relative; }
.user-menu-btn { background: none; border: 1px solid var(--border); border-radius: 999px; padding: 5px 14px 5px 5px; cursor: pointer; color: var(--text); display: flex; align-items: center; font-family: var(--font-body); }
.user-menu-dropdown { display: none; position: absolute; right: 0; top: 120%; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); min-width: 190px; padding: 6px; }
.user-menu:hover .user-menu-dropdown { display: block; }
.user-menu-dropdown a { display: block; padding: 8px 12px; border-radius: 8px; color: var(--text); }
.user-menu-dropdown a:hover { background: var(--surface-2); text-decoration: none; }

.breadcrumbs { padding: 14px 20px; font-size: .83rem; color: var(--text-muted); font-family: var(--font-mono); }
.breadcrumbs .sep { margin: 0 8px; opacity: .5; }

.alert { padding: 13px 18px; border-radius: var(--radius-sm); margin: 16px 0; font-size: .92rem; border: 1px solid transparent; }
.alert-success { background: #E7F8ED; color: #166534; border-color: #BEEACB; }
.alert-error { background: #FDECEB; color: #991b1b; border-color: #F9CFC9; }

/* ---------- Hero ---------- */
.hero { position: relative; padding: 90px 0 60px; text-align: center; overflow: hidden; }
.hero::before, .hero::after {
  content: ''; position: absolute; border-radius: 50%; filter: blur(60px); z-index: 0; opacity: .55;
  animation: drift 22s ease-in-out infinite alternate;
}
.hero::before { width: 380px; height: 380px; background: var(--accent-lime); top: -140px; left: 8%; }
.hero::after { width: 320px; height: 320px; background: var(--primary); top: -80px; right: 6%; opacity: .25; animation-duration: 26s; animation-delay: -6s; }
[data-theme="dark"] .hero::before { opacity: .18; }
[data-theme="dark"] .hero::after { opacity: .22; }
@keyframes drift { from { transform: translate(0,0) scale(1); } to { transform: translate(30px,40px) scale(1.12); } }

.hero .container { position: relative; z-index: 1; }
.hero-eyebrow { font-family: var(--font-mono); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--primary); display: inline-flex; align-items: center; gap: 8px; margin-bottom: 14px; opacity: 0; animation: rise .6s var(--ease) forwards; }
.hero-eyebrow::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--accent-lime); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent-lime) 30%, transparent); }
.hero h1 { font-size: 3rem; font-weight: 700; max-width: 760px; margin-left: auto; margin-right: auto; opacity: 0; animation: rise .7s .08s var(--ease) forwards; }
.hero p { color: var(--text-muted); font-size: 1.15rem; max-width: 600px; margin: 0 auto 30px; opacity: 0; animation: rise .7s .16s var(--ease) forwards; }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }

.search-box { display: flex; max-width: 560px; margin: 0 auto; box-shadow: var(--shadow-lg); border-radius: 999px; overflow: hidden; opacity: 0; animation: rise .7s .24s var(--ease) forwards; border: 1px solid var(--border); }
.search-box input { flex: 1; border: none; padding: 15px 22px; font-size: 1rem; background: var(--surface); color: var(--text); font-family: var(--font-body); }
.search-box input:focus { outline: none; }
.search-box button { border-radius: 0 999px 999px 0; padding: 0 26px; }
.search-box button::after { content: none; }

/* ---------- Sections & scroll reveal ---------- */
.section { padding: 56px 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 26px; }
.section-head h2 { font-size: 1.7rem; }
.section-head a { font-weight: 600; font-size: .9rem; }

.reveal { opacity: 0; transform: translateY(22px); transition: opacity .6s var(--ease), transform .6s var(--ease); }
.reveal.in-view { opacity: 1; transform: translateY(0); }

/* ---------- Category grid ---------- */
.category-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.category-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 20px; text-align: center; transition: transform .2s var(--ease), box-shadow .2s var(--ease), border-color .2s var(--ease); }
.category-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: transparent; text-decoration: none; }
.category-icon { width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; margin: 0 auto 12px; font-size: 1.3rem; font-family: var(--font-display); font-weight: 700; color: #fff; }
.category-card h3 { font-size: 1rem; color: var(--text); margin: 0; font-family: var(--font-body); font-weight: 600; }
.category-card span { font-size: .78rem; color: var(--text-muted); font-family: var(--font-mono); }

/* ---------- Tool cards (signature: scan-line reveal) ---------- */
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 20px; }
.tool-card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; overflow: hidden; transition: transform .22s var(--ease), box-shadow .22s var(--ease); }
.tool-card::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 3px; background: linear-gradient(90deg, var(--primary), var(--accent-lime), var(--accent-coral)); transform: scaleX(0); transform-origin: left; transition: transform .35s var(--ease); }
.tool-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.tool-card:hover::before { transform: scaleX(1); }
.tool-card-top { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.tool-logo { width: 50px; height: 50px; border-radius: 12px; object-fit: cover; border: 1px solid var(--border); }
.tool-card h3 { font-size: 1.05rem; margin: 0; font-weight: 600; }
.tool-card h3 a { color: var(--text); }
.tool-tagline { color: var(--text-muted); font-size: .88rem; margin: 0 0 12px; }

.badge { display: inline-flex; align-items: center; gap: 5px; font-family: var(--font-mono); font-size: .68rem; font-weight: 600; padding: 4px 10px; border-radius: 999px; text-transform: uppercase; letter-spacing: .04em; }
.badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge-featured { background: color-mix(in srgb, var(--accent-lime) 35%, var(--surface)); color: var(--accent-lime-ink); }
.badge-sponsored { background: color-mix(in srgb, var(--accent-coral) 20%, var(--surface)); color: var(--accent-coral-ink); }
.badge-free { background: #E3F6E9; color: #166534; }
.badge-paid { background: #FDECEB; color: #991b1b; }
.badge-freemium { background: #E7EBFD; color: #3730a3; }
.badge-free_trial { background: #FEF6D8; color: #854d0e; }

.tool-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--border); }
.star-rating .star { color: var(--accent-lime-ink); font-style: normal; filter: none; }
.star-rating .star.full { color: #E8A400; }
.star-rating .star.empty { color: var(--border); }
.fav-btn { background: none; border: none; cursor: pointer; font-size: 1.25rem; color: var(--text-muted); transition: transform .18s var(--ease), color .18s var(--ease); }
.fav-btn:hover { transform: scale(1.15); }
.fav-btn.active { color: var(--accent-coral); }

/* ---------- Detail page ---------- */
.tool-hero { background: var(--surface); border-bottom: 1px solid var(--border); padding: 44px 0; }
.tool-hero-inner { display: flex; gap: 22px; align-items: flex-start; flex-wrap: wrap; }
.tool-hero .tool-logo { width: 84px; height: 84px; border-radius: 18px; }
.tool-meta-row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin: 10px 0; color: var(--text-muted); font-size: .9rem; }
.detail-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 32px; padding: 40px 0; align-items: start; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px; margin-bottom: 22px; }
.pill-list { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; padding: 0; }
.pill-list li { background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px; font-size: .84rem; font-family: var(--font-mono); }
.pros-cons { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.pros-cons ul { padding-left: 18px; margin: 0; }
.pros-cons .pros li { color: var(--success); }
.pros-cons .cons li { color: var(--error); }
.pros-cons li::marker { color: inherit; }

/* ---------- Reviews ---------- */
.review { border-bottom: 1px solid var(--border); padding: 18px 0; }
.review:last-child { border-bottom: none; }
.review-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 18px; }
.form-group label { display: block; font-weight: 600; margin-bottom: 6px; font-size: .9rem; }
.form-control { width: 100%; padding: 12px 15px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text); font-size: .95rem; font-family: var(--font-body); transition: border-color .15s var(--ease), box-shadow .15s var(--ease); }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 18%, transparent); }
textarea.form-control { resize: vertical; min-height: 100px; }
.form-hint { font-size: .8rem; color: var(--text-muted); margin-top: 4px; }
.auth-card { max-width: 420px; margin: 60px auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 36px; box-shadow: var(--shadow); }
.social-login-buttons { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.social-btn { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600; cursor: pointer; transition: border-color .15s var(--ease), background .15s var(--ease); }
.social-btn:hover { border-color: var(--primary); background: var(--surface-2); text-decoration: none; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--text-muted); font-size: .82rem; margin: 16px 0; font-family: var(--font-mono); }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }

/* ---------- Blog ---------- */
.blog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 22px; }
.blog-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; transition: transform .2s var(--ease), box-shadow .2s var(--ease); }
.blog-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); text-decoration: none; }
.blog-card img { height: 170px; object-fit: cover; width: 100%; }
.blog-card-body { padding: 18px 20px; }
.blog-card-meta { font-size: .76rem; color: var(--text-muted); margin-bottom: 8px; font-family: var(--font-mono); text-transform: uppercase; letter-spacing: .03em; }

/* ---------- Ads ---------- */
.ad-slot { text-align: center; margin: 24px 0; }
.ad-slot img { margin: 0 auto; border-radius: var(--radius-sm); }

/* ---------- Compare ---------- */
.compare-table { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.compare-table th, .compare-table td { padding: 15px 18px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.compare-table th { background: var(--surface-2); font-family: var(--font-mono); font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); font-weight: 600; }

/* ---------- FAQ ---------- */
.faq-item { border-bottom: 1px solid var(--border); padding: 18px 0; }
.faq-question { display: flex; justify-content: space-between; align-items: center; cursor: pointer; font-weight: 600; font-family: var(--font-display); }
.faq-question span { transition: transform .3s var(--ease); color: var(--primary); font-size: 1.2rem; }
.faq-item.open .faq-question span { transform: rotate(45deg); }
.faq-answer { max-height: 0; overflow: hidden; transition: max-height .3s var(--ease); color: var(--text-muted); }
.faq-item.open .faq-answer { max-height: 500px; padding-top: 10px; }

/* ---------- Pagination ---------- */
.pagination-list { display: flex; gap: 6px; list-style: none; padding: 0; justify-content: center; margin: 30px 0; }
.pagination-list a { display: block; padding: 9px 15px; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); font-family: var(--font-mono); font-size: .88rem; transition: border-color .15s var(--ease), background .15s var(--ease); }
.pagination-list a:hover { text-decoration: none; border-color: var(--primary); }
.pagination-list .active a { background: var(--primary); color: #fff; border-color: var(--primary); }

/* ---------- Footer ---------- */
.site-footer { background: var(--surface-2); border-top: 1px solid var(--border); margin-top: 70px; padding-top: 44px; }
.footer-grid { display: grid; grid-template-columns: 2fr 1fr 1fr 1.4fr; gap: 30px; padding-bottom: 30px; }
.footer-grid h4 { font-family: var(--font-display); }
.footer-grid a { display: block; color: var(--text-muted); padding: 4px 0; }
.footer-grid a:hover { color: var(--primary); text-decoration: none; }
.newsletter-form { display: flex; gap: 8px; }
.newsletter-form input { flex: 1; padding: 11px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); color: var(--text); }
.footer-bottom { border-top: 1px solid var(--border); padding: 18px 20px; text-align: center; color: var(--text-muted); font-size: .84rem; font-family: var(--font-mono); }

@media (max-width: 860px) {
  .detail-grid { grid-template-columns: 1fr; }
  .pros-cons { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: 1fr 1fr; }
  .hero h1 { font-size: 2.3rem; }
}
@media (max-width: 720px) {
  .main-nav { display: none; }
  .mobile-only { display: inline-flex; }
  .hero { padding: 60px 0 40px; }
  .hero h1 { font-size: 1.9rem; }
  .footer-grid { grid-template-columns: 1fr; }
}
