/* SAP4ALL visual identity — Option 3 (Módulos).
   Overrides only. Do not change JS or data files. */
:root {
  --mark-blocks: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 36 48' fill='none'%3E%3Crect x='0' y='0' width='16' height='14' rx='3.5' fill='%23B47B0E'/%3E%3Crect x='0' y='17' width='16' height='14' rx='3.5' fill='%23FFF4D6'/%3E%3Crect x='20' y='17' width='16' height='14' rx='3.5' fill='%23FFF4D6'/%3E%3Crect x='20' y='34' width='16' height='14' rx='3.5' fill='%23FFF4D6'/%3E%3C/svg%3E");
  --mark-blocks-navy: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 36 48' fill='none'%3E%3Crect x='0' y='0' width='16' height='14' rx='3.5' fill='%23B47B0E'/%3E%3Crect x='0' y='17' width='16' height='14' rx='3.5' fill='%230B1F33'/%3E%3Crect x='20' y='17' width='16' height='14' rx='3.5' fill='%230B1F33'/%3E%3Crect x='20' y='34' width='16' height='14' rx='3.5' fill='%230B1F33'/%3E%3C/svg%3E");
  /* Motivo discreto para fundos escuros (dourado/creme a baixa opacidade) */
  --pattern-navy: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='152' viewBox='0 0 120 152'%3E%3Cg fill='none' opacity='0.055'%3E%3Crect x='12' y='14' width='16' height='14' rx='3.5' fill='%23B47B0E'/%3E%3Crect x='12' y='31' width='16' height='14' rx='3.5' fill='%23FFF4D6'/%3E%3Crect x='32' y='31' width='16' height='14' rx='3.5' fill='%23FFF4D6'/%3E%3Crect x='32' y='48' width='16' height='14' rx='3.5' fill='%23FFF4D6'/%3E%3Crect x='76' y='86' width='16' height='14' rx='3.5' fill='%23B47B0E'/%3E%3Crect x='76' y='103' width='16' height='14' rx='3.5' fill='%23FFF4D6'/%3E%3Crect x='96' y='103' width='16' height='14' rx='3.5' fill='%23FFF4D6'/%3E%3Crect x='96' y='120' width='16' height='14' rx='3.5' fill='%23FFF4D6'/%3E%3C/g%3E%3C/svg%3E");
  /* Motivo ainda mais leve para fundos claros */
  --pattern-light: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='152' viewBox='0 0 120 152'%3E%3Cg fill='none' opacity='0.04'%3E%3Crect x='12' y='14' width='16' height='14' rx='3.5' fill='%23B47B0E'/%3E%3Crect x='12' y='31' width='16' height='14' rx='3.5' fill='%230B1F33'/%3E%3Crect x='32' y='31' width='16' height='14' rx='3.5' fill='%230B1F33'/%3E%3Crect x='32' y='48' width='16' height='14' rx='3.5' fill='%230B1F33'/%3E%3Crect x='76' y='86' width='16' height='14' rx='3.5' fill='%23B47B0E'/%3E%3Crect x='76' y='103' width='16' height='14' rx='3.5' fill='%230B1F33'/%3E%3Crect x='96' y='103' width='16' height='14' rx='3.5' fill='%230B1F33'/%3E%3Crect x='96' y='120' width='16' height='14' rx='3.5' fill='%230B1F33'/%3E%3C/g%3E%3C/svg%3E");
}

/* ---- Links and focus (gold-ink passes WCAG AA on white) ---- */
a {
  color: var(--gold-ink);
}

a:hover {
  color: var(--gold-hover);
}

.skip-link {
  background: var(--navy);
  border-radius: 0 0 var(--radius-tile) var(--radius-tile);
}

.list-item h2 a:hover {
  color: var(--gold-ink);
}

/* ---- Header, footer, hero: subtle 4-block pattern ---- */
.site-header {
  background-image: var(--pattern-navy);
  background-size: 180px 228px;
  background-color: rgba(11, 31, 51, 0.96);
}

.site-footer {
  background-image: var(--pattern-navy);
  background-size: 180px 228px;
  background-color: var(--navy);
}

.portal-hero,
.page-hero {
  position: relative;
  background-image: none;
}

