:root {
  --bg: #e8f0ee;
  --surface: #ffffff;
  --elev: #f7faf9;
  --border: #c5d5d1;
  --text: #0f172a;
  --muted: #475569;
  --accent: #0f766e;
  --accent-soft: rgba(15, 118, 110, 0.12);
  --accent-hover: #115e59;
  --tag-bg: #e0f2f1;
  --tag-warm-bg: #ecfdf5;
  --tag-warm-text: #047857;
  --danger: #b91c1c;
  --radius: 10px;
  --radius-sm: 6px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  --shadow-hover: 0 8px 24px rgba(15, 23, 42, 0.1);
  --footer-t: 0.15s;
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  padding: 0.75rem 1rem;
  background: var(--accent);
  color: #fff;
  z-index: 100;
  font-weight: 600;
}

.skip-link:focus {
  left: 1rem;
  top: 1rem;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px);
}

@supports not (background: color-mix(in srgb, white 50%, transparent)) {
  .site-header {
    background: var(--surface);
  }
}

.header-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0.65rem 1.15rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

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

.brand-mark {
  color: var(--accent);
  display: flex;
  flex-shrink: 0;
}

.brand-text {
  line-height: 1.2;
}

.brand-text strong {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.main {
  position: relative;
  z-index: 1;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 1.15rem 3rem;
}

.hero {
  padding: 1.75rem 0 1.25rem;
  border-bottom: 1px solid var(--border);
}

.hero h1 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.5rem, 3vw, 1.85rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.hero-lead {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
  max-width: 52ch;
}

.toolbar {
  padding: 1.15rem 0 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.toolbar-row {
  display: grid;
  grid-template-columns: 1fr minmax(150px, 200px) minmax(100px, 150px);
  gap: 0.85rem;
  align-items: end;
}

@media (max-width: 720px) {
  .toolbar-row {
    grid-template-columns: 1fr;
  }
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.field-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--muted);
}

.icon-inline {
  opacity: 0.85;
}

.field input,
.field select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  font-family: var(--font);
  font-size: 0.9rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
}

.field input:focus,
.field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.toolbar-meta {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}

.list-section {
  padding-bottom: 1.5rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.contest-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  background: var(--elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
  text-align: left;
  cursor: pointer;
  padding: 0;
  font: inherit;
  box-shadow: var(--shadow);
}

.contest-card:hover,
.contest-card:focus-visible {
  border-color: var(--accent);
  box-shadow: var(--shadow-hover);
}

.contest-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.card-media {
  width: 100%;
  flex-shrink: 0;
  background: var(--surface);
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.85rem;
  border-bottom: 1px solid var(--border);
}

.card-media img {
  width: 100%;
  height: auto;
  max-height: 160px;
  object-fit: contain;
  object-position: center;
}

.card-media-placeholder {
  width: 100%;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--tag-bg);
  color: var(--muted);
}

.card-body {
  padding: 0.85rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
}

.card-title {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.02em;
}

.card-meta {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: auto;
  padding-top: 0.35rem;
}

.tag {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: var(--tag-bg);
  color: var(--muted);
}

.tag.gold {
  background: var(--tag-warm-bg);
  color: var(--tag-warm-text);
}

.load-more-wrap {
  display: flex;
  justify-content: center;
  margin-top: 1.5rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  font-family: var(--font);
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-ghost {
  background: transparent;
  color: var(--muted);
  padding-left: 0.15rem;
}

.btn-ghost:hover {
  color: var(--accent);
}

.detail {
  padding: 1.15rem 0 2.5rem;
}

.back-btn {
  margin-bottom: 1.1rem;
}

/* Uma coluna: conteúdo em toda a largura; ficha abaixo em grade */
.detail-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  align-items: start;
  width: 100%;
}

.detail-main {
  width: 100%;
  min-width: 0;
}

