/* StudyStack — shared styles. Vanilla CSS, mobile-first. */

:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #4f46e5;
  --brand-dark: #4338ca;
  --brand-soft: #eef2ff;
  --green: #16a34a;
  --green-soft: #dcfce7;
  --amber: #b45309;
  --amber-soft: #fef3c7;
  --slate: #475569;
  --slate-soft: #e2e8f0;
  --radius: 12px;
  --maxw: 1080px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

/* ---------- Header ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  max-width: var(--maxw);
  margin: 0 auto;
}
.brand {
  font-weight: 800;
  font-size: 1.35rem;
  color: var(--ink);
  letter-spacing: -0.02em;
}
.brand span { color: var(--brand); }
.brand:hover { text-decoration: none; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a {
  color: var(--muted);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 8px 12px;
  border-radius: 8px;
}
.nav a:hover { background: var(--brand-soft); color: var(--brand-dark); text-decoration: none; }
.nav a.active { color: var(--brand-dark); background: var(--brand-soft); }

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(135deg, #312e81 0%, #4f46e5 60%, #7c3aed 100%);
  color: #fff;
  padding: 72px 0 64px;
  text-align: center;
}
.hero h1 { font-size: 2.6rem; letter-spacing: -0.03em; line-height: 1.15; margin-bottom: 12px; }
.hero .tagline { font-size: 1.2rem; opacity: 0.92; margin-bottom: 28px; }
.hero-cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 24px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-block;
  padding: 12px 22px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 1rem;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.06s ease, background 0.15s ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); text-decoration: none; color: #fff; }
.btn-white { background: #fff; color: var(--brand-dark); }
.btn-white:hover { text-decoration: none; background: var(--brand-soft); }
.btn-outline { background: transparent; color: #fff; border-color: rgba(255,255,255,0.55); }
.btn-outline:hover { background: rgba(255,255,255,0.12); text-decoration: none; color: #fff; }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--brand); color: var(--brand-dark); text-decoration: none; }

/* ---------- Newsletter form ---------- */
.newsletter { max-width: 520px; margin: 0 auto; }
.newsletter-form { display: flex; gap: 8px; }
.newsletter-form input[type="email"] {
  flex: 1;
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid var(--line);
  font-size: 1rem;
  font-family: inherit;
  min-width: 0;
}
.hero .newsletter-form input[type="email"] { border: none; }
.newsletter-form input[type="email"]:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.form-note { font-size: 0.85rem; color: var(--muted); margin-top: 8px; }
.hero .form-note { color: rgba(255,255,255,0.8); }
.newsletter-success {
  background: rgba(255,255,255,0.14);
  border: 1px solid rgba(255,255,255,0.35);
  color: #fff;
  padding: 16px 20px;
  border-radius: var(--radius);
  font-weight: 600;
}
.newsletter-block .newsletter-success {
  background: var(--green-soft);
  border-color: #bbf7d0;
  color: #14532d;
}

/* ---------- Sections ---------- */
.section { padding: 56px 0; }
.section.alt { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section h2 { font-size: 1.7rem; letter-spacing: -0.02em; margin-bottom: 8px; }
.section .lede { color: var(--muted); margin-bottom: 28px; max-width: 640px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.section-head h2 { margin-bottom: 0; }

/* ---------- Cards ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.card:hover { box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08); transform: translateY(-2px); }
.card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.card h3 { font-size: 1.1rem; letter-spacing: -0.01em; }
.card-desc { color: var(--muted); font-size: 0.95rem; flex: 1; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 4px; }
.card-foot a.visit { font-weight: 700; white-space: nowrap; }

.tag {
  display: inline-block;
  background: var(--brand-soft);
  color: var(--brand-dark);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.badge-free { background: var(--green-soft); color: var(--green); }
.badge-freemium { background: #dbeafe; color: #1d4ed8; }
.badge-paid { background: var(--slate-soft); color: var(--slate); }

/* ---------- Category tiles ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.cat-tile {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  color: var(--ink);
}
.cat-tile:hover { text-decoration: none; border-color: var(--brand); box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08); }
.cat-tile h3 { font-size: 1.05rem; margin-bottom: 4px; }
.cat-tile p { color: var(--muted); font-size: 0.9rem; }

/* ---------- How it works ---------- */
.steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.step {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
}
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
  margin-bottom: 12px;
}
.step h3 { margin-bottom: 6px; font-size: 1.05rem; }
.step p { color: var(--muted); font-size: 0.95rem; }

/* ---------- Directory controls ---------- */
.controls { display: flex; flex-direction: column; gap: 14px; margin-bottom: 24px; }
.search-box input {
  width: 100%;
  padding: 13px 18px;
  font-size: 1rem;
  font-family: inherit;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
}
.search-box input:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  font-family: inherit;
}
.chip:hover { border-color: var(--brand); color: var(--brand-dark); }
.chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.result-count { color: var(--muted); font-size: 0.92rem; }
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--muted);
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
}

