/* ==========================================================================
   CTEI – Centro Português de Tiflologia · Welcome page
   Cores extraídas do logótipo: verde #008a4d, vermelho #b72e30, preto #231f20
   ========================================================================== */

:root {
  --green: #008a4d;        /* verde do logótipo (formas, pontos Braille) */
  --green-dark: #006b3b;   /* verde para texto/fundos com contraste AA */
  --red: #b72e30;          /* vermelho do logótipo */
  --ink: #231f20;          /* preto do logótipo */
  --steel: #4a5650;        /* texto secundário */
  --mist: #f1f5f2;        /* fundo claro alternado */
  --white: #ffffff;

  --gutter: clamp(1.25rem, 5vw, 3rem);
  --max: 68rem;
}

/* ---------- Base ---------- */

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

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

body {
  margin: 0;
  font-family: "Atkinson Hyperlegible", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-size: 1.125rem;
  line-height: 1.6;
  color: var(--ink);
  background: var(--white);
}

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

.container {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.h2 {
  margin: 0 0 1.25rem;
  font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.5rem);
  line-height: 1.15;
  font-weight: 700;
  color: var(--ink);
}

/* Link de acessibilidade (visível apenas ao receber foco) */
.skip-link {
  position: absolute;
  left: 1rem;
  top: -4rem;
  z-index: 10;
  padding: 0.75rem 1.25rem;
  background: var(--ink);
  color: var(--white);
  font-weight: 700;
  text-decoration: none;
  border-radius: 0 0 0.25rem 0.25rem;
}

.skip-link:focus {
  top: 0;
  outline: 3px solid var(--green);
  outline-offset: 2px;
}

/* ---------- Hero ---------- */

.hero {
  padding: clamp(2.5rem, 7vw, 5rem) 0;
  background: var(--white);
}

.hero__inner {
  width: 100%;
  max-width: var(--max);
  margin-inline: auto;
  padding-inline: var(--gutter);
  display: grid;
  gap: clamp(1.75rem, 4vw, 3rem);
  justify-items: start;
  align-items: center;
}

.hero__logo {
  width: clamp(11rem, 55vw, 15rem);
}

/* Linha vermelha: eco da linha vertical do logótipo */
.hero__rule {
  width: 5rem;
  height: 6px;
  background: var(--red);
}

.hero__title {
  margin: 0 0 1rem;
  font-size: clamp(2.5rem, 1.4rem + 5vw, 4.5rem);
  line-height: 1.05;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.hero__lead {
  margin: 0 0 2rem;
  max-width: 34rem;
  font-size: clamp(1.125rem, 1rem + 0.7vw, 1.4rem);
  line-height: 1.5;
  color: var(--steel);
}

.btn {
  display: inline-block;
  padding: 0.85rem 1.75rem;
  background: var(--green-dark);
  color: var(--white);
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.2;
  text-decoration: none;
  border-radius: 0.25rem;
  transition: background-color 0.2s ease, transform 0.2s ease;
}

.btn:hover {
  background: var(--ink);
  transform: translateY(-1px);
}

.btn:focus-visible {
  outline: 3px solid var(--red);
  outline-offset: 3px;
}

/* ---------- Braille "CTEI" ---------- */

.braille {
  --dot: clamp(0.95rem, 3.6vw, 1.35rem);
  display: flex;
  gap: calc(var(--dot) * 1.1);
  margin: 0 0 2rem;
}

.braille__cell {
  display: grid;
  grid-template-rows: repeat(3, var(--dot));
  grid-auto-flow: column;
  grid-auto-columns: var(--dot);
  gap: calc(var(--dot) * 0.45);
}

.braille__cell i {
  display: block;
  width: 100%;
  height: 100%;
  border: 2px solid rgba(35, 31, 32, 0.22);
  border-radius: 50%;
}

.braille__cell i.on {
  background: var(--green);
  border-color: var(--green);
  animation: raise 0.6s cubic-bezier(0.2, 0.7, 0.3, 1) both;
  animation-delay: calc(var(--c, 0) * 260ms + var(--d, 0) * 70ms + 200ms);
}

/* Atraso por letra e por ponto: os pontos "surgem" em sequência */
.braille__cell:nth-child(1) { --c: 0; }
.braille__cell:nth-child(2) { --c: 1; }
.braille__cell:nth-child(3) { --c: 2; }
.braille__cell:nth-child(4) { --c: 3; }

.braille__cell i:nth-child(1) { --d: 0; }
.braille__cell i:nth-child(2) { --d: 1; }
.braille__cell i:nth-child(3) { --d: 2; }
.braille__cell i:nth-child(4) { --d: 3; }
.braille__cell i:nth-child(5) { --d: 4; }
.braille__cell i:nth-child(6) { --d: 5; }

@keyframes raise {
  from { opacity: 0; transform: scale(0.3); }
  to   { opacity: 1; transform: scale(1); }
}

/* ---------- O que é a tiflologia ---------- */

.intro {
  background: var(--mist);
  padding: clamp(3rem, 7vw, 5rem) 0;
}

.intro__text {
  margin: 0 0 1rem;
  max-width: 40rem;
}

.intro__text--soft {
  margin-bottom: 0;
  color: var(--steel);
}

/* ---------- Áreas de atuação ---------- */

.areas {
  background: var(--white);
  padding: clamp(3rem, 7vw, 5rem) 0;
}

.areas__list {
  list-style: none;
  margin: 2rem 0 0;
  padding: 0;
}

.areas__item {
  display: grid;
  gap: 0.5rem;
  margin: 0;
  padding: 1.5rem 0;
  border-top: 3px solid var(--green);
}

.areas__item:last-child {
  border-bottom: 1px solid rgba(35, 31, 32, 0.2);
}

.areas__name {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.25;
  font-weight: 700;
  color: var(--ink);
}

.areas__desc {
  margin: 0;
  max-width: 38rem;
  color: var(--steel);
}

/* ---------- Aviso ---------- */

.notice {
  background: var(--green-dark);
  color: var(--white);
  padding: clamp(2rem, 5vw, 3rem) 0;
}

.notice__title {
  margin: 0 0 0.35rem;
  font-size: 1.35rem;
  line-height: 1.25;
  font-weight: 800;
  color: var(--white);
}

.notice__text {
  margin: 0;
  max-width: 40rem;
}

/* ---------- Rodapé ---------- */

.footer {
  background: var(--ink);
  color: #d8dcd9;
  padding: 1.5rem 0;
  font-size: 0.95rem;
}

.footer__text {
  margin: 0;
}

/* ---------- Tablet e desktop ---------- */

@media (min-width: 48rem) {
  .areas__item {
    grid-template-columns: minmax(12rem, 1fr) 2fr;
    gap: 2rem;
    align-items: baseline;
  }
}

@media (min-width: 56rem) {
  .hero__inner {
    grid-template-columns: auto 6px 1fr;
    justify-items: stretch;
  }

  .hero__logo {
    width: clamp(14rem, 24vw, 19rem);
  }

  .hero__rule {
    width: 6px;
    height: 100%;
    min-height: 12rem;
    justify-self: center;
  }

  .braille {
    --dot: clamp(1.1rem, 1.8vw, 1.5rem);
  }
}

/* ---------- Preferências do utilizador ---------- */

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

  .braille__cell i.on {
    animation: none;
  }

  .btn {
    transition: none;
  }

  .btn:hover {
    transform: none;
  }
}

@media (forced-colors: active) {
  .braille__cell i.on {
    background: Highlight;
    border-color: Highlight;
  }

  .hero__rule {
    background: CanvasText;
  }
}
