:root {
  color-scheme: dark;
  font-synthesis: none;
  --ease: cubic-bezier(.16, 1, .3, 1);
}

@font-face {
  font-family: "Oswald Sermão";
  src: url("assets/Oswald-Variable.ttf") format("truetype");
  font-weight: 200 700;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Cinzel Sermão";
  src: url("assets/Cinzel-Variable.ttf") format("truetype");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}

* { box-sizing: border-box; }

html, body { width: 100%; height: 100%; margin: 0; }

body {
  overflow: hidden;
  background: var(--stage);
  color: var(--ink);
  font-family: var(--body);
  -webkit-font-smoothing: antialiased;
}

body::selection, mark::selection { background: var(--accent); color: var(--accent-ink); }

.deck { position: relative; width: 100vw; height: 100dvh; overflow: hidden; isolation: isolate; }

.slide {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: clamp(3rem, 6vw, 7.5rem) clamp(4rem, 8vw, 10rem);
  overflow: hidden;
  background-color: var(--surface);
  background-image: var(--plate), var(--shade);
  background-size: cover;
  background-position: center;
  opacity: 0;
  visibility: hidden;
  transform: translate3d(3.5%, 0, 0) scale(.985);
  transition: opacity 420ms var(--ease), transform 620ms var(--ease), visibility 0s linear 620ms;
}

.slide::before,
.slide::after {
  content: "";
  position: absolute;
  pointer-events: none;
  z-index: 0;
}

.slide::before {
  inset: 0;
  background: var(--atmosphere);
  opacity: 0;
  transition: opacity 850ms var(--ease);
}

.slide::after { opacity: 0; }

.slide.is-before { transform: translate3d(-3.5%, 0, 0) scale(.985); }

.slide.is-active {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition-delay: 0s;
  z-index: 2;
}

.slide.is-active::before { opacity: 1; }

.slide-content {
  position: relative;
  z-index: 1;
  width: min(78vw, 1240px);
  max-width: 100%;
}

.cover .slide-content,
.section .slide-content,
.word .slide-content,
.phrase .slide-content,
.end .slide-content { text-align: left; }

h1, h2, p, blockquote, cite, figure { margin: 0; }

.cover h1 {
  max-width: 11ch;
  font-family: var(--display);
  font-size: clamp(4.6rem, 9vw, 10rem);
  font-weight: var(--display-weight);
  line-height: .88;
  letter-spacing: -.035em;
  text-wrap: balance;
}

.reference {
  display: inline-flex;
  align-items: center;
  gap: 1rem;
  margin-top: clamp(2rem, 4vh, 3.25rem);
  font-size: clamp(1.35rem, 2vw, 2.3rem);
  font-weight: 700;
  letter-spacing: .04em;
}

.reference::before {
  content: "";
  width: clamp(2.5rem, 5vw, 5rem);
  height: .38rem;
  background: var(--accent);
}

.section h2 {
  max-width: 12ch;
  font-family: var(--display);
  font-size: clamp(5.8rem, 12vw, 13rem);
  font-weight: var(--display-weight);
  line-height: .82;
  letter-spacing: -.035em;
  text-wrap: balance;
}

.section h2::after {
  content: "";
  display: block;
  width: min(42vw, 32rem);
  height: .55rem;
  margin-top: 2rem;
  background: var(--accent);
  transform-origin: left;
}

.section.is-active h2::after { animation: ruleIn 850ms 250ms var(--ease) both; }

.verse .slide-content { width: min(74vw, 1160px); }

.verse blockquote {
  font-family: var(--reading);
  font-size: clamp(2.45rem, 4.55vw, 5.3rem);
  line-height: 1.13;
  letter-spacing: -.02em;
  text-wrap: pretty;
}

.verse.dense blockquote { font-size: clamp(2rem, 3.6vw, 4rem); line-height: 1.16; }
.verse.compact blockquote { font-size: clamp(2.25rem, 4.1vw, 4.7rem); }

mark {
  color: var(--mark-ink);
  background: linear-gradient(transparent 54%, var(--mark) 54%, var(--mark) 94%, transparent 94%);
  padding: 0 .06em;
  font-weight: 800;
}

.verse cite {
  display: block;
  margin-top: clamp(1.5rem, 3vh, 2.4rem);
  font-family: var(--body);
  font-size: clamp(1.15rem, 1.8vw, 1.85rem);
  font-style: normal;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}

