/**
 * components.css — Componentes compartilhados.
 *
 * Header, drawer, footer, cards, buttons, forms — tudo que aparece
 * em mais de uma página. CSS específico de página vai em pages.css.
 */

/* ============================================================
 * HEADER + BRAND
 * ============================================================ */
.site-header {
  padding: 1.5rem 0 1.25rem;
  position: relative;
  z-index: 10;
  background: var(--bg-base);
}
.site-header.on-gray { background: var(--gray); }
.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--ink);
}
.brand-mark { flex: 0 0 auto; color: var(--ink); }
.brand-name {
  font-weight: 500;
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
}

/* MENU TOGGLE */
.menu-toggle {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.55rem 1rem 0.55rem 1.1rem;
  background: transparent;
  border: 1px solid var(--ink);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.85rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--t-base) ease, color var(--t-base) ease;
}
.menu-toggle:hover { background: var(--ink); color: var(--white); }
.menu-toggle .lines {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  width: 16px;
}
.menu-toggle .lines span {
  display: block;
  height: 1.5px;
  background: currentColor;
  width: 100%;
}
.menu-toggle .lines span:nth-child(2) { width: 70%; }

@media (max-width: 600px) {
  .menu-toggle { padding: 0.45rem 0.75rem 0.45rem 0.85rem; font-size: 0.78rem; gap: 0.55rem; }
  .menu-toggle .lines { width: 14px; }
  .brand-name { font-size: 0.95rem; }
}

/* ============================================================
 * DRAWER (mesmo em desktop e mobile)
 * ============================================================ */
.drawer-overlay {
  position: fixed; inset: 0;
  background: rgba(4, 10, 7, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--t-slow) ease;
  z-index: 50;
}
.drawer-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(28rem, 92vw);
  background: var(--ink);
  color: var(--white);
  z-index: 60;
  transform: translateX(100%);
  transition: transform 380ms var(--ease);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.drawer.is-open { transform: translateX(0); }
.drawer ::selection { background: var(--white); color: var(--ink); }

.drawer-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}
.drawer-eyebrow {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: rgba(255, 255, 255, 0.5);
  margin: 0;
}
.drawer-close {
  background: transparent;
  border: 0;
  color: var(--white);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
}
.drawer-close:hover { color: var(--tan); }

.drawer-body { padding: 2.5rem 2rem 2rem; flex: 1; }

.drawer-nav {
  list-style: none;
  margin: 0 0 2.5rem;
  padding: 0;
}
.drawer-nav li {
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
}
.drawer-nav li:first-child {
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}
.drawer-nav a {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 1.1rem 0;
  font-family: var(--serif);
  font-size: 1.625rem;
  font-weight: 400;
  letter-spacing: -0.012em;
  color: var(--white);
  transition: color var(--t-base) ease, padding-left var(--t-base) ease;
}
.drawer-nav a:hover { color: var(--tan); padding-left: 0.5rem; }
.drawer-nav a.active { color: var(--tan); }
.drawer-nav .num {
  font-family: var(--sans);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  color: rgba(255, 255, 255, 0.4);
  font-weight: 500;
}

.drawer-epigraph {
  margin: 2rem 0;
  padding: 1.5rem 1.5rem;
  border-left: 2px solid var(--tan);
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.78);
  text-align: left;
  hyphens: none;
}
.drawer-epigraph .author {
  display: block;
  margin-top: 0.6rem;
  font-style: normal;
  font-family: var(--sans);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
}

.drawer-block {
  margin-top: 2rem;
  padding-top: 1.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
}
.drawer-block h4 {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.22em;
  color: var(--tan);
  font-weight: 500;
  margin: 0 0 0.75rem;
}
.drawer-block p {
  margin: 0 0 1rem;
  font-size: 0.9375rem;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.78);
  text-align: left;
  hyphens: none;
}
.drawer-block p strong { color: var(--white); font-weight: 500; }
.drawer-links { display: flex; flex-direction: column; gap: 0.4rem; }
.drawer-links a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.875rem;
  color: var(--white);
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  transition: color var(--t-base) ease;
}
.drawer-links a:hover { color: var(--tan); }
.drawer-links a:last-child { border-bottom: 0; }
.drawer-links a .label {
  font-size: 0.7rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  margin-right: auto;
  font-weight: 500;
}

.drawer-footer {
  padding: 1.5rem 2rem 2rem;
  border-top: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.5);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
}

