/*
 * Raio-X experience layer
 * Shared visual and interaction rules for the gate, lesson hub and five lessons.
 */

:root {
  --rx-shell: 1180px;
  --rx-accent-soft: rgba(177, 210, 67, .12);
  --rx-accent-line: rgba(177, 210, 67, .34);
  --rx-elevated: #171917;
  --rx-shadow: 0 24px 70px rgba(0, 0, 0, .32);
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 88px;
}

body {
  background:
    radial-gradient(900px 520px at 82% -120px, rgba(177, 210, 67, .11), transparent 66%),
    radial-gradient(720px 520px at -12% 32%, rgba(177, 210, 67, .045), transparent 65%),
    var(--bg-base);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: .16;
  background-image:
    linear-gradient(rgba(255, 255, 255, .025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: linear-gradient(to bottom, #000, transparent 72%);
}

a,
button,
input,
summary {
  -webkit-tap-highlight-color: transparent;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 3px solid rgba(177, 210, 67, .55) !important;
  outline-offset: 3px;
}

/* Shared header */
.triade-topbar,
.raiox-topbar {
  border-bottom-color: rgba(255, 255, 255, .08);
  box-shadow: 0 10px 40px rgba(0, 0, 0, .18);
}

.triade-topbar {
  min-height: 64px;
  padding-inline: max(24px, calc((100vw - var(--rx-shell)) / 2));
}

.triade-topbar img {
  height: 30px;
}

/* Gate */
body.rx-gate .wrap {
  width: min(100%, var(--rx-shell));
  max-width: none;
  padding: 0 24px 72px;
}

.rx-gate-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(380px, .72fr);
  gap: clamp(48px, 7vw, 92px);
  align-items: center;
  min-height: calc(100vh - 64px);
  padding: 64px 0;
}

body.rx-gate header.top {
  padding: 0;
  text-align: left;
}

body.rx-gate .logo-badge {
  width: 70px;
  height: 70px;
  margin: 0 0 28px;
  padding: 13px;
  border: 1px solid var(--rx-accent-line);
  border-radius: 20px;
  background: var(--rx-accent-soft);
  box-shadow: inset 0 0 30px rgba(177, 210, 67, .06);
}

body.rx-gate h1.title {
  max-width: 13ch;
  font-size: clamp(40px, 5.4vw, 68px);
  line-height: 1.01;
  margin-bottom: 24px;
}

body.rx-gate h1.title br {
  display: none;
}

body.rx-gate .sub {
  max-width: 58ch;
  font-size: 18px;
}

.rx-proof-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.rx-proof {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-dim);
  background: rgba(255, 255, 255, .025);
  font-size: 13px;
  font-weight: 600;
}

.rx-proof::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(177, 210, 67, .7);
}

body.rx-gate .form-card {
  position: relative;
  margin: 0;
  padding: 34px;
  border-color: rgba(255, 255, 255, .13);
  background: linear-gradient(155deg, rgba(255, 255, 255, .035), transparent 35%), var(--bg-card);
  box-shadow: var(--rx-shadow);
}

body.rx-gate .form-card::before {
  content: "Acesso imediato";
  display: inline-flex;
  margin-bottom: 22px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}

body.rx-gate .field label {
  color: var(--ink);
  font-size: 13px;
}

body.rx-gate .field input {
  min-height: 49px;
  border-color: rgba(255, 255, 255, .13);
  background: #111311;
}

body.rx-gate .field input:hover {
  border-color: rgba(255, 255, 255, .22);
}

body.rx-gate .btn-primary {
  min-height: 52px;
  box-shadow: 0 12px 30px rgba(177, 210, 67, .15);
}

.rx-form-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  margin: 13px 0 0;
  color: var(--ink-faint);
  font-size: 12px;
  text-align: center;
}

.rx-form-note svg {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
}

body.rx-gate footer {
  padding-bottom: 24px;
}

/* Lesson hub */
body.rx-hub .wrap {
  width: min(100%, var(--rx-shell));
  max-width: none;
  padding: 0 24px 88px;
}