.verse-num { font-size: .58em; vertical-align: super; margin-right: .18em; color: var(--muted); }

.word .slide-content,
.end .slide-content { width: 84vw; }

.word h2,
.end h2 {
  font-family: var(--display);
  font-size: clamp(8rem, 20vw, 23rem);
  font-weight: var(--display-weight);
  line-height: .72;
  letter-spacing: -.05em;
  text-transform: uppercase;
}

.word.long-word h2,
.end.long-word h2 {
  font-size: clamp(5rem, 10vw, 11rem);
  letter-spacing: -.035em;
}

.word.is-active h2 { animation: wordIn 850ms var(--ease) both; }

.phrase blockquote {
  max-width: 15ch;
  font-family: var(--display);
  font-size: clamp(4.2rem, 8vw, 9rem);
  font-weight: var(--display-weight);
  line-height: .94;
  letter-spacing: -.035em;
  text-wrap: balance;
}

.media { padding: clamp(2rem, 4vw, 4.5rem); }

.media .slide-content { width: min(86vw, 1480px); height: min(76vh, 820px); }

.media-shell {
  position: relative;
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--frame-bg);
  border: var(--frame-border);
  box-shadow: var(--frame-shadow);
  border-radius: var(--frame-radius);
}

.media-shell img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; object-fit: cover; object-position: center; }
.media.contain .media-shell img { object-fit: contain; padding: clamp(.5rem, 1vw, 1rem); }

.chrome {
  position: fixed;
  z-index: 20;
  inset: auto 0 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.2rem 1.15rem;
  color: var(--chrome-ink);
  opacity: .2;
  transition: opacity 200ms ease;
}

body:hover .chrome,
.chrome:focus-within { opacity: 1; }

.controls { display: flex; gap: .45rem; }

.controls button {
  width: 2.8rem;
  height: 2.8rem;
  display: grid;
  place-items: center;
  color: inherit;
  background: var(--chrome-bg);
  border: 1px solid var(--chrome-line);
  border-radius: .8rem;
  cursor: pointer;
}

.controls button:hover { background: var(--accent); color: var(--accent-ink); }
.controls button:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.controls svg { width: 1.15rem; fill: none; stroke: currentColor; stroke-width: 1.8; }

.counter {
  font-variant-numeric: tabular-nums;
  font-size: .86rem;
  font-weight: 800;
  letter-spacing: .08em;
  padding: .65rem .8rem;
  background: var(--chrome-bg);
  border: 1px solid var(--chrome-line);
  border-radius: .7rem;
}

.progress { position: fixed; z-index: 21; left: 0; bottom: 0; width: 100%; height: 4px; background: color-mix(in srgb, var(--accent) 15%, transparent); }
.progress span { display: block; height: 100%; width: 100%; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform 380ms var(--ease); }

.theme-mar {
  --stage: #071d2b;
  --surface: #eeeae2;
  --plate: url("assets/fundo-mar.png");
  --shade: linear-gradient(90deg, rgba(246,243,237,.12) 0 64%, rgba(2,18,29,.06));
  --atmosphere: radial-gradient(circle at 65% 50%, rgba(243,190,27,.07), transparent 38%);
  --sweep: rgba(241,188,26,.32);
  --ink: #171a1d;
  --muted: #344652;
  --accent: #e3af19;
  --accent-ink: #11171b;
  --mark: rgba(236,186,31,.82);
  --mark-ink: #101519;
  --display: "Oswald Sermão", "Arial Narrow", sans-serif;
  --reading: "Bahnschrift", "Segoe UI", sans-serif;
  --body: "Bahnschrift", "Segoe UI", sans-serif;
  --display-weight: 800;
  --frame-bg: #071d2b;
  --frame-border: 8px solid rgba(246,243,237,.92);
  --frame-shadow: 0 24px 70px rgba(0,25,40,.34);
  --frame-radius: 1.8rem;
  --chrome-bg: rgba(239,236,228,.88);
  --chrome-line: rgba(20,29,34,.16);
  --chrome-ink: #172027;
}

