/* Não Exemplar — educacional, limpo, responsivo
   Idiomas: PT preto | EN cinza | ES cinza médio */

:root {
  --bg: #f7f5f2;
  --bg-panel: #ffffff;
  --bg-soft: #efece7;
  --line: #e4dfd7;
  --line-strong: #cdc5b8;
  --text: #1a1a1a;
  --text-soft: #5a5a5a;
  --accent: #c45c26;
  --accent-soft: #f4e8df;
  --chrome: #111111;
  --focus: #111111;
  --max: 1120px;
  --font: "Roboto", "Helvetica Neue", Arial, sans-serif;
  --radius: 3px;
  --touch: 44px;
}

html.lang-pt { --text: #111; --text-soft: #4a4a4a; --chrome: #111; }
html.lang-en { --text: #4a4a4a; --text-soft: #6e6e6e; --chrome: #555; }
html.lang-es { --text: #333; --text-soft: #5f5f5f; --chrome: #3a3a3a; }

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

html {
  font-size: 18px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; height: auto; display: block; }

a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}
a:hover { text-decoration-thickness: 2px; }

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.container {
  width: min(100% - 2rem, var(--max));
  margin-inline: auto;
}

.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;
}

.skip-link {
  position: absolute; left: -999px; top: 0;
  background: #111; color: #fff;
  padding: 0.75rem 1rem; z-index: 1000;
}
.skip-link:focus { left: 0.5rem; top: 0.5rem; }

/* ========== HEADER ========== */
.site-header {
  background: var(--bg-panel);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}

.header-top { background: var(--bg-panel); }

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.95rem 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  text-decoration: none;
  color: var(--text);
  min-width: 0;
}

.brand img {
  height: 72px;
  width: auto;
  max-width: 280px;
  object-fit: contain;
  flex-shrink: 0;
}

.brand-text { min-width: 0; }

.brand strong {
  display: block;
  font-size: 1.28rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

.brand small {
  display: block;
  margin-top: 0.12rem;
  color: var(--text-soft);
  font-size: 0.8rem;
  line-height: 1.35;
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.search-mini {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--line-strong);
  background: #fff;
  border-radius: var(--radius);
  overflow: hidden;
  max-width: 100%;
}

.search-mini input {
  border: 0;
  width: 12rem;
  max-width: 42vw;
  padding: 0.55rem 0.7rem;
  font: inherit;
  font-size: 0.95rem;
  background: transparent;
  color: var(--text);
  min-height: var(--touch);
}

.search-mini input::placeholder { color: #8a8a8a; }

.search-mini button,
.btn,
.menu-toggle,
.filter-bar button,
.search-box button {
  font: inherit;
  font-size: 0.95rem;
  font-weight: 500;
  padding: 0.55rem 0.95rem;
  border: 0;
  background: var(--chrome);
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
  min-height: var(--touch);
}

.btn {
  display: inline-block;
  text-decoration: none;
  border-radius: var(--radius);
  line-height: 1.3;
}

.btn-secondary {
  background: #fff !important;
  color: var(--text) !important;
  border: 1px solid var(--line-strong) !important;
}

.lang-switch { display: flex; gap: 0.3rem; }

.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--line-strong);
  text-decoration: none !important;
  color: var(--text-soft);
  background: #fff;
  font-size: 0.85rem;
  font-weight: 500;
  min-height: var(--touch);
  border-radius: var(--radius);
}

.lang-btn .flag-svg {
  width: 22px;
  height: 15px;
  display: block;
  flex-shrink: 0;
  border-radius: 1px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.18);
}

.lang-btn.is-active {
  border-color: var(--chrome);
  color: var(--chrome);
  background: var(--bg-soft);
  font-weight: 700;
}

.menu-toggle {
  display: none;
  border-radius: var(--radius);
}

/* ========== NAV ========== */
.site-nav {
  background: var(--bg-panel);
  border-top: 1px solid var(--line);
}

.nav-root {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0;
}

.nav-root > li { position: relative; }

.nav-root > li > a {
  display: flex;
  align-items: center;
  padding: 0.8rem 0.9rem;
  text-decoration: none !important;
  color: var(--text);
  font-weight: 500;
  font-size: 0.96rem;
  border-bottom: 3px solid transparent;
  min-height: 48px;
}

.nav-root > li > a:hover,
.nav-root > li > a.is-active {
  border-bottom-color: var(--accent);
  color: var(--text);
}