body.rx-hub .welcome-banner {
  width: min(100%, var(--rx-shell));
  max-width: none;
  margin-top: 26px;
  text-align: left;
}

body.rx-hub header.top {
  max-width: 780px;
  padding: 52px 0 22px;
  text-align: left;
}

body.rx-hub h1.title {
  max-width: 13ch;
  font-size: clamp(40px, 6vw, 66px);
  line-height: 1.02;
}

body.rx-hub .sub {
  max-width: 62ch;
  font-size: 18px;
}

body.rx-hub .aula-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin: 36px 0 68px;
}

body.rx-hub .aula-card {
  position: relative;
  min-height: 220px;
  padding: 28px;
  align-items: flex-start;
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, .025), transparent 42%),
    var(--bg-card);
  transition: border-color .2s ease, transform .2s ease, background .2s ease;
}

body.rx-hub .aula-card::after {
  content: "";
  position: absolute;
  width: 180px;
  height: 180px;
  right: -90px;
  bottom: -110px;
  border: 1px solid rgba(177, 210, 67, .13);
  border-radius: 50%;
  transition: transform .3s ease, border-color .3s ease;
}

body.rx-hub .aula-card:hover {
  transform: translateY(-4px);
  background: var(--rx-elevated);
  box-shadow: 0 20px 46px rgba(0, 0, 0, .2);
}

body.rx-hub .aula-card:hover::after {
  transform: scale(1.18);
  border-color: rgba(177, 210, 67, .32);
}

body.rx-hub .aula-card:first-child {
  grid-column: span 2;
  min-height: 190px;
}

body.rx-hub .aula-card .num {
  width: 52px;
  height: 52px;
  border: 1px solid rgba(177, 210, 67, .22);
  font-size: 18px;
}

body.rx-hub .aula-card .info h3 {
  max-width: 29ch;
  font-size: clamp(20px, 2.4vw, 27px);
  line-height: 1.18;
  margin-bottom: 12px;
}

body.rx-hub .aula-card .info p {
  max-width: 52ch;
  line-height: 1.55;
}

body.rx-hub .aula-card .arrow {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 50%;
  transition: background .2s ease, color .2s ease, transform .2s ease;
}

body.rx-hub .aula-card:hover .arrow {
  color: var(--navy-950);
  background: var(--accent);
  transform: translateX(3px);
}

.rx-card-topic {
  display: block;
  margin-bottom: 9px;
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

/* Lessons */
body.rx-lesson {
  padding-top: 64px;
  padding-bottom: 118px;
}

body.rx-lesson .wrap {
  width: min(100%, 1140px);
  max-width: none;
  padding-inline: 24px;
}

body.rx-lesson .raiox-topbar {
  min-height: 64px;
  padding-inline: max(20px, calc((100vw - var(--rx-shell)) / 2));
}

.rx-reading-progress {
  position: fixed;
  top: 63px;
  left: 0;
  right: 0;
  z-index: 10000;
  height: 2px;
  background: rgba(255, 255, 255, .055);
  pointer-events: none;
}

.rx-reading-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  box-shadow: 0 0 12px rgba(177, 210, 67, .65);
  transition: width .1s linear;
}

body.rx-lesson .rx-hero {
  position: relative;
  min-height: min(68vh, 680px);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: clamp(92px, 12vw, 156px) 0 64px;
  overflow: hidden;
}

body.rx-lesson .rx-hero::after {
  content: "";
  position: absolute;
  top: 70px;
  right: 2%;
  width: clamp(170px, 30vw, 360px);
  aspect-ratio: 1;
  border: 1px solid rgba(177, 210, 67, .15);
  border-radius: 50%;
  box-shadow:
    0 0 0 34px rgba(177, 210, 67, .025),
    0 0 0 68px rgba(177, 210, 67, .018);
  pointer-events: none;
}

body.rx-lesson .rx-hero > * {
  position: relative;
  z-index: 1;
}

