/*
 * ============================================================
 * TIRZEAPP — ESTILOS DE APLICAÇÃO
 * ============================================================
 * Mobile-first. Hero, Módulos, CTA, DS Test, Menu Mobile.
 * Nenhum elemento usa largura fixa que cause overflow.
 * Todos os max-width são relativos ao container pai.
 * ============================================================
 */

/* ═══════════════════════════════════════════
   UTILITÁRIO — QUEBRA DE LINHA CONDICIONAL
   ═══════════════════════════════════════════ */

.break-lg {
  display: none;
}

@media (min-width: 1024px) {
  .break-lg { display: block; }
}

/* ═══════════════════════════════════════════
   HERO SECTION — Mobile-first
   ═══════════════════════════════════════════ */

.section-hero {
  /* Mobile: padding-top = header + respiro generoso */
  padding-top: calc(var(--header-height) + 52px);
  padding-bottom: var(--space-20);

  /* Mobile: altura natural, sem min-height que force scroll */
  min-height: auto;

  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  position: relative;
  overflow: hidden;

  /* Contenção lateral */
  width: 100%;
}

/* Tablet+ */
@media (min-width: 640px) {
  .section-hero {
    padding-top: calc(var(--header-height) + 72px);
    padding-bottom: var(--space-24);
    justify-content: center;
  }
}

/* Desktop */
@media (min-width: 1024px) {
  .section-hero {
    padding-top: calc(var(--header-height) + 100px);
    padding-bottom: var(--space-40);
    min-height: 100vh;
  }
}

/* ── Grid decorativo de fundo ── */
.section-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  /* Contido dentro do hero — não causa scroll */
  width: 100%;
  background-image:
    linear-gradient(rgba(255,255,255,0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.018) 1px, transparent 1px);
  background-size: 80px 80px;
  pointer-events: none;
  mask-image: radial-gradient(ellipse 70% 55% at 30% 10%, black 20%, transparent 100%);
  -webkit-mask-image: radial-gradient(ellipse 70% 55% at 30% 10%, black 20%, transparent 100%);
}

@media (min-width: 768px) {
  .section-hero::before {
    background-size: 100px 100px;
  }
}

/* ── Linha decorativa sob o header ── */
.section-hero::after {
  content: '';
  position: absolute;
  top: var(--header-height);
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, var(--color-border-subtle), transparent 70%);
  pointer-events: none;
}

/* ── Overline ── */
.hero-overline {
  display: flex;
  align-items: center;
  gap: var(--space-3);

  /* Mobile */
  margin-bottom: var(--space-8);

  color: var(--color-text-tertiary);
  flex-wrap: wrap;
}

@media (min-width: 640px) {
  .hero-overline { margin-bottom: var(--space-10); }
}

@media (min-width: 1024px) {
  .hero-overline { margin-bottom: var(--space-14); }
}

/* Ponto de acento */
.hero-overline-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--color-text-disabled);
  flex-shrink: 0;
}

/* ── Heading principal ── */
.hero-heading {
  /* Mobile: ocupa toda a largura */
  max-width: 100%;
  margin-bottom: var(--space-6);

  /* Quebra segura */
  overflow-wrap: break-word;
  word-break: normal;
}

@media (min-width: 640px) {
  .hero-heading {
    max-width: 16ch;
    margin-bottom: var(--space-8);
  }
}

@media (min-width: 1024px) {
  .hero-heading {
    max-width: 18ch;
    margin-bottom: var(--space-11);
  }
}

/* Segunda linha — hierarquia tonal */
.hero-heading-em {
  display: block;
  font-style: normal;
  color: var(--color-text-secondary);
  font-weight: var(--font-weight-thin);
  letter-spacing: -0.035em;
}

/* ── Subtítulo ── */
.hero-subtitle {
  /* Mobile: largura total */
  max-width: 100%;
  margin-bottom: var(--space-10);
  color: var(--color-text-secondary);
  overflow-wrap: break-word;
}

@media (min-width: 640px) {
  .hero-subtitle {
    max-width: 44ch;
    margin-bottom: var(--space-12);
  }
}

