/* ==========================================================================
   Loop Midia — Politicas Operacionais e Comerciais
   ========================================================================== */

:root {
  --color-brand: #1f7a45;
  --color-brand-dark: #165835;
  --color-brand-soft: #e9f4ed;
  --color-bg: #ffffff;
  --color-bg-app: #f5f7f5;
  --color-surface: #ffffff;
  --color-surface-alt: #f9fbf9;
  --color-text: #111111;
  --color-text-muted: #555555;
  --color-border: #dde3dd;
  --color-border-strong: #cad5cb;
  --color-shadow: rgba(17, 17, 17, 0.08);
  --color-shadow-soft: rgba(17, 17, 17, 0.04);

  --font-family: "Poppins", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-size-base: 1rem;
  --font-size-sm: 0.875rem;
  --line-height: 1.85;
  --max-content: 54rem;
  --max-wide: 76rem;
  --header-height: 4.5rem;
  --space-xs: 0.5rem;
  --space-sm: 1rem;
  --space-md: 1.5rem;
  --space-lg: 2.5rem;
  --space-xl: 4rem;
  --radius: 0.75rem;
  --radius-lg: 1rem;
  --shadow-header: 0 1px 0 var(--color-shadow-soft), 0 10px 26px var(--color-shadow-soft);
  --shadow-card: 0 2px 12px var(--color-shadow-soft), 0 12px 28px var(--color-shadow-soft);
  --transition: 0.25s ease;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-height) + 1.5rem);
}

body {
  margin: 0;
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  font-weight: 400;
  line-height: var(--line-height);
  color: var(--color-text);
  background: radial-gradient(circle at top, #fbfdfb 0%, var(--color-bg-app) 100%);
  -webkit-font-smoothing: antialiased;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--color-brand);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.22em;
  transition: color var(--transition), background var(--transition), border-color var(--transition);
}

a:hover,
a:focus-visible {
  color: var(--color-brand-dark);
}

:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  top: -100%;
  left: var(--space-sm);
  z-index: 300;
  padding: 0.5rem 1rem;
  background: var(--color-brand);
  color: #fff;
  border-radius: var(--radius);
  font-weight: 600;
  text-decoration: none;
}

.skip-link:focus {
  top: var(--space-sm);
}

.reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 3px;
  z-index: 250;
  background: rgba(0, 0, 0, 0.07);
}

.reading-progress__bar {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--color-brand-dark) 0%, var(--color-brand) 100%);
  transition: width 0.1s linear;
}

.site-header {
  position: fixed;
  top: 3px;
  left: 0;
  right: 0;
  z-index: 200;
  height: var(--header-height);
  background: rgba(255, 255, 255, 0.93);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-header);
  transition: box-shadow var(--transition), background var(--transition), border-color var(--transition);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  max-width: var(--max-wide);
  height: 100%;
  margin: 0 auto;
  padding: 0 var(--space-md);
}

.site-header__logo {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

.site-header__logo img {
  height: 2.45rem;
  width: auto;
}

.site-header.is-scrolled {
  background: rgba(255, 255, 255, 0.98);
  border-bottom-color: #d2ddd4;
  box-shadow: 0 2px 12px rgba(17, 17, 17, 0.09), 0 14px 30px rgba(17, 17, 17, 0.05);
}

.menu-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  cursor: pointer;
  color: var(--color-brand);
}

.menu-toggle__icon {
  display: block;
  width: 1.25rem;
  height: 2px;
  background: currentColor;
  position: relative;
  transition: background var(--transition);
}

.menu-toggle__icon::before,
.menu-toggle__icon::after {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  background: currentColor;
  transition: transform var(--transition);
}

.menu-toggle__icon::before {
  top: -6px;
}

.menu-toggle__icon::after {
  top: 6px;
}

.menu-toggle[aria-expanded="true"] .menu-toggle__icon {
  background: transparent;
}

.menu-toggle[aria-expanded="true"] .menu-toggle__icon::before {
  top: 0;
  transform: rotate(45deg);
}

.menu-toggle[aria-expanded="true"] .menu-toggle__icon::after {
  top: 0;
  transform: rotate(-45deg);
}

.mobile-nav {
  display: none;
  position: fixed;
  top: calc(var(--header-height) + 3px);
  left: 0;
  right: 0;
  z-index: 199;
  max-height: calc(100vh - var(--header-height));
  overflow-y: auto;
  background: #ffffff;
  border-bottom: 1px solid var(--color-border);
  box-shadow: var(--shadow-header);
  padding: var(--space-sm) var(--space-md) var(--space-md);
}