body.rx-lesson .rx-hero .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  padding: 7px 11px;
  margin-bottom: 22px;
  border: 1px solid var(--rx-accent-line);
  border-radius: 999px;
  background: rgba(177, 210, 67, .08);
  font-size: 11px;
}

body.rx-lesson .rx-hero .eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
}

body.rx-lesson .rx-hero h1 {
  max-width: 16ch;
  font-size: clamp(42px, 6.6vw, 76px);
  line-height: 1;
}

body.rx-lesson .rx-hero .sub {
  max-width: 65ch;
  font-size: clamp(17px, 2vw, 20px);
}

.rx-jump-nav {
  padding: 22px 0 26px;
  border-bottom: 1px solid var(--line);
}

.rx-jump-nav-label {
  display: block;
  margin-bottom: 14px;
  color: var(--ink-faint);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.rx-jump-nav-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  grid-auto-rows: 1fr;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.rx-jump-nav-list li {
  display: flex;
  min-width: 0;
  height: 100%;
}

.rx-jump-nav a {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  height: 100%;
  min-height: 46px;
  padding: 10px 13px;
  border: 1px solid rgba(255, 255, 255, .11);
  border-radius: 11px;
  color: var(--ink-dim);
  background: rgba(255, 255, 255, .018);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  text-decoration: none;
}

.rx-jump-nav a span {
  display: inline-grid;
  place-items: center;
  width: 25px;
  height: 25px;
  flex: 0 0 25px;
  border-radius: 7px;
  background: rgba(177, 210, 67, .1);
  color: var(--accent);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.rx-jump-nav a:hover,
.rx-jump-nav a[aria-current="true"] {
  border-color: var(--rx-accent-line);
  color: var(--ink);
  background: var(--rx-accent-soft);
}

body.rx-lesson .rx-section {
  position: relative;
  padding: clamp(64px, 8vw, 96px) 0;
}

body.rx-lesson .rx-section::before {
  content: attr(data-rx-index);
  position: absolute;
  top: clamp(64px, 8vw, 96px);
  right: 0;
  color: rgba(255, 255, 255, .055);
  font-family: 'Roboto', sans-serif;
  font-size: clamp(58px, 9vw, 112px);
  font-weight: 900;
  line-height: .8;
  letter-spacing: -.05em;
  pointer-events: none;
}

body.rx-lesson .rx-section > * {
  position: relative;
  z-index: 1;
}

body.rx-lesson .rx-section-head {
  max-width: 840px;
  margin-bottom: 38px;
  padding-right: clamp(0px, 8vw, 90px);
}

body.rx-lesson .rx-label {
  font-size: 11px;
}

body.rx-lesson .rx-section h2 {
  max-width: 24ch;
  font-size: clamp(30px, 4.2vw, 48px);
  line-height: 1.1;
  letter-spacing: -.018em;
}

body.rx-lesson .rx-section p.lede {
  max-width: 72ch;
  font-size: clamp(16px, 1.7vw, 18px);
}

/* Prose-only sections get the same visual weight as diagnostic cards. */
body.rx-lesson .rx-content-panel {
  position: relative;
  width: 100%;
  padding: clamp(28px, 4vw, 42px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .115);
  border-radius: 14px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, .028), transparent 48%),
    var(--bg-card);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .12);
}

body.rx-lesson .rx-content-panel::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  width: 34%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(177, 210, 67, .5));
}

body.rx-lesson .rx-content-panel p.lede {
  max-width: 82ch;
}

body.rx-lesson .rx-content-panel p.lede:first-child {
  color: var(--ink);
  font-size: clamp(17px, 1.9vw, 20px);
}

body.rx-lesson .rx-content-panel p.lede + p.lede {
  margin-top: 17px;
}

body.rx-lesson .rx-content-panel .rx-list {
  max-width: 78ch;
  margin-top: 20px;
}

body.rx-lesson .rx-card-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: 16px;
}