.detail-header h1 {
  margin: 0 0 0.35rem;
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.detail-sub {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.detail-image-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin: 0 0 1rem;
  padding: 0;
  box-sizing: border-box;
  border: none;
  outline: none;
  background: transparent;
  border-radius: 0;
  overflow: visible;
}

.detail-image-wrap img {
  width: auto;
  height: auto;
  display: block;
  max-width: 200px;
  max-height: 120px;
  margin: 0;
  object-fit: contain;
  object-position: center;
  border: none;
  outline: none;
}

.prose {
  max-width: 68ch;
}

/* Detalhe do concurso: descrição e blocos usam largura total do painel */
#view-detail .prose {
  max-width: none;
}

#view-detail .detail-body {
  width: 100%;
  max-width: none;
}

.prose p {
  margin: 0 0 0.85rem;
  color: var(--muted);
}

.prose h2 {
  font-size: 1.05rem;
  font-weight: 600;
  margin: 1.5rem 0 0.5rem;
  color: var(--text);
}

.prose h2:first-child {
  margin-top: 0;
}

.prose .blob {
  white-space: pre-wrap;
  font-size: 0.9rem;
  line-height: 1.65;
}

.prose code {
  font-size: 0.85em;
  padding: 0.1rem 0.3rem;
  background: var(--tag-bg);
  border-radius: 4px;
  color: var(--accent);
}

.detail-block {
  margin-bottom: 1.25rem;
  padding: 0.95rem 1rem;
  background: var(--elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: 100%;
  max-width: none;
  box-sizing: border-box;
}

.detail-block h2 {
  margin: 0 0 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.95rem;
}

.detail-aside {
  position: static;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  width: 100%;
  max-width: none;
}

.aside-card {
  padding: 0.9rem;
  background: var(--elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.85rem;
}

.aside-card h3 {
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
}

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

.kv li {
  display: flex;
  gap: 0.35rem;
  padding: 0.3rem 0;
  border-bottom: 1px solid var(--border);
}

.kv li:last-child {
  border-bottom: none;
}

.kv dt {
  flex: 0 0 40%;
  color: var(--muted);
  font-size: 0.78rem;
}

.kv dd {
  margin: 0;
  flex: 1;
  font-weight: 500;
  font-size: 0.85rem;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-top: 1.15rem;
}

.detail-actions a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.state-block {
  padding: 3rem 1.5rem;
  text-align: center;
}

.state-error .state-icon {
  color: var(--danger);
  margin-bottom: 0.75rem;
}

.state-error h2 {
  margin: 0 0 0.4rem;
  font-size: 1.25rem;
}

.state-error p {
  color: var(--muted);
  margin-bottom: 1rem;
}

.spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  color: var(--muted);
}

.spinner svg {
  width: 44px;
  height: 44px;
}

/* Rodapé Virtues — alinhado a Dicionário Informal / ClimaQuest */
.site-footer.virtues-footer {
  background: #1e1e22;
  color: rgba(255, 255, 255, 0.55);
  margin-top: 3rem;
  max-width: 100%;
  overflow-x: visible;
}

.footer-main {
  max-width: min(1200px, 100%);
  margin: 0 auto;
  padding: 3rem 1.5rem 2.5rem;
  display: grid;
  grid-template-columns: 2fr 1fr 1.6fr 1fr auto minmax(12rem, 1.35fr);
  gap: 2rem 2.5rem;
  min-width: 0;
  overflow-x: clip;
}

.footer-col-spacer {
  height: 1em;
  margin-bottom: 0.85rem;
}

.footer-copyright-block {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  text-align: right;
}

.footer-copyright-line {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.38);
  line-height: 1.45;
}

.footer-col--copyright .footer-by {
  display: block;
  text-align: right;
}

