/* ==========================================================================
   Zen Terapias — reset, tipografia e primitivos de layout
   ========================================================================== */

@layer reset, base, layout, motion;

@layer reset {
  *,
  *::before,
  *::after {
    box-sizing: border-box;
  }

  * {
    margin: 0;
  }

  html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--header-h) + 1.5rem);
    interpolate-size: allow-keywords;
    color-scheme: light;
  }

  body {
    min-height: 100svh;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
  }

  img,
  picture,
  video,
  canvas,
  svg,
  iframe {
    display: block;
    max-width: 100%;
  }

  img,
  video {
    height: auto;
  }

  input,
  button,
  textarea,
  select {
    font: inherit;
    color: inherit;
  }

  button {
    background: none;
    border: 0;
    cursor: pointer;
  }

  p,
  h1,
  h2,
  h3,
  h4,
  h5,
  h6 {
    overflow-wrap: break-word;
  }

  ul[class],
  ol[class] {
    list-style: none;
    padding: 0;
  }

  :where(a) {
    color: inherit;
    text-decoration: none;
  }

  :target {
    scroll-margin-top: calc(var(--header-h) + 2rem);
  }

  ::selection {
    background: color-mix(in oklab, var(--gold-400) 55%, transparent);
    color: var(--ink-900);
  }

  :focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
    border-radius: var(--radius-xs);
  }
}

@layer base {
  body {
    background-color: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: var(--step-0);
    font-weight: 300;
    line-height: 1.72;
    letter-spacing: 0.005em;

    /* Luz ambiente dourada/teal + textura de papel da logo */
    background-image:
      radial-gradient(72rem 42rem at 12% -8%, color-mix(in oklab, var(--gold-200) 46%, transparent), transparent 62%),
      radial-gradient(58rem 38rem at 96% 6%, color-mix(in oklab, var(--teal-100) 52%, transparent), transparent 60%);
    background-repeat: no-repeat;
  }

  body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    opacity: 0.08;
    mix-blend-mode: multiply;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 0.78  0 0 0 0 0.72  0 0 0 0 0.58  0 0 0 0.55 0'/></filter><rect width='100%25' height='100%25' filter='url(%23n)'/></svg>");
  }

  body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 1;
    background: radial-gradient(34rem 24rem at var(--mx, 72%) var(--my, 8%),
      color-mix(in oklab, var(--gold-400) 8%, transparent), transparent 72%);
    mix-blend-mode: soft-light;
    opacity: 0.55;
  }

  @media (pointer: coarse) {
    body::after {
      display: none;
    }
  }

  h1,
  h2,
  h3,
  h4 {
    font-family: var(--font-display);
    font-weight: 400;
    line-height: 1.08;
    letter-spacing: -0.012em;
    color: var(--ink-900);
    text-wrap: balance;
  }

  h1 {
    font-size: var(--step-5);
  }

  h2 {
    font-size: var(--step-4);
  }

  h3 {
    font-size: var(--step-2);
  }

  h4 {
    font-size: var(--step-1);
  }

  p {
    text-wrap: pretty;
  }

  strong {
    font-weight: 500;
    color: var(--ink-900);
  }

  em {
    font-style: italic;
  }

  small {
    font-size: var(--step--1);
  }

  hr {
    border: 0;
    height: 1px;
    background: var(--line);
  }

  ::placeholder {
    color: color-mix(in oklab, var(--ink-400) 88%, transparent);
    opacity: 1;
  }
}

