/*
Theme Name: ms Theme
Theme URI: https://midiasim.com.br
Author: MIDIASIM Criação e Soluções Web
Author URI: https://midiasim.com.br
Description: Tema da CorruTech (eletrodutos, dutos e drenos corrugados), construído sobre o tema base ms-theme.
Version: 1.3.0
Requires at least: 6.0
Tested up to: 7.1
Requires PHP: 7.4
Text Domain: ms-theme
*/

:root {
  /* tokens do tema base (valores da identidade CorruTech) */
  --container-width: 1200px;
  --space-1: 0.5rem;
  --space-2: 1rem;
  --space-3: 1.5rem;
  --space-4: 2rem;
  --color-bg: #ffffff;
  --color-surface: #ffffff;
  --color-text: #263238;
  --color-muted: #5e6872;
  --color-accent: #7a0f17;
  --color-border: #e3e6ea;

  /* tokens CorruTech */
  --color-accent-dark: #5e0a11;
  --color-accent-bright: #a3121d;
  --color-accent-soft: #f7e7e8;
  --color-ink: #1c2428;
  --color-panel: #f3f4f6;
  --color-tile: #5e6872;
  --color-field-border: #c9ced3;
  --color-wa: #25d366;
  --color-wa-dark: #1da851;
  --font-head: 'Comfortaa', system-ui, sans-serif;
  --font-body: 'Quicksand', system-ui, sans-serif;
  --gutter: clamp(16px, 4vw, 40px);
  --header-h: 72px;
  --radius: 4px;
  --radius-card: 6px;
  --admin-bar-h: var(--wp-admin--admin-bar--height, 0px);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 21px + var(--admin-bar-h));
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font: 500 16px/1.65 var(--font-body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, h4, p, ul, ol, figure {
  margin: 0;
}

ul,
ol {
  padding: 0;
  list-style: none;
}

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

a {
  color: inherit;
  text-decoration: none;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

:focus-visible {
  outline: 3px solid var(--color-accent-bright);
  outline-offset: 3px;
}

.screen-reader-text {
  position: absolute;
  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: 16px;
  top: -60px;
  z-index: 100;
  background: var(--color-accent);
  color: #fff;
  padding: 10px 16px;
  border-radius: var(--radius);
  font-weight: 700;
}

.skip-link:focus {
  top: 12px;
}

.wrap {
  max-width: var(--container-width);
  margin: 0 auto;
  padding-inline: var(--gutter);
}

/* ===== TIPOGRAFIA ===== */
.eyebrow {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--color-accent);
  line-height: 1.5;
}

.eyebrow::before {
  content: "";
  width: 28px;
  height: 2px;
  background: currentColor;
  flex: none;
}

.eyebrow.light {
  color: #fff;
}

.h1 {
  font-family: var(--font-head);
  font-weight: 500;
  font-size: clamp(32px, 4.6vw, 58px);
  line-height: 1.12;
  letter-spacing: -.02em;
  color: var(--color-ink);
  text-wrap: balance;
}

.h2 {
  font-family: var(--font-head);
  font-weight: 500;
  font-size: clamp(28px, 3.4vw, 42px);
  line-height: 1.18;
  letter-spacing: -.015em;
  color: var(--color-ink);
  text-wrap: balance;
}

.h1 .soft,
.h2 .soft {
  color: var(--color-muted);
  font-weight: 400;
}

.lead {
  font-size: clamp(17px, 1.45vw, 19px);
  line-height: 1.7;
  color: var(--color-text);
  max-width: 60ch;
  text-wrap: pretty;
}

.rule {
  display: block;
  width: 44px;
  height: 3px;
  background: var(--color-accent);
}

.section {
  padding-block: clamp(72px, 9vw, 120px);
}

.section-head {
  display: flex;
  flex-direction: column;
  gap: 18px;
  max-width: 720px;
  margin-bottom: clamp(36px, 5vw, 56px);
}

.section-head.flush {
  margin: 0;
}

/* ===== BOTOES ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 26px;
  border: 1.5px solid transparent;
  border-radius: var(--radius);
  font-size: 16px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  cursor: pointer;
  transition: background-color .18s, border-color .18s, color .18s, transform .18s;
}

.btn:active {
  transform: translateY(1px);
}

.btn svg {
  width: 20px;
  height: 20px;
  flex: none;
}

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

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

.btn-outline {
  border-color: var(--color-text);
  color: var(--color-text);
  background: transparent;
}

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

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

.btn-light:hover {
  background: var(--color-accent-soft);
}

.btn-ghost-light {
  border-color: rgba(255, 255, 255, .7);
  color: #fff;
}

.btn-ghost-light:hover {
  background: rgba(255, 255, 255, .1);
  border-color: #fff;
}

.btn-sm {
  min-height: 44px;
  padding: 0 18px;
  font-size: 14px;
}

/* ===== HEADER ===== */
.site-header {
  position: sticky;
  top: var(--admin-bar-h);
  z-index: 50;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--color-border);
  transition: box-shadow .2s;
}

