/* ================================================================
   DIÁRIO DE ESTUDOS — style.css
   Mobile-first · Dark default · [data-theme="light"] override
   ================================================================ */

/* ── Reset ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
a   { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; }
img, svg { display: block; max-width: 100%; }
ul, ol { list-style: none; }

/* ── Design tokens (dark default) ───────────────────────────── */
:root {
  /* Colors */
  --bg:          #080c14;
  --bg-card:     #0f1520;
  --bg-hover:    #141c2e;
  --text:        #e8ecf4;
  --text-2:      #94a3b8;
  --border:      #1e2a3a;
  --accent:      #818cf8;
  --accent-dim:  rgba(129, 140, 248, 0.13);

  /* Link button colors */
  --c-guia-bg:   rgba(129, 140, 248, 0.13);
  --c-guia-fg:   #818cf8;
  --c-pdf-bg:    rgba(251, 191, 36, 0.12);
  --c-pdf-fg:    #fbbf24;
  --c-ex-bg:     rgba(52, 211, 153, 0.11);
  --c-ex-fg:     #34d399;

  /* Shadows */
  --shadow:      0 2px 16px rgba(0,0,0,0.45);
  --shadow-up:   0 8px 36px rgba(0,0,0,0.65);

  /* Misc */
  --radius:      14px;
  --radius-sm:   8px;
  --header-h:    56px;
  --max-w:       680px;
  --ease:        0.2s ease;
  --font:        system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ── Light mode overrides ────────────────────────────────────── */
[data-theme="light"] {
  --bg:          #f0f4ff;
  --bg-card:     #ffffff;
  --bg-hover:    #f5f7ff;
  --text:        #1e2235;
  --text-2:      #64748b;
  --border:      #e2e8f0;
  --accent:      #6366f1;
  --accent-dim:  rgba(99, 102, 241, 0.10);

  --c-guia-bg:   rgba(99, 102, 241, 0.10);
  --c-guia-fg:   #6366f1;
  --c-pdf-bg:    #fef3c7;
  --c-pdf-fg:    #d97706;
  --c-ex-bg:     #d1fae5;
  --c-ex-fg:     #059669;

  --shadow:      0 2px 16px rgba(0,0,0,0.08);
  --shadow-up:   0 8px 36px rgba(0,0,0,0.16);
}

/* ── Base ───────────────────────────────────────────────────── */
html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  line-height: 1.6;
  transition: background var(--ease), color var(--ease);
}

/* ── Header ─────────────────────────────────────────────────── */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--header-h);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0 1rem;
  transition: background var(--ease), border-color var(--ease);
}

.header-back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 1.5rem;
  line-height: 1;
  flex-shrink: 0;
  transition: color var(--ease), background var(--ease);
}
.header-back:hover {
  color: var(--text);
  background: var(--bg-hover);
}

.header-logo {
  flex: 1;
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.header-logo em {
  font-style: normal;
  color: var(--accent);
}

.theme-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: none;
  font-size: 1rem;
  color: var(--text);
  transition: border-color var(--ease), background var(--ease);
}
.theme-btn:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

/* ── Main layout ────────────────────────────────────────────── */
.main {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 1.25rem 1rem 5rem;
}

/* ── Home hero ──────────────────────────────────────────────── */
.hero {
  padding: 2rem 0 1.75rem;
  text-align: center;
}

.hero-pill {
  display: inline-block;
  padding: 3px 12px;
  border-radius: 20px;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 0.75rem;
}

.hero h1 {
  font-size: clamp(1.65rem, 5vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 0.6rem;
}

.hero-sub {
  color: var(--text-2);
  font-size: 0.88rem;
  max-width: 34ch;
  margin: 0 auto 1.5rem;
  line-height: 1.65;
}

.stats {
  display: flex;
  justify-content: center;
  gap: 2rem;
}
.stat-val {
  display: block;
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
}
.stat-lbl {
  display: block;
  font-size: 0.68rem;
  color: var(--text-2);
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Search ─────────────────────────────────────────────────── */
.search-wrap {
  position: relative;
  margin: 1.25rem 0;
}
.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
  font-size: 0.9rem;
  color: var(--text-2);
}
#search-input {
  display: block;
  width: 100%;
  height: 44px;
  padding: 0 1rem 0 2.5rem;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: 22px;
  color: var(--text);
  font-family: var(--font);
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--ease);
  -webkit-appearance: none;
  appearance: none;
}
#search-input::placeholder { color: var(--text-2); }
#search-input:focus { border-color: var(--accent); }

/* ── Section label ──────────────────────────────────────────── */
.sec-label {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-2);
  margin-bottom: 0.75rem;
}