/* ---------- Sponsor slots ---------- */
.slot {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  margin-bottom: 16px;
}
.slot h3 { font-size: 1.2rem; margin-bottom: 8px; }
.slot p { color: var(--muted); margin-bottom: 16px; }
.slot ul { margin: 0 0 16px 20px; color: var(--muted); }
.todo-flag {
  display: inline-block;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
  margin-left: 8px;
  vertical-align: middle;
}

/* ---------- Prose pages ---------- */
.prose { max-width: 720px; }
.prose h1 { font-size: 2.1rem; letter-spacing: -0.02em; margin-bottom: 16px; }
.prose h2 { font-size: 1.35rem; margin: 32px 0 10px; }
.prose p { margin-bottom: 14px; color: #334155; }
.prose ul { margin: 0 0 14px 22px; color: #334155; }
.prose li { margin-bottom: 6px; }
.page-head { padding: 48px 0 8px; }

/* ---------- Footer ---------- */
.site-footer {
  background: var(--ink);
  color: #cbd5e1;
  padding: 40px 0 32px;
  margin-top: 24px;
}
.footer-inner { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.site-footer .brand { color: #fff; }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }
.footer-links a { color: #cbd5e1; font-size: 0.95rem; }
.copyright { margin-top: 24px; font-size: 0.85rem; color: #94a3b8; }

/* ---------- Responsive ---------- */
@media (max-width: 640px) {
  .hero { padding: 52px 0 44px; }
  .hero h1 { font-size: 2rem; }
  .newsletter-form { flex-direction: column; }
  .newsletter-form .btn { width: 100%; }
  .section { padding: 40px 0; }
  .header-inner { flex-direction: column; gap: 10px; align-items: flex-start; }
}

/* ---- Guide pages ---- */
.guide { padding: 40px 0 64px; }
.crumbs { font-size: 14px; color: #666; margin-bottom: 12px; }
.crumbs a { color: #666; }
.guide h1 { font-size: 34px; margin: 0 0 12px; line-height: 1.2; }
.guide .lede { font-size: 18px; color: #444; max-width: 720px; }
.updated { font-size: 13px; color: #888; margin: 8px 0 32px; }
.tool-spot { border: 1px solid #e5e5e5; border-radius: 12px; padding: 24px; margin-bottom: 20px; background: #fff; }
.tool-spot-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tool-spot-head h2 { margin: 0; font-size: 22px; }
.price-badge { font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; background: #eef4ff; color: #2456c6; white-space: nowrap; }
.best-for { background: #f7f9fc; border-left: 3px solid #2456c6; padding: 10px 14px; border-radius: 0 8px 8px 0; }
.guide-faq { margin: 40px 0; }
.guide-faq h2 { font-size: 24px; }
.guide-faq h3 { font-size: 17px; margin: 20px 0 6px; }
.related { border-top: 1px solid #e5e5e5; padding-top: 28px; margin-top: 12px; }
.related ul { padding-left: 20px; }
.related li { margin-bottom: 8px; }

.dir-main{padding-top:40px}
.dir-title{font-size:2rem;letter-spacing:-0.02em;margin-bottom:8px}

/* ---------- Rankings & marketing pages (ported from dark theme, light values) ---------- */
.skip{position:absolute;left:-999px;top:8px;background:#facc15;color:#000;padding:8px 14px;border-radius:8px;z-index:100;font-weight:700}
.skip:focus{left:8px}
.sr{position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0,0,0,0);white-space:nowrap;border:0}
.hp{position:absolute!important;left:-9999px;width:1px;height:1px;overflow:hidden}
.site-header > .wrap{display:flex;align-items:center;justify-content:space-between;gap:12px;min-height:60px;flex-wrap:wrap}
.hero{padding:44px 0 28px}
.eyebrow{display:inline-block;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:.78rem;text-transform:uppercase;letter-spacing:.12em;color:var(--brand);margin-bottom:12px}
.lede{font-size:clamp(1.05rem,2.6vw,1.25rem);color:var(--muted);max-width:60ch}
.updated{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:.82rem;color:#94a3b8}
.block{padding:30px 0}
.note{font-size:.9rem;color:#94a3b8}
.crumbs{font-size:.88rem;color:#94a3b8;padding:18px 0 0}
.crumbs a{color:var(--muted)}
.rank-list{list-style:none;margin:0;padding:0;display:grid;gap:14px}
.rank-item{display:grid;grid-template-columns:auto 1fr;gap:14px 16px;background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:18px}
.rank-item.top{border-color:var(--brand);box-shadow:0 0 0 1px rgba(79,70,229,.25)}
.rank-no{font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-weight:800;font-size:1.5rem;color:#cbd5e1;min-width:2ch;text-align:center;line-height:1.2}
.rank-body h3{display:flex;flex-wrap:wrap;align-items:center;gap:10px;margin-bottom:.2em}
.tier{display:inline-flex;align-items:center;justify-content:center;min-width:2.1em;height:2.1em;padding:0 .5em;border-radius:9px;font-weight:900;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:.9rem;border:2px solid currentColor}
.tier-S{color:var(--amber);background:var(--amber-soft)}
.tier-A{color:var(--brand);background:var(--brand-soft)}
.tier-B{color:#0e7490;background:#cffafe}
.maker{font-size:.85rem;color:#94a3b8;font-weight:500}
.for{color:var(--ink)}
.visit{display:inline-flex;margin-top:6px;font-weight:700}
.uc-nav{display:flex;gap:8px;flex-wrap:wrap;list-style:none;padding:0;margin:0}
.uc-nav a{display:inline-block;padding:8px 14px;border:1px solid var(--line);border-radius:999px;background:var(--surface);color:var(--ink);font-weight:600;font-size:.9rem}
.uc-nav a:hover{border-color:var(--brand);color:var(--brand-dark);text-decoration:none}
.uc-icon{font-size:1.6rem;display:block;margin-bottom:6px}
.own-list{padding-left:1.2em;margin:12px 0}
.own-list li{margin-bottom:8px}
.btn{display:inline-flex;align-items:center;justify-content:center;gap:8px;padding:12px 20px;border-radius:12px;font-weight:700;text-decoration:none;border:1px solid var(--line);background:var(--surface);color:var(--ink);cursor:pointer;font-size:1rem}
.btn:hover{text-decoration:none;border-color:var(--brand)}
.btn-primary{background:var(--brand);border-color:transparent;color:#fff}
.btn-primary:hover{background:var(--brand-dark);color:#fff}
.newsletter{background:var(--brand-soft);border:1px solid var(--line);border-radius:20px;padding:26px}
.newsletter input[type="email"]{width:100%;max-width:340px;padding:12px 14px;border:1px solid var(--line);border-radius:10px;font-size:1rem;margin:10px 8px 0 0}
.newsletter input[type="email"]:focus{outline:2px solid var(--brand);outline-offset:1px}
.newsletter .btn{margin-top:10px}
.form-msg{min-height:1.6em;margin:10px 0 0;font-weight:600}
.fine{margin-top:26px;font-size:.82rem;color:#94a3b8}
.grad{background:linear-gradient(90deg,#7c3aed,#0891b2);-webkit-background-clip:text;background-clip:text;color:transparent}
.actions{display:flex;gap:12px;flex-wrap:wrap;margin-top:20px}
.more{margin-top:auto;font-weight:700}
.pick-card{display:flex;flex-direction:column;background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:20px}
.pick-card ol{list-style:none;margin:0 0 14px;padding:0;display:grid;gap:8px}
.pick-card li{display:flex;align-items:center;gap:10px;color:var(--ink)}
.pick-card .more{margin-top:auto;font-weight:700}
.h3-like{font-size:1.1rem;margin:0 0 .35em;letter-spacing:-.01em}
.cols{display:grid;gap:26px;grid-template-columns:1fr}
.cols-3{display:grid;gap:16px;grid-template-columns:1fr}
.cols-4{display:grid;gap:16px;grid-template-columns:1fr}
@media(min-width:720px){.cols{grid-template-columns:1fr 1fr 1fr}.cols-3{grid-template-columns:repeat(3,1fr)}.cols-4{grid-template-columns:repeat(2,1fr)}}
@media(min-width:1020px){.cols-4{grid-template-columns:repeat(4,1fr)}}
.site-footer .cols h2{font-size:.95rem;color:#fff;margin-bottom:10px}
.site-footer .cols ul{list-style:none;padding:0;margin:0}
.site-footer .cols li{margin-bottom:6px}
.site-footer .cols a{color:#cbd5e1}
.tier-card{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:20px}
.tier-card.highlight{border-color:var(--brand);box-shadow:0 0 0 1px rgba(79,70,229,.25)}
.tier-card ul{padding-left:1.1em;color:var(--muted);margin:0 0 16px}
.price{font-size:2.2rem;font-weight:900;letter-spacing:-.03em}
.price small{font-size:.9rem;color:var(--muted);font-weight:500}
.card.release{background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);padding:20px;margin-bottom:14px}
.card.release h3{margin:.3em 0}
.tags{list-style:none;display:flex;gap:6px;flex-wrap:wrap;padding:0;margin:8px 0 0}
.tags li{background:var(--brand-soft);color:var(--brand-dark);font-size:.8rem;font-weight:600;padding:3px 10px;border-radius:999px}

/* ---------- Theme-port fixes: nav markers + hero contrast on gradient ---------- */
.nav{list-style:none;margin:0;padding:0}
.hero .eyebrow{color:#e0e7ff}
.hero .lede{color:rgba(255,255,255,.88)}
.hero .updated{color:rgba(255,255,255,.75)}
.hero .grad{background:linear-gradient(90deg,#e0e7ff,#a5f3fc);-webkit-background-clip:text;background-clip:text;color:transparent}

/* ---------- Theme-port fix: brand logo sizing (was unbounded) ---------- */
.site-header .brand{display:flex;align-items:center;gap:10px;font-size:1.1rem}
.brand svg{width:30px;height:30px;flex:none}

/* ---------- Sponsored placement. Rust stays inside this card only. ---------- */
.sponsor-slot{border:2px solid #9a3412;background:#fff4ee;color:#3f1d12;border-radius:20px;padding:24px;position:relative}
.sponsor-slot h3{font-size:1.4rem;margin-top:10px;color:#3f1d12}
.sponsor-slot p{color:#3f1d12;max-width:62ch;margin:8px 0 0}
.sponsor-slot .subline{color:#7c2d12;font-weight:600}
.sponsor-slot .badge{display:inline-block;font-size:.72rem;font-weight:700;letter-spacing:.08em;text-transform:uppercase;padding:4px 10px;border-radius:999px;border:1px solid #9a3412;color:#fff;background:#9a3412}
.sponsor-slot .btn{margin-top:14px}
.sponsor-slot .btn,
.sponsor-slot .btn-primary{background:#9a3412;border-color:#7c2d12;color:#fff}
.sponsor-slot .btn:hover,
.sponsor-slot .btn-primary:hover{background:#7c2d12;color:#fff}

.watchout{font-size:.92rem;line-height:1.45;background:#fef3c7;color:#451a03;border-radius:8px;padding:8px 10px}
.watchout strong{font-weight:800}
.save-btn{min-width:44px;min-height:44px;border-radius:999px;border:1px solid var(--line);background:var(--surface);color:#9f1239;font-size:1.25rem;line-height:1;cursor:pointer;font-family:inherit}
.save-btn[aria-pressed="true"]{background:#ffe4e6;border-color:#be123c;color:#9f1239}
.card-actions{display:flex;align-items:center;gap:8px}

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