@media (min-width: 1024px) {
  .hero-subtitle {
    max-width: 48ch;
    margin-bottom: var(--space-18);
  }
}

/* ── Separador pré-busca ── */
.hero-search-separator {
  /* Nunca mais largo que o container */
  width: 100%;
  max-width: 100%;
  height: 1px;
  background: linear-gradient(90deg, var(--color-border-subtle), transparent 60%);

  /* Mobile */
  margin-bottom: var(--space-6);
}

@media (min-width: 640px) {
  .hero-search-separator { margin-bottom: var(--space-8); }
}

@media (min-width: 1024px) {
  .hero-search-separator {
    max-width: 680px;
    margin-bottom: var(--space-9);
  }
}

/* ── Wrapper da busca ── */
.hero-search-wrapper {
  /* Mobile: 100% — sem largura fixa */
  width: 100%;
  max-width: 100%;
  margin-bottom: var(--space-4);

  /* Contém o input */
  min-width: 0;
}

@media (min-width: 1024px) {
  .hero-search-wrapper {
    max-width: 680px;
    margin-bottom: var(--space-5);
  }
}

/* Hint abaixo do input de busca */
.search-hint {
  margin-top: var(--space-3);
  color: var(--color-text-tertiary);
  padding-left: 2px;
  letter-spacing: 0.08em;
  overflow-wrap: break-word;
}

/* ── Tags rápidas ── */
.hero-tags {
  /* Contida no mesmo max-width da busca */
  width: 100%;
  max-width: 100%;

  display: flex;
  align-items: center;
  /* flex-wrap obrigatório — tags não ultrapassam a linha */
  flex-wrap: wrap;
  gap: var(--space-2);

  /* Mobile */
  margin-top: var(--space-5);
  padding-top: var(--space-5);

  border-top: 1px solid var(--color-border-subtle);

  /* Contenção */
  min-width: 0;
  overflow: hidden;
}

@media (min-width: 640px) {
  .hero-tags {
    margin-top: var(--space-6);
    padding-top: var(--space-6);
    gap: var(--space-2);
  }
}

@media (min-width: 1024px) {
  .hero-tags { max-width: 680px; }
}

/* Label "Frequente" */
.hero-tags-label {
  font-size: var(--font-size-2xs);
  font-weight: var(--font-weight-semibold);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--color-text-tertiary);
  margin-right: var(--space-1);
  white-space: nowrap;
  opacity: 0.7;
  flex-shrink: 0;
}

/* Mobile: label oculto — mais limpo */
@media (max-width: 479px) {
  .hero-tags-label { display: none; }
}

/* Tag item */
.tag-item {
  font-family: var(--font-family-base);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-regular);
  color: var(--color-text-tertiary);
  background: transparent;
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius-sm);
  letter-spacing: 0.01em;
  cursor: pointer;

  /* Touch target: mínimo 36px de altura */
  min-height: 36px;
  padding: 0 12px;

  /* Sem overflow do texto */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;

  /* Limite para não estourar em telas pequenas */
  max-width: calc(50vw - var(--page-margin) - var(--space-4));

  transition:
    color var(--duration-fast) var(--ease-out-quart),
    border-color var(--duration-fast) var(--ease-out-quart),
    background var(--duration-fast) var(--ease-out-quart);
}

@media (min-width: 480px) {
  .tag-item { max-width: none; }
}

.tag-item:hover {
  color: var(--color-text-support);
  border-color: var(--color-border-default);
  background: var(--color-interactive-dim);
}

/* ═══════════════════════════════════════════
   MÓDULOS — Mobile-first
   ═══════════════════════════════════════════ */

.section-modules {
  border-top: 1px solid var(--color-border-subtle);
  background: var(--color-surface-01);
  background-image: linear-gradient(
    to bottom,
    var(--color-surface-00) 0%,
    var(--color-surface-01) 80px
  );
}

/* Grid de módulos: 1 coluna mobile → 3 colunas desktop */
.modules-grid {
  margin-top: var(--space-10);
  /* 1 coluna herdado do .grid mobile-first */
}

