/* ============================================
   CSS VARIABLES
   ============================================ */
:root {
  --bg: #0f1115;
  --bg-soft: #151923;
  --card: #181c27;
  --text: #e6e9ef;
  --muted: #b6bdc7;
  --brand: #8b5cf6; /* violet */
  --brand-2: #06b6d4; /* cyan */
  --accent: #22c55e; /* green */
  --ring: #3b82f6; /* blue */
  --shadow: 0 10px 30px rgba(0,0,0,0.35);
  --gradient-test: radial-gradient(1200px 500px at 10% -10%, rgba(139,92,246,0.25), transparent 60%),
              radial-gradient(1000px 400px at 110% -20%, rgba(6,182,212,0.25), transparent 60%),
              var(--bg);
}

[data-theme="light"] {
  --bg: #f6f7fb;
  --bg-soft: #ffffff;
  --card: #ffffff;
  --text: #0f1115;
  --muted: #4b5563;
  --brand: #7c3aed;
  --brand-2: #0891b2;
  --accent: #16a34a;
  --ring: #2563eb;
  --shadow: 0 10px 30px rgba(2,6,23,0.08);
}

/* ============================================
   GLOBAL RESET & BASE STYLES
   ============================================ */
* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 500px at 10% -10%, rgba(139,92,246,0.25), transparent 60%),
              radial-gradient(1000px 400px at 110% -20%, rgba(6,182,212,0.25), transparent 60%),
              var(--bg);
  background-attachment: fixed;
  line-height: 1.5;
}

/* ============================================
   HEADER & NAVIGATION (OPTIMIZED)
   ============================================ */
.header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(1.2) blur(8px);
  background: color-mix(in oklab, var(--bg-soft) 80%, transparent);
  border-bottom: 1px solid color-mix(in oklab, var(--text) 12%, transparent);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  /* Centered by default, spaced when expanded */
  justify-content: center;
  gap: 12px;
  position: relative;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

/* --- Logo Styling --- */
.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  cursor: pointer;
  position: relative; /* Fixed: Removed absolute positioning */
  flex-shrink: 0;
  z-index: 2;
  transition: transform 0.2s ease;
}

.logo .mark {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  overflow: hidden;
  background-color: var(--card); /* Fallback bg if image fails */
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--brand) 40%, transparent), var(--shadow);
  display: flex;
  justify-content: center;
  align-items: center;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.logo .mark img {
  background-image: url('https://i.imgur.com/1gcsIi1.png'); /* Fallback image */
  background-size: contain; 
  background-position: center;
  background-repeat: no-repeat;
  width: auto;
  height: 2.5rem;
}

.logo:hover .mark {
  background-color: var(--card);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--brand) 60%, transparent), 
              0 8px 24px color-mix(in oklab, var(--brand) 25%, transparent);
  transform: scale(1.05) translateY(-3px);
}

/* --- Title Text --- */
.title {
  font-weight: 800;
  letter-spacing: 0.2px;
  opacity: 1;
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  transition: all 0.6s ease-in-out;
}



/* --- Search Bar --- */
.search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-soft);
  height: 40px;
  border-radius: 12px;
  border: 1px solid color-mix(in oklab, var(--text) 10%, transparent);
  box-shadow: var(--shadow);
  
  /* Hidden State */
  opacity: 0;
  max-width: 0;
  padding: 0;
  border-width: 0;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.search input {
  flex: 1;
  background: transparent;
  color: var(--text);
  border: 0;
  outline: none;
  font-size: 15px;
  min-width: 200px;
}

/* --- Buttons --- */
.btn {
  border: 1px solid color-mix(in oklab, var(--text) 10%, transparent);
  background: linear-gradient(180deg, color-mix(in oklab, var(--bg-soft) 85%, transparent), color-mix(in oklab, var(--bg) 85%, transparent));
  color: var(--text);
  padding: 10px 12px;
  border-radius: 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: transform .12s ease-in-out, border-color .2s ease-in-out, box-shadow .2s ease-in-out;
}

.btn:hover {
  background-color: var(--card);
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--brand) 60%, transparent), 
              0 8px 24px color-mix(in oklab, var(--brand) 25%, transparent);
  transform: scale(1.02) translateY(-2px);
}

#themeToggle {
  opacity: 0;
  max-width: 0;
  padding: 0;
  margin: 0;
  border-width: 0;
  overflow: hidden;
  transition: all 0.4s ease;
}