/* ── Subject cards ──────────────────────────────────────────── */
.subjects-grid {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.subject-card {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.9rem 1rem;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-left: 4px solid var(--subject-color, var(--accent));
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color var(--ease), box-shadow var(--ease), transform var(--ease);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.subject-card[data-active="true"]:hover,
.subject-card[data-active="true"]:focus-visible {
  border-color: var(--subject-color, var(--accent));
  box-shadow: var(--shadow-up);
  transform: translateY(-2px);
  outline: none;
}

.subject-card.coming-soon {
  opacity: 0.5;
  cursor: default;
}

.card-icon {
  font-size: 1.9rem;
  line-height: 1;
  flex-shrink: 0;
  width: 44px;
  text-align: center;
}

.card-body { flex: 1; min-width: 0; }

.card-title {
  font-size: 0.95rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.15rem;
}

.card-desc {
  font-size: 0.78rem;
  color: var(--text-2);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-badge {
  display: inline-block;
  margin-top: 0.4rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.67rem;
  font-weight: 700;
}
.badge-active { background: var(--accent-dim); color: var(--accent); }
.badge-soon   { background: var(--border);      color: var(--text-2); }

.card-arrow {
  font-size: 1.3rem;
  color: var(--text-2);
  flex-shrink: 0;
  transition: transform var(--ease);
}
.subject-card[data-active="true"]:hover .card-arrow,
.subject-card[data-active="true"]:focus-visible .card-arrow {
  transform: translateX(4px);
}

/* Skeleton */
.subject-card.skeleton {
  pointer-events: none;
  border-left-color: var(--border);
  animation: skpulse 1.4s ease-in-out infinite;
}
.subject-card.skeleton .card-icon { font-size: 0; background: var(--border); border-radius: 6px; height: 36px; }
.subject-card.skeleton .card-title { background: var(--border); border-radius: 4px; height: 14px; width: 55%; color: transparent; }
.subject-card.skeleton .card-desc  { background: var(--border); border-radius: 4px; height: 11px; width: 80%; margin-top: 6px; color: transparent; }
.subject-card.skeleton .card-badge { background: var(--border); color: transparent; }
.subject-card.skeleton .card-arrow { display: none; }

@keyframes skpulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.45; }
}

/* No results message */
.no-results {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-2);
  font-size: 0.9rem;
  display: none;
}
.no-results.visible { display: block; }

/* ── Materia hero ───────────────────────────────────────────── */
.materia-hero {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.5rem 0 1.25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1.5rem;
}

.m-icon {
  font-size: 2.8rem;
  line-height: 1;
  flex-shrink: 0;
}

.m-name {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--subject-color, var(--accent));
  margin-bottom: 0.2rem;
  line-height: 1.2;
}

.m-desc {
  font-size: 0.82rem;
  color: var(--text-2);
  line-height: 1.55;
}

/* ── Portfolio strips ───────────────────────────────────────── */
.portfolio-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.resumo-strip {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.9rem 1rem;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-left: 4px solid var(--subject-color, var(--accent));
  border-radius: var(--radius);
  text-decoration: none;
  color: var(--text);
  transition: border-color var(--ease), box-shadow var(--ease), transform var(--ease);
  -webkit-tap-highlight-color: transparent;
}

.resumo-strip:hover,
.resumo-strip:focus-visible {
  border-color: var(--subject-color, var(--accent));
  box-shadow: var(--shadow-up);
  transform: translateY(-2px);
  outline: none;
}

.resumo-body { flex: 1; min-width: 0; }

.resumo-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.3rem;
  flex-wrap: wrap;
}

