/* ==========================================================================
   rentech.au — landing page
   Palette, type and layout tokens come from the Rentech design system.
   ========================================================================== */

/* block, not swap: a fallback face re-wraps the paragraph when Platypi lands,
   which re-centres the column and jolts the headline mid-type. js/type.js
   holds the reveal until the font is ready, so nothing waits on an empty
   screen; if it never arrives, the browser falls back after ~3s. */
@font-face {
  font-family: 'Platypi';
  src: url('/assets/fonts/platypi-400.woff2') format('woff2');
  font-weight: 400;
  font-style: normal;
  font-display: block;
}
@font-face {
  font-family: 'Platypi';
  src: url('/assets/fonts/platypi-700.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: block;
}
/* IBM Plex Sans ships as one variable file per subset — covers 400/500/600. */
@font-face {
  font-family: 'IBM Plex Sans';
  src: url('/assets/fonts/ibm-plex-sans-latin.woff2') format('woff2');
  font-weight: 100 700;
  font-style: normal;
  font-stretch: 100%;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA,
    U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193,
    U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Sans';
  src: url('/assets/fonts/ibm-plex-sans-latin-ext.woff2') format('woff2');
  font-weight: 100 700;
  font-style: normal;
  font-stretch: 100%;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF,
    U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020,
    U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --rt-ink: #05070F;
  --rt-primary: #1F2747;
  --rt-white: #FFFFFF;
  --rt-800: #171D35;
  --rt-600: #36447C;
  --rt-400: #5F71B9;
  --rt-200: #A6B0D8;
  --rt-100: #C7CDE8;
  --rt-link: #7385D6;

  --font-display: 'Platypi', Georgia, serif;
  --font-sans: 'IBM Plex Sans', system-ui, sans-serif;

  --rt-fallback-bg:
    radial-gradient(120% 90% at 15% 0%, #1F2747 0%, rgba(31, 39, 71, 0) 60%),
    radial-gradient(120% 90% at 85% 100%, #2E3A6E 0%, rgba(46, 58, 110, 0) 60%),
    #05070F;
}

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

html, body {
  margin: 0;
  padding: 0;
  background: var(--rt-ink);
}

a {
  color: var(--rt-white);
  text-decoration: underline;
  text-underline-offset: 3px;
}
a:hover { color: var(--rt-100); }

/* --------------------------------------------------------------------------
   Layout
   -------------------------------------------------------------------------- */

[data-rt-root] {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 48px 24px;
  overflow: hidden;
  text-align: center;
}

[data-rt-bg-host] {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: var(--rt-fallback-bg);
}
[data-rt-bg-host] canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 600ms ease;
}
[data-rt-bg-host] canvas[data-rt-live] { opacity: 1; }

[data-rt-scrim] {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: radial-gradient(
    ellipse 70% 60% at 50% 45%,
    rgba(5, 7, 15, 0.55) 0%,
    rgba(5, 7, 15, 0.3) 60%,
    rgba(5, 7, 15, 0.1) 100%
  );
}

[data-rt-row] {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(20px, 3vw, 56px);
  max-width: 1200px;
}

/* --------------------------------------------------------------------------
   Logo lockup
   -------------------------------------------------------------------------- */

[data-rt-lockup] {
  display: flex;
  align-items: center;
  gap: 0;
  flex-shrink: 0;
  animation: rtIn 1100ms cubic-bezier(0.22, 1, 0.36, 1) 300ms both;
}

[data-rt-mark] {
  position: relative;
  width: clamp(180px, 24vw, 400px);
  height: clamp(180px, 24vw, 400px);
  flex-shrink: 0;
  mix-blend-mode: screen;
}
/* Static white mark: the rest state, and the fallback if WebGL is unavailable. */
[data-rt-mark-static] {
  position: absolute;
  inset: 0;
  background: var(--rt-white);
  transform: scale(0.55);
  -webkit-mask: url('/assets/rentech-mark.png') no-repeat center / contain;
  mask: url('/assets/rentech-mark.png') no-repeat center / contain;
  transition: opacity 300ms ease;
}
[data-rt-mark-canvas],
[data-rt-mark-dither] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  transition: opacity 300ms ease;
  pointer-events: none;
}
/* The heatmap's outer glow is faded out before it reaches the canvas edge. */
[data-rt-mark-canvas] {
  -webkit-mask-image: radial-gradient(closest-side, rgba(0, 0, 0, 1) 55%, rgba(0, 0, 0, 0) 82%);
  mask-image: radial-gradient(closest-side, rgba(0, 0, 0, 1) 55%, rgba(0, 0, 0, 0) 82%);
}
/* The dither layer is clipped to the mark itself. */
[data-rt-mark-dither] {
  transform: scale(0.55);
  transition: opacity 350ms ease;
  -webkit-mask: url('/assets/rentech-mark.png') no-repeat center / contain;
  mask: url('/assets/rentech-mark.png') no-repeat center / contain;
}

[data-rt-wordmark] {
  height: clamp(66px, 10.2vw, 170px);
  width: clamp(270px, 41.7vw, 695px);
  max-width: 24vw;
  margin-left: -16px;
  background: var(--rt-white);
  -webkit-mask: url('/assets/rentech-wordmark.svg') no-repeat left center / contain;
  mask: url('/assets/rentech-wordmark.svg') no-repeat left center / contain;
}

/* --------------------------------------------------------------------------
   Copy column
   -------------------------------------------------------------------------- */

[data-rt-col] {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: min(520px, 30vw);
  flex-shrink: 0;
  text-align: left;
  mix-blend-mode: difference;
  animation: rtFade 1100ms ease 900ms both;
}

[data-rt-headline] {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(28px, 3.6vw, 44px);
  line-height: 1.25;
  color: var(--rt-white);
  text-wrap: pretty;
}

[data-rt-body] {
  margin: 28px 0 0;
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 18px;
  line-height: 1.65;
  color: var(--rt-100);
  text-wrap: pretty;
  text-shadow: 0 1px 16px rgba(5, 7, 15, 0.55);
}

/* Untyped characters stay laid out but invisible so nothing re-wraps. */
[data-rt-hidden] { visibility: hidden; }

/* One block per headline row: line-height alone sets the row's height, and the
   copy is written to fit, so a row can never wrap or shift the rows below. */
[data-rt-line] {
  display: block;
  white-space: nowrap;
}

[data-rt-caret] {
  display: inline-block;
  width: 0.06em;
  height: 0.95em;
  margin-left: 0.05em;
  vertical-align: -0.12em;
  background: var(--rt-white);
}

[data-rt-body] a { color: var(--rt-link); }

/* Mobile-only sentence-ending period (desktop keeps the inline email). */
[data-rt-dot] { display: none; }

/* --------------------------------------------------------------------------
   Calls to action — revealed once the paragraph finishes typing
   -------------------------------------------------------------------------- */

[data-rt-cta] {
  display: none;
  align-items: center;
  gap: 10px;
  margin-top: 28px;
  opacity: 0;
}
[data-rt-cta][data-rt-cta-show] {
  animation: rtIn 900ms cubic-bezier(0.22, 1, 0.36, 1) 200ms both;
}
[data-rt-cta] a {
  font-family: var(--font-sans);
  font-size: 16px;
  padding: 9px 18px;
  border-radius: 999px;
  text-decoration: none;
  white-space: nowrap;
}
[data-rt-cta-primary] {
  background: var(--rt-white);
  color: var(--rt-primary);
  font-weight: 600;
}
[data-rt-cta-primary]:hover { color: var(--rt-800); }
[data-rt-cta-secondary] {
  border: 1px solid rgba(255, 255, 255, 0.45);
  color: var(--rt-white);
  font-weight: 500;
  padding: 8px 17px;
}

/* js/type.js sets data-rt-wait until the display font is ready, so the reveal
   and the typing start against final metrics. Without JS the attribute is
   never set and the animations simply run. */
[data-rt-wait] [data-rt-lockup],
[data-rt-wait] [data-rt-col] {
  animation-play-state: paused;
}

@keyframes rtIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}
@keyframes rtFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* --------------------------------------------------------------------------
   Desktop
   -------------------------------------------------------------------------- */

