/* =====================================================================
   STAGE 2 - information architecture and navigation
   Lean menu, "Meu painel" first for people who already have a profile,
   subjects collapsed under "Aprofundar" and tab bar on the phone.
   ===================================================================== */

.skip{
  position:absolute; left:12px; top:-60px; z-index:300;
  background:var(--ink); color:#fff; padding:10px 16px;
  border-radius:0 0 var(--raio-sm) var(--raio-sm);
  font-weight:700; text-decoration:none;
}
.skip:focus{ top:0; }

section{ scroll-margin-top:64px; }
.conteudo{ display:flex; flex-direction:column; }
.conteudo > section{ order:0; }
body.has-profile .conteudo > #estudando{ order:-2; }

/* top menu */
nav.section-nav .wrap{ overflow:visible; align-items:center; gap:18px; }
.nav-brand{
  font-family:var(--font-display); font-weight:700; font-size:22px;
  color:var(--ink); text-decoration:none; letter-spacing:-.01em;
  margin-right:6px; border-bottom:0 !important; padding:0 !important;
}
.nav-brand:hover{ background:transparent !important; }
.section-nav .nav-core{ gap:6px; min-width:0; }
.section-nav .nav-core a:first-child{ font-weight:inherit; color:var(--ink-soft); }
.section-nav .nav-more{ display:block; position:relative; }
.section-nav .nav-more summary{
  padding:7px 12px 6px; border-radius:var(--raio-sm) var(--raio-sm) 0 0;
  border-bottom:2px solid transparent; font-size:14.5px; color:var(--ink-soft);
}
.section-nav .nav-more summary:hover,
.section-nav .nav-more[open] summary{ background:var(--paper-2); border-bottom-color:var(--giz); color:var(--ink); }
.section-nav .nav-more-menu{ border-radius:var(--raio-md); box-shadow:var(--sombra-folha-hover); z-index:30; left:0; right:auto; }
.section-nav .nav-more-menu a{ border-radius:var(--raio-sm); padding:9px 12px; }
.section-nav a[aria-current="true"],
.section-nav .nav-more summary[aria-current="true"]{
  color:var(--ink); font-weight:700; background:var(--paper-2); border-bottom-color:var(--ink);
}

/* meu painel */
.panel-metrics{
  display:grid;
  grid-template-columns:repeat(auto-fit, minmax(170px, 1fr));
  gap:14px;
  max-width:640px;
  margin-bottom:22px;
}
.metric{
  background:#fff;
  border:1px solid var(--linha);
  border-radius:var(--raio-md);
  box-shadow:var(--sombra-folha);
  padding:14px 16px;
  display:flex; flex-direction:column; gap:6px;
}
.metric-label{ font-size:11px; font-weight:700; letter-spacing:.06em; text-transform:uppercase; color:var(--ink-soft); }
.metric-value{ font-family:var(--font-display); font-size:30px; line-height:1; font-weight:600; color:var(--ink); }
.metric-value small{ font-family:var(--font-body); font-size:14px; font-weight:600; color:var(--ink-soft); }
.metric-bar{ display:block; height:8px; border-radius:999px; background:var(--linha); overflow:hidden; }
.metric-bar > span{ display:block; height:100%; border-radius:999px; background:var(--natureza); }
.studying-summary{ margin-bottom:26px; }
.profile-card{ max-width:640px; }

/* deepen: relations between subjects, collapsed */
.section-deepen{ padding:0 0 44px; }
.deepen > summary{
  list-style:none; cursor:pointer;
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  padding:14px 18px;
  border:2px dashed var(--linha);
  border-radius:var(--raio-md);
  font-weight:700; color:var(--ink);
  transition:background-color .15s ease, border-color .15s ease;
}
.deepen > summary::-webkit-details-marker{ display:none; }
.deepen > summary::after{ content:"+"; font-size:22px; line-height:1; color:var(--ink-soft); transition:transform .2s ease; }
.deepen[open] > summary::after{ transform:rotate(45deg); }
.deepen > summary:hover{ background:var(--paper-2); border-color:var(--giz); }
.deepen > summary:focus-visible{ outline:3px solid var(--giz); outline-offset:3px; }
.deepen[open] > summary{ margin-bottom:34px; }

