/* =========================================================================
   Portal do Município de Ibirama/SC — protótipo modernizado
   Design system: verde (Mata Atlântica) + teal (Rio Hercílio) + âmbar (aventura)
   ========================================================================= */

:root {
  /* Marca */
  --brand: #1e7a46;
  --brand-600: #23894f;
  --brand-dark: #145c34;
  --brand-darker: #0e3d24;
  --river: #0f766e;
  --river-dark: #115e59;
  --accent: #e8871e;
  --accent-dark: #c9741a;

  /* Neutros */
  --ink: #16241d;
  --text: #23322b;
  --muted: #5c6c64;
  --surface: #f4f8f5;
  --card: #ffffff;
  --border: #e2eae5;
  --border-strong: #cdd8d1;
  --bg: #ffffff;

  /* Semânticos */
  --info: #0f6fb8;
  --warn: #b7791f;
  --danger: #c0392b;

  /* Raios */
  --r-xs: 6px;
  --r-sm: 10px;
  --r: 14px;
  --r-lg: 20px;
  --r-xl: 28px;
  --pill: 999px;

  /* Sombras (sutis) */
  --shadow-sm: 0 1px 2px rgba(14, 61, 36, 0.06), 0 1px 3px rgba(14, 61, 36, 0.05);
  --shadow: 0 4px 16px rgba(14, 61, 36, 0.08);
  --shadow-lg: 0 12px 32px rgba(14, 61, 36, 0.12);

  /* Layout */
  --maxw: 1180px;
  --header-h: 76px;

  --font: "Figtree", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* Alto contraste (acessibilidade) */
:root.contraste {
  --brand: #0a4a2a;
  --brand-dark: #063018;
  --river: #0a4f49;
  --accent: #a85a00;
  --text: #000000;
  --muted: #1a1a1a;
  --surface: #ffffff;
  --border: #000000;
  --border-strong: #000000;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: clamp(15px, 0.6vw + 14px, 16.5px);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { color: var(--ink); line-height: 1.15; margin: 0 0 .4em; font-weight: 800; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 4vw, 3rem); }
h2 { font-size: clamp(1.5rem, 2.4vw, 2.1rem); }
h3 { font-size: 1.2rem; }
p { margin: 0 0 1rem; }
a { color: var(--river-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
ul { margin: 0; padding: 0; }

/* Foco visível (teclado) */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

.container { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: clamp(1rem, 4vw, 2rem); }
.section { padding-block: clamp(3rem, 6vw, 5rem); }
.section--tight { padding-block: clamp(2rem, 4vw, 3rem); }
.section--surface { background: var(--surface); }

.eyebrow {
  display: inline-flex; align-items: center; gap: .5rem;
  font-size: .8rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: var(--brand); margin-bottom: .6rem;
}
.section-head { max-width: 62ch; margin-bottom: 2rem; }
.section-head p { color: var(--muted); margin-bottom: 0; }
.center { text-align: center; margin-inline: auto; }

/* ---------- Skip link ---------- */
.skip-link {
  position: absolute; left: .5rem; top: -60px; z-index: 200;
  background: var(--brand-darker); color: #fff; padding: .6rem 1rem; border-radius: var(--r-sm);
  transition: top .15s ease;
}
.skip-link:focus { top: .5rem; }

/* ---------- Botões ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  font: inherit; font-weight: 700; cursor: pointer;
  padding: .72rem 1.35rem; border-radius: var(--pill); border: 2px solid transparent;
  transition: transform .12s ease, background .15s ease, box-shadow .15s ease;
  text-decoration: none; line-height: 1;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn--primary { background: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-dark); }
.btn--accent { background: var(--accent); color: #3a2205; }
.btn--accent:hover { background: var(--accent-dark); color: #fff; }
.btn--ghost { background: #fff; color: var(--brand-dark); border-color: var(--border-strong); }
.btn--ghost:hover { background: var(--surface); }
.btn--on-dark { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.35); }
.btn--on-dark:hover { background: rgba(255,255,255,.24); }
.btn--sm { padding: .5rem 1rem; font-size: .9rem; }
.btn--block { width: 100%; }

/* =========================================================================
   Cabeçalho
   ========================================================================= */
.topbar { background: var(--brand-darker); color: #dcece3; font-size: .82rem; }
.topbar .container { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 38px; flex-wrap: wrap; }
.topbar a { color: #dcece3; }
.topbar__util { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.topbar__util button, .topbar__util a.util {
  background: transparent; border: 1px solid rgba(255,255,255,.2); color: #eaf3ee;
  border-radius: var(--r-xs); padding: .2rem .5rem; font: inherit; font-size: .78rem; cursor: pointer;
  display: inline-flex; align-items: center; gap: .3rem;
}
.topbar__util button:hover, .topbar__util a.util:hover { background: rgba(255,255,255,.12); text-decoration: none; }

.site-header { position: sticky; top: 0; z-index: 100; background: #fff; border-bottom: 1px solid var(--border); }
.header-main { display: flex; align-items: center; gap: 1.25rem; min-height: var(--header-h); }
.brand { display: flex; align-items: center; gap: .75rem; text-decoration: none; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand__crest { height: 46px; width: auto; flex: none; display: block; }
.footer-crest .brand__crest { background: #fff; border-radius: 8px; padding: 4px; box-sizing: border-box; }
.brand__text strong { display: block; font-size: 1.06rem; font-weight: 800; line-height: 1.05; color: var(--brand-darker); }
.brand__text span { display: block; font-size: .72rem; color: var(--muted); font-weight: 600; }

.nav { margin-left: auto; }
.nav__list { display: flex; align-items: center; gap: .15rem; list-style: none; }
.nav__list a {
  display: block; padding: .6rem .75rem; border-radius: var(--r-sm); color: var(--text);
  font-weight: 600; font-size: .95rem;
}
.nav__list a:hover { background: var(--surface); text-decoration: none; color: var(--brand-dark); }
.nav__list a[aria-current="page"] { color: var(--brand-dark); background: color-mix(in srgb, var(--brand) 12%, #fff); }
.header-actions { display: flex; align-items: center; gap: .5rem; }
.icon-btn {
  width: 42px; height: 42px; border-radius: var(--pill); border: 1px solid var(--border-strong);
  background: #fff; color: var(--brand-dark); display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
}
.icon-btn:hover { background: var(--surface); }
.nav-toggle { display: none; }

/* Menu mobile */
@media (max-width: 940px) {
  .nav {
    position: fixed; inset: 0 0 0 auto; width: min(84vw, 340px);
    background: #fff; box-shadow: var(--shadow-lg); transform: translateX(100%);
    transition: transform .22s ease; padding: 1rem; overflow-y: auto; z-index: 130;
  }
  .nav.open { transform: translateX(0); }
  .nav__list { flex-direction: column; align-items: stretch; gap: .1rem; }
  .nav__list a { padding: .85rem 1rem; font-size: 1.05rem; }
  .nav-toggle { display: inline-flex; }
  .nav__close { display: inline-flex; margin-left: auto; margin-bottom: .5rem; }
  .backdrop { position: fixed; inset: 0; background: rgba(6,30,18,.45); z-index: 120; }
}
@media (min-width: 941px) { .nav__close { display: none; } }

/* =========================================================================
   Hero
   ========================================================================= */
.hero {
  position: relative; overflow: hidden; color: #fff;
  background: linear-gradient(135deg, var(--brand-darker) 0%, var(--brand-dark) 42%, var(--river) 100%);
}
.hero__wrap { position: relative; z-index: 2; display: grid; grid-template-columns: 1.1fr .9fr; gap: 2rem; align-items: center; padding-block: clamp(3rem, 6vw, 5.5rem); }
.hero__badge { display: inline-flex; align-items: center; gap: .5rem; background: rgba(255,255,255,.15); border: 1px solid rgba(255,255,255,.25); padding: .4rem .9rem; border-radius: var(--pill); font-weight: 700; font-size: .85rem; margin-bottom: 1rem; }
.hero h1 { color: #fff; font-size: clamp(2.1rem, 4.6vw, 3.4rem); }
.hero p.lead { font-size: clamp(1.05rem, 1.5vw, 1.25rem); color: rgba(255,255,255,.92); max-width: 46ch; }
.hero__cta { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.6rem; }
.hero__decor { position: absolute; inset: 0; z-index: 1; opacity: .9; }
.hero__glow { position: absolute; width: 520px; height: 520px; border-radius: 50%; background: radial-gradient(circle, rgba(232,135,30,.35), transparent 60%); top: -180px; right: -120px; filter: blur(4px); }

/* Card "foto" ilustrativo (placeholder sem imagem externa) */
.photo {
  border-radius: var(--r-lg); position: relative; overflow: hidden; min-height: 300px;
  background: linear-gradient(160deg, #1c6f5f, #0f766e 45%, #2f8f57);
  box-shadow: var(--shadow-lg); display: grid; place-items: center; color: rgba(255,255,255,.9);
}
.photo::after { content: ""; position: absolute; inset: 0; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cpath d='M0 90 Q30 60 60 90 T120 90' fill='none' stroke='%23ffffff22' stroke-width='2'/%3E%3C/svg%3E"); opacity: .5; }
.photo__label { position: relative; z-index: 2; font-weight: 700; font-size: .9rem; background: rgba(0,0,0,.28); padding: .4rem .8rem; border-radius: var(--pill); }
.photo--tall { min-height: 380px; }
.photo--sky { background: linear-gradient(160deg, #0e5aa0, #0f766e); }
.photo--forest { background: linear-gradient(160deg, #14603a, #1e7a46); }
.photo--river { background: linear-gradient(160deg, #0f766e, #0e5aa0); }
.photo--sun { background: linear-gradient(160deg, #c9741a, #1e7a46); }

/* =========================================================================
   Serviços rápidos (atalhos do cidadão)
   ========================================================================= */
.quick { display: grid; grid-template-columns: repeat(6, 1fr); gap: .75rem; }
.quick__item {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r);
  padding: 1.1rem .8rem; text-align: center; color: var(--text); font-weight: 700; font-size: .92rem;
  display: flex; flex-direction: column; align-items: center; gap: .55rem; transition: .15s ease;
}
.quick__item:hover { text-decoration: none; border-color: var(--brand); box-shadow: var(--shadow); transform: translateY(-2px); color: var(--brand-dark); }
.quick__ico { width: 44px; height: 44px; border-radius: var(--r-sm); background: color-mix(in srgb, var(--brand) 12%, #fff); color: var(--brand-dark); display: grid; place-items: center; }
.quick--float { margin-top: -3.5rem; position: relative; z-index: 5; }

/* =========================================================================
   Cards / grids
   ========================================================================= */
.grid { display: grid; gap: 1.25rem; }
.grid--2 { grid-template-columns: repeat(2, 1fr); }
.grid--3 { grid-template-columns: repeat(3, 1fr); }
.grid--4 { grid-template-columns: repeat(4, 1fr); }

.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 1.5rem; box-shadow: var(--shadow-sm); transition: .15s ease;
}
.card--link:hover { box-shadow: var(--shadow); transform: translateY(-2px); border-color: var(--border-strong); }
.card__ico { width: 48px; height: 48px; border-radius: var(--r-sm); display: grid; place-items: center; background: color-mix(in srgb, var(--river) 12%, #fff); color: var(--river-dark); margin-bottom: .9rem; }
.card h3 { margin-bottom: .35rem; }
.card p { color: var(--muted); margin-bottom: 0; font-size: .95rem; }
.card__link { display: inline-flex; align-items: center; gap: .3rem; margin-top: .9rem; font-weight: 700; color: var(--river-dark); }

/* Notícia (card) */
.news { display: flex; flex-direction: column; background: var(--card); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-sm); transition: .15s ease; }
.news:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.news__media { height: 168px; }
.news__body { padding: 1.15rem 1.25rem 1.35rem; display: flex; flex-direction: column; flex: 1; }
.tag { align-self: flex-start; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--brand-dark); background: color-mix(in srgb, var(--brand) 12%, #fff); padding: .25rem .6rem; border-radius: var(--pill); }
.news__body h3 { margin: .6rem 0 .4rem; font-size: 1.1rem; }
.news__body h3 a { color: var(--ink); }
.news__date { color: var(--muted); font-size: .82rem; margin-top: auto; }

/* Lista de serviços/links */
.linklist { list-style: none; display: grid; gap: .5rem; }
.linklist a { display: flex; align-items: center; gap: .6rem; padding: .8rem 1rem; background: #fff; border: 1px solid var(--border); border-radius: var(--r-sm); color: var(--text); font-weight: 600; }
.linklist a:hover { border-color: var(--brand); color: var(--brand-dark); text-decoration: none; background: var(--surface); }
.linklist a .arrow { margin-left: auto; color: var(--muted); }

/* Faixa destaque (turismo/transparência) */
.band { color: #fff; border-radius: var(--r-xl); overflow: hidden; position: relative; }
.band--tourism { background: linear-gradient(120deg, var(--brand-dark), var(--river)); }
.band--dark { background: linear-gradient(120deg, var(--brand-darker), var(--brand-dark)); }
.band__grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 2rem; align-items: center; padding: clamp(1.75rem, 4vw, 3rem); }
.band h2 { color: #fff; }
.band p { color: rgba(255,255,255,.9); }

/* Stats */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.stat { text-align: center; padding: 1.25rem 1rem; background: #fff; border: 1px solid var(--border); border-radius: var(--r-lg); }
.stat b { display: block; font-size: clamp(1.8rem, 3vw, 2.4rem); color: var(--brand); line-height: 1; }
.stat span { color: var(--muted); font-size: .9rem; font-weight: 600; }

/* Breadcrumb + page header */
.pagehead { background: linear-gradient(135deg, var(--brand-darker), var(--river)); color: #fff; padding-block: clamp(2.25rem, 5vw, 3.5rem); }
.pagehead h1 { color: #fff; margin-bottom: .3rem; }
.pagehead p { color: rgba(255,255,255,.9); margin-bottom: 0; max-width: 60ch; }
.crumbs { list-style: none; display: flex; flex-wrap: wrap; gap: .4rem; font-size: .85rem; margin-bottom: .9rem; color: rgba(255,255,255,.8); }
.crumbs a { color: rgba(255,255,255,.9); }
.crumbs li::after { content: "/"; margin-left: .4rem; opacity: .5; }
.crumbs li:last-child::after { content: ""; }

/* Layout com sidebar */
.with-aside { display: grid; grid-template-columns: 1fr 300px; gap: 2.5rem; align-items: start; }
.aside .card { position: sticky; top: calc(var(--header-h) + 1rem); }

/* Prosa (artigo) */
.prose { max-width: 68ch; }
.prose p { color: var(--text); }
.prose h2 { margin-top: 2rem; }
.prose img, .prose .photo { margin-block: 1.5rem; }
.prose blockquote { margin: 1.5rem 0; padding: 1rem 1.25rem; border-left: 4px solid var(--accent); background: var(--surface); border-radius: 0 var(--r-sm) var(--r-sm) 0; color: var(--text); }

/* Formulários */
.form { display: grid; gap: 1rem; }
.field { display: grid; gap: .35rem; }
.field label { font-weight: 700; font-size: .92rem; color: var(--ink); }
.field .req { color: var(--danger); }
.field input, .field select, .field textarea {
  font: inherit; padding: .7rem .85rem; border: 1.5px solid var(--border-strong); border-radius: var(--r-sm);
  background: #fff; color: var(--text); width: 100%;
}
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 20%, transparent); }
.field .hint { font-size: .82rem; color: var(--muted); }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }

/* Notas / avisos */
.note { border-radius: var(--r); padding: 1rem 1.15rem; border: 1px solid var(--border); background: var(--surface); font-size: .95rem; }
.note--info { border-color: color-mix(in srgb, var(--info) 40%, #fff); background: color-mix(in srgb, var(--info) 8%, #fff); }

/* =========================================================================
   Rodapé
   ========================================================================= */
.site-footer { background: var(--brand-darker); color: #cfe1d7; margin-top: 3rem; }
.footer-top { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1.2fr; gap: 2rem; padding-block: 3rem; }
.site-footer h4 { color: #fff; font-size: .95rem; letter-spacing: .04em; text-transform: uppercase; margin-bottom: 1rem; }
.site-footer a { color: #cfe1d7; }
.site-footer a:hover { color: #fff; }
.footer-links { list-style: none; display: grid; gap: .5rem; font-size: .92rem; }
.footer-brand p { font-size: .9rem; color: #a9c4b8; }
.footer-crest { display: flex; align-items: center; gap: .6rem; margin-bottom: .8rem; }
.footer-crest strong { color: #fff; }
.social { display: flex; gap: .5rem; margin-top: .5rem; }
.social a { width: 38px; height: 38px; border-radius: var(--pill); border: 1px solid rgba(255,255,255,.25); display: grid; place-items: center; color: #fff; }
.social a:hover { background: rgba(255,255,255,.14); }
.footer-bottom { border-top: 1px solid rgba(255,255,255,.14); padding-block: 1.15rem; display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; font-size: .82rem; color: #a9c4b8; }

/* Voltar ao topo */
.to-top { position: fixed; right: 1rem; bottom: 1rem; z-index: 90; opacity: 0; visibility: hidden; transition: .2s ease; }
.to-top.show { opacity: 1; visibility: visible; }

/* =========================================================================
   Responsivo
   ========================================================================= */
@media (max-width: 940px) {
  .hero__wrap { grid-template-columns: 1fr; }
  .hero__media { display: none; }
  .band__grid { grid-template-columns: 1fr; }
  .with-aside { grid-template-columns: 1fr; }
  .aside .card { position: static; }
  .quick { grid-template-columns: repeat(3, 1fr); }
  .grid--4 { grid-template-columns: repeat(2, 1fr); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .footer-top { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 620px) {
  .quick { grid-template-columns: repeat(2, 1fr); }
  .grid--2, .grid--3, .grid--4 { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .footer-top { grid-template-columns: 1fr; }
  .footer-bottom { flex-direction: column; }
  .quick--float { margin-top: 1rem; }
}

/* Movimento reduzido */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
