/* ==========================================================================
   Rex — shared site styles
   Rex Radiant design tokens, see DESIGN.md. Light theme only.
   ========================================================================== */

:root {
  /* Brand */
  --primary: #FF6B35;
  --primary-hover: #E85A2A;
  --primary-deep: #AB3500;
  --deep: #594139;
  --surface: #FFF8F6;
  --tonal: #FDF1EE;

  /* Derived */
  --ink: #2E211C;
  --ink-soft: #6B554C;
  --line: rgba(89, 65, 57, 0.12);
  --line-strong: rgba(89, 65, 57, 0.22);
  --shadow-sm: 0 2px 8px rgba(89, 65, 57, 0.06);
  --shadow-md: 0 12px 28px rgba(89, 65, 57, 0.10);
  --shadow-lg: 0 28px 60px rgba(89, 65, 57, 0.16);

  /* Layout */
  --wrap: 1080px;
  --wrap-narrow: 720px;
  --radius-sm: 12px;
  --radius: 18px;
  --radius-lg: 28px;
  --nav-h: 64px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--nav-h) + 16px);
  -webkit-text-size-adjust: 100%;
}

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

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

img {
  max-width: 100%;
}

a {
  color: var(--primary-deep);
  text-decoration-color: rgba(171, 53, 0, 0.35);
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-color: currentColor;
}

:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
  border-radius: 6px;
}

h1,
h2,
h3 {
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin: 0;
  font-weight: 800;
  color: var(--ink);
  text-wrap: balance;
}

h1 {
  font-size: clamp(2.4rem, 6.2vw, 4rem);
}

h2 {
  font-size: clamp(1.85rem, 4vw, 2.6rem);
}

h3 {
  font-size: 1.12rem;
  letter-spacing: -0.015em;
  line-height: 1.3;
}

p {
  margin: 0 0 1rem;
}

.wrap {
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 24px;
}

.wrap--narrow {
  max-width: var(--wrap-narrow);
}

.lede {
  font-size: clamp(1.05rem, 2.2vw, 1.3rem);
  line-height: 1.55;
  color: var(--ink-soft);
  text-wrap: pretty;
}

.section {
  padding: clamp(64px, 9vw, 112px) 0;
}

.section--tight {
  padding: clamp(48px, 6vw, 72px) 0;
}

.section--tonal {
  background: var(--tonal);
}

.center {
  text-align: center;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--primary-deep);
  background: rgba(255, 107, 53, 0.12);
  border: 1px solid rgba(255, 107, 53, 0.28);
  border-radius: 9999px;
  padding: 6px 14px;
  margin: 0 0 22px;
}

.eyebrow .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--primary);
}

.section-label {
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--primary-deep);
  margin: 0 0 12px;
}

/* --------------------------------------------------------------------------
   Buttons
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 15px 30px;
  border-radius: 9999px;
  border: 2px solid transparent;
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.btn--primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 8px 20px rgba(255, 107, 53, 0.28);
}

.btn--primary:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
}

.btn--ghost {
  background: transparent;
  color: var(--primary-deep);
  border-color: rgba(255, 107, 53, 0.5);
}

.btn--ghost:hover {
  background: rgba(255, 107, 53, 0.08);
}

.btn--muted {
  background: transparent;
  color: var(--ink-soft);
  border-color: var(--line-strong);
  font-weight: 600;
}

.btn--muted:hover {
  background: rgba(89, 65, 57, 0.05);
}

.btn--sm {
  padding: 10px 20px;
  font-size: 0.9rem;
}

.btn--disabled {
  background: transparent;
  color: var(--ink-soft);
  border: 2px dashed var(--line-strong);
  opacity: 0.75;
  cursor: default;
  pointer-events: none;
  box-shadow: none;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
}

.center .btn-row {
  justify-content: center;
}

.fineprint {
  font-size: 0.86rem;
  color: var(--ink-soft);
  margin: 16px 0 0;
}

@media (prefers-reduced-motion: reduce) {
  .btn:hover {
    transform: none;
  }
}

/* --------------------------------------------------------------------------
   Nav
   -------------------------------------------------------------------------- */

.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  background: rgba(255, 248, 246, 0.82);
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color 0.2s ease;
}

.nav.is-stuck {
  border-bottom-color: var(--line);
}