/* Four-item groups should read as a complete set, never as an orphaned 3 + 1 row. */
body.rx-lesson .rx-card-grid.rx-grid-4,
body.rx-lesson .rx-card-grid:has(> .rx-card:nth-child(4):last-child) {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

body.rx-lesson .rx-card,
body.rx-lesson .rx-stat,
body.rx-lesson .rx-calc,
body.rx-lesson .rx-erro-card,
body.rx-lesson .rx-contrast .col,
body.rx-lesson .diag-item,
body.rx-lesson .chk-item,
body.rx-lesson .rx-bio-teaser {
  border-color: rgba(255, 255, 255, .105);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, .024), transparent 44%),
    var(--bg-card);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .1);
}

body.rx-lesson .rx-card {
  min-height: 100%;
  padding: 30px;
}

body.rx-lesson .rx-card:hover {
  box-shadow: 0 22px 54px rgba(0, 0, 0, .18);
}

body.rx-lesson .rx-card .num {
  border-color: rgba(177, 210, 67, .24);
}

body.rx-lesson .rx-card h3 {
  font-size: 20px;
}

body.rx-lesson .rx-calc {
  width: 100%;
  max-width: none;
  padding: 28px 30px;
}

body.rx-lesson .rx-eq.result {
  max-width: 940px;
  padding: 24px 28px;
  border: 1px solid var(--rx-accent-line);
  border-left-width: 3px;
  background: linear-gradient(105deg, rgba(177, 210, 67, .15), rgba(177, 210, 67, .025));
}

body.rx-lesson .rx-erro-card {
  padding: clamp(26px, 4vw, 42px);
}

body.rx-lesson .rx-erro-card details {
  border-top-color: rgba(255, 255, 255, .12);
}

body.rx-lesson .rx-erro-card summary {
  min-height: 42px;
}

body.rx-lesson .diag-item,
body.rx-lesson .chk-item {
  min-height: 58px;
}

body.rx-lesson .diag-item.checked,
body.rx-lesson .chk-item.checked {
  box-shadow: inset 3px 0 0 var(--accent), 0 18px 50px rgba(0, 0, 0, .1);
}

body.rx-lesson .rx-bio-teaser {
  padding: 28px;
}

body.rx-lesson .rx-bio-teaser img {
  width: 72px;
  height: 72px;
  border: 2px solid var(--rx-accent-line);
}

body.rx-lesson .rx-bio-teaser a {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid var(--rx-accent-line);
  border-radius: 999px;
}

body.rx-lesson .rx-bio-teaser a:hover {
  background: var(--rx-accent-soft);
}

body.rx-lesson .raiox-ctabar {
  left: 50%;
  right: auto;
  bottom: 14px;
  width: min(calc(100% - 28px), 1140px);
  min-height: 74px;
  padding: 10px 12px 10px 18px;
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 18px;
  transform: translateX(-50%);
  box-shadow: 0 20px 60px rgba(0, 0, 0, .48);
}

body.rx-lesson .raiox-ctabar .raiox-nav {
  align-items: center;
  gap: 14px;
  font-size: 13px;
}

body.rx-lesson .raiox-ctabar .raiox-cta {
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 18px;
  box-shadow: 0 10px 24px rgba(177, 210, 67, .13);
}

@media (max-width: 820px) {
  .rx-gate-layout {
    grid-template-columns: 1fr;
    min-height: auto;
    padding: 48px 0 64px;
  }

  body.rx-gate header.top {
    text-align: center;
  }

  body.rx-gate .logo-badge {
    margin-inline: auto;
  }

  body.rx-gate h1.title,
  body.rx-gate .sub {
    margin-inline: auto;
  }

  .rx-proof-row {
    justify-content: center;
  }

  body.rx-hub .aula-grid {
    grid-template-columns: 1fr;
  }

  body.rx-hub .aula-card:first-child {
    grid-column: auto;
  }

  body.rx-lesson .rx-card-grid.rx-grid-4,
  body.rx-lesson .rx-card-grid:has(> .rx-card:nth-child(4):last-child) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.rx-lesson .raiox-topbar .raiox-welcome {
    display: none;
  }
}