#githubIconDark {
  width: 2.5rem;
  height: 2.5rem;
  opacity: 0;
  max-width: 0;
  margin: 0 auto;
  overflow: hidden;
  display: flex;
  visibility: hidden;
  justify-content: center;
  align-items: center;
  transition: all 0.4s ease;
}

button#githubIconDark:hover {
  transform: scale(1.03) translateY(-3px);
  transition: all 0.25s ease-in-out;
}

button#githubIconDark:active {
  color: var(--brand);
  transform: scale(1) translateY(3px);
  transition: all 0.1s ease-in;
}

a#headerTitle {
  display: flex;
  font-weight: 800;
  letter-spacing: 0.2px;
  font-size: 1rem;
  text-align: center;
  text-decoration: none;
  color: var(--text);
  transition: all 0.25s ease-in-out;
}

a#headerTitle .expanded {
  display: flex;
  font-weight: 800;
  letter-spacing: 0.2px;
  font-size: 1rem;
  text-align: center;
  text-decoration: none;
  color: var(--text);
}

a#headerTitle:hover {
  font-weight: 800;
  letter-spacing: 1.2px;
  color: var(--brand);
  transform: scale(1.03) translateY(-3px);
  transition: all 0.25s ease-in-out;
}

/* a#headerTitle:hover::ended {
  transform: scale(1) translateY(0px);
  transition: all 0.65s ease-in-out;
} */

a#headerTitle:active {
  font-weight: 800;
  letter-spacing: 0.2px;
  color: var(--brand);
  transform: scale(1) translateY(3px);
  transition: all 0.1s ease-in;
}


/* ============================================
   EXPANDED STATE (Active)
   ============================================ */
.header-inner.expanded {
  justify-content: space-between;
}

.header-inner.expanded .logo .mark {
  width: 40px;
  height: 40px;
}

.header-inner.expanded .title {
  opacity: 1;
  max-width: 12.5rem;
  margin-right: 0.625rem;
}

.header-inner.expanded .search {
  opacity: 1;
  max-width: 600px;
  flex: 1;
  padding: 0 12px;
  border-width: 1px;
  align-items: center;
  justify-content: center;
}

.header-inner.expanded #themeToggle {
  opacity: 1;
  max-width: 160px;
  padding: 10px 12px;
  margin-left: 8px;
  border-width: 1px;
  align-items: center;
  justify-content: center;
}

.header-inner.expanded #githubIconDark {
  visibility: visible;
  opacity: 1;
  background-image: url(/images/github-mark.png);
  background-size: contain;
  background-position: center;
  background-repeat: no-repeat;
  max-width: 160px;
  padding: 10px 12px; /* TALVEZ CAUSE PROBLEMA NO FUTURO */
  margin-left: 8px;
  border-width: 1px;
  border-radius: 50%;
}

#githubIconDark:hover {
  box-shadow: 0 0 0 3px color-mix(in oklab, var(--brand) 60%, transparent), 
              0 8px 24px color-mix(in oklab, var(--brand) 25%, transparent);
  transform: scale(1.01) translateY(-1px);
}

/* ============================================
   HERO SECTION
   ============================================ */
.hero {
  max-width: 1100px;
  margin: 20px auto 0;
  padding: 16px;
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
}

.hero-card {
  background: linear-gradient(180deg, color-mix(in oklab, var(--card) 93%, transparent), color-mix(in oklab, var(--bg-soft) 88%, transparent));
  border: 1px solid color-mix(in oklab, var(--text) 10%, transparent);
  border-radius: 16px;
  padding: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
}

.hero-card .shine {
  position: absolute;
  inset: -40% -20% auto;
  height: 140%;
  background: conic-gradient(from 0deg, transparent 0 20%, color-mix(in oklab, var(--brand) 35%, transparent) 20% 40%, transparent 40% 60%, color-mix(in oklab, var(--brand-2) 35%, transparent) 60% 80%, transparent 80%);
  filter: blur(30px);
  opacity: .55;
  animation: rotateShine 16s linear infinite;
  pointer-events: none;
}

@keyframes rotateShine {
  to { transform: rotate(1turn); }
}

.hero h1 {
  margin: 0 0 6px;
  font-size: 28px;
}

.hero p {
  margin: 0;
  color: var(--muted);
}

/* Stats */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 10px;
}

.stat {
  background: var(--bg-soft);
  border: 1px solid color-mix(in oklab, var(--text) 10%, transparent);
  border-radius: 12px;
  padding: 12px;
  text-align: center;
  transition: transform .15s ease;
}