.nav__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: 100%;
  max-width: var(--wrap);
  margin: 0 auto;
  padding: 0 24px;
}

.nav__brand {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: -0.02em;
  flex: 0 0 auto;
}

.nav__brand img {
  height: 26px;
  width: auto;
  display: block;
}

.nav__links {
  display: flex;
  align-items: center;
  gap: 26px;
  margin: 0 auto;
}

.nav__links a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.94rem;
  font-weight: 600;
}

.nav__links a:hover {
  color: var(--ink);
}

@media (max-width: 820px) {
  .nav__links {
    display: none;
  }

  .nav__inner {
    padding: 0 18px;
  }
}

/* --------------------------------------------------------------------------
   Hero
   -------------------------------------------------------------------------- */

.hero {
  position: relative;
  padding: clamp(48px, 8vw, 92px) 0 0;
  text-align: center;
  overflow: hidden;
}

.hero::before {
  content: "";
  position: absolute;
  top: -280px;
  left: 50%;
  transform: translateX(-50%);
  width: 900px;
  height: 620px;
  background: radial-gradient(closest-side, rgba(255, 107, 53, 0.16), rgba(255, 107, 53, 0));
  pointer-events: none;
  z-index: -1;
}

.hero h1 {
  /* Line breaks are authored with <br>, so don't let the balancer re-wrap. */
  text-wrap: initial;
  margin: 0 auto 20px;
}

.hero .lede {
  max-width: 46ch;
  margin: 0 auto 32px;
}

.hero .btn-row {
  justify-content: center;
}

/* --------------------------------------------------------------------------
   Phone frame — the CSS bezel drawn around raw simulator screenshots
   -------------------------------------------------------------------------- */

.phone {
  position: relative;
  width: 100%;
  max-width: 280px;
  aspect-ratio: 9 / 19.5;
  background: linear-gradient(160deg, #6f564d, #3a2a24);
  border-radius: 44px;
  box-shadow: var(--shadow-lg), inset 0 0 0 1px rgba(255, 255, 255, 0.14);
  flex: 0 0 auto;
}

.phone__screen {
  /* Absolute + inset instead of width/height: 100% - measured on a real
     iPhone that a percentage height fails to resolve against .phone's
     aspect-ratio-derived height in WebKit, rendering .phone__screen ~28px
     taller than its container (with nothing to clip the excess, since
     .phone itself doesn't set overflow: hidden). inset reproduces the same
     9px bezel without depending on that percentage resolution.  */
  position: absolute;
  inset: 9px;
  border-radius: 36px;
  overflow: hidden;
  background: var(--tonal);
  isolation: isolate;
  /* Safari/WebKit can fail to clip a large object-fit:cover image against
     border-radius + overflow:hidden; masking forces a reliable clip. */
  -webkit-mask-image: -webkit-radial-gradient(white, black);
}

.phone__screen img,
.phone__screen svg {
  display: block;
  width: 100%;
  height: 100%;
  /* Cancel the aspect-ratio Safari/WebKit implies from the img's width/height
     attributes; without this it can conflict with the 100%/100% sizing here. */
  aspect-ratio: auto;
  object-fit: cover;
  object-position: top center;
}

/* Hero trio */
.hero__phones {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 0;
  margin: clamp(40px, 6vw, 64px) auto 0;
  padding-bottom: 8px;
  max-width: 860px;
}

.hero__phones .phone {
  max-width: 236px;
}

.hero__phones .phone--side {
  max-width: 206px;
  opacity: 0.96;
  margin-bottom: 34px;
}

.hero__phones .phone--left {
  transform: rotate(-5deg) translateX(26px);
  z-index: 1;
}

.hero__phones .phone--right {
  transform: rotate(5deg) translateX(-26px);
  z-index: 1;
}

.hero__phones .phone--main {
  z-index: 3;
  max-width: 262px;
}

@media (max-width: 760px) {
  .hero__phones .phone--side {
    display: none;
  }

  .hero__phones .phone--main {
    max-width: 260px;
  }
}

/* --------------------------------------------------------------------------
   Feature rows
   -------------------------------------------------------------------------- */

.feature {
  display: grid;
  grid-template-columns: 1fr minmax(230px, 280px);
  gap: clamp(32px, 5vw, 64px);
  align-items: center;
  padding: clamp(44px, 6vw, 72px) 0;
}

.feature .phone {
  max-width: 258px;
}

.feature + .feature {
  border-top: 1px solid var(--line);
}

.feature--flip .feature__media {
  order: -1;
}

.feature__media {
  display: flex;
  justify-content: center;
}

.feature__body h2 {
  margin-bottom: 14px;
}

.feature__body p {
  color: var(--ink-soft);
  font-size: 1.03rem;
  max-width: 46ch;
}

@media (max-width: 860px) {
  .feature {
    grid-template-columns: 1fr;
    text-align: left;
  }

  .feature--flip .feature__media {
    order: 0;
  }
}

/* Strength signal pills */
.signals {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
  max-width: 400px;
}

.signal {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 15px;
  box-shadow: var(--shadow-sm);
}

.section--tonal .signal {
  background: #fff;
}

.signal__emoji {
  font-size: 1.3rem;
  line-height: 1;
}

.signal__name {
  font-weight: 800;
  letter-spacing: -0.01em;
}

.signal__desc {
  color: var(--ink-soft);
  font-size: 0.92rem;
}

/* --------------------------------------------------------------------------
   Steps
   -------------------------------------------------------------------------- */

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  margin-top: 48px;
  counter-reset: step;
}