@media (max-width: 600px) {
  html {
    scroll-padding-top: 74px;
  }

  body::before {
    background-size: 32px 32px;
  }

  .triade-topbar {
    padding: 12px 16px;
  }

  body.rx-gate .wrap,
  body.rx-hub .wrap,
  body.rx-hub .welcome-banner,
  body.rx-lesson .wrap {
    padding-inline: 18px;
  }

  .rx-gate-layout {
    gap: 36px;
    padding-top: 38px;
  }

  body.rx-gate h1.title,
  body.rx-hub h1.title {
    font-size: clamp(36px, 11vw, 50px);
  }

  body.rx-gate .sub,
  body.rx-hub .sub {
    font-size: 16px;
  }

  body.rx-gate .form-card {
    padding: 26px 20px;
    border-radius: 18px;
  }

  body.rx-hub header.top {
    padding-top: 36px;
  }

  body.rx-hub .aula-card,
  body.rx-hub .aula-card:first-child {
    min-height: 0;
    padding: 22px 18px;
  }

  body.rx-hub .aula-card {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 14px;
  }

  body.rx-hub .aula-card .num {
    width: 46px;
    height: 46px;
  }

  body.rx-hub .aula-card .info h3 {
    font-size: 19px;
  }

  body.rx-hub .aula-card .arrow {
    display: none;
  }

  body.rx-lesson {
    padding-top: 62px;
    padding-bottom: 154px;
  }

  body.rx-lesson .raiox-topbar {
    min-height: 62px;
    padding: 10px 16px;
    flex-wrap: nowrap;
    justify-content: space-between;
    font-size: 13px;
  }

  body.rx-lesson .raiox-topbar .raiox-tag {
    font-size: 12px;
  }

  .rx-reading-progress {
    top: 61px;
  }

  body.rx-lesson .rx-hero {
    min-height: 62vh;
    padding: 82px 0 48px;
  }

  body.rx-lesson .rx-hero::after {
    top: 50px;
    right: -70px;
  }

  body.rx-lesson .rx-hero h1 {
    font-size: clamp(38px, 12vw, 56px);
  }

  .rx-jump-nav {
    margin-inline: 0;
    padding-inline: 0;
  }

  .rx-jump-nav-label {
    padding-right: 0;
  }

  .rx-jump-nav-list {
    grid-template-columns: 1fr;
    padding-right: 0;
  }

  body.rx-lesson .rx-card-grid.rx-grid-4,
  body.rx-lesson .rx-card-grid:has(> .rx-card:nth-child(4):last-child) {
    grid-template-columns: 1fr;
  }

  body.rx-lesson .rx-section {
    padding: 62px 0;
  }

  body.rx-lesson .rx-section::before {
    top: 62px;
    font-size: 64px;
  }

  body.rx-lesson .rx-section-head {
    padding-right: 42px;
  }

  body.rx-lesson .rx-section h2 {
    font-size: clamp(29px, 9vw, 40px);
  }

  body.rx-lesson .rx-card,
  body.rx-lesson .rx-erro-card,
  body.rx-lesson .rx-calc,
  body.rx-lesson .rx-contrast .col,
  body.rx-lesson .rx-content-panel {
    padding: 24px 20px;
  }

  body.rx-lesson .rx-calc .calc-row {
    gap: 14px;
  }

  body.rx-lesson .rx-calc .calc-row span:last-child {
    text-align: right;
  }

  body.rx-lesson .rx-eq {
    gap: 10px;
  }

  body.rx-lesson .raiox-ctabar {
    bottom: max(8px, env(safe-area-inset-bottom));
    width: calc(100% - 16px);
    min-height: 0;
    padding: 9px;
    border-radius: 16px;
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 8px;
  }

  body.rx-lesson .raiox-ctabar .raiox-nav {
    justify-content: space-between;
    gap: 8px;
    padding-inline: 4px;
  }

  body.rx-lesson .raiox-ctabar .raiox-nav a {
    overflow: hidden;
    text-overflow: ellipsis;
  }

  body.rx-lesson .raiox-ctabar .raiox-cta {
    width: 100%;
    min-height: 46px;
    font-size: 14px;
  }
}

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

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}
