/* Roger Bacab · Bold — page base the published bundle leaves to the page.
   Ported from the Bold v4 prototype's base; load after bundle.css. */

/* Cross-document card → page morph (pj-media, pj-title, pj-icon). */
@view-transition {
  navigation: auto;
}

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

html {
  scroll-padding-top: 100px;
}

body {
  margin: 0;
  overflow-x: clip;
  transition: background-color 0.5s var(--rb-ease), color 0.5s var(--rb-ease);
}

/* Covers the notch area so content never scrolls under the status bar. */
body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  z-index: 60;
  height: env(safe-area-inset-top, 0px);
  background: var(--bg);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 800;
  letter-spacing: -0.045em;
  text-wrap: balance;
}

p {
  margin: 0;
}

a {
  color: inherit;
}

img {
  max-width: 100%;
}

[hidden] {
  display: none !important;
}

/* ---------- rb_ui additions: rules the bundle doesn't ship ---------- */

/* Smooth in-page jumps, only while motion is on. */
:root[data-motion="on"] {
  scroll-behavior: smooth;
}

@media (prefers-reduced-motion: no-preference) {
  :root:not([data-motion="off"]) {
    scroll-behavior: smooth;
  }
}

/* RbSegmentedLinks: links styled like the .rb-seg buttons. */
.rb-seg a {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  min-width: 36px;
  height: 34px;
  padding: 0 8px;
  border-radius: calc(var(--radius-xs) * var(--rb-sq) - 3px);
  color: var(--muted);
  font: 600 12px/1 var(--font-mono);
  letter-spacing: 0.04em;
  text-decoration: none;
  transition: color 0.3s;
}

.rb-seg a:hover,
.rb-seg a[aria-current="page"] {
  color: var(--fg);
}

/* NavBar wordmark: "RB" replaces the full name on phones. */
.rb-brand-short {
  display: none;
}

@media (max-width: 640px) {
  .rb-nav-links {
    display: none;
  }

  .rb-nav-bar {
    justify-content: space-between;
  }

  .rb-brand-full {
    display: none;
  }

  .rb-brand-short {
    display: inline;
  }
}

.rb-footer {
  padding-block: var(--space-6);
}

/* Grouped-list rows: the name keeps its width and the detail wraps, so a
   long detail ("Auth, Firestore and Functions") never runs over the name. */
.rb-group li {
  grid-template-columns: 32px auto minmax(0, 1fr);
}

/* "Made with Jaspr": the glyph beside the text, like the bar's other link. */
.rb-footer-credit {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}

.rb-footer-credit svg {
  width: 16px;
  height: 16px;
  flex: none;
}

/* Hidden from sight, read by assistive tech (e.g. "opens in a new tab"). */
.rb-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ---------- Home layouts (from the Bold v4 prototype) ---------- */

/* Hero: centred copy over four bobbing screenshots. */
.rb-hero {
  position: relative;
  overflow: clip;
  isolation: isolate;
}

.rb-hero > .rb-wrap {
  position: relative;
  z-index: 2;
  display: grid;
  justify-items: center;
  text-align: center;
  padding-block: clamp(72px, 10vw, 150px) clamp(64px, 9vw, 130px);
}

.rb-hero-copy {
  display: grid;
  justify-items: center;
  gap: clamp(24px, 3vw, 40px);
  min-width: 0;
}

.rb-hero .rb-meta {
  justify-content: center;
}

.rb-hero-sub {
  max-width: 48ch;
  margin-inline: auto;
  color: var(--muted);
  font-size: clamp(17px, 1.35vw, 20px);
}

.rb-hero-ctas {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-3);
}

.rb-hero-float {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.rb-float {
  position: absolute;
  width: clamp(100px, 10.5vw, 152px);
  transform: rotate(var(--rb-r, 0deg));
}

.rb-float-in {
  position: relative;
  animation: rb-bob 7s ease-in-out infinite;
  animation-delay: var(--rb-d, 0s);
}

.rb-float-shot {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 22px 30px var(--shadow-color));
}

@keyframes rb-bob {
  50% {
    transform: translateY(-14px);
  }
}

.rb-f1 {
  left: 2%;
  top: 8%;
  --rb-r: -10deg;
  --rb-d: -1s;
}

.rb-f2 {
  left: 11%;
  bottom: 5%;
  --rb-r: 7deg;
  --rb-d: -3s;
}

.rb-f3 {
  right: 2%;
  top: 6%;
  --rb-r: 9deg;
  --rb-d: -2s;
}

.rb-f4 {
  right: 11%;
  bottom: 3%;
  --rb-r: -6deg;
  --rb-d: -4.5s;
}

