/*
Theme Name: Nexus de Estudo Med
Theme URI: https://nexus-de-estudo-med.local
Author: Nexus
Author URI: 
Description: Painel de estudo pessoal em formato de emblema — cada matéria é um brasão colorido, com sua própria ficha de apostila, aulas gravadas, resumo e exercícios.
Version: 2.0
Requires at least: 6.0
Requires PHP: 7.4
Text Domain: nexus-de-estudo-med
*/

/* ==========================================================================
   DESIGN TOKENS
   ========================================================================== */
:root {
  --bg:          #08080A;  /* fundo preto do site */
  --bg-2:        #111114;  /* painéis/seções um pouco mais claros */
  --bg-3:        #1A1A1F;  /* bordas / divisores sutis */
  --ink:         #F2F1ED;  /* texto principal sobre preto */
  --ink-dim:     #9B9BA3; /* texto secundário */
  --ink-dim2:    #8B8B94;
  --gold:        #D4AF37;  /* dourado — ícones, molduras, detalhes */
  --gold-soft:   #E9CE7A;

  --font-display: 'Sora', 'Inter', -apple-system, sans-serif;
  --font-body:    'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono:    'IBM Plex Mono', 'Courier New', monospace;

  --radius: 14px;
  --max-width: 1280px;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  margin: 0 0 0.4em;
  letter-spacing: -0.01em;
}
p { margin: 0 0 1em; }
.container { max-width: var(--max-width); margin: 0 auto; padding: 0 32px; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* ==========================================================================
   SITE HEADER
   ========================================================================== */
.site-header {
  border-bottom: 1px solid var(--bg-3);
  padding: 18px 0;
  position: sticky;
  top: 0;
  background: rgba(8,8,10,0.9);
  backdrop-filter: blur(10px);
  z-index: 20;
}
.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.site-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
}
.site-title .brand-mark {
  width: 34px; height: 34px;
  flex-shrink: 0;
}
.site-title .mark { color: var(--gold); }
.site-nav { display: flex; gap: 26px; }
.site-nav a {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-dim2);
  padding: 6px 0;
  border-bottom: 2px solid transparent;
}
.site-nav a:hover,
.site-nav a.current { color: var(--ink); border-color: var(--gold); }

/* ==========================================================================
   HERO / STATS BAND
   ========================================================================== */
.hero { padding: 56px 0 36px; }
.hero .kicker {
  font-family: var(--font-mono);
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 14px;
}
.hero h1 {
  font-size: clamp(1.9rem, 3.6vw, 2.8rem);
  color: var(--ink);
  max-width: 20ch;
}
.stats-row { display: flex; gap: 36px; margin-top: 24px; flex-wrap: wrap; }
.stat { display: flex; align-items: baseline; gap: 8px; }
.stat .num { font-family: var(--font-display); font-size: 1.5rem; font-weight: 700; color: var(--gold); }
.stat .label {
  font-size: 0.82rem;
  color: var(--ink-dim2);
}

/* ==========================================================================
   GRADE DE EMBLEMAS
   ========================================================================== */
.materia-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 22px;
  padding: 8px 0 80px;
}
.materia-card {
  position: relative;
  border-radius: var(--radius);
  aspect-ratio: 3 / 4.1;
  overflow: hidden;
  isolation: isolate;
  opacity: 0;
  transform: translateY(16px);
  animation: card-in 0.5s ease forwards;
  box-shadow: 0 14px 30px rgba(0,0,0,0.5);
}
@keyframes card-in { to { opacity: 1; transform: translateY(0); } }
.materia-card:nth-child(1) { animation-delay: 0.02s; }
.materia-card:nth-child(2) { animation-delay: 0.06s; }
.materia-card:nth-child(3) { animation-delay: 0.10s; }
.materia-card:nth-child(4) { animation-delay: 0.14s; }
.materia-card:nth-child(5) { animation-delay: 0.18s; }
.materia-card:nth-child(6) { animation-delay: 0.22s; }
.materia-card:nth-child(7) { animation-delay: 0.26s; }
.materia-card:nth-child(8) { animation-delay: 0.30s; }
.materia-card:nth-child(n+9) { animation-delay: 0.34s; }

.card-bg { position: absolute; inset: 0; z-index: 0; background: linear-gradient(160deg, #232329 0%, #16161a 100%); }
.card-shade {
  position: absolute; inset: 0; z-index: 2;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.25) 45%, rgba(0,0,0,0.05) 68%);
}
.materia-card:hover,
.materia-card:focus-within { transform: translateY(-6px); transition: transform 0.2s ease; box-shadow: 0 22px 38px rgba(0,0,0,0.6); }

.card-content {
  position: relative; z-index: 3;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 18px;
}
.card-content h3 {
  color: #fff;
  font-size: 1.28rem;
  margin: 0;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
}
.materia-card a.card-link { position: absolute; inset: 0; z-index: 4; }