.portal-hero::before,
.page-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image: var(--pattern-light);
  background-size: 180px 228px;
  pointer-events: none;
  z-index: 0;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 42%, transparent 88%);
  mask-image: linear-gradient(180deg, #000 0%, #000 42%, transparent 88%);
}

.portal-hero > *,
.page-hero > * {
  position: relative;
  z-index: 1;
}

/* ---- Nav current + pills become tiles ---- */
.site-nav a {
  border-radius: var(--radius-tile);
}

.site-nav a[aria-current="page"] {
  color: #fff;
  background: #5c4216;
}

.nav-toggle {
  border-radius: var(--radius-tile);
}

/* ---- Buttons, tags, chips, banner: logo tile radius ---- */
.btn {
  border-radius: var(--radius-tile);
}

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

.btn-primary:hover {
  background: var(--navy-2);
  color: #fff;
}

.btn-secondary {
  color: var(--gold-ink);
}

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

.tag,
.news-tag,
.chips li,
.badge-reforma {
  border-radius: var(--radius-tile);
}

.tag,
.news-tag,
.chips.light li {
  background: var(--gold-soft);
  color: var(--gold-ink);
  border-color: transparent;
}

.news-card .meta time,
.modulos-item .meta time,
.list-item .meta time,
.article .meta time {
  color: var(--gold-ink);
  font-weight: 600;
}

/* ---- Title marker: 4-block icon on the same line as the title, gold bar below ---- */
.eyebrow {
  color: var(--gold-ink);
  font-weight: 600;
  letter-spacing: 0.04em;
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
}

.eyebrow::before {
  content: "";
  display: block;
  width: 0.85rem;
  height: 1.05rem;
  flex: 0 0 auto;
  margin: 0;
  background: var(--mark-blocks-navy);
  background-size: contain;
  background-repeat: no-repeat;
}

.portal-hero h1::after,
.page-hero h1::after,
.section-head h2::after,
.modulos-panel > h2::after,
.article h1::after {
  content: "";
  display: block;
  width: 3.2rem;
  height: 0.28rem;
  margin-top: 0.55rem;
  border-radius: 2px;
  background: var(--gold);
}

/* Icon + title on one row; gold bar stays under the text.
   align-items: start + 1lh offset keeps the icon centered on a single
   line and on the first line when the title wraps (e.g. 390px). */
.section-head h2,
.modulos-panel > h2 {
  display: grid;
  grid-template-columns: auto 1fr;
  column-gap: 0.7rem;
  align-items: start;
}

.section-head h2::before,
.modulos-panel > h2::before {
  content: "";
  grid-column: 1;
  grid-row: 1;
  width: 1.2rem;
  height: 1.45rem;
  min-width: 1.2rem;
  flex-shrink: 0;
  margin: 0;
  margin-top: calc((1.2em - 1.45rem) / 2);
  margin-top: calc((1lh - 1.45rem) / 2);
  background: var(--mark-blocks-navy);
  background-size: contain;
  background-repeat: no-repeat;
}

.section-head h2::after,
.modulos-panel > h2::after {
  grid-column: 2;
  grid-row: 2;
  justify-self: start;
  width: 3.2rem;
  max-width: 3.2rem;
}

/* ---- Module tabs: block-shaped, selected with gold edge and gold tile ---- */
.modulos-tab {
  border-radius: var(--radius-tile);
  gap: 0.4rem;
}

.modulos-tab::before {
  content: "";
  display: block;
  width: 0.62rem;
  height: 0.55rem;
  border-radius: 2px;
  background: var(--border);
  flex: 0 0 auto;
}

.modulos-tab:hover {
  border-color: var(--gold-ink);
  color: var(--gold-ink);
}

.modulos-tab:hover::before {
  background: var(--gold);
}

.modulos-tab[aria-selected="true"] {
  background: var(--navy);
  border-color: var(--gold);
  color: #fff;
  box-shadow: inset 0 0 0 1px var(--gold);
}

.modulos-tab[aria-selected="true"]::before {
  background: var(--gold);
}

/* ---- Cards, covers, inputs, notes, banner ---- */
.news-card,
.modulos-item,
.card,
.list-item,
.job,
.fonte-card,
.article-cover,
.modulos-item-cover img,
input[type="text"],
input[type="email"],
.form-status {
  border-radius: var(--radius);
}