/* Counter-rotated so the notification reads level. */
.rb-hero-float .rb-notif {
  position: absolute;
  transform: rotate(calc(var(--rb-r, 0deg) * -1));
}

.rb-f1 .rb-notif {
  left: 38%;
  bottom: -6%;
}

.rb-f3 .rb-notif {
  right: 38%;
  bottom: -8%;
}

/* Sections: eyebrow + title, mono note on the right. */
.rb-section {
  padding-block: clamp(72px, 10vw, var(--space-34));
}

.rb-section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: var(--space-4) var(--space-8);
  margin-bottom: clamp(32px, 5vw, 56px);
}

.rb-section-head > div {
  display: grid;
  gap: var(--space-3);
}

.rb-section-title {
  font-size: clamp(40px, 6vw, 88px);
  line-height: 0.95;
}

.rb-section-note {
  font: 500 12px/1.5 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  max-width: 34ch;
}

/* Work: two columns of cards; each card is one link. */
.rb-work-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-5);
}

a.rb-card {
  text-decoration: none;
}

@media (max-width: 1000px) {
  .rb-hero > .rb-wrap {
    padding-bottom: 28px;
  }

  .rb-hero-float {
    position: relative;
    inset: auto;
    display: flex;
    justify-content: center;
    gap: clamp(8px, 3vw, 24px);
    padding-bottom: 56px;
  }

  .rb-float {
    position: relative;
    inset: auto;
    width: min(21vw, 128px);
  }

  .rb-hero-float .rb-notif {
    display: none;
  }
}

@media (max-width: 760px) {
  .rb-work-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .rb-card-row {
    grid-template-columns: 48px minmax(0, 1fr) 40px;
    padding: 18px 18px 20px;
  }

  .rb-card .rb-app-icon {
    width: 48px;
    height: 48px;
  }

  .rb-arrow {
    width: 40px;
    height: 40px;
  }
}

/* Marquee: tighter band on phones. */
@media (max-width: 640px) {
  .rb-mq-group {
    gap: 22px;
    padding-right: 22px;
  }

  .rb-marquee {
    padding-block: 18px;
  }
}

/* About: the portrait beside the lead and the grouped lists (2×2, stacked
   when the body is under 600px). */
.rb-about > .rb-wrap {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  gap: clamp(32px, 6vw, 96px);
  align-items: center;
}

.rb-portrait {
  margin: 0;
  position: relative;
  isolation: isolate;
}

/* The mint block offset behind the photo. */
.rb-portrait::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  z-index: -1;
  aspect-ratio: 4 / 5;
  border-radius: calc(var(--radius-lg) * var(--rb-sq));
  background: var(--accent);
  transform: translate(18px, 18px);
}

.rb-portrait img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border-radius: calc(var(--radius-lg) * var(--rb-sq));
}

.rb-portrait-cap {
  margin-top: 26px;
  font: 500 12px/1.4 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.rb-about-body {
  display: grid;
  gap: 28px;
  min-width: 0;
  container-type: inline-size;
}

.rb-about-lead {
  max-width: 44ch;
  font-size: clamp(19px, 1.7vw, 24px);
  line-height: 1.5;
}

.rb-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-5);
}

/* Two lists side by side need ~300px each, or a row's label is squeezed
   under its detail; narrower, they stack. */