.mobile-nav.is-open {
  display: block;
}

.mobile-nav a {
  display: block;
  padding: 0.7rem 0.2rem;
  font-size: var(--font-size-sm);
  font-weight: 500;
  text-decoration: none;
  color: var(--color-text);
  border-bottom: 1px solid var(--color-border);
}

.mobile-nav a:last-child {
  border-bottom: none;
}

.hero {
  padding-top: calc(var(--header-height) + var(--space-xl) + 0.75rem);
  padding-bottom: var(--space-lg);
}

.hero__inner {
  max-width: var(--max-wide);
  margin: 0 auto;
  padding: 0 var(--space-md);
  background: linear-gradient(135deg, #ffffff 0%, #f6fbf7 100%);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding-top: clamp(1.25rem, 2vw, 2rem);
  padding-bottom: clamp(1.25rem, 2vw, 2rem);
  animation: fadeInUp 0.5s ease both;
  position: relative;
  overflow: hidden;
}

.hero__inner::after {
  content: "";
  position: absolute;
  width: clamp(180px, 28vw, 320px);
  height: clamp(180px, 28vw, 320px);
  right: -10%;
  top: -30%;
  border-radius: 50%;
  background: radial-gradient(circle at center, rgba(31, 122, 69, 0.14) 0%, rgba(31, 122, 69, 0) 72%);
  pointer-events: none;
}

.hero__logo {
  width: 180px;
  max-width: 100%;
  height: auto;
  margin-bottom: var(--space-sm);
}

.hero__title {
  margin: 0 0 var(--space-sm);
  max-width: 28ch;
  font-size: clamp(1.65rem, 3.6vw, 2.35rem);
  font-weight: 700;
  line-height: 1.2;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #101010;
}

.hero__subtitle {
  margin: 0;
  max-width: 52ch;
  font-size: clamp(1rem, 1.8vw, 1.12rem);
  font-weight: 400;
  line-height: 1.55;
  color: #3a3a3a;
}

.hero__meta {
  margin-top: var(--space-md);
  margin-bottom: 0;
  display: inline-block;
  font-size: var(--font-size-sm);
  line-height: 1.5;
  color: #2f2f2f;
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-brand);
  border-radius: 0.65rem;
  box-shadow: 0 3px 10px var(--color-shadow-soft);
  padding: 0.75rem 0.95rem;
}

.hero__meta time {
  font-weight: 600;
  color: #1a1a1a;
}

.page-layout {
  max-width: var(--max-wide);
  margin: 0 auto;
  padding: var(--space-lg) var(--space-md) var(--space-xl);
  display: grid;
  gap: var(--space-lg);
}

@media (min-width: 1024px) {
  .page-layout {
    grid-template-columns: minmax(17rem, 19rem) minmax(0, var(--max-content));
    justify-content: center;
    align-items: start;
    gap: var(--space-xl);
  }

  .menu-toggle {
    display: none;
  }
}

.toc {
  position: sticky;
  top: calc(var(--header-height) + 1.2rem);
  padding: 1.1rem;
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  animation: fadeInUp 0.55s ease both;
}

.toc__title {
  margin: 0 0 var(--space-sm);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--color-brand-dark);
}

.toc__list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.toc__list li {
  margin: 0;
}

.toc__list a {
  display: block;
  margin-bottom: 0.35rem;
  padding: 0.55rem 0.65rem;
  border-radius: 0.55rem;
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.4;
  text-decoration: none;
  color: #2c2c2c;
  border: 1px solid transparent;
  position: relative;
  padding-left: 1.85rem;
}

.toc__list a::before {
  content: "›";
  position: absolute;
  left: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.95rem;
  color: var(--color-brand);
  opacity: 0.9;
}

.toc__list a:hover {
  background: var(--color-surface-alt);
  border-color: var(--color-border);
  transform: translateX(1px);
}

.toc__list a.is-active {
  color: var(--color-brand-dark);
  background: var(--color-brand-soft);
  border-color: #c7e1d0;
}

.policy-content {
  min-width: 0;
}

.policy-intro,
.policy-section {
  margin-bottom: var(--space-lg);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  scroll-margin-top: calc(var(--header-height) + 1.3rem);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}