.fonte-card,
input[type="text"],
input[type="email"],
.form-status {
  border-radius: var(--radius-tile);
}

.note {
  border-left-color: var(--gold);
}

.job {
  border-left-color: var(--gold);
}

.job.current {
  border-left-color: var(--gold);
}

input:focus-visible {
  border-color: var(--gold-ink);
}

.list-item-cover:focus-visible,
.fonte-nome a:focus-visible {
  outline-color: var(--gold-ink);
}

.fontes-oficiais {
  border-radius: var(--radius);
}

/* ---- Separators: 4-block rule between major blocks ---- */
.news-section,
.fontes-oficiais {
  position: relative;
}

.status-msg {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.status-msg::before {
  content: "";
  display: block;
  width: 1.35rem;
  height: 1.65rem;
  flex: 0 0 auto;
  background: var(--mark-blocks-navy);
  background-size: contain;
  background-repeat: no-repeat;
  animation: mark-pulse 1.4s ease-in-out infinite;
}

@keyframes mark-pulse {
  0%, 100% { opacity: 0.45; transform: scale(0.96); }
  50% { opacity: 1; transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .status-msg::before {
    animation: none;
    opacity: 1;
  }
}

/* Diary / list empty state: calm, not a loading pulse */
.empty-state {
  max-width: 36rem;
  padding: 1.75rem 1.5rem;
}
.empty-state p {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
}


/* Desktop/mobile: keep the motif compact so titles don't wrap oddly */
@media (max-width: 700px) {
  .portal-hero h1::after,
  .page-hero h1::after,
  .section-head h2::after,
  .modulos-panel > h2::after,
  .article h1::after {
    width: 2.6rem;
  }
}


/* ---- Theme toggle (header, discreet) ---- */
.theme-toggle {
  flex: 0 0 auto;
  position: relative;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  min-width: 44px;
  min-height: 44px;
  margin-left: 0.15rem;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: var(--radius-tile);
  background: transparent;
  color: #f3f0e8;
  cursor: pointer;
  touch-action: manipulation;
  pointer-events: auto;
  -webkit-tap-highlight-color: rgba(255, 255, 255, 0.12);
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.theme-toggle:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.theme-toggle-icon {
  display: none;
  width: 1.15rem;
  height: 1.15rem;
}

html[data-theme="light"] .theme-toggle-icon--moon,
html:not([data-theme]) .theme-toggle-icon--moon {
  display: block;
}

html[data-theme="dark"] .theme-toggle-icon--sun {
  display: block;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme]) .theme-toggle-icon--moon { display: none; }
  html:not([data-theme]) .theme-toggle-icon--sun { display: block; }
}

@media (min-width: 761px) {
  .site-nav {
    margin-left: auto;
  }
}

@media (max-width: 760px) {
  .theme-toggle {
    margin-left: auto;
  }
}

/* ---- Dark mode refinements (tokens already swap colors) ---- */
html[data-theme="dark"] {
  --mark-blocks-navy: var(--mark-blocks);
  --pattern-light: var(--pattern-navy);
}

html[data-theme="dark"] .site-header {
  background-color: var(--header-bg);
}

html[data-theme="dark"] .fonte-card,
html[data-theme="dark"] .news-card,
html[data-theme="dark"] .article,
html[data-theme="dark"] .modulos-item,
html[data-theme="dark"] .list-item,
html[data-theme="dark"] .fontes-oficiais {
  background: var(--surface);
  border-color: var(--border);
}

html[data-theme="dark"] .modulos-tab {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme]) {
    --mark-blocks-navy: var(--mark-blocks);
    --pattern-light: var(--pattern-navy);
  }
  html:not([data-theme]) .site-header { background-color: var(--header-bg); }
  html:not([data-theme]) .fonte-card,
  html:not([data-theme]) .news-card,
  html:not([data-theme]) .article,
  html:not([data-theme]) .modulos-item,
  html:not([data-theme]) .list-item,
  html:not([data-theme]) .fontes-oficiais {
    background: var(--surface);
    border-color: var(--border);
  }
  html:not([data-theme]) .modulos-tab {
    background: var(--surface);
    border-color: var(--border);
    color: var(--text);
  }
}