.nav-root > li.has-children > a::after {
  content: "";
  width: 0; height: 0;
  margin-left: 0.4rem;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--text-soft);
}

.nav-root ul {
  list-style: none;
  margin: 0;
  padding: 0.35rem 0;
  position: absolute;
  left: 0;
  top: 100%;
  min-width: 16rem;
  max-width: 22rem;
  background: #fff;
  border: 1px solid var(--line);
  box-shadow: 0 10px 28px rgba(0,0,0,.07);
  display: none;
  z-index: 60;
}

.nav-root > li.is-open > ul {
  display: block;
}

@media (hover: hover) and (pointer: fine) and (min-width: 901px) {
  .nav-root > li:hover > ul,
  .nav-root > li:focus-within > ul {
    display: block;
  }
}

.nav-root ul a {
  display: block;
  padding: 0.7rem 1rem;
  text-decoration: none !important;
  color: var(--text-soft);
  font-weight: 400;
  font-size: 0.94rem;
  min-height: var(--touch);
}

.nav-root ul a:hover,
.nav-root ul a.is-active {
  background: var(--bg-soft);
  color: var(--text);
  font-weight: 600;
}

/* ========== MAIN ========== */
.site-main {
  padding: 0 0 3.5rem;
  min-height: 55vh;
}

.page-header {
  margin: 0 0 1.75rem;
  padding: 1.75rem 0 1.15rem;
  border-bottom: 1px solid var(--line);
}

.page-header h1 {
  margin: 0 0 0.45rem;
  font-size: clamp(1.55rem, 3vw, 2.25rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: -0.02em;
}

.page-header .lead {
  margin: 0;
  color: var(--text-soft);
  font-size: 1.05rem;
  max-width: 42rem;
}

.breadcrumb {
  margin: 0 0 0.75rem;
  font-size: 0.88rem;
  color: var(--text-soft);
  line-height: 1.5;
  word-break: break-word;
}

.breadcrumb a {
  color: var(--text-soft);
  text-decoration: none;
}
.breadcrumb a:hover { color: var(--accent); text-decoration: underline; }

.prose {
  max-width: 44rem;
  font-size: 1.04rem;
}
.prose-readable {
  max-width: 46rem;
  font-size: 1.06rem;
  line-height: 1.75;
}
.prose p { margin: 0 0 1.15rem; }
.prose ol, .prose ul { padding-left: 1.25rem; }
.prose li { margin-bottom: 0.65rem; }

/* Layout páginas do laboratório */
.page-with-side {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
  padding-top: 0.5rem;
}

.lab-side {
  position: sticky;
  top: 6.5rem;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  padding: 1rem 0.9rem;
}

.lab-side-title {
  margin: 0 0 0.65rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.lab-side-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.lab-side-list a {
  display: block;
  padding: 0.65rem 0.55rem;
  text-decoration: none !important;
  color: var(--text);
  border-left: 3px solid transparent;
  min-height: var(--touch);
  line-height: 1.35;
}

.lab-side-list a:hover,
.lab-side-list a.is-active {
  background: var(--bg-soft);
  border-left-color: var(--accent);
  color: var(--text);
}

.page-main { min-width: 0; }

.page-next {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
  margin-top: 2rem;
}

.challenge-list {
  list-style: none;
  margin: 1.25rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.challenge-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.85rem;
  align-items: start;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  padding: 1rem 1.1rem;
}

.challenge-num {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--accent-soft);
  color: #8a3d14;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.challenge-item p {
  margin: 0.15rem 0 0;
  color: var(--text);
  line-height: 1.5;
}

.hub-grid .hub-link h3 { margin-bottom: 0.35rem; }
.hub-grid .hub-link .meta {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
  margin: 0;
}

/* ========== HOME ========== */
.hero {
  padding: 2.5rem 0 2.1rem;
  background: linear-gradient(180deg, #fff 0%, var(--bg) 100%);
  border-bottom: 1px solid var(--line);
}

.hero .eyebrow {
  display: inline-block;
  margin: 0 0 0.8rem;
  padding: 0.28rem 0.65rem;
  background: var(--accent-soft);
  color: #8a3d14;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.hero-title {
  margin: 0 0 0.5rem;
  font-size: clamp(1.7rem, 4.5vw, 2.7rem);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.025em;
  max-width: 16ch;
}

.hero-sub {
  margin: 0 0 0.75rem;
  color: var(--text-soft);
  font-size: 1.1rem;
}

.hero-meta {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.92rem;
}

.section {
  margin: 0;
  padding: 2.25rem 0;
}

.section + .section { border-top: 1px solid var(--line); }

.section-soft { background: rgba(255,255,255,.45); }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
}

.section-head h2,
.section > .container > h2,
.section > h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.section-head a {
  font-weight: 500;
  text-decoration: none;
  color: var(--accent);
  min-height: var(--touch);
  display: inline-flex;
  align-items: center;
}
.section-head a:hover { text-decoration: underline; }

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.grid-2,
.news-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.highlight-item {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  padding: 1.2rem 1.15rem 1.3rem;
  height: 100%;
}

.highlight-item h3 {
  margin: 0 0 0.4rem;
  font-size: 1.08rem;
  line-height: 1.35;
}

.highlight-item h3 a {
  color: var(--text);
  text-decoration: none;
}
.highlight-item h3 a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.highlight-item p {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.96rem;
}

.news-item,
.list-item,
.hub-link {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  padding: 1.15rem 1.2rem;
}

.news-item h3,
.list-item h3,
.hub-link h3 {
  margin: 0 0 0.4rem;
  font-size: 1.08rem;
  line-height: 1.35;
  color: var(--text);
}

.news-item p,
.list-item p {
  margin: 0 0 0.6rem;
  color: var(--text-soft);
}
.news-item p:last-child,
.list-item p:last-child { margin-bottom: 0; }

.item-action a {
  font-weight: 500;
  text-decoration: none;
}
.item-action a:hover { text-decoration: underline; }

.meta {
  color: var(--text-soft);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0 0 0.4rem;
}

.hub-links { display: grid; gap: 0.7rem; }

.hub-link {
  text-decoration: none !important;
  color: inherit;
  display: block;
}
.hub-link:hover { border-color: var(--line-strong); }
.hub-link:hover h3 {
  color: var(--accent);
  text-decoration: underline;
}
.hub-link .meta {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 400;
}

/* Pessoas */
.people-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.85rem;
}

