/* =========================================================================
   Escola Megumi — folha de estilo única
   Reproduz o layout do site original (Squarespace 7.1 / Fluid Engine)
   com CSS próprio: grid de 24 colunas no desktop e 8 no celular.
   ========================================================================= */

/* ---------- Fonte (Roboto variável, subconjunto latino) ---------- */
@font-face {
  font-family: "Roboto";
  src: url("/assets/fonts/roboto-latin-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Tokens ---------- */
:root {
  --c-text: #000;
  --c-light: #f4f4f3;
  --c-white: #fff;
  --c-bright: #f9de7b;

  /* Escala tipográfica fluida (mesma fórmula do tema original):
     tamanho = (S - 1) × k + 1rem, com teto equivalente a 2000px de largura */
  --k: 1.2vw;
  --fs-h1: min(calc(3 * var(--k) + 1rem), 88px);       /* S = 4   */
  --fs-h2: min(calc(1.5 * var(--k) + 1rem), 52px);     /* S = 2.5 */
  --fs-h3: min(calc(1.1 * var(--k) + 1rem), 42.4px);   /* S = 2.1 */
  --fs-h4: min(calc(.4 * var(--k) + 1rem), 25.6px);    /* S = 1.4 */
  --fs-large: var(--fs-h4);                            /* S = 1.4 */
  --fs-normal: min(calc(.1 * var(--k) + 1rem), 18.4px);/* S = 1.1 */
  --fs-small: min(calc(-.1 * var(--k) + 1rem), 14.4px);/* S = 0.9 */
  --fs-button: min(calc(-.2 * var(--k) + 1rem), 12.8px);/* S = 0.8 */
  --fs-menu: calc(1.693 * var(--k) + 1rem);

  /* Espaçamentos de seção */
  --pad-small: 3.3vw;
  --pad-medium: 6.6vw;

  /* Grid */
  --gap: 11px;
  --site-gutter: 4vw;
  --max: 2000px;

  /* Cabeçalho */
  --logo-h: 93px;
  --header-pad-y: 2vw;
  --header-pad-x: 4vw;
  --header-h: calc(var(--logo-h) + 2 * var(--header-pad-y));

  /* Curvas das animações (cúbicas, como na referência) */
  --ease-io: cubic-bezier(.645, .045, .355, 1);
  --ease-out: cubic-bezier(.215, .61, .355, 1);
}

@media (max-width: 799px) {
  :root {
    --header-pad-y: 7.9vw;
    --header-pad-x: 6vw;
  }
}

@media (max-width: 767px) {
  :root {
    --k: calc(.012 * min(100vh, 900px));
    --fs-h1: calc(3 * var(--k) + 1rem);
    --fs-h2: calc(1.5 * var(--k) + 1rem);
    --fs-h3: calc(1.1 * var(--k) + 1rem);
    --fs-h4: calc(.4 * var(--k) + 1rem);
    --fs-large: var(--fs-h4);
    --fs-normal: calc(.1 * var(--k) + 1rem);
    --fs-small: calc(-.1 * var(--k) + 1rem);
    --fs-button: calc(-.2 * var(--k) + 1rem);
    --pad-small: calc(.033 * min(100vh, 900px));
    --pad-medium: calc(.066 * min(100vh, 900px));
    --logo-h: 37px; /* altura da linha do cabeçalho (logo limitado a 30px) */
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--c-light);
  color: var(--c-text);
  font-family: "Roboto", "Helvetica Neue", Arial, sans-serif;
  font-size: var(--fs-normal);
  font-weight: 400;
  line-height: 1.3;
  letter-spacing: -.02em;
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

img { display: block; max-width: 100%; height: auto; }

a { color: inherit; }

strong { font-weight: 700; }

/* Estilos de título também disponíveis como classe (.h1–.h4), para manter
   o visual quando o elemento semântico é outro (ex.: <p class="h3">) */
h1, h2, h3, h4, .h1, .h2, .h3, .h4 {
  margin: 2rem 0;
  font-weight: 400;
  letter-spacing: -.02em;
}
h1, .h1 { font-size: var(--fs-h1); line-height: .968; }
h2, .h2 { font-size: var(--fs-h2); line-height: 1.034; }
h3, .h3 { font-size: var(--fs-h3); line-height: 1.0516; }
h4, .h4 { font-size: var(--fs-h4); line-height: 1.0824; }

p { margin: 1rem 0; }

.center { text-align: center; }

.sqsrte-large,
p.sqsrte-large {
  font-size: var(--fs-large);
  letter-spacing: calc(var(--fs-normal) * -.02);
}

:focus-visible {
  outline: 2px solid var(--c-text);
  outline-offset: 3px;
}

.skip {
  position: absolute;
  left: 50%;
  top: 8px;
  z-index: 100;
  transform: translate(-50%, -200%);
  padding: 12px 24px;
  border-radius: 300px;
  background: #000;
  color: #fff;
  text-decoration: none;
  font-size: var(--fs-small);
}
.skip:focus { transform: translate(-50%, 0); }

/* ---------- Botões ---------- */
.btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem 2.2rem;
  border: 2px solid var(--c-text);
  border-radius: 300px;
  /* mesmo fundo da seção: o texto em modo "diferença" precisa de fundo opaco */
  background: var(--bg, var(--c-light));
  color: var(--c-text);
  font: inherit;
  font-size: var(--fs-button);
  font-weight: 500;
  line-height: normal;
  letter-spacing: .05em;
  text-transform: uppercase;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}
/* Preenchimento que entra pela esquerda e sai pela direita */
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--c-text);
  transform: scaleX(0);
  transform-origin: 100% 50%;
  transition: transform .5s var(--ease-io);
}
/* Texto branco em modo "diferença": fica preto sobre o fundo claro e branco
   sobre o preenchimento, trocando de cor exatamente na borda da cortina */
