/* ============================================================
   RAIN · role pages (/roles/<slug>)
   Builds on rain.css. Scoped to rl-* classes and body.rl-page.
   js/roles.js sets body[data-role-state] from Raindrop, and the
   [data-when] blocks below show only in their state. Without an
   answer the page stays on "open"; the application on Raindrop has
   the final word on whether it takes applications.
============================================================ */

/* ---- States ---- */
.rl-page[data-role-state="open"]   [data-when]:not([data-when~="open"]),
.rl-page[data-role-state="filled"] [data-when]:not([data-when~="filled"]),
.rl-page[data-role-state="closed"] [data-when]:not([data-when~="closed"]) { display: none !important; }

.rl-page [id] { scroll-margin-top: 92px; }
.rl-page .h-display, .rl-page .h-1 { text-wrap: balance; }
.rl-page .lead, .rl-page .lead-lg, .rl-fit-d { text-wrap: pretty; }
.rl-step-d { text-wrap: balance; }
.rl-nowrap { white-space: nowrap; }

/* ---- Hero: the role on the left, the work after each event on the right ---- */
.rl-hero { padding: 128px 0 76px; }
.rl-hero-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 0.92fr);
  gap: clamp(40px, 5vw, 88px);
  align-items: center;
}
.rl-page[data-role-state="filled"] .rl-hero-grid,
.rl-page[data-role-state="closed"] .rl-hero-grid { grid-template-columns: minmax(0, 1fr); }
.rl-hero .h-display {
  font-size: clamp(2.625rem, 2.9vw + 1.55rem, 4.5rem);
  line-height: 0.99;
}
.rl-hero .lead-lg {
  font-size: clamp(16.5px, 1.22vw, 19px);
  line-height: 1.55;
  max-width: 46ch;
  color: rgba(246,243,236,0.72);
}
.rl-hero .hero-cta-row { margin-top: 32px; }
.btn:hover .arr.rl-arr-down { transform: translateY(3px); }
.rl-small {
  margin-top: 18px;
  font-family: var(--sans); font-size: 14px; line-height: 1.4;
  color: rgba(246,243,236,0.55);
}

/* The hero's copy enters in order. Each state shows its own lines, so the
   delays are set per line instead of by position among siblings. */
body.is-loaded .hero.rl-hero .hero-grid > .reveal > [style*="--d"] { transition-delay: var(--d); }

/* RAIN lockup, the same as the BioData page: the page reads as RAIN's first. */
.rl-host {
  display: inline-flex; align-items: center; gap: 18px;
  width: fit-content; max-width: 100%;
  text-decoration: none; color: inherit;
}
.rl-host-seal {
  width: 64px; height: 64px;
  box-shadow: 0 2px 6px rgba(8,19,42,0.45), 0 0 0 1px rgba(204,156,79,0.45), 0 0 22px rgba(204,156,79,0.28);
}
.rl-host:hover .rl-host-seal { transform: rotate(8deg) scale(1.04); }
.rl-host-text { display: flex; flex-direction: column; gap: 9px; min-width: 0; }
.rl-host-name {
  display: flex; align-items: baseline; flex-wrap: wrap; row-gap: 4px;
  font-family: var(--display);
  font-variation-settings: "opsz" 48, "SOFT" 60, "wght" 500;
  font-weight: 500; font-style: italic;
  font-size: 38px; line-height: 0.9; letter-spacing: 0.01em;
  color: #cc9c4f;
  text-shadow: 0 0 18px rgba(204,156,79,0.3);
}
.rl-host-full {
  margin-left: 14px; padding-left: 14px;
  border-left: 1px solid rgba(204,156,79,0.45);
  font-style: normal;
  font-variation-settings: "opsz" 36, "SOFT" 40, "wght" 400;
  font-weight: 400; font-size: 23px; letter-spacing: -0.01em;
  color: #f6f3ec; text-shadow: none;
}
.rl-host-sub {
  font-family: var(--mono); font-size: 11.5px; line-height: 1;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--accent-soft, #cc9c4f);
}
.rl-host-at { color: rgba(246,243,236,0.5); }

/* ---- The panel: from the event to published ---- */
.rl-card {
  position: relative;
  border-radius: var(--r-lg);
  padding: 20px 22px 14px;
  /* Tinted glass without backdrop-filter: the blobs behind it animate. */
  background:
    radial-gradient(120% 80% at 100% 0%, rgba(204,156,79,0.12) 0%, transparent 58%),
    linear-gradient(180deg, rgba(15,31,68,0.8) 0%, rgba(8,19,42,0.72) 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.1),
    inset 0 0 0 1px rgba(255,255,255,0.07),
    0 30px 70px -30px rgba(0,0,0,0.7),
    0 0 60px -20px rgba(39,69,214,0.35);
  color: #f6f3ec;
  opacity: 0;
  transform: translate3d(0, 26px, 0);
  transition: opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1) 0.3s,
              transform 1s cubic-bezier(0.22, 1, 0.36, 1) 0.3s;
}
body.is-loaded .rl-card { opacity: 1; transform: none; }
.rl-card-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 0 2px 14px; margin-bottom: 8px;
  border-bottom: 1px solid rgba(246,243,236,0.1);
  font-family: var(--mono); font-size: 10.5px; line-height: 1.2;
  letter-spacing: 0.18em; text-transform: uppercase;
}
.rl-card-title { color: var(--gold); }
.rl-card-meta { color: rgba(246,243,236,0.5); white-space: nowrap; }