.people-list { display: grid; gap: 0.85rem; }

.person-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.9rem;
  align-items: start;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  padding: 1.05rem 1.1rem;
}

.person-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  margin-top: 0.4rem;
  box-shadow: 0 0 0 3px rgba(0,0,0,.04);
}

.person-card h3 {
  margin: 0 0 0.15rem;
  font-size: 1.05rem;
}

.person-card .meta {
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  font-size: 0.92rem;
  margin-bottom: 0.25rem;
}

.person-role {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.95rem;
}

.person-links {
  margin-top: 0.5rem;
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}
.person-links a {
  font-weight: 500;
  text-decoration: none;
  min-height: var(--touch);
  display: inline-flex;
  align-items: center;
}
.person-links a:hover { text-decoration: underline; }

/* Temas */
.themes-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  list-style: none;
  padding: 0;
  margin: 0;
}

.theme-item {
  border: 1px solid var(--line);
  padding: 0.55rem 0.85rem;
  color: var(--text);
  background: var(--bg-panel);
  font-size: 0.96rem;
}

/* Formulários */
.filter-bar,
.search-box {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  align-items: end;
  margin-bottom: 1.4rem;
  padding: 1.1rem;
  background: var(--bg-panel);
  border: 1px solid var(--line);
}

.filter-bar label,
.search-box label {
  display: block;
  font-weight: 500;
  margin-bottom: 0.3rem;
  font-size: 0.92rem;
}

.filter-bar select,
.search-box input,
.search-box select {
  font: inherit;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--line-strong);
  background: #fff;
  min-width: min(100%, 11rem);
  width: 100%;
  min-height: var(--touch);
  border-radius: var(--radius);
  color: var(--text);
}

.filter-bar > div,
.search-box > div {
  flex: 1 1 12rem;
}

.empty-state {
  padding: 1.5rem;
  border: 1px dashed var(--line-strong);
  background: var(--bg-panel);
}

.edition-list {
  list-style: none;
  padding: 0;
  margin: 0.4rem 0 0;
  display: grid;
  gap: 0.7rem;
}

.edition-list li {
  background: var(--bg-panel);
  border: 1px solid var(--line);
  padding: 1.1rem 1.2rem;
}

.edition-list h3 { margin: 0 0 0.3rem; font-size: 1.05rem; }
.edition-list h3 a { color: var(--text); text-decoration: none; }
.edition-list h3 a:hover { color: var(--accent); text-decoration: underline; }

.banner-event {
  margin: 0 0 1.4rem;
  border: 1px solid var(--line);
  width: 100%;
  max-height: 340px;
  object-fit: cover;
}