/* Tablet: 2 colunas com terceiro card full-width */
@media (min-width: 640px) {
  #modules-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  #modules-grid article:nth-child(3) {
    grid-column: span 2;
  }
}

/* Desktop: 3 colunas iguais */
@media (min-width: 1024px) {
  #modules-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  #modules-grid article:nth-child(3) {
    grid-column: span 1;
  }
}

@media (min-width: 768px) {
  .modules-grid { margin-top: var(--space-12); }
}

.module-number {
  color: var(--color-text-tertiary);
  font-size: var(--font-size-xs);
}

.module-arrow {
  color: var(--color-text-tertiary);
  font-size: var(--font-size-lg);
  transition:
    color var(--duration-fast),
    transform var(--duration-fast) var(--ease-out-quart);
  flex-shrink: 0;
}

.card-interactive:hover .module-arrow {
  color: var(--color-text-primary);
  transform: translateX(4px);
}

/* ═══════════════════════════════════════════
   DESIGN SYSTEM TEST SECTION
   DS: seção interna de validação visual.
   Grids colapsam corretamente no mobile.
   ═══════════════════════════════════════════ */

.design-test-section {
  border-top: 1px solid var(--color-border-subtle);
  background: var(--color-surface-00);
}

/* Bloco */
.ds-block {
  margin-top: var(--space-12);
  padding-top: var(--space-8);
  border-top: 1px solid var(--color-border-subtle);
}

@media (min-width: 768px) {
  .ds-block { margin-top: var(--space-16); padding-top: var(--space-10); }
}

.ds-block:first-of-type { margin-top: var(--space-10); }

.ds-block-header {
  margin-bottom: var(--space-6);
  display: flex;
  align-items: center;
  gap: var(--space-4);
  /* Linha extensora */
  overflow: hidden;
}

.ds-block-header::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--color-border-subtle);
  min-width: 0;
}

@media (min-width: 768px) {
  .ds-block-header { margin-bottom: var(--space-8); }
}

/* ── Tipografia showcase ── */
.ds-type-showcase {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.ds-type-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}

@media (min-width: 768px) {
  .ds-type-row {
    display: grid;
    grid-template-columns: 160px 1fr;
    align-items: center;
    gap: var(--space-8);
  }
}

@media (min-width: 1024px) {
  .ds-type-row {
    grid-template-columns: 220px 1fr;
  }
}

.ds-type-meta {
  display: none; /* Mobile: oculto para limpar */
}

@media (min-width: 768px) {
  .ds-type-meta {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
  }
}

.ds-type-sample {
  color: var(--color-text-primary);
  min-width: 0;
  overflow-wrap: break-word;
}

/* ── Superfícies grid ── */
.ds-surfaces-grid {
  display: grid;
  /* Mobile: 2 colunas */
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-2);
}

@media (min-width: 640px) {
  .ds-surfaces-grid { grid-template-columns: repeat(3, 1fr); gap: var(--space-3); }
}

@media (min-width: 1024px) {
  .ds-surfaces-grid { grid-template-columns: repeat(6, 1fr); }
}

.ds-surface {
  aspect-ratio: 1.6;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-subtle);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--space-3);
  min-width: 0;
  overflow: hidden;
}

@media (min-width: 768px) {
  .ds-surface { padding: var(--space-4); }
}

.ds-surface .type-overline:first-child { color: var(--color-text-tertiary); }
.ds-surface .type-overline:last-child  { color: var(--color-text-disabled); }

/* ── Botões showcase ── */
.ds-row-wrap {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

@media (min-width: 768px) {
  .ds-row-wrap { gap: var(--space-8); }
}

.ds-col {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  min-width: 0;
}

.ds-col .flex {
  flex-wrap: wrap;
  gap: var(--space-3);
}

.ds-sublabel {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-tertiary);
  letter-spacing: var(--tracking-label);
  text-transform: uppercase;
}