.rl-steps {
  --node: 22px;
  --gap: 2px;
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: var(--gap);
}
.rl-step {
  position: relative;
  display: grid; grid-template-columns: var(--node) minmax(0, 1fr); column-gap: 16px;
  padding: 10px 10px 10px 8px;
  opacity: 0;
  transition: opacity 0.6s ease;
}
body.is-loaded .rl-step { opacity: 1; }
body.is-loaded .rl-step:nth-child(1) { transition-delay: 0.55s; }
body.is-loaded .rl-step:nth-child(2) { transition-delay: 0.65s; }
body.is-loaded .rl-step:nth-child(3) { transition-delay: 0.75s; }
body.is-loaded .rl-step:nth-child(4) { transition-delay: 0.85s; }
/* Connector from each node down to the next. The row's height plus the gap is
   exactly the distance between two nodes. */
.rl-step:not(:last-child)::after {
  content: '';
  position: absolute;
  left: calc(8px + var(--node) / 2 - 0.5px);
  top: calc(10px + var(--node));
  width: 1px;
  height: calc(100% + var(--gap) - var(--node));
  background: linear-gradient(180deg, rgba(204,156,79,0.55), rgba(246,243,236,0.22));
  transform: scaleY(0); transform-origin: top;
  transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
body.is-loaded .rl-step:not(:last-child)::after { transform: scaleY(1); }
body.is-loaded .rl-step:nth-child(1)::after { transition-delay: 0.75s; }
body.is-loaded .rl-step:nth-child(2)::after { transition-delay: 0.85s; }
body.is-loaded .rl-step:nth-child(3)::after { transition-delay: 0.95s; }
.rl-node {
  position: relative; z-index: 1;
  width: var(--node); height: var(--node); border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #213566 0%, #0b1733 75%);
  box-shadow: inset 0 0 0 1px rgba(246,243,236,0.24), 0 0 0 4px rgba(8,19,42,0.55);
}
.rl-node::after {
  content: ''; position: absolute; inset: 7px; border-radius: 50%;
  background: rgba(246,243,236,0.6);
}
.rl-step.is-origin .rl-node { box-shadow: inset 0 0 0 1px rgba(204,156,79,0.7), 0 0 0 4px rgba(8,19,42,0.55), 0 0 16px rgba(204,156,79,0.35); }
.rl-step.is-origin .rl-node::after { background: var(--gold); }
.rl-step-t {
  display: block;
  font-family: var(--display);
  font-variation-settings: "opsz" 36, "SOFT" 40, "wght" 450;
  font-weight: 450; font-size: 18.5px; line-height: var(--node);
  letter-spacing: -0.01em; color: #f6f3ec;
}
.rl-step-d {
  display: block; margin-top: 3px;
  font-family: var(--sans); font-size: 13.5px; line-height: 1.45;
  color: rgba(246,243,236,0.64);
  max-width: 52ch;
}

/* ---- What we look for ---- */
.rl-fit-head { max-width: 640px; }
.rl-fit-list {
  list-style: none; margin: clamp(36px, 5vw, 56px) 0 0; padding: 0;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(20px, 3vw, 40px);
}
.rl-fit-item { padding-top: 22px; border-top: 1px solid var(--line-2); position: relative; }
.rl-fit-item::before {
  content: ''; position: absolute; left: 0; top: -1px;
  width: 44px; height: 2px; background: var(--gold);
}
.rl-fit-t {
  font-family: var(--display);
  font-variation-settings: "opsz" 36, "SOFT" 40, "wght" 450;
  font-weight: 450; font-size: clamp(22px, 2vw, 26px); line-height: 1.15;
  letter-spacing: -0.015em; color: var(--ink); margin: 0;
}
.rl-fit-d {
  margin-top: 10px;
  font-family: var(--sans); font-size: 16px; line-height: 1.55;
  color: var(--ink-2); max-width: 34ch;
}

/* Filled or closed, the footer follows the hero directly. Its first row starts
   below the part of the card that rises over the hero, so no text peeks in. */
.rl-page[data-role-state="filled"] .footer,
.rl-page[data-role-state="closed"] .footer { padding-top: 48px; }

/* ---- Apply ---- */
.rl-apply .portal-list .v { max-width: 34ch; }

/* ---- Small screens ---- */
@media (max-width: 1023px) {
  .rl-hero-grid { grid-template-columns: minmax(0, 1fr); }
  .rl-card { max-width: 620px; }
}
@media (max-width: 860px) {
  .rl-fit-list { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .rl-fit-d { max-width: 52ch; }
}
@media (max-width: 640px) {
  .rl-hero { padding: 112px 0 64px; }
  .rl-host { gap: 14px; }
  .rl-host-seal { width: 52px; height: 52px; }
  .rl-host-name { font-size: 31px; }
  .rl-host-full { display: none; }
  .rl-host-sub { font-size: 10.5px; letter-spacing: 0.18em; }
  .rl-card { padding: 18px 16px 10px; }
  .rl-card-head { padding-bottom: 12px; }
  .rl-step { column-gap: 14px; padding: 9px 4px 9px 4px; }
  .rl-step:not(:last-child)::after { left: calc(4px + var(--node) / 2 - 0.5px); top: calc(9px + var(--node)); }
  .rl-step-t { font-size: 17.5px; }
}
@media (prefers-reduced-motion: reduce) {
  .rl-card, .rl-step, .rl-step::after { opacity: 1 !important; transform: none !important; transition: none !important; }
}