@container (max-width: 599px) {
  .rb-groups {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* Contact: a huge title with the mint phrase, then the links. */
.rb-contact-section > .rb-wrap {
  display: grid;
  gap: 36px;
}

.rb-contact-title,
.rb-404-title {
  max-width: 13ch;
  font-size: clamp(46px, 8.4vw, 128px);
  line-height: 0.92;
}

.rb-contact-note {
  max-width: 46ch;
  color: var(--muted);
  font-size: 18px;
}

.rb-contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

@media (max-width: 760px) {
  .rb-about > .rb-wrap {
    grid-template-columns: minmax(0, 1fr);
  }

  .rb-portrait {
    max-width: 400px;
    margin-right: 18px;
  }
}

/* Project page: hero, header, story beside the GIF, gallery, next card. */
.rb-nav-bar--project {
  padding-left: var(--space-2);
}

a.rb-nav-back {
  text-decoration: none;
}

.rb-pj {
  display: grid;
  gap: clamp(36px, 5vw, 64px);
  padding-top: var(--space-6);
  padding-bottom: 40px;
}

.rb-pj-overview {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
  gap: clamp(28px, 5vw, 72px);
  align-items: start;
}

/* No recording yet: the story takes the whole row; the stack list keeps
   the width it has beside a GIF, so its details stay near their names. */
.rb-pj-overview--solo {
  grid-template-columns: minmax(0, 1fr);
}

.rb-pj-overview--solo .rb-pj-stack {
  max-width: 720px;
}

/* The recording plays inside the screenshots' phone frame
   (phone-frame.webp, 428 × 876), which is layered over it, and floats on the
   same shadow as the gallery shots. The video fills the frame's screen
   opening, half a pixel under the bezel on each side; its corner radius
   matches that opening, so it stays off the radius scale and --rb-sq on
   purpose. (The bundle's .rb-gif-frame img also styles the shell: harmless,
   as the frame has no radius and the same aspect ratio.) */
.rb-gif-frame.rb-gif-device {
  position: relative;
  aspect-ratio: 428 / 876;
  border: 0;
  border-radius: 0;
  background: none;
  filter: drop-shadow(0 18px 26px var(--shadow-color));
}

.rb-gif-device video {
  position: absolute;
  left: 5.2%;
  top: 2.2%;
  width: 89.6%;
  height: 94.1%;
  object-fit: cover;
  border-radius: 14.9% / 6.9%;
}

.rb-gif-shell {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.rb-pj-gif {
  position: sticky;
  top: var(--space-24);
}

.rb-pj-text {
  display: grid;
  gap: 28px;
  min-width: 0;
}

.rb-pj-stack {
  display: grid;
  gap: var(--space-1);
}

.rb-pj-screens {
  display: grid;
  gap: var(--space-5);
}

.rb-pj-h {
  font-size: clamp(26px, 3vw, 36px);
  letter-spacing: -0.035em;
  line-height: 1.1;
}

.rb-pj-gallery {
  display: flex;
  gap: var(--space-4);
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 28px;
  border-radius: calc(var(--radius-xl) * var(--rb-sq));
  background: var(--surface);
  scrollbar-width: thin;
}

.rb-pj-gallery img {
  flex: none;
  width: auto;
  max-width: none;
  height: min(520px, 64dvh);
  scroll-snap-align: center;
  filter: drop-shadow(0 18px 26px var(--shadow-color));
}

a.rb-next {
  text-decoration: none;
}

/* Stagger order for `rb-stagger` children (the bundle reads --k). */
.rb-k-0 { --k: 0; }
.rb-k-1 { --k: 1; }
.rb-k-2 { --k: 2; }
.rb-k-3 { --k: 3; }
.rb-k-4 { --k: 4; }
.rb-k-5 { --k: 5; }
.rb-k-6 { --k: 6; }

/* A morph part must not fade in while the morph moves it into place. */
.rb-stagger > [data-morph-name] {
  animation: none;
}

/* The banner morphs as one image, cropped like the card it came from. */
::view-transition-image-pair(pj-media) {
  isolation: auto;
}

::view-transition-old(pj-media),
::view-transition-new(pj-media) {
  height: 100%;
  object-fit: cover;
  animation-duration: 0.62s;
}

@media (max-width: 1000px) {
  .rb-pj-overview {
    grid-template-columns: minmax(0, 1fr);
  }

  .rb-pj-gif {
    position: static;
  }
}

@media (max-width: 760px) {
  /* "Administradores" is one word: below 40px it still fits beside the
     icon on a 360px phone, and a longer name wraps instead of clipping. */
  .rb-pj-title {
    font-size: clamp(30px, 9vw, 40px);
    overflow-wrap: break-word;
  }

  .rb-pj-gallery {
    padding: 18px;
  }

  .rb-pj-gallery img {
    height: min(400px, 56dvh);
  }
}

/* Phones: back and the three controls fill the bar, so the project
   position (arrows and "n / 6") steps aside; the next card stays. */
@media (max-width: 640px) {
  .rb-nav-project {
    display: none;
  }
}

/* Small phones: the back link keeps only its chevron; the label stays
   for assistive tech, so the link is still named "Work". */
@media (max-width: 379px) {
  .rb-nav-back span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

/* 404: one dead end in both languages, English first, each with its way
   home. Fills the first screen so the footer stays below the fold. */
.rb-404 {
  display: grid;
  align-content: center;
  min-height: calc(100svh - var(--nav-height));
}

.rb-404 > .rb-wrap {
  /* A centred grid item shrinks to its content; keep the page width. */
  width: 100%;
  display: grid;
  justify-items: start;
  gap: var(--space-6);
}

.rb-404-body {
  max-width: 48ch;
  color: var(--muted);
  font-size: clamp(17px, 1.35vw, 20px);
}

.rb-404-alt {
  display: grid;
  justify-items: start;
  gap: var(--space-4);
  width: 100%;
  margin-top: var(--space-6);
  padding-top: var(--space-8);
  border-top: 1px solid var(--line);
}

.rb-404-alt-title {
  font: 800 clamp(28px, 4vw, 48px) / 1 var(--font-display);
  letter-spacing: -0.045em;
  text-wrap: balance;
}