.step {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 26px 24px 28px;
  box-shadow: var(--shadow-sm);
}

.section--tonal .step {
  background: #fff;
}

.step__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
  font-size: 0.95rem;
  margin-bottom: 16px;
}

.step h3 {
  margin-bottom: 8px;
}

.step p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.96rem;
}

@media (max-width: 820px) {
  .steps {
    grid-template-columns: 1fr;
    gap: 18px;
  }
}

/* --------------------------------------------------------------------------
   Editorial pull-quote band
   -------------------------------------------------------------------------- */

.editorial {
  max-width: 24ch;
  font-size: clamp(1.7rem, 4.2vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin: 0 auto 24px;
  text-wrap: balance;
}

.editorial em {
  font-style: normal;
  color: var(--primary-deep);
}

/* --------------------------------------------------------------------------
   Feature grid
   -------------------------------------------------------------------------- */

.grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 44px;
}

.tile {
  background: var(--tonal);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 22px 24px;
}

.section--tonal .tile {
  background: #fff;
}

.tile__icon {
  font-size: 1.4rem;
  line-height: 1;
  display: block;
  margin-bottom: 12px;
}

.tile h3 {
  font-size: 1.02rem;
  margin-bottom: 6px;
}

.tile p {
  margin: 0;
  font-size: 0.93rem;
  color: var(--ink-soft);
  line-height: 1.5;
}

@media (max-width: 900px) {
  .grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 560px) {
  .grid {
    grid-template-columns: 1fr;
  }
}

/* --------------------------------------------------------------------------
   Support Rex / indie band
   -------------------------------------------------------------------------- */

.indie {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 32px;
  align-items: center;
  background: var(--tonal);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-lg);
  padding: clamp(28px, 4vw, 44px);
}

.indie h2 {
  font-size: clamp(1.4rem, 3vw, 1.9rem);
  margin-bottom: 10px;
}

.indie p {
  margin: 0;
  color: var(--ink-soft);
  max-width: 54ch;
  font-size: 0.99rem;
}

@media (max-width: 720px) {
  .indie {
    grid-template-columns: 1fr;
  }
}

/* --------------------------------------------------------------------------
   Download band
   -------------------------------------------------------------------------- */