.btn__label {
  position: relative;
  color: #fff;
  mix-blend-mode: difference;
}
.btn:focus-visible::before {
  transform: scaleX(1);
  transform-origin: 0 50%;
}
/* Efeitos de hover só em aparelhos com mouse (no toque eles "grudam") */
@media (hover: hover) {
  .btn:hover::before {
    transform: scaleX(1);
    transform-origin: 0 50%;
  }
}

/* ---------- Cabeçalho ---------- */
.header {
  position: relative;
  z-index: 20;
}

.header__bar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  height: var(--header-h);
  padding: 0 var(--header-pad-x);
}

.header__logo img {
  width: auto;
  height: 93px;
}

.header__right {
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: flex-end;
  gap: 2vw;
  min-width: 0;
  margin-left: 2vw;
}

.header__nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  column-gap: 2vw;
  font-size: var(--fs-small);
}

.header__nav a,
.menu__nav a {
  position: relative;
  padding: .1em 0;
  text-decoration: none;
}

/* Sublinhado que corre da esquerda para a direita no hover;
   a página atual fica sublinhada */
.header__nav a::after,
.menu__nav a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: .1em;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: 100% 50%;
  transition: transform .5s var(--ease-io);
}
.header__nav a[aria-current="page"]::after {
  transform: scaleX(1);
  transform-origin: 0 50%;
}
@media (hover: hover) {
  .header__nav a:hover::after,
  .menu__nav a:hover::after {
    transform: scaleX(1);
    transform-origin: 0 50%;
  }
}

.header__social,
.menu__social {
  display: flex;
  gap: 1.3vw;
}

.icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: calc(1em + 20px);
  height: calc(1em + 20px);
  border-radius: .4em;
  background: #000;
  color: #fff;
}
.icon svg {
  width: .806em;
  height: .806em;
  fill: currentColor;
  transition: transform .5s var(--ease-io);
}
@media (hover: hover) {
  .icon:hover svg { transform: rotate(-8deg) scale(1.15); }
}

.btn--header {
  font-size: var(--fs-small);
  font-weight: 400;
  letter-spacing: -.02em;
  text-transform: none;
}