.site-header.scrolled {
  box-shadow: 0 8px 24px -16px rgba(28, 36, 40, .35);
}

.site-header::before {
  content: "";
  display: block;
  height: 4px;
  background: var(--color-accent);
}

.header-row {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.site-branding {
  display: flex;
  align-items: center;
  flex: none;
}

.site-branding a {
  display: flex;
}

.site-branding img {
  height: 34px;
  width: auto;
}

.main-navigation ul {
  display: flex;
  align-items: center;
  gap: clamp(18px, 2.4vw, 34px);
}

.main-navigation a {
  position: relative;
  display: block;
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text);
  padding: 8px 0;
}

.main-navigation a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 2px;
  height: 2px;
  background: var(--color-accent);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .2s;
}

.main-navigation a:hover,
.main-navigation a.active {
  color: var(--color-accent);
}

.main-navigation a:hover::after,
.main-navigation a.active::after {
  transform: scaleX(1);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mobile-menu-toggle {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  cursor: pointer;
}

.mobile-menu-toggle-bar {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--color-text);
  transition: transform .2s, opacity .2s;
}

.mobile-menu-toggle[aria-expanded="true"] .mobile-menu-toggle-bar:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

.mobile-menu-toggle[aria-expanded="true"] .mobile-menu-toggle-bar:nth-child(2) {
  opacity: 0;
}

.mobile-menu-toggle[aria-expanded="true"] .mobile-menu-toggle-bar:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

@media (max-width: 899.98px) {
  .main-navigation,
  .header-cta {
    display: none;
  }

  .mobile-menu-toggle {
    display: inline-flex;
  }
}

@media screen and (max-width: 600px) {
  .admin-bar .site-header {
    top: 0;
  }
}

/* ===== MENU MOBILE (OFF-CANVAS) ===== */
.mobile-sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 26, 30, .62);
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease, visibility .2s ease;
  z-index: 1000;
}

.mobile-sidebar-overlay.is-open {
  opacity: 1;
  visibility: visible;
}

.mobile-sidebar {
  position: fixed;
  top: var(--admin-bar-h);
  left: 0;
  bottom: 0;
  width: min(86%, 360px);
  display: flex;
  flex-direction: column;
  background: var(--color-surface);
  border-top: 4px solid var(--color-accent);
  box-shadow: 2px 0 24px rgba(15, 20, 26, .2);
  transform: translateX(-100%);
  visibility: hidden;
  transition: transform .25s ease, visibility .25s ease;
  z-index: 1001;
  overflow-y: auto;
  padding: 0 var(--gutter) 28px;
}

.mobile-sidebar.is-open {
  transform: translateX(0);
  visibility: visible;
}

.mobile-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--header-h);
  border-bottom: 1px solid var(--color-border);
}

.mobile-sidebar-brand img {
  height: 30px;
  width: auto;
}

.mobile-sidebar-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--color-border);
  border-radius: 50%;
  background: var(--color-surface);
  font-size: 26px;
  line-height: 1;
  color: var(--color-ink);
  cursor: pointer;
}

.mobile-sidebar-close:hover {
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.mobile-navigation ul {
  display: flex;
  flex-direction: column;
}

.mobile-navigation a {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text);
}

.mobile-navigation a::after {
  content: "";
  width: 8px;
  height: 8px;
  background: var(--color-accent);
}

.mobile-sidebar-cta {
  margin-top: 24px;
}

.mobile-sidebar-content {
  margin-top: auto;
  padding-top: var(--space-3);
  font-size: .9rem;
  color: var(--color-muted);
}

body.mobile-sidebar-open {
  overflow: hidden;
}

/* ===== PAGINAS INTERNAS ===== */
.site-content {
  padding-block: clamp(48px, 6vw, 80px);
}

.content-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}

@media (min-width: 900px) {
  .content-grid.has-sidebar {
    grid-template-columns: 2fr 1fr;
  }
}

.card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-top: 3px solid var(--color-accent);
  border-radius: var(--radius);
  padding: var(--space-3);
}

.site-main > .card + .card,
.widget + .widget {
  margin-top: var(--space-3);
}

.entry-title,
.widget-title {
  font-family: var(--font-head);
  font-weight: 600;
  line-height: 1.25;
  color: var(--color-ink);
  margin-bottom: var(--space-2);
}

.entry-title a:hover {
  color: var(--color-accent);
}

.entry-meta {
  color: var(--color-muted);
  font-size: .95rem;
  margin-bottom: var(--space-2);
}

.entry-content > * + * {
  margin-top: 1em;
}

.entry-content ul {
  list-style: disc;
  padding-left: 1.5em;
}

.entry-content ol {
  list-style: decimal;
  padding-left: 1.5em;
}

.entry-content a {
  color: var(--color-accent);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.not-found {
  text-align: center;
}

/* ===== PAGINA (page.php) ===== */
.page-hero {
  position: relative;
  background: var(--color-panel);
  border-bottom: 1px solid var(--color-border);
  padding-block: clamp(48px, 7vw, 88px);
}

.page-hero::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: clamp(6px, .9vw, 12px);
  background: var(--color-accent);
}

