/*
 * Templo da Lua — primeira onda mobile e acessibilidade
 *
 * Este arquivo sobrepõe estilos inline legados somente em telas de até 768px.
 * A identidade visual permanece baseada no azul mineral e no marfim da marca.
 */

:root {
  --tdl-wave1-gutter: 20px;
  --tdl-wave1-header-offset: 112px;
  --tdl-wave1-focus: #f5efe0;
  --tdl-wave1-focus-shadow: rgba(235, 211, 166, 0.34);
}

.tdl-sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.tdl-skip-link {
  position: fixed;
  z-index: 1200;
  top: 10px;
  left: 12px;
  padding: 12px 16px;
  color: #0e2438;
  background: #f5efe0;
  font: 500 13px/1 "Jost", sans-serif;
  transform: translateY(-160%);
  transition: transform 0.2s ease;
}

.tdl-skip-link:focus {
  color: #0e2438;
  transform: translateY(0);
}

.tdl-site-header {
  position: sticky;
  z-index: 40;
  top: 0;
  box-sizing: border-box;
  display: flex;
  min-height: 66px;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px 40px;
  border-bottom: 1px solid rgba(230, 218, 190, 0.1);
  background: rgba(14, 36, 56, 0.9);
  backdrop-filter: blur(14px);
}

.tdl-brand {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 13px;
  min-height: 42px;
}

.tdl-site-nav {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: flex-end;
  gap: 10px 18px;
  font: 400 11px/1 "IBM Plex Mono", monospace;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.tdl-site-nav a {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  color: #c9c1ae;
  white-space: nowrap;
}

.tdl-site-nav a:hover {
  color: #f5efe0;
}

section[id] {
  scroll-margin-top: 88px;
}

.tdl-menu-button {
  display: none;
}

.tdl-cover-actions,
.tdl-final-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 34px;
}

.tdl-cover-brand {
  transition: opacity 0.8s ease;
}

.tdl-cover-video-mark .tdl-cover-brand {
  opacity: 0 !important;
}

.tdl-primary-action,
.tdl-secondary-action {
  box-sizing: border-box;
  display: inline-flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  padding: 13px 18px;
  border: 1px solid rgba(235, 211, 166, 0.48);
  font: 400 11px/1 "IBM Plex Mono", monospace;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  transition: color 0.25s ease, background 0.25s ease, border-color 0.25s ease;
}

.tdl-primary-action {
  color: #0e2438;
  border-color: #ebd3a6;
  background: #ebd3a6;
}

.tdl-primary-action:hover {
  color: #0e2438;
  background: #f5efe0;
}

.tdl-secondary-action {
  color: #f5efe0;
  background: rgba(14, 36, 56, 0.34);
}

.tdl-secondary-action:hover {
  color: #ffffff;
  border-color: #f5efe0;
  background: rgba(230, 218, 190, 0.12);
}

.tdl-journey-card:focus-visible,
:where(a[href], button, input, summary, video[controls], iframe):focus-visible {
  outline: 3px solid var(--tdl-wave1-focus) !important;
  outline-offset: 3px !important;
  box-shadow: 0 0 0 6px var(--tdl-wave1-focus-shadow) !important;
}

[style*="color:#A8A192"] {
  color: #c5beaf !important;
}

[style*="color:#8E8A7A"] {
  color: #bdb6a6 !important;
}

@media (max-width: 1080px) and (min-width: 769px) {
  .tdl-site-header {
    gap: 18px;
    padding-right: 24px;
    padding-left: 24px;
  }

  .tdl-site-nav {
    gap: 8px 12px;
    font-size: 10px;
    letter-spacing: 0.1em;
  }
}