.policy-intro:hover,
.policy-section:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px var(--color-shadow), 0 14px 32px var(--color-shadow-soft);
  border-color: #d1ddd3;
}

.policy-intro {
  padding: clamp(1.1rem, 2vw, 1.7rem);
}

.policy-intro__body p {
  margin: 0 0 1rem;
  font-size: clamp(0.98rem, 1.05vw, 1.04rem);
  line-height: 1.85;
  color: #2a2a2a;
}

.policy-intro__body p:last-child {
  margin-bottom: 0;
}

.policy-section {
  padding: clamp(1.1rem, 2vw, 1.8rem);
}

.policy-section:last-of-type {
  margin-bottom: 0;
}

.policy-section__title {
  margin: 0 0 1rem;
  font-size: clamp(1.2rem, 2.5vw, 1.55rem);
  font-weight: 700;
  line-height: 1.35;
  color: #121212;
}

.policy-section__body {
  color: var(--color-text);
}

.policy-section__body pre {
  margin: 0;
  white-space: pre-wrap;
  font-family: inherit;
  line-height: 2.02;
  color: #232323;
  font-size: clamp(0.98rem, 1.05vw, 1.04rem);
  letter-spacing: 0.005em;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.85) 0%, rgba(248, 252, 249, 0.95) 100%);
  border: 1px solid #edf2ed;
  border-radius: 0.8rem;
  padding: clamp(0.85rem, 1.2vw, 1rem) clamp(0.95rem, 1.5vw, 1.25rem);
}

.policy-section__body pre .line-bullet {
  display: block;
  background: linear-gradient(90deg, rgba(31, 122, 69, 0.08) 0%, rgba(31, 122, 69, 0.02) 100%);
  border-left: 3px solid var(--color-brand);
  border-radius: 0.45rem;
  padding: 0.2rem 0.55rem;
  margin: 0.2rem 0;
}

.policy-section__body pre .line-text {
  display: inline;
}

.site-footer {
  margin-top: var(--space-xl);
  padding: var(--space-xl) var(--space-md);
  background: linear-gradient(140deg, #101010 0%, #1d1d1d 100%);
  color: rgba(255, 255, 255, 0.88);
  text-align: center;
  border-top: 4px solid var(--color-brand);
}

.site-footer__inner {
  max-width: var(--max-wide);
  margin: 0 auto;
}

.site-footer__brand {
  margin: 0 0 0.5rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
}

.site-footer__copy {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.8;
}

.back-to-top {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 210;
  width: 2.7rem;
  height: 2.7rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  background: #ffffff;
  color: var(--color-brand-dark);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  box-shadow: var(--shadow-card);
  transition: opacity var(--transition), transform var(--transition), background var(--transition);
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
}

.back-to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

.back-to-top:hover {
  background: var(--color-brand-soft);
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1023px) {
  .page-layout {
    grid-template-columns: 1fr;
  }

  .toc {
    display: none;
  }

}

@media (min-width: 320px) and (max-width: 413px) {
  :root {
    --space-md: 1rem;
    --space-lg: 1.75rem;
    --header-height: 4.2rem;
  }

  .hero__inner,
  .policy-intro,
  .policy-section,
  .toc {
    border-radius: 0.8rem;
  }
}

@media (min-width: 414px) and (max-width: 767px) {
  .hero__inner {
    padding-left: 1.25rem;
    padding-right: 1.25rem;
  }

}

@media (min-width: 768px) and (max-width: 1023px) {
  .page-layout {
    max-width: min(92vw, 58rem);
  }

  .hero__inner {
    max-width: min(92vw, 58rem);
  }
}

@media (min-width: 1366px) {
  .page-layout,
  .hero__inner,
  .site-header__inner,
  .site-footer__inner {
    max-width: min(90vw, 92rem);
  }
}

@media (min-width: 1920px) {
  .page-layout,
  .hero__inner,
  .site-header__inner,
  .site-footer__inner {
    max-width: min(82vw, 104rem);
  }

  .policy-content {
    max-width: 62rem;
  }
}

@media (min-width: 2560px) {
  .page-layout,
  .hero__inner,
  .site-header__inner,
  .site-footer__inner {
    max-width: min(76vw, 118rem);
  }

  .policy-content {
    max-width: 64rem;
  }
}

@media (min-width: 3440px) {
  .page-layout,
  .hero__inner,
  .site-header__inner,
  .site-footer__inner {
    max-width: min(66vw, 126rem);
  }

  .policy-content {
    max-width: 66rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
