/* ════════════════════════════════════════
   Desmistificando Matemática — style.css
   Design: dark navy · gold accents · math
   ════════════════════════════════════════ */

:root {
  --bg:        #060d1f;
  --surface:   #0c1630;
  --surface2:  #111e3d;
  --border:    rgba(99, 140, 255, 0.12);
  --border2:   rgba(99, 140, 255, 0.25);
  --text:      #dce8ff;
  --muted:     #6a82b0;
  --gold:      #f5c842;
  --gold2:     #e8a820;
  --blue:      #3d7fff;
  --blue2:     #6ba3ff;
  --glow:      rgba(61, 127, 255, 0.35);
  --radius:    14px;
  --maxw:      1180px;
  --font-head: 'Syne', sans-serif;
  --font-body: 'IBM Plex Sans', sans-serif;
  --font-mono: 'IBM Plex Mono', monospace;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

/* ── animated mesh background ── */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 900px 500px at 10% 5%,  rgba(61,127,255,.13), transparent 70%),
    radial-gradient(ellipse 700px 400px at 90% 90%, rgba(245,200,66,.07), transparent 70%),
    radial-gradient(ellipse 600px 300px at 60% 40%, rgba(61,127,255,.06), transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ── grid dot pattern ── */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(rgba(99,140,255,.18) 1px, transparent 1px);
  background-size: 32px 32px;
  pointer-events: none;
  z-index: 0;
  mask-image: radial-gradient(ellipse 80% 80% at 50% 50%, black 20%, transparent 100%);
}

a { text-decoration: none; color: inherit; }

.container {
  position: relative;
  z-index: 1;
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 20px 80px;
}

/* ════════════════════════════
   FLOATING MATH SYMBOLS
   ════════════════════════════ */
.math-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.math-bg span {
  position: absolute;
  font-family: var(--font-mono);
  font-size: clamp(1.8rem, 3vw, 3.5rem);
  color: rgba(99, 140, 255, 0.06);
  transition: transform 0.8s ease;
  user-select: none;
  animation: floatSym linear infinite;
}

.math-bg span:nth-child(1)  { left:  5%; top: 10%; animation-duration: 22s; font-size: 2.8rem; }
.math-bg span:nth-child(2)  { left: 15%; top: 70%; animation-duration: 28s; font-size: 4rem; color: rgba(245,200,66,.05); }
.math-bg span:nth-child(3)  { left: 25%; top: 30%; animation-duration: 19s; font-size: 3.5rem; }
.math-bg span:nth-child(4)  { left: 35%; top: 80%; animation-duration: 25s; font-size: 2.5rem; }
.math-bg span:nth-child(5)  { left: 50%; top: 15%; animation-duration: 32s; font-size: 5rem; color: rgba(245,200,66,.04); }
.math-bg span:nth-child(6)  { left: 62%; top: 55%; animation-duration: 21s; font-size: 3rem; }
.math-bg span:nth-child(7)  { left: 72%; top: 20%; animation-duration: 26s; font-size: 4.5rem; }
.math-bg span:nth-child(8)  { left: 82%; top: 75%; animation-duration: 18s; font-size: 2rem; }
.math-bg span:nth-child(9)  { left: 90%; top: 40%; animation-duration: 30s; font-size: 3.8rem; color: rgba(245,200,66,.05); }
.math-bg span:nth-child(10) { left:  8%; top: 50%; animation-duration: 23s; font-size: 2.2rem; }
.math-bg span:nth-child(11) { left: 45%; top: 60%; animation-duration: 27s; }
.math-bg span:nth-child(12) { left: 58%; top: 85%; animation-duration: 20s; font-size: 2.6rem; }
.math-bg span:nth-child(13) { left: 78%; top:  5%; animation-duration: 24s; font-size: 3.2rem; }
.math-bg span:nth-child(14) { left: 20%; top: 90%; animation-duration: 16s; }
.math-bg span:nth-child(15) { left: 40%; top: 45%; animation-duration: 29s; font-size: 4.2rem; color: rgba(245,200,66,.04); }
.math-bg span:nth-child(16) { left: 68%; top: 65%; animation-duration: 22s; }
.math-bg span:nth-child(17) { left: 88%; top: 25%; animation-duration: 17s; font-size: 2.8rem; }
.math-bg span:nth-child(18) { left: 30%; top: 12%; animation-duration: 31s; }
.math-bg span:nth-child(19) { left: 55%; top: 35%; animation-duration: 25s; font-size: 3.6rem; color: rgba(245,200,66,.05); }
.math-bg span:nth-child(20) { left: 95%; top: 58%; animation-duration: 20s; font-size: 2.4rem; }