/* tab bar (phone) */
.tabbar{ display:none; }

@media (max-width:720px){
  nav.section-nav .wrap{ flex-wrap:nowrap; justify-content:space-between; padding-top:10px; padding-bottom:10px; overflow:visible; }
  .section-nav .nav-core{ display:none !important; }
  .nav-auth{ width:auto !important; order:0 !important; padding-top:0 !important; border-top:0 !important; margin-left:auto; }
  .user-chip{ width:auto !important; gap:8px; }
  .user-chip .login-link{ padding:5px 10px; font-size:12.5px; }
  #navEditPreferences{ display:none; }

  body{ padding-bottom:72px; }
  .tabbar{
    display:flex;
    position:fixed; left:0; right:0; bottom:0; z-index:80;
    background:#fff;
    border-top:2px solid var(--linha);
    padding:6px 6px calc(6px + env(safe-area-inset-bottom));
    box-shadow:0 -8px 20px -14px rgba(39,120,165,.4);
  }
  .tabbar a{
    flex:1; display:flex; flex-direction:column; align-items:center; gap:2px;
    padding:6px 2px; border-radius:var(--raio-sm);
    color:var(--ink-soft); text-decoration:none;
    font-size:11px; font-weight:700; letter-spacing:.01em;
  }
  .tabbar svg{ width:24px; height:24px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
  .tabbar a[aria-current="true"],
  .tabbar-more summary[aria-current="true"]{ color:var(--ink); background:var(--paper-2); }
  .tabbar-more{ flex:1; position:relative; display:flex; }
  .tabbar-more summary{
    flex:1; display:flex; flex-direction:column; align-items:center; gap:2px;
    padding:6px 2px; border-radius:var(--raio-sm); cursor:pointer; list-style:none;
    color:var(--ink-soft); font-size:11px; font-weight:700; letter-spacing:.01em;
  }
  .tabbar-more summary::-webkit-details-marker{ display:none; }
  .tabbar-more summary:focus-visible{ outline:3px solid var(--giz); outline-offset:-2px; }
  .tabbar-more[open] summary{ color:var(--ink); background:var(--paper-2); }
  .tabbar-more-menu{
    position:absolute; right:0; bottom:calc(100% + 12px); min-width:170px;
    display:flex; flex-direction:column; gap:2px; padding:6px;
    background:#fff; border:2px solid var(--linha); border-radius:var(--raio-md);
    box-shadow:0 10px 24px -10px rgba(39,120,165,.45);
  }
  .tabbar .tabbar-more-menu a{
    flex:none; flex-direction:row; align-items:center; justify-content:flex-start;
    padding:12px 14px; font-size:14px; min-height:44px;
  }
  /* HipátIA suggestions: one line that scrolls sideways, without cutting buttons */
  .chat-chips{ flex-wrap:nowrap; overflow-x:auto; overflow-y:hidden; max-height:none; -webkit-overflow-scrolling:touch; }
  .chat-chips button{ flex:0 0 auto; white-space:nowrap; }
  .tabbar a:focus-visible{ outline:3px solid var(--giz); outline-offset:-2px; }

  .chat-toggle-btn{ bottom:88px; right:16px; }
  /* with the "Mais" menu open, the floating HipátIA button gets out of the way of the last item */
  body:has(.tabbar-more[open]) .chat-toggle-btn{ visibility:hidden; }
  .chat-panel{ bottom:156px; }
  .admin-bar{ bottom:64px; }
  body.has-admin-bar{ padding-bottom:132px; }
  body.has-admin-bar .chat-toggle-btn{ bottom:152px; }
  body.has-admin-bar .chat-panel{ bottom:220px; }
  section{ scroll-margin-top:56px; }
}

#nivel{ padding-bottom:36px; border-bottom:0; }

/* with a profile, Explore and Deepen get out of the way */
body.explore-hidden #nivel,
body.explore-hidden #disciplinas{ display:none; }
body.explore-hidden .section-nav a[href="#nivel"],
body.explore-hidden .tabbar a[href="#nivel"]{ display:none; }
.profile-row-wide{ flex-basis:100%; }
.profile-row-wide span:last-child{ font-weight:600; line-height:1.5; }

/* Elementary per-topic roadmap (simple list, no graph) */
.topics-elementary{ list-style:none; margin:10px 0 0; padding:0; counter-reset:topico; display:grid; gap:12px; }
.topic-elementary{ counter-increment:topico; background:var(--paper,#fff); border:1px solid var(--linha,rgba(0,0,0,.12)); border-radius:var(--raio-md,12px); padding:12px 14px 12px 44px; position:relative; }
.topic-elementary::before{ content:counter(topico); position:absolute; left:12px; top:12px; width:24px; height:24px; border-radius:50%; background:var(--marca); font-family:var(--font-hand); font-size:18px; line-height:24px; text-align:center; color:var(--ink); }
.topic-elementary h5{ margin:0 0 4px; font-family:var(--font-display); font-size:16px; }
.topic-elementary p{ margin:0 0 8px; font-size:14px; }
.test-general{ margin-top:12px; }
.test-general summary{ cursor:pointer; font-weight:700; padding:6px 0; }

/* Topic map (simple graph of the per-topic roadmap) */
.topic-map-wrap{ overflow-x:auto; padding:8px 2px 4px; margin:8px 0 2px; }
.topic-map{ display:block; max-width:none; height:auto; }
.topic-map-edge{ fill:none; stroke:var(--ink-soft); stroke-width:1.6; opacity:.6; }
.topic-map-tip{ fill:var(--ink-soft); opacity:.75; }
.topic-map-node{ cursor:pointer; }
.topic-map-node rect{ fill:#fff; stroke:var(--ink-soft); stroke-width:2; }
.topic-map-node text{ font-family:var(--font-body); font-size:13px; font-weight:700; fill:var(--ink); pointer-events:none; }
.topic-map-node .topic-map-mark{ font-size:15px; fill:#2C6444; }
.topic-map-node:hover rect{ fill:var(--paper-2,#f6f3ea); }
.topic-map-node[data-status="feito"] rect{ fill:#E7F0E9; stroke:#3E7D57; }
.topic-map-node[data-status="basico"] rect{ fill:#FBF0DC; stroke:#D98F2B; }
.topic-map-node[data-status="revisao"] rect{ fill:#E4EDF5; stroke:#2B5D89; }
.topic-map-node[data-status="sem-dominio"] rect{ fill:#F8E4DF; stroke:#B23A22; }
.topic-map-node.next rect{ stroke-dasharray:7 4; stroke-width:2.6; stroke:var(--ink); }
.topic-map-node:focus{ outline:none; }
.topic-map-node:focus-visible rect{ stroke:var(--ink); stroke-width:3.4; }
.topic-map-legend{ font-size:12.5px; color:var(--ink-soft); margin:2px 0 10px; }
.topic-map [data-map-hidden]{ display:none; }
.topic-map-controls{ display:flex; flex-wrap:wrap; align-items:center; gap:8px; margin:6px 0 4px; }
.topic-map-count{ flex:1 1 220px; font-size:12.5px; color:var(--ink-soft); }
.topic-map-controls .topic-map-action{ font-size:12.5px; padding:6px 12px; }
.topic-elementary.node-highlight{ box-shadow:0 0 0 3px var(--giz); transition:box-shadow .3s; }

.chat-suggestions{ display:flex; flex-direction:column; gap:6px; margin-top:8px; align-items:flex-start; }
