/*
 * base.css — Portal joinet.org
 * Criado em:     2026-10-19
 * Atualizado em: 2026-11-01 (banner de cookies, ADR-020)
 * Autor:         João Camargo Neto (com Claude Code)
 *
 * Site-wide look: color tokens copied from hub.html, site bar,
 * sidebar tree (ADR-013) and page layout. Page-specific styles live
 * in their own files (e.g. articles.css).
 *
 * A light theme can be added later by redefining the tokens below.
 */

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

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface2: #22263a;
  --border: #2e3248;
  --accent: #4f7fff;
  --accent-dim: #1e2f5e;
  --text: #e2e6f0;
  --text-muted: #7a84a3;
  --radius: 12px;
  --radius-sm: 6px;
  --sidebar-width: 17rem;
  --bar-height: 3.25rem;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  min-height: 100vh;
}

/* No underlines anywhere on the site (Revisão 01). */
a {
  color: var(--accent);
  text-decoration: none;
}

/* ── Site bar ── */

.site-bar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--bar-height);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.site-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
  letter-spacing: -0.2px;
}

.site-logo {
  display: block;
}

.site-user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.82rem;
}

.site-user a,
.link-button {
  color: var(--text-muted);
  text-decoration: none;
  background: none;
  border: none;
  font: inherit;
  cursor: pointer;
}

.site-user a:hover,
.link-button:hover {
  color: var(--text);
}

.menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 1.1rem;
  line-height: 1;
  padding: 6px 10px;
  cursor: pointer;
}

/* ── Layout ── */

.layout {
  display: flex;
  min-height: calc(100vh - var(--bar-height));
}

.page {
  flex: 1;
  min-width: 0; /* lets the card grid shrink inside flex */
}

/* ── Sidebar tree (ADR-013) ── */

.sidebar {
  flex: 0 0 var(--sidebar-width);
  position: sticky;
  top: var(--bar-height);
  height: calc(100vh - var(--bar-height));
  overflow-y: auto;
  padding: 20px 12px 40px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  font-size: 0.85rem;
}

.tree,
.tree ul {
  list-style: none;
}

.tree details > summary {
  list-style: none; /* hide the default triangle; we draw our own */
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
}

.tree details > summary::-webkit-details-marker {
  display: none;
}

.tree details > summary::before {
  content: "▸";
  color: var(--text-muted);
  font-size: 0.9rem; /* was 0.75rem (Revisão 03) */
  transition: transform 0.15s;
}

.tree details[open] > summary::before {
  transform: rotate(90deg);
}

.tree summary:hover {
  background: var(--surface2);
}

.tree-notebook > details > summary {
  font-weight: 700;
  color: var(--text);
}

/* Main page: the notebook itself is the selected item (Revisão 02). */
.tree-notebook.is-active > details > summary {
  color: var(--accent);
}

.tree-folders {
  margin-left: 12px;
}

/* Folders: white, regular weight; only the active folder turns blue. */
.tree-folder > details > summary {
  color: var(--text);
}

.tree-folder.is-active > details > summary {
  color: var(--accent);
}

/* Names are links (D2, F2); the arrow beside them only opens/closes. */
.tree-link,
.tree-link:visited {
  color: inherit;
  text-decoration: none;
  flex: 1;
  min-width: 0;
}

.tree-link:hover {
  color: inherit;
}

.tree-count {
  margin-left: auto;
  font-size: 0.72rem;
  color: var(--text-muted);
}

/* Cells: gray cards like the LinkedIn summary block (F3). */
.tree-cells {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 4px 0 10px 22px;
}

.tree-cells a {
  display: block;
  padding: 7px 10px;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.8rem;
  line-height: 1.4;
}

.tree-cells a:hover {
  color: var(--text);
  border-color: var(--accent);
}

.tree-cells a.is-active {
  color: var(--text);
  font-weight: 700;
}

.tree-phase {
  padding: 5px 8px 5px 26px;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* ── Content ── */

.content {
  max-width: 1280px;
  margin: 0 auto;
  padding: 36px 40px;
}

/* ── Small screens: sidebar becomes a ☰ drawer ── */

@media (max-width: 900px) {
  .menu-toggle {
    display: inline-block;
  }

  .sidebar {
    position: fixed;
    left: 0;
    z-index: 40;
    width: min(85vw, var(--sidebar-width));
    transform: translateX(-100%);
    transition: transform 0.2s;
  }

  body.sidebar-open .sidebar {
    transform: none;
    box-shadow: 0 0 0 100vmax rgba(0, 0, 0, 0.55);
  }

  .content {
    padding: 24px 20px;
  }
}

/* ── Cookie banner (ADR-020) ── */

.consent-banner {
  position: fixed;
  right: 16px;
  bottom: 16px;
  left: 16px;
  z-index: 100;
  max-width: 34rem;
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  font-size: 0.82rem;
  color: var(--text-muted);
}

.consent-banner[hidden] {
  display: none;
}

.consent-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.consent-button {
  padding: 6px 14px;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.consent-button:hover {
  border-color: var(--text-muted);
}

.consent-button.is-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

@media (max-width: 600px) {
  .consent-banner {
    flex-direction: column;
    align-items: stretch;
  }

  .consent-actions {
    justify-content: flex-end;
  }
}