.theme-vitral {
  --stage: #020712;
  --surface: #050b18;
  --plate: url("assets/fundo-vitral.png");
  --shade: linear-gradient(90deg, rgba(1,7,16,.06) 0 67%, rgba(1,5,12,.02));
  --atmosphere: radial-gradient(circle at 78% 34%, rgba(244,172,33,.18), transparent 32%);
  --sweep: rgba(255,190,48,.34);
  --ink: #fff2d1;
  --muted: #d9c79f;
  --accent: #f2ad2b;
  --accent-ink: #09101b;
  --mark: rgba(243,170,37,.78);
  --mark-ink: #fff7e4;
  --display: "Cinzel Sermão", Cambria, Georgia, serif;
  --reading: Cambria, Georgia, serif;
  --body: "Trebuchet MS", "Segoe UI", sans-serif;
  --display-weight: 700;
  --frame-bg: #020711;
  --frame-border: 7px solid #b98526;
  --frame-shadow: 0 0 0 5px #050915, 0 22px 80px rgba(0,0,0,.7), inset 0 0 35px rgba(241,170,35,.12);
  --frame-radius: 0;
  --chrome-bg: rgba(2,8,18,.86);
  --chrome-line: rgba(242,173,43,.38);
  --chrome-ink: #fff0cd;
}

.theme-pedra {
  --stage: #171714;
  --surface: #d8c7a9;
  --plate: url("assets/fundo-pedra.png");
  --shade: linear-gradient(90deg, rgba(232,217,189,.03) 0 67%, rgba(22,22,20,.04));
  --atmosphere: linear-gradient(110deg, transparent 26%, rgba(255,236,184,.16) 48%, transparent 62%);
  --sweep: rgba(255,222,150,.22);
  --ink: #1c1a16;
  --muted: #5a4c38;
  --accent: #9b6420;
  --accent-ink: #fff8e8;
  --mark: rgba(177,112,30,.7);
  --mark-ink: #1b1710;
  --display: "Cinzel Sermão", Cambria, Georgia, serif;
  --reading: Cambria, Georgia, serif;
  --body: "Trebuchet MS", "Segoe UI", sans-serif;
  --display-weight: 700;
  --frame-bg: #22211d;
  --frame-border: 8px solid #87602d;
  --frame-shadow: 0 0 0 12px rgba(210,191,156,.72), 0 24px 62px rgba(22,18,12,.34);
  --frame-radius: .15rem;
  --chrome-bg: rgba(224,209,181,.9);
  --chrome-line: rgba(38,31,22,.2);
  --chrome-ink: #29231a;
}