html[data-theme="dark"] .fontes-categoria h4 {
  color: var(--text);
}

html[data-theme="dark"] .badge-reforma,
html[data-theme="dark"] .tag-exemplo,
html[data-theme="dark"] .dado-pendente {
  color: var(--gold-ink);
}

html[data-theme="dark"] .modulos-tab[aria-selected="true"] {
  background: var(--navy);
  border-color: var(--gold);
  color: #fff;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme]) .fontes-categoria h4 { color: var(--text); }
  html:not([data-theme]) .badge-reforma,
  html:not([data-theme]) .tag-exemplo,
  html:not([data-theme]) .dado-pendente { color: var(--gold-ink); }
  html:not([data-theme]) .modulos-tab[aria-selected="true"] {
    background: var(--navy);
    border-color: var(--gold);
    color: #fff;
  }
}

.site-header {
  position: sticky;
  z-index: 50;
}
.header-inner {
  position: relative;
  z-index: 1;
}
.nav-toggle {
  position: relative;
  z-index: 2;
  min-height: 44px;
  touch-action: manipulation;
  pointer-events: auto;
}


/* ---- Contact cards: whole card is the link ---- */
.section-contato {
  padding-top: 1.15rem;
  padding-bottom: 2.25rem;
}

@media (max-width: 700px) {
  .section-contato {
    padding-top: 0.7rem;
    padding-bottom: 1.25rem;
  }
  .page-contato .site-footer {
    margin-top: 1.75rem;
  }
}

.contact-list {
  margin: 0;
}

.contact-list li {
  padding: 0;
  background: transparent;
  border: none;
  display: block;
}

.contact-card {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-height: 44px;
  padding: 1rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  text-decoration: none;
  touch-action: manipulation;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease, color 0.16s ease;
}

.contact-card:hover {
  color: var(--text);
  border-color: var(--gold-ink);
  box-shadow: 0 8px 20px rgba(11, 31, 51, 0.12);
  transform: translateY(-2px);
  text-decoration: none;
}

.contact-card:focus-visible {
  color: var(--text);
  outline: 2px solid var(--gold-ink);
  outline-offset: 3px;
  border-color: var(--gold-ink);
  box-shadow: 0 8px 20px rgba(11, 31, 51, 0.12);
  transform: translateY(-2px);
}

.contact-card-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 1.5rem;
  width: 1.5rem;
  height: 1.5rem;
  color: var(--gold-ink);
}

.contact-card-icon svg {
  width: 1.5rem;
  height: 1.5rem;
  display: block;
}

.contact-card-label {
  flex: 1 1 auto;
  font-weight: 600;
  font-size: 1.05rem;
  line-height: 1.3;
}

.contact-card-arrow {
  flex: 0 0 auto;
  color: var(--gold-ink);
  font-size: 1.2rem;
  line-height: 1;
  transform: translateX(0);
  transition: transform 0.16s ease;
}

.contact-card:hover .contact-card-arrow,
.contact-card:focus-visible .contact-card-arrow {
  transform: translateX(0.25rem);
}

html[data-theme="dark"] .contact-card:hover,
html[data-theme="dark"] .contact-card:focus-visible {
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
}

@media (prefers-reduced-motion: reduce) {
  .contact-card,
  .contact-card-arrow {
    transition: none;
  }
  .contact-card:hover,
  .contact-card:focus-visible {
    transform: none;
  }
  .contact-card:hover .contact-card-arrow,
  .contact-card:focus-visible .contact-card-arrow {
    transform: none;
  }
}


/* ---- Home and blog cards: whole card is one link ---- */
.stretched-link {
  color: inherit;
  text-decoration: none;
}

.stretched-link::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
}

.stretched-link:focus,
.stretched-link:focus-visible {
  outline: none;
}