@keyframes floatSym {
  0%   { transform: translateY(0px) rotate(0deg); opacity: 0.6; }
  33%  { opacity: 1; }
  66%  { opacity: 0.6; }
  100% { transform: translateY(-30px) rotate(8deg); opacity: 0.6; }
}

/* ════════════════════════════
   HERO
   ════════════════════════════ */
.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 40px;
  padding: 64px 0 48px;
  animation: fadeUp .7s ease both;
}

.hero-tag {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--blue2);
  background: rgba(61,127,255,.1);
  border: 1px solid rgba(61,127,255,.25);
  border-radius: 100px;
  padding: 6px 14px;
  margin-bottom: 20px;
}

.hero h1 {
  font-family: var(--font-head);
  font-size: clamp(2.8rem, 6vw, 5rem);
  font-weight: 800;
  line-height: 1.0;
  color: var(--text);
  letter-spacing: -1px;
  margin-bottom: 18px;
}

.hero h1 .accent {
  background: linear-gradient(135deg, var(--gold), var(--blue2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero-sub {
  font-size: 1rem;
  color: var(--muted);
  font-weight: 300;
  max-width: 380px;
  line-height: 1.6;
  margin-bottom: 28px;
}

.hero-stats {
  display: flex;
  align-items: center;
  gap: 20px;
}

.stat { display: flex; flex-direction: column; align-items: center; }
.stat-num {
  font-family: var(--font-head);
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--gold);
  line-height: 1;
}
.stat-label {
  font-size: 0.7rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-top: 3px;
}
.stat-div {
  width: 1px;
  height: 36px;
  background: var(--border2);
}

/* floating formula cards */
.hero-formula {
  position: relative;
  width: 320px;
  flex-shrink: 0;
  height: 220px;
}

.formula-card {
  position: absolute;
  background: var(--surface2);
  border: 1px solid var(--border2);
  border-radius: 12px;
  padding: 10px 16px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--blue2);
  white-space: nowrap;
  box-shadow: 0 8px 24px rgba(0,0,0,.4);
  animation: floatCard ease-in-out infinite;
}

.formula-card .frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: middle;
  font-size: 0.7rem;
  line-height: 1.1;
  border-left: 1px solid var(--border2);
  padding-left: 6px;
  margin-left: 4px;
}
.formula-card .frac span:first-child {
  border-bottom: 1px solid var(--blue2);
  padding-bottom: 1px;
  margin-bottom: 1px;
}

.f1 { top:   0; left: 40px;  color: var(--gold);  animation-duration: 4.5s; animation-delay: 0s; }
.f2 { top:  60px; left:  0;  color: var(--blue2); animation-duration: 5.2s; animation-delay: 0.8s; }
.f3 { top: 120px; left: 30px; color: #7dd6a0;     animation-duration: 6s;   animation-delay: 1.4s; }
.f4 { top: 170px; left: 60px; color: var(--muted); animation-duration: 4.8s; animation-delay: 2s; }

@keyframes floatCard {
  0%, 100% { transform: translateY(0px); }
  50%       { transform: translateY(-8px); }
}

/* ════════════════════════════
   TOOLBAR
   ════════════════════════════ */
.toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
  padding: 14px 18px;
  background: rgba(12, 22, 48, 0.8);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(12px);
  animation: fadeUp .7s ease .15s both;
}