@media (min-width: 901px) {
  [data-rt-root] {
    overflow: visible;
    padding-top: 32px;
    padding-bottom: 32px;
  }
  [data-rt-bg-host],
  [data-rt-scrim] {
    position: fixed;
    inset: 0;
  }
  [data-rt-cta] {
    display: flex;
    margin-top: 20px;
  }
  /* Desktop shows the primary pill only; the mailto lives in the paragraph. */
  [data-rt-cta] a + a { display: none; }
}

/* Shorter desktop viewports: tighten the copy so the CTA stays above the fold. */
@media (min-width: 901px) and (max-height: 960px) {
  [data-rt-body] {
    margin-top: 16px;
    font-size: 16px;
    line-height: 1.55;
  }
  [data-rt-cta] { margin-top: 14px; }
}

@media (min-width: 901px) and (max-width: 1250px) {
  [data-rt-row] {
    max-width: 94vw;
    flex-wrap: wrap;
  }
  [data-rt-col] { width: min(520px, 36vw); }
  [data-rt-headline] { font-size: clamp(24px, 3vw, 36px); }
  /* The column is narrower here, so the copy runs longer — pull it in a step. */
  [data-rt-body] { font-size: 15px; line-height: 1.5; }
}

/* --------------------------------------------------------------------------
   Mobile / portrait
   -------------------------------------------------------------------------- */