@media (max-width: 480px) {
  .drawer-header, .drawer-body, .drawer-footer { padding-left: 1.5rem; padding-right: 1.5rem; }
  .drawer-nav a { font-size: 1.375rem; }
}

/* ============================================================
 * SCROLL ARROW (hero indicator)
 * ============================================================ */
.hero-scroll {
  position: absolute;
  bottom: 2.5rem;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  color: var(--muted);
  cursor: pointer;
  transition: color var(--t-base) ease;
  text-decoration: none;
}
.hero-scroll:hover { color: var(--ink); }
.hero-scroll-label {
  font-family: var(--sans);
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 500;
}
.hero-scroll-arrow {
  width: 1px;
  height: 36px;
  background: currentColor;
  position: relative;
  animation: scrollPulse 2.4s ease-in-out infinite;
}
.hero-scroll-arrow::after {
  content: "";
  position: absolute;
  bottom: -1px;
  left: 50%;
  transform: translateX(-50%) rotate(45deg);
  width: 8px; height: 8px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
}
@keyframes scrollPulse {
  0%, 100% { transform: translateY(0); opacity: 1; }
  50%       { transform: translateY(6px); opacity: 0.5; }
}

/* ============================================================
 * READING PROGRESS BAR
 * ============================================================ */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  background: var(--tan);
  width: 0%;
  z-index: 100;
  transition: width 80ms linear;
}

/* ============================================================
 * SECTION HEADER (eyebrow + link)
 * ============================================================ */
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 2rem;
  margin-bottom: 2.5rem;
  flex-wrap: wrap;
}
.section-eyebrow {
  font-family: var(--sans);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--muted);
  font-weight: 500;
  margin: 0;
}
.section-link {
  font-size: 0.875rem;
  color: var(--ink);
  letter-spacing: 0.01em;
  border-bottom: 1px solid var(--tan);
  padding-bottom: 2px;
  transition: color var(--t-base) ease, border-color var(--t-base) ease;
}
.section-link:hover { color: var(--muted); border-color: var(--ink); }

/* ============================================================
 * WRITING / ARCHIVE LIST
 * ============================================================ */
.writing-list,
.archive-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.writing-item,
.archive-item {
  display: grid;
  grid-template-columns: 9rem 1fr auto;
  gap: 2rem;
  align-items: baseline;
  padding: 1.6rem 0;
  border-bottom: 1px solid var(--hairline);
  transition: padding var(--t-base) ease;
  text-decoration: none;
  color: var(--ink);
}
.writing-item:hover,
.archive-item:hover { padding-left: 0.5rem; }
.writing-item:hover .writing-title,
.archive-item:hover .archive-title { color: var(--muted); }
.writing-meta,
.archive-meta {
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}
.writing-meta .dot,
.archive-meta .dot { margin: 0 0.4rem; opacity: 0.4; }
.writing-title,
.archive-title {
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(1.1875rem, 2.2vw, 1.5rem);
  line-height: 1.25;
  letter-spacing: -0.012em;
  margin: 0;
  transition: color var(--t-base) ease;
  text-wrap: balance;
}
.archive-title small {
  display: block;
  font-family: var(--sans);
  font-size: 0.875rem;
  color: var(--muted);
  margin-top: 0.4rem;
  font-style: normal;
  letter-spacing: 0;
  line-height: 1.5;
  font-weight: 400;
}
.writing-arrow,
.archive-arrow {
  font-size: 1rem;
  color: var(--muted);
  transition: transform var(--t-base) ease;
  align-self: center;
}
.writing-item:hover .writing-arrow,
.archive-item:hover .archive-arrow { transform: translateX(4px); }

@media (max-width: 720px) {
  .writing-item,
  .archive-item { grid-template-columns: 1fr; gap: 0.4rem; padding: 1.4rem 0; }
  .writing-arrow,
  .archive-arrow { display: none; }
}

/* ============================================================
 * CARDS (recommended, related)
 * ============================================================ */