.download {
  background: linear-gradient(165deg, #FF7A48, #E85A2A);
  border-radius: var(--radius-lg);
  padding: clamp(40px, 6vw, 72px) 28px;
  text-align: center;
  color: #fff;
  box-shadow: var(--shadow-md);
}

.download h2 {
  color: #fff;
  margin-bottom: 14px;
}

.download p {
  color: rgba(255, 255, 255, 0.92);
  max-width: 46ch;
  margin: 0 auto 28px;
  font-size: 1.05rem;
}

.download .btn--primary {
  background: #fff;
  color: var(--primary-deep);
  box-shadow: 0 10px 24px rgba(89, 41, 20, 0.25);
}

.download .btn--primary:hover {
  background: #fff5f1;
}

.download .btn--disabled {
  color: rgba(255, 255, 255, 0.9);
  border-color: rgba(255, 255, 255, 0.5);
}

.download .fineprint {
  color: rgba(255, 255, 255, 0.85);
}

/* --------------------------------------------------------------------------
   FAQ
   -------------------------------------------------------------------------- */

.faq {
  margin-top: 36px;
  border-top: 1px solid var(--line);
}

.faq details {
  border-bottom: 1px solid var(--line);
}

.faq summary {
  cursor: pointer;
  list-style: none;
  padding: 20px 40px 20px 0;
  font-weight: 700;
  font-size: 1.04rem;
  letter-spacing: -0.01em;
  position: relative;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: "+";
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.5rem;
  font-weight: 400;
  color: var(--primary);
  line-height: 1;
}

.faq details[open] summary::after {
  content: "–";
}

.faq details > *:not(summary) {
  color: var(--ink-soft);
  font-size: 0.98rem;
  margin: 0 0 20px;
  max-width: 68ch;
}

/* --------------------------------------------------------------------------
   Long-form article pages (privacy, support)
   -------------------------------------------------------------------------- */

.article {
  padding: clamp(40px, 6vw, 72px) 0 clamp(56px, 7vw, 88px);
}

.article h1 {
  font-size: clamp(2rem, 4.5vw, 2.8rem);
  margin-bottom: 8px;
}

.article h2 {
  font-size: 1.35rem;
  margin: 40px 0 10px;
}

.article h3 {
  margin: 26px 0 6px;
}

.article p,
.article li {
  color: var(--ink-soft);
  font-size: 1rem;
}

.article ul,
.article ol {
  padding-left: 22px;
}

.article li {
  margin-bottom: 8px;
}

.article strong {
  color: var(--ink);
}

.article code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.92em;
  font-weight: 700;
  background: var(--tonal);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 6px;
  color: var(--ink);
}

.article .updated {
  font-size: 0.88rem;
  color: var(--ink-soft);
  opacity: 0.85;
  margin-bottom: 28px;
}

/* Changelog: one section per version, newest first. */
.release + .release {
  border-top: 1px solid var(--line);
  margin-top: 40px;
}

.release h2 {
  margin-bottom: 4px;
}

.release .updated {
  margin-bottom: 16px;
}

.callout {
  background: var(--tonal);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin: 0 0 32px;
}

.callout p:last-child {
  margin-bottom: 0;
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.footer {
  background: var(--tonal);
  border-top: 1px solid var(--line);
  padding: 56px 0 40px;
  margin-top: 0;
}

.footer__inner {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 40px;
}

.footer__brand img {
  height: 48px;
  width: auto;
  display: block;
  margin-bottom: 14px;
}

.footer__brand p {
  color: var(--ink-soft);
  font-size: 0.94rem;
  max-width: 34ch;
  margin: 0;
}

.footer h4 {
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  margin: 0 0 14px;
}

.footer ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.footer li {
  margin-bottom: 9px;
}

.footer a {
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 0.94rem;
}

.footer a:hover {
  color: var(--primary-deep);
  text-decoration: underline;
}

.footer__legal {
  margin-top: 44px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  font-size: 0.86rem;
  color: var(--ink-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  justify-content: space-between;
}

@media (max-width: 720px) {
  .footer__inner {
    grid-template-columns: 1fr 1fr;
    gap: 32px;
  }

  .footer__brand {
    grid-column: 1 / -1;
  }
}

/* --------------------------------------------------------------------------
   Scroll reveal
   -------------------------------------------------------------------------- */

/* Scoped to .js so the page stays fully readable without JavaScript. */
.js .reveal {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.js .reveal.is-visible {
  opacity: 1;
  transform: none;
}

@media (prefers-reduced-motion: reduce) {
  .js .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}

/* --------------------------------------------------------------------------
   Centered card pages (invite, 404)
   -------------------------------------------------------------------------- */

.card-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.card {
  background: var(--tonal);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 40px 32px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: var(--shadow-md);
}

.card .logo {
  width: 116px;
  height: auto;
  margin: 0 auto 20px;
  display: block;
}

.card h1 {
  font-size: clamp(1.7rem, 5vw, 2.15rem);
  margin: 0 0 10px;
}

.card p {
  color: var(--ink-soft);
}