.burger {
  display: none;
  position: relative;
  width: 47px;
  height: 37px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--c-text);
  cursor: pointer;
}
.burger span {
  position: absolute;
  left: 6px;
  width: 35px;
  height: 1px;
  background: currentColor;
  transition: transform .25s ease, top .25s ease;
}
.burger span:first-child { top: 12px; }
.burger span:last-child { top: 23px; }
.burger[aria-expanded="true"] span { top: 18px; }
.burger[aria-expanded="true"] span:first-child { transform: rotate(45deg) scaleX(.83); }
.burger[aria-expanded="true"] span:last-child { transform: rotate(-45deg) scaleX(.83); }

/* Menu do celular (sobreposição) */
.menu { display: none; }

@media (max-width: 799px) {
  .header__bar {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
  }
  .burger { display: block; }
  .header__right { display: none; }

  .menu {
    position: fixed;
    inset: 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    padding: var(--header-h) 6vw 6vw;
    background: var(--c-light);
    visibility: hidden;
    opacity: 0;
    overflow-y: auto;
    transition: visibility .6s cubic-bezier(.4, 0, .2, 1), opacity .4s cubic-bezier(.4, 0, .2, 1);
  }
  .menu.is-open {
    visibility: visible;
    opacity: 1;
  }
  .menu__nav {
    display: flex;
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6vw;
    font-size: var(--fs-menu);
    line-height: 1;
  }
  .menu__actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 54px;
    padding-top: 16px;
  }
  .menu__social { gap: 15px; }
  .icon--lg { width: 45px; height: 45px; }
  .icon--lg svg { width: 20px; height: 20px; }
  .menu__nav a { padding: 0; }
  .btn--menu {
    min-width: 210px;
    font-size: 1.2rem;
    font-weight: 400;
    letter-spacing: -.02em;
    text-transform: none;
  }
  html.menu-open { overflow: hidden; }
}

@media (max-width: 767px) {
  .header__logo img { height: 30px; }
}

/* ---------- Seções ---------- */
.sec {
  position: relative;
  background: var(--bg, var(--c-light));
}
.sec--light { --bg: var(--c-light); }
.sec--white { --bg: var(--c-white); }
.sec--bright { --bg: var(--c-bright); }

/* Seção "recuada" (banners do topo): fundo com margem lateral */
.sec--inset {
  --inset: calc(2 * var(--site-gutter));
  padding: 0 var(--site-gutter) var(--site-gutter);
  background: transparent;
}
.sec--banner > .grid {
  position: relative;
  align-content: center;
  min-height: calc(33vh - var(--header-h) - var(--site-gutter));
}
/* Moldura do banner: recorta a foto (que pode ser ampliada pelo parallax) */
.sec__frame {
  position: absolute;
  inset: 0 var(--site-gutter) var(--site-gutter);
  overflow: hidden;
}
.sec__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Alturas de seção do tema original: pequena = 33% da tela, média = 66%,
   com o conteúdo centralizado na vertical */