.rec-card,
.related-card {
  display: flex;
  flex-direction: column;
  background: var(--white);
  transition: transform var(--t-base) ease;
  height: 100%;
  overflow: hidden;
  text-decoration: none;
  color: var(--ink);
}
.rec-card:hover,
.related-card:hover { transform: translateY(-2px); }
.rec-card-image,
.related-card-image {
  aspect-ratio: 16 / 10;
  background: linear-gradient(135deg, var(--gray) 0%, var(--tan) 100%);
  position: relative;
  overflow: hidden;
}
.rec-card-image img,
.related-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.rec-card-image-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 0.7rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.45;
}
.rec-card-body,
.related-card-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.rec-card .meta,
.related-card .meta,
.rec-card .rec-meta {
  font-family: var(--sans);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--muted);
  font-weight: 500;
}
.rec-card .title,
.related-card .title,
.rec-card .rec-title {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.125rem;
  line-height: 1.3;
  letter-spacing: -0.012em;
  color: var(--ink);
  text-wrap: balance;
}
.rec-card .excerpt,
.related-card .excerpt,
.rec-card .rec-excerpt {
  font-family: var(--serif);
  font-size: 0.9375rem;
  line-height: 1.55;
  color: var(--muted);
  margin: 0;
  text-align: left;
  hyphens: none;
}

/* ============================================================
 * CONTROLES DE CARROSSEL
 * ============================================================ */
.rec-controls,
.related-controls {
  display: flex;
  gap: 0.5rem;
}
.rec-controls button,
.related-controls button {
  width: 36px;
  height: 36px;
  background: transparent;
  border: 1px solid var(--ink);
  color: var(--ink);
  cursor: pointer;
  font-size: 1rem;
  transition: background var(--t-base) ease, color var(--t-base) ease;
}
.rec-controls button:hover,
.related-controls button:hover {
  background: var(--ink);
  color: var(--white);
}
.rec-controls button:disabled,
.related-controls button:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.rec-controls button:disabled:hover,
.related-controls button:disabled:hover {
  background: transparent;
  color: var(--ink);
}

/* ============================================================
 * FOOTER
 * ============================================================ */
.site-footer {
  background: var(--ink);
  color: var(--white);
  padding: clamp(3rem, 7vh, 4.5rem) 0 1.25rem;
}
.site-footer ::selection { background: var(--white); color: var(--ink); }
.footer-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 3rem;
  align-items: start;
}
.footer-block h4 {
  margin: 0 0 1rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-weight: 500;
  color: var(--tan);
}
.footer-block p,
.footer-block a {
  font-size: 0.9375rem;
  line-height: 1.6;
  margin: 0 0 0.4rem;
  color: rgba(255, 255, 255, 0.85);
}
.footer-block a { display: block; text-decoration: none; }
.footer-block a:hover { color: var(--tan); }
.footer-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.footer-brand .brand-mark { color: var(--white); }
.footer-brand .brand-name { color: var(--white); font-size: 1.0625rem; }
.footer-rule {
  border: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.15);
  margin: 3rem 0 1.25rem;
}
.footer-bottom {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.5);
}
.footer-bottom em { font-style: italic; color: var(--tan); }

/* MOBILE: footer ocupa 100vh, brand full-width centralizado, canais lado a lado */
@media (max-width: 760px) {
  .site-footer {
    min-height: 100svh;
    display: flex;
    flex-direction: column;
    padding-top: 2.25rem;
    padding-bottom: 1rem;
  }
  .site-footer > .wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
  }
  .footer-grid {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-template-areas:
      "brand brand"
      "personal juridico";
    gap: 1.75rem 1.25rem;
    align-content: start;
  }
  .footer-grid > .footer-block:nth-child(1) {
    grid-area: brand;
    text-align: center;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  }
  .footer-grid > .footer-block:nth-child(1) .footer-brand { justify-content: center; }
  .footer-grid > .footer-block:nth-child(1) p {
    text-align: center;
    hyphens: none;
    margin-left: auto;
    margin-right: auto;
  }
  .footer-grid > .footer-block:nth-child(2) {
    grid-area: personal;
    min-width: 0;
  }
  .footer-grid > .footer-block:nth-child(3) {
    grid-area: juridico;
    min-width: 0;
  }
  .footer-block h4 {
    font-size: 0.66rem;
    letter-spacing: 0.18em;
    margin-bottom: 0.7rem;
  }
  .footer-block p,
  .footer-block a {
    font-size: 0.8125rem;
    line-height: 1.45;
    margin-bottom: 0.35rem;
    overflow-wrap: break-word;
    overflow-wrap: anywhere;
  }
  .footer-rule { margin: 1.5rem 0 0.75rem; }
  .footer-bottom {
    flex-direction: column;
    gap: 0.4rem;
    align-items: center;
    text-align: center;
    font-size: 0.66rem;
  }
}