.news-card,
.list-item,
.modulos-item {
  cursor: pointer;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.news-card:hover,
.list-item:hover,
.modulos-item:hover {
  border-color: var(--gold-ink);
  box-shadow: 0 8px 20px rgba(11, 31, 51, 0.12);
  transform: translateY(-2px);
}

.news-card:hover .stretched-link,
.list-item:hover .stretched-link,
.modulos-item:hover .stretched-link {
  color: var(--gold-ink);
  text-decoration: none;
}

.news-card:focus-within,
.list-item:focus-within,
.modulos-item:focus-within {
  border-color: var(--gold-ink);
  box-shadow: 0 0 0 3px var(--gold-ink), 0 8px 20px rgba(11, 31, 51, 0.12);
  transform: translateY(-2px);
}

html[data-theme="dark"] .news-card:hover,
html[data-theme="dark"] .list-item:hover,
html[data-theme="dark"] .modulos-item:hover {
  border-color: var(--gold-ink);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
}

html[data-theme="dark"] .news-card:focus-within,
html[data-theme="dark"] .list-item:focus-within,
html[data-theme="dark"] .modulos-item:focus-within {
  border-color: var(--gold-ink);
  box-shadow: 0 0 0 3px var(--gold-ink), 0 8px 22px rgba(0, 0, 0, 0.35);
}

@media (prefers-reduced-motion: reduce) {
  .news-card,
  .list-item,
  .modulos-item {
    transition: none;
  }
  .news-card:hover,
  .list-item:hover,
  .modulos-item:hover,
  .news-card:focus-within,
  .list-item:focus-within,
  .modulos-item:focus-within {
    transform: none;
  }
}

/* ---- Header logo: Tetris-like drop of the 4 blocks (size stays fixed, no CLS) ---- */
.logo-mark .logo-block,
.logo-mark .logo-block-wrap {
  transform-box: fill-box;
  transform-origin: center;
}

@keyframes logo-block-drop {
  0% {
    transform: translateY(-58px);
    opacity: 0;
  }
  14% {
    opacity: 1;
  }
  68% {
    transform: translateY(2.2px);
    opacity: 1;
  }
  84% {
    transform: translateY(-1.6px);
  }
  100% {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes logo-block-lock {
  0% {
    transform: translateY(-8px);
  }
  58% {
    transform: translateY(1.6px);
  }
  78% {
    transform: translateY(-1px);
  }
  100% {
    transform: translateY(0);
  }
}

/* Total drop: last piece settles at 0.48s + 0.48s delay = 0.96s (within 0.8–1.2s). */
.site-header .logo-block--base {
  animation: logo-block-drop 0.48s cubic-bezier(0.2, 0.7, 0.2, 1) 0s both;
}
.site-header .logo-block--mid-r {
  animation: logo-block-drop 0.48s cubic-bezier(0.2, 0.7, 0.2, 1) 0.16s both;
}
.site-header .logo-block--mid-l {
  animation: logo-block-drop 0.48s cubic-bezier(0.2, 0.7, 0.2, 1) 0.32s both;
}
.site-header .logo-block--gold {
  animation: logo-block-drop 0.48s cubic-bezier(0.2, 0.7, 0.2, 1) 0.48s both;
}

/* Hover/focus: short lock-in on the wrappers so the load animation is not restarted. */
.site-header .logo:is(:hover, :focus-visible) .logo-block-wrap--base,
.logo-footer:is(:hover, :focus-visible) .logo-block-wrap--base {
  animation: logo-block-lock 0.36s cubic-bezier(0.2, 0.7, 0.2, 1) 0s both;
}
.site-header .logo:is(:hover, :focus-visible) .logo-block-wrap--mid-r,
.logo-footer:is(:hover, :focus-visible) .logo-block-wrap--mid-r {
  animation: logo-block-lock 0.36s cubic-bezier(0.2, 0.7, 0.2, 1) 0.07s both;
}
.site-header .logo:is(:hover, :focus-visible) .logo-block-wrap--mid-l,
.logo-footer:is(:hover, :focus-visible) .logo-block-wrap--mid-l {
  animation: logo-block-lock 0.36s cubic-bezier(0.2, 0.7, 0.2, 1) 0.14s both;
}
.site-header .logo:is(:hover, :focus-visible) .logo-block-wrap--gold,
.logo-footer:is(:hover, :focus-visible) .logo-block-wrap--gold {
  animation: logo-block-lock 0.36s cubic-bezier(0.2, 0.7, 0.2, 1) 0.21s both;
}

@media (prefers-reduced-motion: reduce) {
  .logo-mark .logo-block,
  .logo-mark .logo-block-wrap {
    animation: none !important;
    transform: none !important;
    opacity: 1 !important;
  }
}