.page-hero .wrap {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.page-title {
  font-size: clamp(32px, 4vw, 52px);
  max-width: 20ch;
}

.page-updated {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-muted);
}

.page-layout {
  padding-block: clamp(48px, 6vw, 88px);
}

.page-layout.has-toc {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: clamp(32px, 5vw, 80px);
  align-items: start;
}

.page-toc {
  position: sticky;
  top: calc(var(--header-h) + 21px + var(--admin-bar-h) + 24px);
  border-left: 3px solid var(--color-accent);
  padding-left: 18px;
}

.page-toc-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--color-accent);
  margin-bottom: 10px;
}

.page-toc ol {
  display: flex;
  flex-direction: column;
}

.page-toc a {
  display: block;
  padding: 6px 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--color-muted);
  transition: color .15s;
}

.page-toc a:hover {
  color: var(--color-accent);
}

.page-content {
  max-width: 760px;
  font-size: 17px;
  line-height: 1.75;
}

.page-content > * + * {
  margin-top: 1.1em;
}

.page-content h2 {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: clamp(22px, 2.2vw, 28px);
  line-height: 1.25;
  letter-spacing: -.01em;
  color: var(--color-ink);
  margin-top: 2.4em;
}

.page-content h2::before {
  content: "";
  display: block;
  width: 36px;
  height: 3px;
  margin-bottom: 16px;
  background: var(--color-accent);
}

.page-content > h2:first-child {
  margin-top: 0;
}

.page-content h3 {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 19px;
  line-height: 1.35;
  color: var(--color-ink);
  margin-top: 1.8em;
}

.page-content h2 + *,
.page-content h3 + * {
  margin-top: .8em;
}

.page-content strong {
  color: var(--color-ink);
  font-weight: 700;
}

.page-content ul,
.page-content ol {
  list-style: none;
  padding-left: 0;
  display: flex;
  flex-direction: column;
  gap: .55em;
}

.page-content li {
  position: relative;
  padding-left: 22px;
}

.page-content ul > li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: .65em;
  width: 7px;
  height: 7px;
  background: var(--color-accent);
}

.page-content ol {
  counter-reset: item;
}

.page-content ol > li::before {
  counter-increment: item;
  content: counter(item) ".";
  position: absolute;
  left: 0;
  font-weight: 700;
  color: var(--color-accent);
}

@media (max-width: 899.98px) {
  .page-layout.has-toc {
    display: block;
  }

  .page-toc {
    display: none;
  }
}

/* ===== RODAPE ===== */
.site-footer {
  background: var(--color-ink);
  color: #c9d0d5;
}

.site-footer::before {
  content: "";
  display: block;
  height: 4px;
  background: var(--color-accent);
}

.foot-grid {
  display: grid;
  grid-template-columns: 2fr 1fr 1.4fr;
  gap: 40px clamp(32px, 5vw, 80px);
  padding-block: clamp(56px, 7vw, 80px) 40px;
}

.foot-brand img {
  height: 36px;
  width: auto;
  margin-bottom: 18px;
}

.foot-brand p {
  font-size: 14px;
  line-height: 1.7;
  max-width: 40ch;
  color: #aeb7be;
}

.foot-brand p.tag {
  font-family: var(--font-head);
  font-size: 16px;
  color: #fff;
  margin-bottom: 8px;
}

.foot-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: #8e99a2;
  margin-bottom: 14px;
}

.foot-links,
.foot-links ul {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 15px;
}

.foot-links a:hover {
  color: #fff;
}

.foot-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px 32px;
  padding-block: 22px 28px;
  border-top: 1px solid #333e44;
  font-size: 13px;
  color: #8e99a2;
}

.foot-bottom a {
  color: #c9d0d5;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.foot-bottom a:hover {
  color: #fff;
}

.foot-bottom-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
}

@media (max-width: 899.98px) {
  .foot-grid {
    grid-template-columns: 1fr 1fr;
  }

  .foot-brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 479.98px) {
  .foot-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== WHATSAPP FLUTUANTE ===== */
.wa-float {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
  display: flex;
  align-items: center;
  gap: 10px;
  height: 56px;
  padding: 0 20px 0 16px;
  background: var(--color-wa);
  color: #fff;
  border-radius: 999px;
  box-shadow: 0 12px 28px -8px rgba(0, 0, 0, .4);
  font-size: 15px;
  font-weight: 700;
  transition: background .18s, transform .18s;
}

.wa-float:hover {
  background: var(--color-wa-dark);
  transform: translateY(-2px);
}

.wa-float svg {
  width: 26px;
  height: 26px;
  flex: none;
}

@media (max-width: 639.98px) {
  .wa-float {
    width: 58px;
    height: 58px;
    padding: 0;
    justify-content: center;
    right: 16px;
    bottom: 16px;
  }

  .wa-float span {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  * {
    transition: none !important;
  }
}

@media print {
  .site-header,
  .wa-float,
  .mobile-sidebar,
  .mobile-sidebar-overlay {
    display: none;
  }
}