/* card "+" de criação */
.add-card {
  background: var(--bg-2);
  border: 1.5px dashed var(--bg-3);
  display: flex;
  align-items: center;
  justify-content: center;
}
.add-card .add-idle {
  background: none; border: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  color: var(--ink-dim2);
  font-family: var(--font-body); font-size: 0.9rem; font-weight: 600;
  padding: 20px;
}
.add-card .add-plus {
  font-size: 2.2rem; line-height: 1;
  color: var(--gold);
  width: 52px; height: 52px;
  border: 1.5px solid var(--bg-3);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.2s ease, color 0.2s ease;
}
.add-card:hover .add-plus { border-color: var(--gold); }
.add-card:hover .add-idle { color: var(--ink); }
.add-card .add-form {
  display: none;
  width: 100%;
  height: 100%;
  padding: 20px;
  flex-direction: column;
  gap: 12px;
}
.add-card.is-open .add-idle { display: none; }
.add-card.is-open .add-form { display: flex; }
.add-form label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-dim2);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.add-form input[type="text"] {
  background: var(--bg);
  border: 1px solid var(--bg-3);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 0.92rem;
}
.add-form input[type="text"]:focus { outline: none; border-color: var(--gold); }
.file-label {
  cursor: pointer;
}
.file-label-text {
  background: var(--bg);
  border: 1px dashed var(--bg-3);
  border-radius: 8px;
  padding: 10px 12px;
  font-weight: 500;
  color: var(--ink-dim2);
  font-size: 0.85rem;
  text-align: center;
}
.add-form input[type="file"] { display: none; }
.add-hint {
  font-size: 0.72rem;
  color: var(--ink-dim2);
  margin: -4px 0 0;
}
.add-error {
  font-size: 0.78rem;
  color: #E0665C;
  margin: 0;
}
.add-actions { display: flex; gap: 8px; margin-top: auto; }
.add-actions .btn { flex: 1; padding: 9px 12px; font-size: 0.8rem; text-align: center; }

/* empty state */
.empty-state {
  border: 1px dashed var(--bg-3);
  border-radius: var(--radius);
  padding: 56px 32px;
  text-align: center;
  color: var(--ink-dim2);
  background: var(--bg-2);
}
.empty-state a.btn { margin-top: 18px; display: inline-block; }

/* ==========================================================================
   BOTÕES
   ========================================================================== */
.btn {
  font-size: 0.86rem;
  font-weight: 600;
  display: inline-block;
  padding: 11px 20px;
  border-radius: 999px;
  background: var(--gold);
  color: #14140f;
  border: 1px solid var(--gold);
}
.btn:hover { background: var(--gold-soft); border-color: var(--gold-soft); }
.btn.outline { background: transparent; color: var(--ink); border-color: var(--bg-3); }
.btn.outline:hover { border-color: var(--gold); color: var(--gold); }

/* ==========================================================================
   PÁGINA DA MATÉRIA
   ========================================================================== */
.materia-single { background: var(--bg); color: var(--ink); }
.materia-header {
  position: relative;
  padding: 64px 0 44px;
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(160deg, #232329 0%, #16161a 100%);
}
.materia-header .card-shade {
  position: absolute; inset: 0;
  background: linear-gradient(100deg, rgba(0,0,0,0.9) 20%, rgba(0,0,0,0.55) 100%);
}
.materia-header .container { position: relative; z-index: 3; }
.back-link {
  font-size: 0.82rem;
  font-weight: 600;
  color: rgba(255,255,255,0.7);
  display: inline-block;
  margin-bottom: 22px;
}
.back-link:hover { color: #fff; }
.materia-header .kicker {
  font-family: var(--font-mono);
  color: var(--gold);
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 10px;
}
.materia-header h1 { color: #fff; font-size: clamp(1.9rem, 3.6vw, 2.9rem); max-width: 18ch; }
.materia-header .progress-track { background: rgba(255,255,255,0.15); max-width: 380px; margin-top: 6px; }
.materia-header .progress-label { color: rgba(255,255,255,0.7); max-width: 380px; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.materia-body { padding: 52px 0 90px; }
.materia-section {
  padding: 32px 0;
  border-top: 1px solid var(--bg-3);
}
.materia-section:first-child { border-top: none; padding-top: 0; }
.materia-section .section-label {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold);
  margin-bottom: 10px;
}
.materia-section h2 { font-size: 1.3rem; color: var(--ink); margin-bottom: 16px; }

.link-list { list-style: none; margin: 0; padding: 0; }
.link-list li { border-bottom: 1px solid var(--bg-3); }
.link-list li:last-child { border-bottom: none; }
.link-list a {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 13px 4px; color: var(--ink);
}
.link-list a:hover { color: var(--gold); }
.link-list a .go { font-family: var(--font-mono); font-size: 0.75rem; color: var(--gold); flex-shrink: 0; }

.video-embed {
  position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden;
  border-radius: 10px; margin-bottom: 16px; background: #000;
}
.video-embed iframe { position: absolute; top: 0; left: 0; width: 100%; height: 100%; border: 0; }

.progress-track { height: 6px; background: var(--bg-3); border-radius: 4px; overflow: hidden; margin-bottom: 6px; }
.progress-fill { height: 100%; background: var(--gold); border-radius: 4px; }
.progress-label { font-family: var(--font-mono); font-size: 0.72rem; color: var(--ink-dim2); display: flex; justify-content: space-between; }

.notes-text { white-space: pre-line; color: var(--ink); }
.notes-text a { color: var(--gold); text-decoration: underline; }

.empty-field { color: var(--ink-dim2); font-style: italic; font-size: 0.92rem; }

/* ==========================================================================
   PÁGINAS GENÉRICAS
   ========================================================================== */
.generic-page { background: var(--bg); color: var(--ink); padding: 64px 0 90px; }
.generic-page h1 { font-size: 2.1rem; margin-bottom: 24px; }

/* ==========================================================================
   FOOTER
   ========================================================================== */
.site-footer { border-top: 1px solid var(--bg-3); padding: 34px 0; }
.site-footer .container {
  display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center;
}
.site-footer .footer-brand {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--ink-dim2);
  text-transform: uppercase;
  letter-spacing: 0.16em;
}
.site-footer .footer-motto {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.2em;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */
@media (max-width: 640px) {
  .materia-grid { grid-template-columns: 1fr 1fr; gap: 14px; }
}
@media (max-width: 420px) {
  .materia-grid { grid-template-columns: 1fr; }
}