.stat:hover {
  transform: translateY(-2px);
}

.stat .kpi {
  font-size: 20px;
  font-weight: 800;
}

.stat .kcap {
  color: var(--muted);
  font-size: 12px;
}

/* ============================================
   SECTIONS & CARDS
   ============================================ */
.container {
  max-width: 1100px;
  margin: 10px auto 80px;
  padding: 0 16px;
}

.section {
  margin-top: 18px;
  border-radius: 16px;
  overflow: hidden;
  border: 1px solid color-mix(in oklab, var(--text) 10%, transparent);
  background: linear-gradient(180deg, color-mix(in oklab, var(--card) 92%, transparent), color-mix(in oklab, var(--bg-soft) 88%, transparent));
  box-shadow: var(--shadow);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: 0.25px;
}

.section-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.chevron {
  transition: transform .25s ease;
}

.section[aria-expanded="true"] .chevron {
  transform: rotate(180deg);
}

.section-content {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  display: grid;
  gap: 12px;
  padding: 0 14px;
  max-height: 0;
  overflow: hidden;
  transition: max-height .35s ease, padding-top .25s ease;
}

.section[aria-expanded="true"] .section-content {
  padding-top: 6px;
  max-height: 1200px;
}

/* Cards */
.card {
  position: relative;
  background: var(--bg-soft);
  border: 1px solid color-mix(in oklab, var(--text) 12%, transparent);
  border-radius: 14px;
  padding: 14px;
  display: grid;
  /* 1. Ensure the middle column (text) handles sizing strictly */
  grid-template-columns: auto minmax(0, 1fr) auto; 
  gap: 12px;
  align-items: center;
  transition: transform .15s ease, border-color .2s ease, box-shadow .2s ease;
}

.card:hover {
  transform: translateY(-3px);
  border-color: color-mix(in oklab, var(--ring) 35%, transparent);
  box-shadow: 0 14px 28px color-mix(in oklab, var(--ring) 18%, transparent);
}

.icon {
  width: 42px;
  height: 42px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, color-mix(in oklab, var(--brand) 25%, transparent), color-mix(in oklab, var(--brand-2) 25%, transparent));
  color: white;
  font-weight: 800;
  letter-spacing: 0.5px;
  box-shadow: inset 0 0 0 3px rgba(255,255,255,0.25);
  position: relative;
}

.icon::before {
  content: '';
  position: absolute;
  inset: 6px;
  border: 2px solid rgba(255,255,255,0.4);
  border-radius: 2px;
}

.meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  /* 2. THE MAGIC FIX: This allows the flex/grid item to shrink below its content width */
  min-width: 0; 
  overflow: hidden; 
}

.meta .label {
  font-weight: 700;
  /* 3. OPTIONAL: Force text to one line with ... if too long */
  white-space: nowrap; 
  overflow: hidden;
  text-overflow: ellipsis;
}

.meta .desc {
  color: var(--muted);
  font-size: 13px;
  /* 4. Same truncation for description. 
     If you prefer wrapping text, remove 'white-space: nowrap' here */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.actions {
  display: flex;
  gap: 8px;
}

.a {
  text-decoration: none;
  color: var(--text);
}

.pill {
  padding: 6px 10px;
  border-radius: 10px;
  border: 1px solid color-mix(in oklab, var(--text) 12%, transparent);
  background: linear-gradient(180deg, color-mix(in oklab, var(--card) 88%, transparent), color-mix(in oklab, var(--bg) 80%, transparent));
  font-size: 12px;
  color: var(--muted);
}

/* ============================================
   ANIMATIONS & UTILITIES
   ============================================ */
.reveal {
  opacity: 0;
  transform: translateY(12px) scale(0.98);
  transition: opacity .5s ease, transform .5s ease;
}

.reveal.in {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* ============================================
   FOOTER & UI ELEMENTS
   ============================================ */
footer {
  text-align: center;
  color: var(--muted);
  padding: 30px 16px 60px;
}

.to-top {
  position: fixed;
  right: 18px;
  bottom: 18px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s ease, transform .2s ease;
}

.to-top.show {
  opacity: 1;
  pointer-events: auto;
}

.to-top:hover {
  transform: translateY(-2px);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 900px) {
  .hero {
    grid-template-columns: 1fr;
  }
  .section-content {
    grid-template-columns: 1fr;
  }
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

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