.sec--small,
.sec--medium {
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.sec--small { min-height: 33vh; }
.sec--medium { min-height: 66vh; }
.sec--small > .grid { padding-block: var(--pad-small); }
.sec--medium > .grid { padding-block: var(--pad-medium); }
.sec--inset.sec--small { min-height: 0; }

/* ---------- Grid (equivalente ao Fluid Engine) ---------- */
.grid {
  --gutter: 6vw;
  --cols: 8;
  --cw: min(var(--max), 100vw - 2 * var(--site-gutter) - var(--inset, 0px));
  position: relative;
  display: grid;
  gap: var(--gap);
  grid-template-columns:
    minmax(calc(var(--gutter) - var(--gap)), 1fr)
    repeat(var(--cols), minmax(0, calc((var(--max) - var(--gap) * (var(--cols) - 1)) / var(--cols))))
    minmax(calc(var(--gutter) - var(--gap)), 1fr);
  grid-template-rows: repeat(var(--rm), minmax(24px, auto));
}

@media (min-width: 768px) {
  .grid {
    --gutter: var(--site-gutter);
    --cols: 24;
    grid-template-rows: repeat(var(--rd), minmax(calc(var(--cw) * .0215), auto));
  }
}

/* Bloco posicionado no grid: --m (celular) e --d (desktop) = linha/coluna início/fim */
.b {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: var(--vm, flex-start);
  grid-area: var(--m);
  min-width: 0;
}
@media (min-width: 768px) {
  .b {
    grid-area: var(--d);
    justify-content: var(--vd, flex-start);
  }
}

/* Espaço entre elementos de texto do bloco (equivale às margens colapsadas
   do tema original: 1rem entre parágrafos, 2rem junto de títulos) */
.b > * { margin-block: 0; }
.b > * + * { margin-top: 1rem; }
.b > :is(h1, h2, h3, h4, .h1, .h2, .h3, .h4) + *,
.b > * + :is(h1, h2, h3, h4, .h1, .h2, .h3, .h4) { margin-top: 2rem; }

/* Espaço extra no fim do bloco (o original tinha um parágrafo vazio aqui) */
.b--trail { padding-bottom: calc(1rem + 1.3 * var(--fs-normal)); }

/* --ph: cor média da foto, aparece enquanto ela carrega */
.b--img { overflow: hidden; background: var(--ph, transparent); }
.b--img img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.b--img img.contain { object-fit: contain; }

/* Escurecimento leve sobre a imagem (efeito "overlay" do original) */
.b--shade::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .18);
  mix-blend-mode: multiply;
  pointer-events: none;
}

.b--btn .btn {
  flex: 1 1 auto;
  padding-block: 0;
}

/* ---------- Acordeão (Disciplinas extracurriculares) ---------- */
.acc { border-top: 1px solid var(--c-text); }

.acc__item { border-bottom: 1px solid var(--c-text); }

.acc__title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 0 15px;
  list-style: none;
  cursor: pointer;
  font-size: var(--fs-large);
  line-height: normal;
  letter-spacing: calc(var(--fs-normal) * -.02);
}
.acc__title::-webkit-details-marker { display: none; }

.acc__icon {
  position: relative;
  flex: none;
  width: 14px;
  height: 14px;
  transition: transform .7s ease-in-out;
}
/* O "+" gira no hover (efeito da referência) */
@media (hover: hover) {
  .acc__title:hover .acc__icon { transform: rotate(90deg); }
  .acc__item[open] .acc__title:hover .acc__icon { transform: rotate(180deg); }
}
.acc__icon::before,
.acc__icon::after {
  content: "";
  position: absolute;
  top: 6px;
  left: 0;
  width: 14px;
  height: 2px;
  background: currentColor;
  transition: transform .25s;
}
.acc__icon::after { transform: rotate(90deg); }
.acc__item[open] .acc__icon::after { transform: rotate(0deg); }

.acc__desc {
  width: max(70%, min(300px, 100%));
  margin: 16px auto;
  padding-bottom: 30px;
  font-size: var(--fs-large);
  letter-spacing: calc(var(--fs-normal) * -.02);
}
.acc__desc > :first-child { margin-top: 0; }
.acc__desc > :last-child { margin-bottom: 0; }

/* ---------- Rodapé ---------- */
/* Links com sublinhado: no hover a linha sai pela direita e outra entra pela esquerda */
.footer a {
  position: relative;
  text-decoration: none;
}
.footer a::before,
.footer a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -.05em;
  height: 1px;
  background: currentColor;
  transition: transform .5s var(--ease-io);
}
.footer a::before { transform-origin: 100% 50%; }
.footer a::after {
  transform: scaleX(0);
  transform-origin: 0 50%;
}
@media (hover: hover) {
  .footer a:hover::before { transform: scaleX(0); }
  .footer a:hover::after {
    transform: scaleX(1);
    transition-delay: .25s;
  }
}

/* =========================================================================
   Efeitos (versão animada)
   O JavaScript (assets/js/main.js) liga a rolagem suave, o painel de
   carregamento, as animações ao rolar e o parallax. Sem JavaScript, ou com
   "reduzir movimento" ativado no aparelho, o site aparece estático.
   ========================================================================= */