.theme-vitral .verse mark { background: none; color: #ffb52f; text-shadow: 0 0 20px rgba(255,174,39,.28); }
.theme-pedra .verse mark { background: none; color: #8c5416; text-decoration: underline; text-decoration-color: rgba(154,98,32,.7); text-decoration-thickness: .1em; text-underline-offset: .12em; }
.theme-vitral .verse .slide-content,
.theme-pedra .verse .slide-content { width: min(66vw, 1060px); transform: translateX(-4vw); }
.theme-vitral .word h2, .theme-vitral .end h2 { color: #ffd78a; text-shadow: 0 0 36px rgba(236,163,30,.25); }

.theme-pedra .cover h1,
.theme-pedra .section h2,
.theme-pedra .word h2,
.theme-pedra .end h2 {
  position: relative;
  display: inline-block;
  color: #74542e;
  -webkit-text-stroke: .7px rgba(68, 43, 20, .62);
  text-shadow:
    -2px -2px 1px rgba(53, 34, 17, .76),
    2px 2px 1px rgba(255, 243, 207, .78),
    0 1px 2px rgba(62, 42, 22, .34);
  mix-blend-mode: multiply;
}

.theme-pedra .cover h1::before,
.theme-pedra .section h2::before,
.theme-pedra .word h2::before,
.theme-pedra .end h2::before {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  z-index: -1;
  color: transparent;
  -webkit-text-stroke: 2px rgba(255, 240, 200, .38);
  transform: translate(2px, 2px);
  filter: blur(.35px);
  pointer-events: none;
}

.theme-pedra .reference {
  color: #644620;
  text-shadow: 1px 1px 0 rgba(255, 244, 211, .7), -1px -1px 1px rgba(62, 39, 17, .36);
}

.theme-mar .slide::after {
  left: -26vw;
  bottom: -11vh;
  width: 50vw;
  height: 34vh;
  border-radius: 48% 52% 0 0;
  background: radial-gradient(ellipse at 50% 100%, rgba(0, 98, 126, .28), rgba(227, 175, 25, .14) 42%, transparent 70%);
  transform: rotate(-5deg);
}

.theme-mar .slide.is-active::after { animation: tideDrift 2200ms 120ms var(--ease) both; }

.theme-vitral .slide::after {
  top: -38vh;
  left: 58vw;
  width: 26vw;
  height: 176vh;
  background: linear-gradient(90deg, transparent, rgba(255, 185, 51, .22), rgba(97, 181, 220, .12), transparent);
  transform: rotate(18deg) translateY(-12vh);
  filter: blur(2px);
}

.theme-vitral .slide.is-active::after { animation: refractedLight 1800ms 160ms var(--ease) both; }

.theme-pedra .slide::after {
  top: -15%;
  bottom: -15%;
  left: -28%;
  width: 34%;
  background: linear-gradient(90deg, transparent, rgba(255, 234, 181, .3), rgba(116, 82, 37, .08), transparent);
  transform: skewX(-8deg);
  filter: blur(1px);
}

.theme-pedra .slide.is-active::after { animation: rakingLight 1900ms 100ms var(--ease) both; }

@keyframes tideDrift {
  from { transform: translate3d(-14vw, 5vh, 0) rotate(-7deg) scale(.9); opacity: 0; }
  38% { opacity: .72; }
  to { transform: translate3d(118vw, -4vh, 0) rotate(3deg) scale(1.18); opacity: 0; }
}

@keyframes refractedLight {
  from { transform: rotate(18deg) translate3d(-18vw, -15vh, 0); opacity: 0; }
  32% { opacity: .8; }
  to { transform: rotate(18deg) translate3d(44vw, 14vh, 0); opacity: 0; }
}

@keyframes rakingLight {
  from { transform: translateX(-15vw) skewX(-8deg); opacity: 0; }
  28% { opacity: .78; }
  to { transform: translateX(158vw) skewX(-8deg); opacity: 0; }
}
@keyframes wordIn { from { opacity: 0; transform: scale(.88); filter: blur(12px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes ruleIn { from { transform: scaleX(0); } to { transform: scaleX(1); } }

@media (max-aspect-ratio: 4/3) {
  .slide { padding: 3.5rem 2.2rem; background-position: right center; }
  .slide-content, .verse .slide-content { width: 88vw; }
  .cover .slide-content { align-self: start; margin-top: 7vh; }
  .cover h1 { max-width: 8.4ch; text-shadow: 0 2px 20px color-mix(in srgb, var(--surface) 72%, transparent); }
  .cover h1 { font-size: clamp(4rem, 12vw, 7rem); }
  .section h2 { font-size: clamp(4.2rem, 14vw, 8rem); }
  .verse blockquote, .verse.compact blockquote { font-size: clamp(2rem, 5.8vw, 3.4rem); }
  .verse.dense blockquote { font-size: clamp(1.7rem, 4.7vw, 2.8rem); }
  .media .slide-content { width: 90vw; height: 66vh; }
  .word h2, .end h2 { font-size: clamp(4rem, 22vw, 8rem); line-height: .82; }
  .word.long-word h2, .end.long-word h2 { font-size: clamp(2.25rem, 10.5vw, 4.8rem); letter-spacing: -.025em; }
  .theme-pedra .cover .slide-content {
    width: min(88vw, 23rem);
    padding: 1.15rem 1.2rem 1.35rem;
    margin-left: -.7rem;
    background: linear-gradient(105deg, rgba(232, 216, 184, .96), rgba(218, 196, 157, .86));
    border: 1px solid rgba(92, 62, 29, .36);
    box-shadow: 0 14px 34px rgba(23, 18, 12, .26);
  }
  .theme-pedra .cover .reference { color: #4d3418; text-shadow: 1px 1px 0 rgba(255,244,211,.72); }
  .theme-pedra .cover h1 {
    max-width: 7.4ch;
    font-size: clamp(3.3rem, 13.2vw, 4.3rem);
    text-shadow: -1px -1px 1px rgba(53,34,17,.76), 1px 1px 1px rgba(255,243,207,.78), 0 1px 2px rgba(62,42,22,.3);
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; scroll-behavior: auto !important; }
}

@page { size: 13.333in 7.5in; margin: 0; }

@media print {
  html, body { width: 13.333in; height: auto; overflow: visible; }
  .deck { width: 13.333in; height: auto; }
  .slide, .slide.is-active, .slide.is-before {
    position: relative;
    width: 13.333in;
    height: 7.5in;
    opacity: 1;
    visibility: visible;
    transform: none;
    page-break-after: always;
    break-after: page;
  }
  .slide::after, .chrome, .progress { display: none; }
}