.email-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 0.6rem;
}

.email-list li {
  padding: 1rem 1.1rem;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  font-size: 1.02rem;
  word-break: break-word;
}

/* Footer */
.site-footer {
  border-top: 1px solid #1a1a1a;
  background: #222;
  color: #cfcfcf;
  padding: 1.85rem 0;
  font-size: 0.92rem;
}

.site-footer a {
  color: #fff;
  text-decoration: none;
  display: inline-block;
  min-height: 36px;
  line-height: 36px;
}
.site-footer a:hover { text-decoration: underline; }

.footer-inner { display: grid; gap: 0.35rem; }
.footer-inner p { margin: 0; }

.lang-note {
  margin-top: 0.45rem !important;
  font-size: 0.82rem;
  color: #9a9a9a;
}

/* ========== TABLET ========== */
@media (max-width: 980px) {
  .grid-3 { grid-template-columns: 1fr; }
  .people-grid { grid-template-columns: 1fr; }
  .hero-title { max-width: none; }
  .page-with-side {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  .lab-side {
    position: static;
    top: auto;
  }
  .lab-side-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
  }
  .lab-side-list li { flex: 1 1 auto; }
  .lab-side-list a {
    border-left: 0;
    border-bottom: 2px solid transparent;
    padding: 0.55rem 0.65rem;
    background: var(--bg-soft);
  }
  .lab-side-list a.is-active,
  .lab-side-list a:hover {
    border-bottom-color: var(--accent);
  }
}

/* ========== MOBILE / TABLET NAV ========== */
@media (max-width: 900px) {
  .grid-2,
  .news-grid { grid-template-columns: 1fr; }

  .menu-toggle { display: inline-flex; align-items: center; }

  .site-nav {
    display: none;
    border-top: 1px solid var(--line);
    max-height: calc(100vh - 8rem);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }

  .site-nav.is-open { display: block; }

  .nav-root {
    flex-direction: column;
    padding: 0.25rem 0 0.85rem;
  }

  .nav-root > li > a {
    border-bottom: 0;
    padding: 0.85rem 0;
    justify-content: space-between;
  }

  .nav-root > li > a.is-active,
  .nav-root > li > a:hover {
    border-bottom: 0;
    color: var(--accent);
  }

  .nav-root ul {
    position: static;
    display: none;
    border: 0;
    box-shadow: none;
    background: var(--bg-soft);
    padding: 0.15rem 0 0.35rem 0.85rem;
    margin: 0 0 0.35rem;
    min-width: 0;
  }

  .nav-root > li.is-open > ul { display: block; }

  .nav-root ul a {
    padding: 0.7rem 0.4rem;
  }

  .search-mini input {
    width: 9rem;
    max-width: 36vw;
  }
}

@media (max-width: 640px) {
  html { font-size: 17px; }

  .container { width: min(100% - 1.35rem, var(--max)); }

  .page-next { grid-template-columns: 1fr; }

  .prose-readable { font-size: 1.02rem; }

  .header-inner {
    flex-wrap: wrap;
    align-items: center;
    gap: 0.75rem;
  }

  .brand { flex: 1 1 auto; }
  .brand small {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .header-tools {
    width: 100%;
    justify-content: space-between;
    gap: 0.45rem;
  }

  .search-mini {
    order: 3;
    flex: 1 1 100%;
    margin-top: 0.15rem;
  }

  .search-mini input {
    width: 100%;
    max-width: none;
    flex: 1;
  }

  .lang-btn .code { font-size: 0.8rem; }

  .hero { padding: 1.75rem 0 1.5rem; }
  .hero-title { font-size: 1.65rem; }
  .hero-sub { font-size: 1rem; }

  .section { padding: 1.65rem 0; }

  .page-header { padding-top: 1.35rem; }

  .highlight-item,
  .news-item,
  .list-item,
  .person-card,
  .hub-link {
    padding: 1rem;
  }

  .filter-bar,
  .search-box {
    padding: 0.95rem;
  }

  .filter-bar > div,
  .search-box > div {
    flex: 1 1 100%;
  }

  .filter-bar button,
  .search-box button,
  .btn-secondary {
    width: 100%;
  }

  .site-footer { padding: 1.5rem 0; }
}

@media (max-width: 400px) {
  .brand img { height: 40px; max-width: 150px; }
  .brand strong { font-size: 1.05rem; }
  .lang-btn { padding: 0.35rem 0.45rem; }
}