/* ---------- Rolagem suave (Lenis) ---------- */
html.lenis,
html.lenis body { height: auto; }
.lenis:not(.lenis-autoToggle).lenis-stopped { overflow: clip; }
.lenis [data-lenis-prevent] { overscroll-behavior: contain; }
.lenis.lenis-smooth iframe { pointer-events: none; }

/* ---------- Painel de carregamento ----------
   .is-intro: primeira visita da sessão (símbolo aparece, painel sobe)
   .is-leaving: ao clicar num link interno o painel sobe cobrindo a tela
   .is-entering: na página seguinte o painel continua subindo e revela o conteúdo */
.loader { display: none; }
html:is(.is-intro, .is-entering, .is-leaving) .loader {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--c-bright);
}
.loader img {
  width: clamp(70px, 8vw, 120px);
  height: auto;
}
html.is-intro .loader img { animation: loader-symbol 1s var(--ease-out) .1s both; }
/* Segurança: se o JavaScript não assumir, o painel sai sozinho */
html:is(.is-intro, .is-entering) .loader { animation: loader-out .9s var(--ease-io) 3.5s forwards; }

@keyframes loader-symbol {
  from { opacity: 0; transform: scale(.8) rotate(-10deg); }
}
@keyframes loader-out {
  to { transform: translateY(-100%); visibility: hidden; }
}

/* ---------- Entrada dos blocos ao rolar ---------- */
@media (prefers-reduced-motion: no-preference) {
  /* Estado inicial: textos descem 50px com leve inclinação, fotos ficam
     transparentes (mostrando a cor de espera). O JS coloca .is-visible no
     bloco quando ele entra na tela; --i escalona os itens do mesmo bloco. */
  html.js:not(.fx-off) :is(main, .footer) .b:not(.b--img):not(.b--btn) > *,
  html.js:not(.fx-off) :is(main, .footer) .b--btn {
    opacity: 0;
    transform: translateY(50px) skew(0, 2deg);
    transition: transform .9s var(--ease-out), opacity .9s var(--ease-out);
    transition-delay: calc(.1s + var(--i, 0) * .08s);
  }
  html.js:not(.fx-off) :is(main, .footer) .b--img > img,
  html.js:not(.fx-off) .sec__bg {
    opacity: 0;
    transition: opacity 1s var(--ease-out) .15s;
  }

  html.js:not(.fx-off) :is(main, .footer) .b.is-visible:not(.b--img):not(.b--btn) > *,
  html.js:not(.fx-off) :is(main, .footer) .b--btn.is-visible {
    opacity: 1;
    transform: none;
  }
  html.js:not(.fx-off) :is(main, .footer) .b--img.is-visible > img.is-loaded,
  html.js:not(.fx-off) .sec--banner.is-visible .sec__bg.is-loaded { opacity: 1; }

  /* Títulos divididos em letras: quem anima é o GSAP, letra por letra */
  html.js:not(.fx-off) :is(main, .footer) .b:not(.b--img):not(.b--btn) > .fx-split {
    opacity: 1;
    transform: none;
    transition: none;
  }

  /* Segurança: se o JavaScript não carregar em 3,5 s, mostra tudo */
  html.js:not(.fx):not(.fx-off) :is(main, .footer) .b > *,
  html.js:not(.fx):not(.fx-off) :is(main, .footer) .b--btn,
  html.js:not(.fx):not(.fx-off) .sec__bg { animation: fx-show .6s ease 3.5s forwards; }

  @keyframes fx-show {
    to { opacity: 1; transform: none; }
  }

  /* Parallax: a foto se move dentro da moldura; o rodapé "sobe" por trás */
  html.fx :is(.b--img > img:not(.contain), .sec__bg) { will-change: transform; }
  html.fx .footer { overflow: clip; }
}

@media (prefers-reduced-motion: reduce) {
  .menu, .burger span, .acc__icon, .acc__icon::after,
  .btn, .btn::before, .icon svg,
  .header__nav a::after, .menu__nav a::after,
  .footer a::before, .footer a::after { transition: none; }
}