@media (max-width: 768px) {
  .tdl-cover-overlay {
    background: linear-gradient(180deg, rgba(14, 36, 56, .82) 0%, rgba(14, 36, 56, .56) 36%, rgba(14, 36, 56, .9) 74%, #244f73 100%) !important;
  }

  /* Estrutura mobile ancorada em seletores semânticos. O runtime normaliza os
     atributos style, portanto seletores baseados no texto do style não são
     confiáveis depois da hidratação. */
  section[data-screen-label="Conceito"],
  #territorio,
  #aptidao,
  section[data-screen-label="Três pilares"],
  #vilas,
  #modelo,
  #numeros,
  section[data-screen-label="Jurídico e ambiental"] {
    padding: 84px var(--tdl-wave1-gutter) 0 !important;
  }

  section[data-screen-label="Síntese"] {
    padding: 84px var(--tdl-wave1-gutter) 72px !important;
  }

  section[data-screen-label="Conceito"] > div:first-child,
  #territorio > div:first-child,
  #aptidao > div:first-child,
  section[data-screen-label="Jurídico e ambiental"] > div:first-child,
  #wellness > div:first-child > div:first-child,
  #hotel > div:first-child > div:first-child {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 30px !important;
  }

  #aptidao > div:first-child > div:first-child {
    position: static !important;
    top: auto !important;
  }

  #pranchas,
  #wellness,
  #hotel {
    padding-top: 84px !important;
  }

  #pranchas > div:first-child {
    padding: 0 var(--tdl-wave1-gutter) 52px !important;
  }

  #wellness > div:first-child,
  #hotel > div:first-child {
    box-sizing: border-box;
    padding-right: var(--tdl-wave1-gutter) !important;
    padding-left: var(--tdl-wave1-gutter) !important;
  }

  .tdl-stack-mobile {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  #wellness .tdl-stack-mobile:first-child,
  #vilas .tdl-stack-mobile,
  #modelo .tdl-stack-mobile {
    gap: 30px !important;
  }

  #modelo .tdl-stack-mobile > div:first-child {
    position: static !important;
    top: auto !important;
  }

  #wellness > .tdl-stack-mobile > div {
    padding: 32px 24px !important;
  }

  #wellness > .tdl-stack-mobile img,
  #hotel .tdl-stack-mobile > div > img {
    height: clamp(280px, 72vw, 420px) !important;
  }

  #hotel .tdl-stack-mobile > div > div {
    padding: 28px 24px !important;
  }

  .tdl-data-table {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    overflow-x: auto !important;
    overflow-y: hidden;
    overscroll-behavior-inline: contain;
    touch-action: pan-x;
    scrollbar-width: thin;
    scrollbar-color: #d7b98c rgba(230, 218, 190, 0.08);
    -webkit-overflow-scrolling: touch;
  }

  #aptidao .tdl-data-table > div {
    min-width: 700px;
  }

  #vilas .tdl-data-table > div {
    min-width: 820px;
  }

  .tdl-journey-overlay {
    right: var(--tdl-wave1-gutter) !important;
    bottom: var(--tdl-wave1-gutter) !important;
    left: var(--tdl-wave1-gutter) !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 12px !important;
  }

  .tdl-journey-dots {
    width: 100%;
    gap: 4px !important;
  }

  .tdl-journey-card > div:last-child {
    gap: 14px !important;
    padding: 22px 18px 24px !important;
  }

  .tdl-journey-card h4 {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
  }

  :root {
    --tdl-wave1-header-offset: 82px;
  }

  html {
    scroll-padding-top: var(--tdl-wave1-header-offset);
  }

  section,
  section[id],
  article[id],
  #tipologias-hospedagem,
  #prancha-1,
  #prancha-2,
  #prancha-3 {
    scroll-margin-top: var(--tdl-wave1-header-offset) !important;
  }

  .tdl-site-header {
    display: flex !important;
    min-height: 68px !important;
    align-items: center !important;
    gap: 14px !important;
    padding: 9px 16px !important;
  }

  .tdl-brand {
    min-width: 0;
  }

  .tdl-brand img:last-child {
    max-width: min(45vw, 190px);
  }

  .tdl-menu-button {
    display: inline-flex;
    min-width: 82px;
    min-height: 46px;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-left: auto;
    padding: 0 12px;
    color: #ebd3a6;
    border: 1px solid rgba(235, 211, 166, 0.3);
    background: rgba(14, 36, 56, 0.42);
    font: 400 10px/1 "IBM Plex Mono", monospace;
    letter-spacing: 0.14em;
    text-transform: uppercase;
  }

  .tdl-menu-button-lines {
    display: flex;
    width: 18px;
    flex-direction: column;
    gap: 5px;
  }

  .tdl-menu-button-lines span {
    display: block;
    width: 100%;
    height: 1px;
    background: currentColor;
  }

  .tdl-site-nav {
    position: absolute;
    z-index: 2;
    top: 100%;
    right: 0;
    left: 0;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1px;
    max-height: 0;
    padding: 0 16px;
    overflow: hidden;
    visibility: hidden;
    background: rgba(14, 36, 56, 0.98);
    opacity: 0;
    transform: translateY(-8px);
    transition: max-height 0.28s ease, opacity 0.2s ease, transform 0.28s ease, visibility 0.28s;
  }

  .tdl-site-nav--open {
    max-height: min(78svh, 520px);
    padding-top: 12px;
    padding-bottom: 16px;
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
  }

  .tdl-site-nav a {
    min-height: 48px;
    justify-content: center;
    padding: 0 8px;
    border: 1px solid rgba(230, 218, 190, 0.12);
    background: rgba(30, 70, 101, 0.42);
    font-size: 10px;
    text-align: center;
  }

  .tdl-cover-actions,
  .tdl-final-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    max-width: 330px;
  }

  .tdl-primary-action,
  .tdl-secondary-action {
    width: 100%;
  }

  /* Compatibilidade com o cabeçalho legado durante a transição. */
  x-dc > div[style*="min-height:100vh"] > div[style*="position:sticky"] {
    box-sizing: border-box !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    align-items: stretch !important;
    gap: 8px !important;
    width: 100% !important;
    min-height: 0 !important;
    padding: 9px 16px 7px !important;
  }

  x-dc > div[style*="min-height:100vh"] > div[style*="position:sticky"] > div:first-child {
    box-sizing: border-box;
    width: 100%;
    min-width: 0;
  }

  x-dc > div[style*="min-height:100vh"] > div[style*="position:sticky"] > div:first-child img:last-child {
    max-width: calc(100vw - 88px);
  }

  x-dc > div[style*="min-height:100vh"] > div[style*="position:sticky"] > div:last-child {
    box-sizing: border-box;
    display: flex !important;
    flex-wrap: nowrap !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 6px !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 1px 0 5px;
    scroll-snap-type: inline proximity;
    overscroll-behavior-inline: contain;
    touch-action: pan-x;
    scrollbar-width: thin;
    scrollbar-color: rgba(235, 211, 166, 0.55) transparent;
    -webkit-overflow-scrolling: touch;
  }

  x-dc > div[style*="min-height:100vh"] > div[style*="position:sticky"] > div:last-child > a {
    box-sizing: border-box;
    display: inline-flex !important;
    flex: 0 0 auto;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 12px;
    border: 1px solid rgba(230, 218, 190, 0.16);
    background: rgba(14, 36, 56, 0.34);
    scroll-snap-align: start;
    white-space: nowrap;
  }

  /* Respiro lateral e vertical consistente. */
  section[data-screen-label="Capa"] {
    min-height: calc(100svh - 102px) !important;
    padding: 48px var(--tdl-wave1-gutter) 52px !important;
  }

  section[style*="padding:130px 72px 0"] {
    padding: 84px var(--tdl-wave1-gutter) 0 !important;
  }

  section[style*="padding:130px 72px 120px"] {
    padding: 84px var(--tdl-wave1-gutter) 72px !important;
  }

  section[style*="padding:130px 0 0"] {
    padding-top: 84px !important;
  }

  .tdl-feature-film {
    padding: 84px var(--tdl-wave1-gutter) 0 !important;
  }

  #pranchas > div[style*="padding:0 40px"] {
    padding-right: var(--tdl-wave1-gutter) !important;
    padding-left: var(--tdl-wave1-gutter) !important;
  }

  [style*="padding:0 72px"],
  [style*="padding:96px 72px"],
  [style*="padding:64px 72px"] {
    padding-right: var(--tdl-wave1-gutter) !important;
    padding-left: var(--tdl-wave1-gutter) !important;
  }

  [style*="margin-top:130px"][style*="padding:110px 72px"] {
    margin-top: 84px !important;
    padding: 72px var(--tdl-wave1-gutter) 80px !important;
  }

  [style*="left:72px;right:72px"] {
    right: var(--tdl-wave1-gutter) !important;
    left: var(--tdl-wave1-gutter) !important;
  }

  [style*="left:72px;bottom:52px"] {
    bottom: 28px !important;
    left: var(--tdl-wave1-gutter) !important;
  }

  /* Todos os splits editoriais passam a uma coluna. */
  [style*="grid-template-columns:minmax(0,340px) minmax(0,1fr)"],
  [style*="grid-template-columns:1.35fr 1fr"],
  [style*="grid-template-columns:1fr 1.4fr"],
  [style*="grid-template-columns:repeat(3,1fr)"] {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 30px !important;
  }

  [style*="grid-template-columns:repeat(auto-fit,minmax(320px,1fr))"],
  [style*="grid-template-columns:repeat(auto-fit,minmax(300px,1fr))"],
  [style*="grid-template-columns:repeat(auto-fit,minmax(280px,1fr))"] {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  [style*="height:540px;object-fit:cover"],
  [style*="height:520px;object-fit:cover"] {
    height: clamp(280px, 72vw, 420px) !important;
  }

  img,
  video,
  iframe {
    max-width: 100%;
  }

  /* Quadros de dados preservam as colunas e ganham rolagem local, sem corte. */
  section[data-screen-label="Aptidão"] div[style*="display:flex;flex-direction:column;gap:2px;background:rgba(230,218,190,.1)"],
  section[data-screen-label="Vilas"] div[style*="display:flex;flex-direction:column;gap:2px;background:rgba(230,218,190,.1)"] {
    box-sizing: border-box;
    width: 100%;
    max-width: 100%;
    overflow-x: auto !important;
    overflow-y: hidden;
    overscroll-behavior-inline: contain;
    touch-action: pan-x;
    scrollbar-width: thin;
    scrollbar-color: #d7b98c rgba(230, 218, 190, 0.08);
    -webkit-overflow-scrolling: touch;
  }

  [style*="grid-template-columns:1fr .8fr .7fr 1.6fr"] {
    grid-template-columns: 1fr 0.8fr 0.7fr 1.6fr !important;
    min-width: 700px;
  }

  [style*="grid-template-columns:1.5fr .5fr .8fr 1fr 1fr"] {
    grid-template-columns: 1.5fr 0.5fr 0.8fr 1fr 1fr !important;
    min-width: 820px;
  }

  /* Simuladores: controles legíveis, com espaço para toque e sem estouro. */
  label[style*="flex-direction:column"] {
    gap: 11px !important;
    min-width: 0 !important;
  }

  label[style*="flex-direction:column"] > span[style*="justify-content:space-between"] {
    flex-wrap: wrap !important;
    align-items: center !important;
    gap: 10px 14px !important;
  }

  label[style*="flex-direction:column"] > span[style*="justify-content:space-between"] > span:first-child {
    flex: 1 1 150px;
    min-width: 0;
    line-height: 1.5 !important;
  }

  input[type="number"] {
    box-sizing: border-box;
    width: 110px !important;
    max-width: 100%;
    min-height: 44px;
    padding: 9px 10px !important;
    border-color: rgba(235, 211, 166, 0.45) !important;
    font-size: 16px !important;
    line-height: 1.25 !important;
  }

  input[type="range"] {
    box-sizing: border-box;
    width: 100% !important;
    min-height: 44px;
    height: 44px !important;
    margin: 0 !important;
    cursor: ew-resize;
  }

  [style*="padding:26px 24px 30px"] {
    padding: 22px 18px 26px !important;
  }

  [style*="padding:22px 24px"] {
    padding-right: 18px !important;
    padding-left: 18px !important;
  }

  button[onclick*="reset"] {
    min-height: 44px;
    padding: 12px 16px !important;
  }

  /* Alvos de toque nativos. */
  button,
  summary,
  a[target="_blank"] {
    box-sizing: border-box;
    min-height: 44px;
  }

  a[target="_blank"] {
    display: inline-flex !important;
    align-items: center;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  summary {
    align-items: center;
  }

  /* Amplia a área tocável dos indicadores da jornada sem engrossar o ponto. */
  .tdl-journey-dot {
    position: relative !important;
    box-sizing: border-box !important;
    display: inline-flex !important;
    flex: 0 0 44px !important;
    width: 44px !important;
    height: 44px !important;
    align-items: center;
    justify-content: center;
    border-radius: 0 !important;
    background: transparent !important;
  }

  .tdl-journey-dot::after {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 8px;
    height: 8px;
    border-radius: 999px;
    background: rgba(230, 218, 190, 0.52);
    content: "";
    transform: translate(-50%, -50%);
  }

  .tdl-journey-dot[style*="width:26px"]::after {
    width: 26px;
    background: #ebd3a6;
  }

  .tdl-journey-card {
    min-height: 44px;
  }

  /* Foco visível recupera o outline removido pelos estilos inline. */
  :where(a[href], button, input, summary, video[controls], iframe):focus-visible {
    outline: 3px solid var(--tdl-wave1-focus) !important;
    outline-offset: 3px !important;
    box-shadow: 0 0 0 6px var(--tdl-wave1-focus-shadow) !important;
  }

  :where(input, button, summary):focus-visible {
    border-color: #ebd3a6 !important;
  }
}

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

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