.search-wrap {
  position: relative;
  flex: 1;
  max-width: 400px;
}

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

#q {
  width: 100%;
  padding: 10px 12px 10px 38px;
  background: rgba(6,13,31,.8);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9rem;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
#q:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(61,127,255,.15);
}
#q::placeholder { color: var(--muted); }

.toolbar-info {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--muted);
  font-family: var(--font-mono);
  white-space: nowrap;
}

/* ════════════════════════════
   GRID & CARDS
   ════════════════════════════ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(188px, 1fr));
  gap: 16px;
  animation: fadeUp .7s ease .25s both;
}

/* card entrance animation */
.thumb-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  opacity: 0;
  transform: translateY(16px);
  transition:
    opacity .4s ease,
    transform .4s ease,
    box-shadow .25s ease,
    border-color .25s ease;
}

.thumb-card.visible {
  opacity: 1;
  transform: translateY(0);
}

.thumb-card:hover {
  border-color: var(--border2);
  box-shadow:
    0 0 0 1px rgba(61,127,255,.2),
    0 12px 36px rgba(0,0,0,.5),
    0 0 20px rgba(61,127,255,.08);
  transform: translateY(-4px) scale(1.01);
}

/* thumbnail image wrapper */
.thumb-img-wrap {
  position: relative;
  overflow: hidden;
  aspect-ratio: 3/4;
  background: #fff;
}

.thumb-img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .35s ease, filter .35s ease;
}

.thumb-card:hover .thumb-img-wrap img {
  transform: scale(1.04);
  filter: brightness(0.75);
}

/* hover overlay */
.thumb-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  background: linear-gradient(135deg, rgba(61,127,255,.4), rgba(245,200,66,.2));
  transition: opacity .3s ease;
}

.thumb-card:hover .thumb-overlay {
  opacity: 1;
}

.open-btn {
  background: var(--gold);
  color: #060d1f;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: 0.78rem;
  padding: 8px 18px;
  border-radius: 100px;
  letter-spacing: 0.5px;
  transform: translateY(6px);
  transition: transform .3s ease;
}

.thumb-card:hover .open-btn {
  transform: translateY(0);
}

/* card footer */
.thumb-foot {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 9px 12px;
  background: var(--surface2);
  border-top: 1px solid var(--border);
}

.pg-icon {
  font-size: 0.85rem;
  opacity: 0.7;
}

.pg-num {
  font-family: var(--font-mono);
  font-size: 0.73rem;
  color: var(--muted);
  letter-spacing: 0.5px;
  transition: color .2s;
}

.thumb-card:hover .pg-num {
  color: var(--gold);
}

/* ════════════════════════════
   EMPTY STATE
   ════════════════════════════ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 80px 20px;
  color: var(--muted);
  font-size: 1rem;
  text-align: center;
}
.empty-icon { font-size: 3rem; }

/* ════════════════════════════
   FOOTER
   ════════════════════════════ */
.site-footer {
  margin-top: 60px;
  text-align: center;
  padding-bottom: 20px;
}

.footer-symbols {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  color: rgba(99,140,255,.2);
  letter-spacing: 12px;
  margin-bottom: 10px;
}

.site-footer p {
  font-size: 0.78rem;
  color: var(--muted);
  letter-spacing: 0.5px;
}

/* ════════════════════════════
   ANIMATIONS
   ════════════════════════════ */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ════════════════════════════
   RESPONSIVE
   ════════════════════════════ */
@media (max-width: 900px) {
  .hero { flex-direction: column; padding: 40px 0 32px; }
  .hero-formula { display: none; }
  .hero h1 { font-size: 2.8rem; }
}

@media (max-width: 600px) {
  .grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .hero h1 { font-size: 2.2rem; }
  .toolbar { flex-wrap: wrap; }
  .toolbar-info { width: 100%; text-align: right; }
}

@media (max-width: 380px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
}