.footer-col--social {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.footer-col-title--contact {
  width: 100%;
  text-align: center;
  margin: 0 0 0.85rem 0;
}

.footer-social-nav {
  display: grid;
  grid-template-columns: repeat(3, 2.1rem);
  grid-template-rows: repeat(3, 2.1rem);
  gap: 0.32rem 0.45rem;
  justify-content: center;
  justify-items: center;
  align-items: center;
  margin: 0 auto;
}

.footer-social-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  color: rgba(255, 255, 255, 0.52);
  border-radius: 6px;
  transition: color var(--footer-t), background var(--footer-t);
}

.footer-social-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.footer-social-link svg {
  width: 1.05rem;
  height: 1.05rem;
  fill: currentColor;
}

.footer-brand-col {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.footer-di-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: rgba(255, 255, 255, 0.55);
}

.footer-brand-logo {
  flex-shrink: 0;
  width: 3.15rem;
  height: auto;
  max-height: 3.25rem;
  opacity: 0.85;
  transition: opacity var(--footer-t);
}

.footer-brand-nome--text {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: rgba(255, 255, 255, 0.65);
  transition: color var(--footer-t), opacity var(--footer-t);
}

.footer-brand-nome-img {
  height: 2rem;
  width: auto;
  max-width: min(220px, 55vw);
  object-fit: contain;
  object-position: left center;
  opacity: 0.88;
  transition: opacity var(--footer-t);
}

.footer-di-brand:hover .footer-brand-logo,
.footer-di-brand:hover .footer-brand-nome--text,
.footer-di-brand:hover .footer-brand-nome-img {
  opacity: 0.95;
  color: #fff;
}

/* Concurso.quest no rodapé: logo e nome em cinza */
.footer-di-brand.footer-brand-cq .footer-brand-logo,
.footer-di-brand.footer-brand-cq .footer-brand-nome-img {
  filter: grayscale(1);
  opacity: 0.48;
  transition: opacity var(--footer-t), filter var(--footer-t);
}

.footer-di-brand.footer-brand-cq:hover .footer-brand-logo,
.footer-di-brand.footer-brand-cq:hover .footer-brand-nome-img {
  opacity: 0.62;
  filter: grayscale(1);
  color: inherit;
}

.footer-contacts {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.footer-contact-link {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.5);
  text-decoration: none;
  transition: color var(--footer-t);
}

.footer-contact-link:hover {
  color: #fff;
}

.footer-col-title {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.3);
  margin: 0 0 0.85rem 0;
}

.footer-col-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.footer-col-list a,
.footer-link-btn {
  font-size: 0.84rem;
  color: rgba(255, 255, 255, 0.55);
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  text-align: left;
  font-family: inherit;
  transition: color var(--footer-t);
}

.footer-col-list a:hover,
.footer-link-btn:hover {
  color: #fff;
}

.footer-col-list a[aria-current="page"] {
  color: rgba(255, 255, 255, 0.75);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.footer-bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.footer-bottom-inner {
  max-width: min(1200px, 100%);
  margin: 0 auto;
  padding: 1.25rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: nowrap;
  min-width: 0;
  box-sizing: border-box;
}

.footer-by {
  font-size: 0.73rem;
  color: rgba(255, 255, 255, 0.25);
}

.footer-letters-grid {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.footer-col-list.footer-letters-row {
  flex-direction: row;
  flex-wrap: nowrap;
  gap: 0.42rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  padding: 2px 3px 4px;
  box-sizing: border-box;
}

.footer-col-list.footer-letters-row > li {
  flex-shrink: 0;
}

.footer-bottom-badges {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.35rem;
  flex: 1;
  min-width: 0;
  justify-content: flex-start;
}

.footer-bottom-inner .footer-virtues-link {
  flex-shrink: 0;
}

.footer-store-link {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  opacity: 0.8;
  transition: opacity var(--footer-t);
  text-decoration: none;
}

.footer-store-link:hover {
  opacity: 1;
}

.footer-badge {
  height: auto;
  width: auto;
  max-width: 100%;
  max-height: 48px;
  display: block;
  object-fit: contain;
}

.footer-store-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.68rem;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: color var(--footer-t), background var(--footer-t), border-color var(--footer-t);
}

.footer-store-chip:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.22);
}