/* ── Escala de espaçamento ── */
.ds-spacing-scale {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.ds-space-item {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-width: 0;
}

.ds-space-bar {
  height: 4px;
  background: var(--color-surface-05);
  border-radius: var(--radius-pill);
  min-width: 4px;
  /* max-width: nunca ultrapassa o container */
  max-width: calc(100% - 60px);
  flex-shrink: 0;
}

/* ── Cards do DS test ── */
/* Override inline styles dos grids do DS test */
.ds-cards-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}

@media (min-width: 640px) {
  .ds-cards-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1024px) {
  .ds-cards-grid { grid-template-columns: repeat(3, 1fr); }
}

.ds-inputs-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6);
}

@media (min-width: 640px) {
  .ds-inputs-grid { grid-template-columns: repeat(2, 1fr); }
}

.ds-inputs-grid .ds-full {
  grid-column: 1 / -1;
}

/* ═══════════════════════════════════════════
   CTA SECTION — Mobile-first
   ═══════════════════════════════════════════ */

.section-cta {
  border-top: 1px solid var(--color-border-subtle);
  background: var(--color-surface-01);
}

.cta-inner {
  /* Mobile: 1 coluna */
  display: flex;
  flex-direction: column;
  gap: var(--space-10);
  min-width: 0;
}

@media (min-width: 768px) {
  .cta-inner {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-20);
    align-items: start;
  }
}

.cta-left,
.cta-right {
  min-width: 0;
}

.cta-input-row {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  align-items: stretch;
  width: 100%;
}

@media (min-width: 480px) {
  .cta-input-row {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: stretch;
  }

  .cta-input-row .input {
    flex: 1;
    min-width: 200px;
    max-width: 320px;
  }
}

@media (max-width: 479px) {
  .cta-input-row .input,
  .cta-input-row .btn {
    width: 100%;
    max-width: 100%;
  }
}

/* ═══════════════════════════════════════════
   MOBILE MENU
   ═══════════════════════════════════════════ */

.mobile-menu {
  position: fixed;
  top: var(--header-height);
  left: 0;
  right: 0;
  bottom: 0;
  /* Nunca excede a viewport */
  width: 100%;
  z-index: calc(var(--z-header) - 1);
  background: rgba(0, 0, 0, 0.97);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--color-border-subtle);
  overflow-y: auto;
  overflow-x: hidden;
  /* Inicia fora da viewport — sem causar scroll */
  transform: translateY(-100%);
  transition:
    transform var(--duration-enter) var(--ease-out-quart),
    opacity var(--duration-base) var(--ease-out-quart);
  opacity: 0;
}

.mobile-menu.is-open {
  transform: translateY(0);
  opacity: 1;
}

/* Override do hidden — permite animação */
.mobile-menu[hidden] {
  display: block !important;
  pointer-events: none;
}

.mobile-menu-inner {
  padding: var(--space-8) var(--page-margin);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
  /* Sem overflow */
  width: 100%;
  min-width: 0;
}

.mobile-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* Escala: 24px mobile, não 20px que é pequeno demais */
  font-size: clamp(22px, 6vw, 28px);
  font-weight: var(--font-weight-light);
  color: var(--color-text-secondary);

  /* Touch target: mínimo 56px */
  min-height: 56px;
  padding: var(--space-5) 0;

  border-bottom: 1px solid var(--color-border-subtle);
  transition: color var(--duration-fast);
  letter-spacing: var(--tracking-snug);

  /* Sem overflow */
  overflow: hidden;
  min-width: 0;
}

.mobile-nav-item.is-active  { color: var(--color-text-primary); }
.mobile-nav-item.is-disabled {
  pointer-events: none;
  opacity: 0.4;
}

/* ═══════════════════════════════════════════
   SEÇÃO DE CABEÇALHO
   section-header-row: alinha no tablet
   ═══════════════════════════════════════════ */

/* Corrige o p à direita no mobile */
.section-header-row > p {
  text-align: left !important;
  max-width: 100% !important;
}

@media (min-width: 768px) {
  .section-header-row > p {
    text-align: right !important;
    max-width: 320px !important;
  }
}
