/* 03 · A história (#historia). Dono: maestro. Céu de aurora; no computador a seção fica presa enquanto rola. */

.historia.secao {
  position: relative; overflow: hidden; isolation: isolate;
  min-height: 100vh; min-height: 100svh;
  padding: calc(var(--nav-altura) + clamp(28px, 5vh, 60px)) var(--margem) clamp(36px, 6vh, 72px);
  color: var(--creme);
  background: linear-gradient(180deg, #1a0d07 0%, #2a130a 34%, #4d2213 66%, #7a3519 100%);
}

/* ---------- céu: sol que nasce, raios e bruma ---------- */
.historia__ceu { position: absolute; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.historia__sol {
  position: absolute; left: 70%; top: 58%;
  width: min(110vh, 1000px); aspect-ratio: 1; translate: -50% -50%;
  border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 226, 160, 1) 0%, rgba(255, 200, 112, .88) 14%, rgba(240, 150, 64, .55) 36%, rgba(200, 70, 40, .2) 62%, transparent 100%);
  will-change: transform;
}
.historia__raios {
  position: absolute; left: 70%; top: 58%;
  width: 135vmax; aspect-ratio: 1; translate: -50% -50%;
  background: repeating-conic-gradient(from 0deg, rgba(255, 196, 107, .12) 0deg 3deg, transparent 3deg 14deg);
  -webkit-mask: radial-gradient(closest-side, #000 10%, transparent 88%);
  mask: radial-gradient(closest-side, #000 10%, transparent 88%);
  opacity: .55; will-change: transform;
}
.historia__bruma {
  position: absolute; inset: auto 0 0 0; height: 45%;
  background: linear-gradient(0deg, rgba(122, 53, 25, .85), transparent);
}

/* ---------- palco: duas colunas ---------- */
.historia__palco {
  position: relative; max-width: 1320px; margin-inline: auto; height: 100%;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.02fr); gap: clamp(24px, 4vw, 72px);
  align-items: center;
}
.historia__texto { position: relative; z-index: 2; }
.historia__sobre { color: var(--sol); margin-bottom: .6em; }

/* odômetro */
.historia__ano {
  display: flex; font-family: var(--fonte-titulo); font-weight: 800; line-height: 1;
  font-size: min(13.5vw, 25vh, 13rem); letter-spacing: -.04em;
  font-variation-settings: "SOFT" 100, "WONK" 0, "opsz" 144;
  margin-left: -.04em;
}
.historia__digito { display: block; height: 1em; overflow: hidden; width: .64em; text-align: center; }
.historia__fita { display: flex; flex-direction: column; will-change: transform; }
.historia__fita span {
  display: block; height: 1em;
  background: linear-gradient(180deg, #ffe2a6 0%, var(--sol) 40%, var(--aurora) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* linha do tempo */
.historia__tempo {
  display: flex; align-items: center; gap: 14px; margin: clamp(6px, 1.2vh, 14px) 0 clamp(18px, 3vh, 34px);
  font-size: .78rem; font-weight: 700; letter-spacing: .14em; color: var(--creme-suave);
  max-width: 520px;
}
.historia__trilho { position: relative; flex: 1; height: 2px; border-radius: 2px; background: rgba(255, 246, 232, .18); }
.historia__preenche { position: absolute; inset: 0; border-radius: inherit; background: linear-gradient(90deg, var(--aurora), var(--girassol)); transform: scaleX(0); transform-origin: 0 50%; }
.historia__ponto {
  position: absolute; top: 50%; left: 0; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%;
  background: var(--girassol); box-shadow: 0 0 0 5px rgba(242, 179, 33, .22), 0 0 18px rgba(242, 179, 33, .7);
}

.historia__titulo {
  font-size: clamp(2.2rem, min(4.4vw, 7.4vh), 4.6rem); font-weight: 560; line-height: 1.02; max-width: 13ch;
  margin-bottom: clamp(16px, 2.8vh, 30px);
}
.historia__titulo em { font-style: italic; font-weight: 300; color: var(--sol); }
.historia__paragrafos { display: grid; gap: clamp(8px, 1.4vh, 14px); max-width: 33rem; }
.historia__p { margin: 0; font-size: clamp(1rem, .55vw + .75rem, 1.22rem); line-height: 1.45; color: rgba(255, 246, 232, .9); text-wrap: pretty; }
.historia__p--forte { font-family: var(--fonte-titulo); font-style: italic; font-size: clamp(1.2rem, 1.6vw, 1.6rem); line-height: 1.2; color: var(--creme); font-variation-settings: "SOFT" 100, "opsz" 36; }
.historia__destaque {
  font-family: var(--fonte-mao); font-weight: 700; font-size: 1.35em; color: var(--sol); white-space: nowrap;
  /* a letra de mão maior não pode abrir espaço entre as linhas do parágrafo */
  line-height: 1; display: inline-block; vertical-align: -.06em;
}

/* ---------- colagem: retrato, polaroides, bilhete ---------- */
.historia__colagem {
  position: relative; z-index: 1; justify-self: center;
  width: min(100%, 600px); height: min(78vh, 720px);
}
.historia__retrato {
  position: absolute; left: 50%; top: 4%; margin: 0;
  width: min(66%, 52vh); aspect-ratio: 1000 / 1338; translate: -50% 0;
}
.historia__moldura {
  position: absolute; inset: -16px; width: calc(100% + 32px); height: calc(100% + 32px); overflow: visible;
}
.historia__moldura path { fill: none; stroke: var(--sol); stroke-width: 1.5; opacity: .75; }
.historia__arco {
  position: absolute; inset: 0; overflow: hidden;
  border-radius: 50% 50% 12px 12px / 37.4% 37.4% 12px 12px;
  clip-path: circle(80% at 50% 36%);
  box-shadow: 0 40px 80px -30px rgba(20, 12, 7, .8);
  background: #3a2416;
}
.historia__arco img {
  width: 100%; height: 100%; object-fit: cover; object-position: 50% 20%;
  filter: sepia(.5) saturate(1.3) contrast(1.08) brightness(.93) hue-rotate(-6deg);
  transform-origin: 50% 35%;
}
.historia__arco::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(70% 45% at 92% 6%, rgba(255, 170, 80, .7), transparent 70%),
    radial-gradient(120% 80% at 50% 30%, transparent 40%, rgba(90, 30, 12, .55) 100%),
    linear-gradient(180deg, rgba(233, 137, 59, .42) 0%, rgba(200, 80, 45, .2) 50%, rgba(40, 16, 8, .6) 100%);
  mix-blend-mode: multiply;
}

.historia__polaroide {
  position: absolute; margin: 0; padding: 10px 10px 0; background: #fbf6ec; color: var(--tinta);
  box-shadow: 0 24px 40px -18px rgba(20, 12, 7, .75), 0 2px 4px rgba(20, 12, 7, .2);
  will-change: transform;
}
.historia__polaroide img { width: 100%; height: auto; object-fit: cover; filter: saturate(1.05) contrast(1.03); }
.historia__polaroide figcaption { font-size: clamp(1.15rem, 1.5vw, 1.45rem); line-height: 1.1; padding: 8px 4px 12px; text-align: center; color: #3a2a1c; }
.historia__polaroide--kombi { width: min(31%, 25vh); right: -2%; top: -1%; rotate: 7deg; }
.historia__polaroide--kombi img { aspect-ratio: 3 / 4; object-position: 50% 40%; }
.historia__polaroide--chuva { width: min(52%, 40vh); left: -6%; bottom: 13%; rotate: -6deg; }
.historia__polaroide--chuva img { aspect-ratio: 4 / 3; object-position: 40% 50%; }
.historia__fita-adesiva {
  position: absolute; left: 50%; top: -12px; width: 86px; height: 26px; translate: -50% 0; rotate: -4deg;
  background: linear-gradient(90deg, rgba(232, 211, 181, .78), rgba(244, 228, 200, .9), rgba(232, 211, 181, .78));
  box-shadow: 0 1px 2px rgba(0, 0, 0, .15);
  -webkit-mask: linear-gradient(90deg, transparent 0 2px, #000 2px calc(100% - 2px), transparent calc(100% - 2px)), repeating-linear-gradient(180deg, #000 0 3px, transparent 3px 4px);
  -webkit-mask-composite: source-over;
}
.historia__polaroide--chuva .historia__fita-adesiva { rotate: 5deg; left: 30%; }

.historia__bilhete {
  position: absolute; right: 0%; bottom: 0%; isolation: isolate;
  width: min(48%, 290px); padding: 30px 22px 22px;
  color: #2b1d12;
  rotate: -4deg; transform-origin: 50% 0;
  filter: drop-shadow(0 18px 18px rgba(20, 12, 7, .5));
}
.historia__bilhete::before { /* papelão kraft com as bordas tortas */
  content: ""; position: absolute; inset: 0; z-index: -1; border-radius: 4px;
  background:
    radial-gradient(120% 90% at 20% 10%, rgba(255, 255, 255, .2), transparent 60%),
    repeating-linear-gradient(0deg, rgba(140, 106, 71, .09) 0 1px, transparent 1px 5px),
    var(--kraft);
  clip-path: polygon(0 4%, 3% 0, 97% 1%, 100% 5%, 99% 97%, 95% 100%, 4% 99%, 0 95%);
}
.historia__furo { position: absolute; top: 12px; left: 50%; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: #2a130a; box-shadow: inset 0 1px 2px rgba(0, 0, 0, .6); }
.historia__barbante { position: absolute; left: 50%; top: -60px; width: 2px; height: 74px; margin-left: -1px; background: repeating-linear-gradient(180deg, #d9c19a 0 3px, #b89a6c 3px 6px); }
.historia__bilhete-texto { margin: 0; font-size: clamp(1.7rem, 2.4vw, 2.3rem); line-height: 1.02; transform: rotate(-2deg); }
.historia__bilhete-texto span { display: block; clip-path: inset(-10% -4% -18% -4%); }

/* ---------- computador baixo (1366x768, 1280x720 do projetor, 947x585): a seção presa tem que caber
   inteira, e a última frase não pode descer até o canto de baixo (onde fica o botão do Raio-X) ---------- */
@media (min-width: 901px) and (max-height: 780px) {
  .historia.secao { padding-top: calc(var(--nav-altura) + clamp(12px, 2.4vh, 28px)); padding-bottom: 76px; }
  .historia__ano { font-size: min(13.5vw, 17vh, 13rem); }
  .historia__tempo { margin: 4px 0 clamp(12px, 2vh, 20px); }
  .historia__titulo { font-size: clamp(2rem, 6.4vh, 3.4rem); margin-bottom: clamp(10px, 1.8vh, 18px); }
  .historia__p { font-size: clamp(.95rem, .5vw + .62rem, 1.08rem); line-height: 1.38; }
  .historia__p--forte { font-size: clamp(1.1rem, 1.4vw, 1.4rem); line-height: 1.2; }
}

/* ---------- celular: sem pin, uma coluna ---------- */
@media (max-width: 900px) {
  .historia.secao { padding-top: clamp(110px, 18vw, 150px); padding-bottom: 90px; background: linear-gradient(180deg, #1a0d07 0%, #2a130a 26%, #4d2213 58%, #7a3519 100%); }
  .historia__palco { grid-template-columns: 1fr; gap: 56px; }
  .historia__sol { left: 50%; top: 72%; width: 140vw; }
  .historia__raios { left: 50%; top: 72%; }
  .historia__ano { font-size: clamp(5rem, 27vw, 9rem); }
  .historia__titulo { font-size: clamp(2.3rem, 10.5vw, 3.4rem); }
  .historia__colagem { width: 100%; max-width: 460px; height: auto; aspect-ratio: 390 / 560; }
  .historia__retrato { width: 64%; top: 6%; }
  .historia__polaroide--kombi { width: 34%; right: -1%; top: 0; }
  .historia__polaroide--chuva { width: 56%; left: -2%; bottom: 14%; }
  .historia__polaroide { padding: 7px 7px 0; }
  .historia__polaroide figcaption { font-size: 1.05rem; padding: 6px 2px 9px; }
  .historia__bilhete { width: 54%; right: 0; bottom: 0; padding: 26px 16px 16px; }
  .historia__bilhete-texto { font-size: 1.6rem; }
  .historia__barbante { top: -40px; height: 52px; }
}

@media (prefers-reduced-motion: reduce) {
  .historia__arco { clip-path: none; }
}