.footer-store-chip svg {
  width: 0.95rem;
  height: 0.95rem;
  flex-shrink: 0;
  opacity: 0.8;
}

.footer-virtues-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 700;
  transition: opacity var(--footer-t);
}

.footer-virtues-link:hover {
  opacity: 0.85;
  color: #fff;
}

.footer-virtues-logo {
  height: 28px;
  width: 28px;
  flex-shrink: 0;
  color: rgba(255, 255, 255, 0.65);
}

.footer-virtues-logo-img {
  height: auto;
  max-height: 36px;
  width: auto;
  max-width: min(140px, 42vw);
  object-fit: contain;
  flex-shrink: 0;
  opacity: 0.9;
}

.footer-virtues-text {
  font-family: var(--font);
  letter-spacing: 0.02em;
}

@media (max-width: 768px) {
  .footer-main {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    padding: 2rem 1rem 1.5rem;
    gap: 1.5rem 1rem;
  }

  .footer-main > .footer-col,
  .footer-main > .footer-brand-col {
    min-width: 0;
  }

  .footer-brand-col,
  .footer-col--copyright {
    grid-column: 1 / -1;
  }

  .footer-col--letters {
    justify-self: end;
    text-align: right;
    min-width: 0;
    max-width: 100%;
    overflow: visible;
  }

  .footer-col--letters .footer-col-title {
    text-align: right;
    width: 100%;
  }

  .footer-col--letters .footer-letters-grid {
    align-items: flex-end;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    flex-wrap: nowrap;
  }

  .footer-col--letters .footer-col-list.footer-letters-row {
    flex-wrap: nowrap;
    justify-content: flex-end;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    gap: 0.28rem;
    scrollbar-width: thin;
    padding-inline: 4px;
  }

  .footer-col--social {
    justify-self: end;
    align-items: flex-end;
  }

  .site-footer .footer-col--social .footer-col-title--contact {
    text-align: right;
  }

  .footer-col--social .footer-social-nav {
    margin-left: auto;
    margin-right: 0;
  }

  .footer-copyright-block,
  .footer-col--copyright .footer-by {
    text-align: center;
  }

  .footer-bottom-inner {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
    text-align: center;
  }

  .footer-bottom-badges {
    flex-wrap: wrap;
    justify-content: center;
  }

  .footer-bottom-inner .footer-virtues-link {
    justify-content: center;
  }
}

@media (max-width: 540px) {
  .footer-main {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 1.25rem 0.75rem;
    padding: 1.5rem 1rem 1.75rem;
    align-items: start;
  }

  .footer-col--dic .footer-link-btn,
  .footer-col--dic a,
  .footer-col--legal a,
  .footer-contact-link {
    overflow-wrap: anywhere;
  }

  .footer-brand-col {
    grid-column: 1 / -1;
    max-width: none;
  }

  .footer-col--copyright {
    grid-column: 1 / -1;
  }

  .footer-col--copyright .footer-copyright-block,
  .footer-col--copyright .footer-by {
    text-align: center;
  }

  .footer-bottom-inner {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-rows: repeat(3, auto);
    gap: 0.55rem 0.4rem;
    padding: 1rem 0.85rem 1.25rem;
    align-items: center;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    box-sizing: border-box;
  }

  .footer-bottom-badges {
    display: contents;
  }

  .footer-bottom-inner .footer-store-link {
    flex: none;
    min-width: 0;
    justify-content: center;
  }

  .footer-bottom-inner .footer-virtues-link {
    grid-column: 3;
    grid-row: 3;
    justify-self: end;
    align-self: center;
    margin: 0;
  }

  .footer-badge {
    max-height: 42px;
    margin: 0 auto;
  }

  .footer-virtues-logo {
    height: 26px;
  }

  .footer-virtues-logo-img {
    max-height: 30px;
  }
}

[hidden] {
  display: none !important;
}