.tipo-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tipo-guia       { background: rgba(129,140,248,0.15); color: #818cf8; }
.tipo-resumo     { background: rgba(56,189,248,0.13);  color: #38bdf8; }
.tipo-exercicios { background: rgba(251,146,60,0.15);  color: #fb923c; }
.tipo-formulario { background: rgba(52,211,153,0.13);  color: #34d399; }
.tipo-livro      { background: rgba(245,158,11,0.15);  color: #f59e0b; }
.tipo-apostila   { background: rgba(6,182,212,0.13);   color: #06b6d4; }
.tipo-prova      { background: rgba(244,63,94,0.13);   color: #f43f5e; }

.pdf-tag {
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(245,158,11,0.18);
  color: #f59e0b;
  text-transform: uppercase;
}

/* ── Tipo filter chips ──────────────────────────────────────── */
.tipo-filter {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}

.filter-chip {
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  border: 1.5px solid var(--border);
  background: none;
  color: var(--text-2);
  cursor: pointer;
  transition: border-color var(--ease), color var(--ease), background var(--ease);
  -webkit-tap-highlight-color: transparent;
}
.filter-chip:hover     { border-color: var(--accent); color: var(--accent); }
.filter-chip.active    { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

.rotulo-tag {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-2);
  letter-spacing: 0.04em;
}

.resumo-title {
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 0.15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.resumo-desc {
  font-size: 0.78rem;
  color: var(--text-2);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.resumo-arrow {
  font-size: 1.3rem;
  color: var(--text-2);
  flex-shrink: 0;
  transition: transform var(--ease);
}

.resumo-strip:hover .resumo-arrow,
.resumo-strip:focus-visible .resumo-arrow { transform: translateX(4px); }

/* ── Empty / error states ───────────────────────────────────── */
.empty-msg {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-2);
  font-size: 0.9rem;
}

.error-msg {
  text-align: center;
  padding: 2rem 1rem;
  color: #f87171;
  font-size: 0.9rem;
}

/* ── Footer ─────────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.25rem 1rem;
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-2);
  margin-top: 2rem;
}

/* ── KaTeX ──────────────────────────────────────────────────── */
/* Make rendered math inherit the container color, not default black */
.katex { color: inherit; }

/* Inline equation wrapper */
.eq { display: inline; }

/* Block / display-mode equation wrapper */
.eq-block {
  display: block;
  overflow-x: auto;
  text-align: center;
}
.eq-block .katex-display { margin: 0.2em 0; }

/* ── Paired card (PDF list + HTML solution) ─────────────────── */
.resumo-strip.resumo-paired {
  flex-direction: column;
  align-items: stretch;
  cursor: default;
  gap: 0;
  padding: 0;
  overflow: hidden;
}

.resumo-strip.resumo-paired:hover,
.resumo-strip.resumo-paired:focus-visible {
  transform: translateY(-2px);
  box-shadow: var(--shadow-up);
  border-color: var(--subject-color, var(--accent));
}

/* PDF banner — top section, amber */
.paired-pdf-banner {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 0.85rem;
  background: rgba(245, 158, 11, 0.09);
  border-bottom: 1px solid rgba(245, 158, 11, 0.18);
  text-decoration: none;
  color: #f59e0b;
  transition: background var(--ease);
}
.paired-pdf-banner:hover { background: rgba(245, 158, 11, 0.17); }

.paired-pdf-icon { font-size: 1.1rem; flex-shrink: 0; }

.paired-pdf-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  gap: 1px;
}

.paired-pdf-label {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #f59e0b;
}

.paired-pdf-name {
  font-size: 0.75rem;
  font-weight: 500;
  color: rgba(245, 158, 11, 0.7);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.paired-pdf-arrow {
  font-size: 0.9rem;
  flex-shrink: 0;
}

.paired-divider {
  height: 1px;
  background: var(--border);
}

/* Solution section — bottom */
.paired-solution {
  padding: 0.75rem 0.85rem 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.paired-solution-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.paired-solution-row > div { flex: 1; min-width: 0; }

.paired-sol-btn {
  flex-shrink: 0;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  text-decoration: none;
  background: var(--accent-dim);
  color: var(--accent);
  transition: background var(--ease);
}
.paired-sol-btn:hover { background: rgba(129, 140, 248, 0.22); }

.paired-tag {
  font-size: 0.58rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--accent-dim);
  color: var(--accent);
  text-transform: uppercase;
}

/* ── Hub (materia) 3-column layout ─────────────────────────── */
.main--wide {
  max-width: 1080px;
}

.hub-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 1.25rem;
  align-items: start;
}

.hub-col {
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1rem 1.25rem;
}

.hub-col-header {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-bottom: 0.9rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.hub-col-icon { font-size: 1rem; flex-shrink: 0; }

.hub-col-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-2);
  flex: 1;
  line-height: 1;
}

.hub-col-count {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 10px;
  background: var(--accent-dim);
  color: var(--accent);
  flex-shrink: 0;
}

.hub-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

/* Tighter strips inside hub columns */
.hub-col .resumo-strip {
  padding: 0.7rem 0.8rem;
}

.hub-empty {
  text-align: center;
  padding: 1.5rem 0.5rem;
  color: var(--text-2);
  font-size: 0.82rem;
}

/* Responsive hub */
@media (max-width: 900px) {
  .hub-grid {
    grid-template-columns: 1fr 1fr;
  }
  .hub-col:last-child {
    grid-column: 1 / -1;
  }
}

@media (max-width: 560px) {
  .hub-grid {
    grid-template-columns: 1fr;
  }
  .hub-col:last-child {
    grid-column: auto;
  }
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (min-width: 480px) {
  .cap-links { flex-direction: row; flex-wrap: wrap; }
}

@media (min-width: 680px) {
  .main  { padding: 2rem 1.5rem 5rem; }
  .hero  { padding: 2.75rem 0 2rem; }
}