@layer layout {
  .shell {
    width: min(100% - (var(--gutter) * 2), var(--content));
    margin-inline: auto;
  }

  .shell--wide {
    width: min(100% - (var(--gutter) * 2), var(--content-wide));
  }

  .shell--narrow {
    width: min(100% - (var(--gutter) * 2), var(--content-narrow));
  }

  .section {
    padding-block: var(--section-pad);
    position: relative;
  }

  .section--tight {
    padding-block: calc(var(--section-pad) * 0.62);
  }

  .section--sunken {
    background: linear-gradient(180deg, transparent, var(--bg-sunken) 18%, var(--bg-sunken) 82%, transparent);
  }

  .section--dark {
    background: var(--grad-dark);
    color: var(--text-on-dark);
    isolation: isolate;
    overflow: clip;
  }

  .section--dark h1,
  .section--dark h2,
  .section--dark h3,
  .section--dark h4 {
    color: var(--text-on-dark);
  }

  .section--dark .lead,
  .section--dark p {
    color: var(--text-on-dark-muted);
  }

  /* Brilho decorativo das seções escuras */
  .section--dark::before {
    content: "";
    position: absolute;
    inset: -30% -10% auto -10%;
    height: 70%;
    background:
      radial-gradient(40rem 22rem at 20% 0%, color-mix(in oklab, var(--teal-500) 30%, transparent), transparent 68%),
      radial-gradient(34rem 20rem at 85% 12%, color-mix(in oklab, var(--gold-600) 26%, transparent), transparent 66%);
    filter: blur(6px);
    pointer-events: none;
    z-index: -1;
  }

  .stack > * + * {
    margin-block-start: var(--flow, var(--space-s));
  }

  .grid {
    display: grid;
    gap: var(--grid-gap, var(--space-m));
  }

  .grid--2 {
    grid-template-columns: repeat(auto-fit, minmax(min(22rem, 100%), 1fr));
  }

  .grid--3 {
    grid-template-columns: repeat(auto-fit, minmax(min(17rem, 100%), 1fr));
  }

  .grid--4 {
    grid-template-columns: repeat(auto-fit, minmax(min(13.5rem, 100%), 1fr));
  }

  /*
   * Faixa centralizada para listas de tamanho variável (equipe, planos): os itens
   * crescem até um limite e ficam centrados quando são poucos.
   */
  .strip {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--grid-gap, var(--space-m));
  }

  .strip > * {
    flex: 1 1 var(--strip-basis, 15rem);
    max-inline-size: var(--strip-max, 22rem);
  }

  .split {
    display: grid;
    gap: clamp(var(--space-l), 4vw, var(--space-2xl));
    align-items: center;
    grid-template-columns: 1fr;
  }

  @media (width >= 62rem) {
    .split {
      grid-template-columns: 1fr 1fr;
    }

    .split--wide-start {
      grid-template-columns: 1.15fr 0.85fr;
    }

    .split--wide-end {
      grid-template-columns: 0.85fr 1.15fr;
    }
  }

  .cluster {
    display: flex;
    flex-wrap: wrap;
    gap: var(--cluster-gap, var(--space-xs));
    align-items: center;
  }

  .center {
    text-align: center;
    margin-inline: auto;
  }

  .sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }

  .skip-link {
    position: absolute;
    inset-inline-start: var(--space-s);
    inset-block-start: -100%;
    z-index: 999;
    padding: 0.75rem 1.25rem;
    background: var(--ink-900);
    color: var(--text-on-dark);
    border-radius: var(--radius-pill);
    transition: inset-block-start var(--dur) var(--ease-out);
  }

  .skip-link:focus-visible {
    inset-block-start: var(--space-s);
  }
}

@layer motion {
  /* Transições entre páginas (Chrome/Edge). Degrada sem efeito nos demais. */
  @view-transition {
    navigation: auto;
  }

  ::view-transition-old(root) {
    animation: vt-out 260ms var(--ease-in-out) both;
  }

  ::view-transition-new(root) {
    animation: vt-in 380ms var(--ease-out) both;
  }

  @keyframes vt-out {
    to {
      opacity: 0;
      transform: translateY(-8px) scale(0.995);
    }
  }

  @keyframes vt-in {
    from {
      opacity: 0;
      transform: translateY(14px);
    }
  }

  /* Revelação no scroll: usa scroll-driven animations quando suportado,
     com fallback via IntersectionObserver (.is-visible). */
  .reveal {
    opacity: 0;
    transform: translateY(1.75rem);
    transition: opacity var(--dur-slow) var(--ease-out), transform var(--dur-slow) var(--ease-out);
    transition-delay: var(--reveal-delay, 0ms);
  }

  .reveal.is-visible {
    opacity: 1;
    transform: none;
  }

  @supports (animation-timeline: view()) {
    @media (prefers-reduced-motion: no-preference) {
      .reveal {
        opacity: 1;
        transform: none;
        transition: none;
        animation: reveal-up linear both;
        animation-timeline: view();
        animation-range: entry 6% cover 26%;
      }
    }
  }

  @keyframes reveal-up {
    from {
      opacity: 0;
      transform: translateY(2.5rem);
    }
    to {
      opacity: 1;
      transform: none;
    }
  }

  @keyframes float-soft {
    0%, 100% {
      transform: translateY(0);
    }
    50% {
      transform: translateY(-0.85rem);
    }
  }

  @keyframes spin-slow {
    to {
      transform: rotate(1turn);
    }
  }

  @keyframes shine-sweep {
    to {
      --shine-angle: 360deg;
    }
  }

  @keyframes pulse-ring {
    0% {
      box-shadow: 0 0 0 0 color-mix(in oklab, var(--teal-400) 55%, transparent);
    }
    70% {
      box-shadow: 0 0 0 1.15rem transparent;
    }
    100% {
      box-shadow: 0 0 0 0 transparent;
    }
  }

  @media (prefers-reduced-motion: reduce) {
    html {
      scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
      animation-duration: 1ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 1ms !important;
    }
  }
}