@media (max-width: 900px) {
  /* svh, not vh/dvh: the page can't scroll, so it has to fit the *smallest*
     viewport — the one with the browser's chrome showing. dvh changes as Safari
     shows and hides its bars, which both shifts the copy and pushes the CTAs
     out of reach. */
  html, body {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100vh;
    height: 100svh;
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: none;
  }
  [data-rt-root] {
    min-height: 100vh;
    min-height: 100svh;
    padding: 24px 24px calc(16px + env(safe-area-inset-bottom));
  }
  [data-rt-bg-host] {
    position: fixed;
    top: -80px;
    bottom: -80px;
    left: 0;
    right: 0;
    height: auto;
  }
  [data-rt-row] {
    flex-direction: column;
    align-items: flex-start;
    gap: 0;
    width: 100%;
    min-height: calc(100vh - 56px);
    min-height: calc(100svh - 56px);
  }
  [data-rt-lockup] {
    flex-direction: row;
    align-items: center;
    gap: 10px;
    margin-bottom: clamp(12px, 2.4svh, 22px);
  }
  [data-rt-mark] {
    width: 34px;
    height: 34px;
  }
  [data-rt-wordmark] {
    width: 92px;
    height: 23px;
    max-width: 40vw;
    margin-left: 0;
  }
  [data-rt-col] {
    width: min(480px, 86vw);
    margin-top: auto;
    padding-bottom: 0;
    transform: none !important; /* stacked layout: the baseline nudge is off */
  }
  /* --rt-fit is set by js/type.js when the measured viewport is shorter than
     CSS reports, so the CTAs can never end up out of reach on a device whose
     browser chrome we can't predict. */
  [data-rt-headline] {
    font-size: calc(clamp(22px, min(7.4vw, 4.4svh), 34px) * var(--rt-fit, 1));
    line-height: 1.2;
    margin-right: 24px;
  }
  [data-rt-body] {
    margin-top: clamp(10px, 1.7svh, 16px);
    font-size: calc(clamp(12.5px, min(3.9vw, 2.05svh), 15px) * var(--rt-fit, 1));
    line-height: 1.5;
  }
  [data-rt-cta] {
    display: flex;
    margin-top: clamp(12px, 2svh, 22px);
  }
  [data-rt-cta] a {
    font-size: clamp(14px, 1.9svh, 16px);
    padding: 8px 16px;
  }
  /* The paragraph drops the inline email on mobile; the pill carries it. */
  [data-rt-email] { display: none; }
  [data-rt-dot] { display: inline; }
}

@media (prefers-reduced-motion: reduce) {
  [data-rt-lockup],
  [data-rt-col],
  [data-rt-cta][data-rt-cta-show] { animation: none; opacity: 1; }
}

/* --------------------------------------------------------------------------
   No-JS
   -------------------------------------------------------------------------- */

[data-rt-noscript] {
  position: relative;
  z-index: 3;
  max-width: 640px;
  margin: 0 auto;
  padding: 48px 24px;
  font-family: var(--font-display);
  color: var(--rt-100);
  text-align: left;
}
[data-rt-noscript] h1 {
  font-weight: 700;
  font-size: clamp(28px, 3.6vw, 44px);
  line-height: 1.25;
  color: var(--rt-white);
}
