/* CiRCLES landing page. Loaded after styles.css; everything is scoped to .cx
   except the site header and footer adjustments for this page. */

@font-face {
  font-family: "DM Sans";
  src: url("../fonts/DMSans.woff2") format("woff2");
  font-weight: 400 700;
  font-style: normal;
  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;
}

/* Site chrome: the floating tab bar overlaps the hero instead of pushing it
   down, and the footer sits on the wallpaper below the footnotes. */
.cx-page .ktui-header {
  margin-bottom: -64px;
}

.cx-page .ktui-footer {
  margin-top: 0;
  padding: 28px 16px 32px;
}

/* Base */

.cx {
  --cx-accent: #2563eb;
  --cx-text: #1d1d1f;
  --cx-text-2: #515154;
  --cx-text-3: #6e6e73;
  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, system-ui, "Hiragino Sans", "Hiragino Kaku Gothic ProN", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  letter-spacing: normal;
  color: var(--cx-text);
  overflow-x: clip;
}

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

.cx img,
.cx svg {
  -webkit-user-drag: none;
}

/* Undo the site's heading styles (font, color, margins). Zero-specificity
   wrapper so the classes below still win. */
:where(.cx) :is(h1, h2, h3, p) {
  margin: 0;
  padding: 0;
  font-family: inherit;
  color: inherit;
}

.cx-accent {
  color: var(--cx-accent);
}

.cx-h2 {
  font-size: clamp(36px, 5.4vw, 64px);
  line-height: 1.04;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.cx-body {
  margin-top: 20px;
  font-size: 19px;
  line-height: 1.45;
  color: var(--cx-text-2);
}

/* Footnote markers */
.cx-fn {
  margin-left: 2px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0;
  vertical-align: super;
  line-height: 0;
}

.cx-h2 .cx-fn {
  margin-left: 4px;
  font-size: 16px;
}

.cx-fn a,
.cx-fn a:hover {
  color: inherit;
  border-bottom: none;
}

.cx-fn a:hover {
  text-decoration: underline;
}

/* Device frame around a screenshot */
.cx-phone {
  padding: 10px;
  border-radius: 40px;
  background: #111114;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.08) inset,
              0 40px 80px -30px rgba(15, 30, 80, 0.45),
              0 18px 36px -18px rgba(15, 30, 80, 0.35);
}

.cx-phone img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 30px;
}

.cx-phone-sm {
  padding: 8px;
  border-radius: 32px;
}

.cx-phone-sm img {
  border-radius: 24px;
}

/* Store badges */
.cx-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 32px;
}

.cx a.cx-badge,
.cx a.cx-badge:hover {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  height: 48px;
  padding: 0 16px 0 12px;
  border: 1px solid #a6a6a6;
  border-radius: 10px;
  background: #000000;
  color: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Helvetica, Arial, sans-serif;
  white-space: nowrap;
}

.cx-badge-apple {
  flex: none;
  width: 22px;
  height: 27px;
  margin-top: -3px;
  background: currentColor;
  -webkit-mask: url("../img/badges/apple.svg") center / contain no-repeat;
  mask: url("../img/badges/apple.svg") center / contain no-repeat;
}

.cx-badge img {
  flex: none;
  display: block;
}

.cx-badge-label {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  font-size: 20px;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.01em;
}

.cx-badge-label small {
  margin-bottom: 3px;
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.02em;
}

/* Hero */

.cx-hero {
  position: relative;
  overflow: hidden;
  padding: 120px 24px 0;
  background: #f5f7fc;
}

.cx-hero-rings {
  position: absolute;
  left: 50%;
  top: 520px;
  width: 1500px;
  height: 1500px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.cx-hero-inner {
  position: relative;
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.cx-hero-icon {
  display: block;
  width: 96px;
  height: 96px;
  border-radius: 22px;
  box-shadow: 0 12px 30px -10px rgba(40, 70, 160, 0.45);
}

.cx-hero-title {
  margin-top: 28px;
  font-size: clamp(56px, 10vw, 112px);
  line-height: 0.95;
  font-weight: 700;
  letter-spacing: -0.04em;
}

.cx-hero-tagline {
  margin-top: 18px;
  font-size: clamp(26px, 3.4vw, 40px);
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.cx-hero-lede {
  max-width: 560px;
  margin-top: 18px;
  font-size: 19px;
  line-height: 1.5;
  color: var(--cx-text-2);
}

.cx-hero-device {
  position: relative;
  display: flex;
  justify-content: center;
  margin-top: 72px;
}

.cx-hero-device .cx-phone {
  width: 340px;
  max-width: 80vw;
  margin-bottom: -180px;
  padding: 11px;
  border-radius: 46px;
}

.cx-hero-device .cx-phone img {
  border-radius: 35px;
}

.cx-hero-spacer {
  height: 180px;
  background: #ffffff;
}

/* Docked scenes. Static, stacked sections unless scroll-driven motion is on. */

.cx-stage {
  position: relative;
  display: flex;
  align-items: center;
  padding: 120px 24px;
}

.cx-stage-in {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 64px;
}

.cx-copy {
  flex: 1 1 420px;
  min-width: 0;
}

.cx-visual {
  flex: 1 1 300px;
  display: flex;
  justify-content: center;
}

.cx-reverse {
  flex-wrap: wrap-reverse;
}

.cx-figure {
  display: block;
  width: 100%;
  margin-top: 36px;
}

/* Phones scale with the docked viewport height (900px when not docked). */
.cx-fit   { width: clamp(170px, calc((var(--sh, 900px) - 160px) * 0.44), 290px); }
.cx-fit-c { width: clamp(170px, calc((var(--sh, 900px) - 160px) * 0.4), 260px); }
.cx-fit-s { width: clamp(150px, calc((var(--sh, 900px) - 160px) * 0.34), 220px); }

/* Section colors */
.cx-bg-white { background: #ffffff; }
.cx-bg-sky   { background: #e3f2fc; }
.cx-bg-gray  { background: #e5e5ea; }

.cx-bg-night {
  background: #0a0f1f;
  color: #f5f5f7;
}

.cx-bg-night .cx-body { color: #b4b9c8; }

.cx-bg-blue {
  background: #1a3aa3;
  color: #ffffff;
}

.cx-bg-blue .cx-body { color: #d3defc; }

/* Map scene: three phones fanned out */
.cx-fan {
  position: relative;
  flex: 1 1 520px;
  min-width: 0;
  display: flex;
  justify-content: center;
}

.cx-fan-l,
.cx-fan-r {
  position: absolute;
  left: 50%;
  top: 28px;
}

.cx-fan-l { transform: translateX(-109%) rotate(-7deg); }
.cx-fan-r { transform: translateX(9%) rotate(7deg); }

.cx-fan-c {
  position: relative;
  z-index: 2;
}

/* Feature rows between scenes */
.cx-features {
  padding: 40px 24px 140px;
  background: #ffffff;
}

.cx-features-in {
  max-width: 1080px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 40px 32px;
}

.cx-feature svg {
  display: block;
  width: 32px;
  height: 32px;
  fill: none;
  stroke: var(--cx-accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cx-feature h3 {
  margin-top: 14px;
  font-size: 19px;
  font-weight: 600;
  line-height: 1.3;
}

.cx-feature p {
  margin-top: 6px;
  font-size: 16px;
  line-height: 1.5;
  color: var(--cx-text-3);
}

/* Account scene: the card overlaps the screenshot */
.cx-account {
  position: relative;
  flex: 0 1 560px;
  min-width: 0;
  display: flex;
  justify-content: flex-end;
}

.cx-card-wrap {
  position: absolute;
  left: 0;
  bottom: 6%;
  z-index: 2;
  width: 360px;
}

.cx-card {
  position: relative;
  overflow: hidden;
  padding: 26px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 32px;
  background: #3366e6;
  color: #ffffff;
  box-shadow: 0 50px 100px -40px rgba(5, 15, 60, 0.7),
              0 20px 40px -20px rgba(5, 15, 60, 0.5);
}

.cx-card-rings {
  position: absolute;
  right: -60px;
  top: -60px;
  width: 240px;
  height: 240px;
}

.cx-card-head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
}

.cx-card-head svg {
  flex: none;
  width: 56px;
  height: 56px;
}

.cx-card-event {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #dbe4ff;
}

.cx-card-name {
  margin-top: 2px;
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.cx-card-calendar {
  position: relative;
  display: block;
  width: 100%;
  margin-top: 18px;
}

.cx-card-days {
  position: relative;
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cx-day {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.14);
}

.cx-day-date {
  font-size: 12px;
  color: #dbe4ff;
}

.cx-day-ticket {
  margin-top: 1px;
  font-size: 16px;
  font-weight: 600;
}

.cx-day svg {
  flex: none;
  width: 20px;
  height: 20px;
  fill: none;
  stroke: #ffffff;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.cx-day-off {
  background: rgba(255, 255, 255, 0.07);
}

.cx-day-off .cx-day-date,
.cx-day-off .cx-day-ticket {
  color: #c3d0f7;
}

/* Closing call to action */
.cx-cta {
  position: relative;
  overflow: hidden;
  padding: 140px 24px 120px;
  background: #ffffff;
  text-align: center;
}

.cx-cta-rings {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 900px;
  height: 900px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.cx-cta-in {
  position: relative;
  max-width: 900px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.cx-cta-icon {
  display: block;
  width: 80px;
  height: 80px;
  border-radius: 18px;
}

.cx-cta .cx-h2 {
  margin-top: 24px;
  text-wrap: balance;
}

.cx-cta .cx-body {
  margin-top: 18px;
}

.cx-source {
  margin-top: 28px;
  font-size: 15px;
}

/* Footnotes */
.cx-footnotes {
  padding: 40px 24px 48px;
  border-top: 1px solid #e3e3e8;
  background: #f5f5f7;
  font-size: 12px;
  line-height: 1.6;
  color: var(--cx-text-3);
}

.cx-footnotes-in {
  max-width: 1080px;
  margin: 0 auto;
}

.cx-footnotes ol {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.cx-footnotes li {
  scroll-margin-top: 80px;
}

.cx-footnotes p {
  margin-top: 16px;
}

/* SVG drawing helpers */
.cx-draw {
  stroke-dasharray: var(--len);
  stroke-dashoffset: 0;
}

/* Motion */

@keyframes cx-rise { from { opacity: 0; transform: translateY(56px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes cx-rise-far { from { opacity: 0; transform: translateY(240px) scale(0.92); } to { opacity: 1; transform: none; } }
@keyframes cx-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes cx-draw { from { stroke-dashoffset: var(--len); } to { stroke-dashoffset: 0; } }
@keyframes cx-pop { from { opacity: 0; transform: scale(0.3); } to { opacity: 1; transform: scale(1); } }
@keyframes cx-fan-l { from { opacity: 0; transform: translateX(-50%) rotate(0deg) scale(0.9); } to { opacity: 1; transform: translateX(-109%) rotate(-7deg); } }
@keyframes cx-fan-r { from { opacity: 0; transform: translateX(-50%) rotate(0deg) scale(0.9); } to { opacity: 1; transform: translateX(9%) rotate(7deg); } }
@keyframes cx-tilt { from { opacity: 0; transform: perspective(1400px) rotateX(38deg) translateY(160px) scale(0.9); } to { opacity: 1; transform: perspective(1400px) rotateX(0deg) translateY(0) scale(1); } }
@keyframes cx-spin { to { transform: rotate(360deg); } }
@keyframes cx-spin-r { to { transform: rotate(-360deg); } }
@keyframes cx-load { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes cx-load-phone { from { opacity: 0; transform: translateY(120px) scale(0.94); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: no-preference) {
  .cx-spin   { transform-box: fill-box; transform-origin: center; animation: cx-spin 120s linear infinite; }
  .cx-spin-r { transform-box: fill-box; transform-origin: center; animation: cx-spin-r 160s linear infinite; }
  .cx-load { animation: cx-load 1s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
  .cx-load-2 { animation-delay: 0.12s; }
  .cx-load-3 { animation-delay: 0.24s; }
  .cx-load-phone { animation: cx-load-phone 1.4s cubic-bezier(0.2, 0.7, 0.2, 1) 0.3s both; }

  @supports (animation-timeline: view()) {
    .cx-rv { animation: cx-rise linear both; animation-timeline: view(); animation-range: entry 0% cover 32%; }
    .cx-rv-2 { animation-range: entry 12% cover 40%; }
    .cx-rv-3 { animation-range: entry 24% cover 48%; }

    /* Dock: the scene sticks to the viewport while its tall track scrolls
       past, and the track's progress scrubs every animation inside it. */
    .cx-pin {
      --sh: min(100vh, 1600px);
      height: calc(var(--sh) * 2.8);
      view-timeline-name: --pin;
    }

    @supports (height: 100svh) {
      .cx-pin { --sh: min(100svh, 1600px); }
    }

    .cx-stage {
      position: sticky;
      top: 0;
      height: var(--sh);
      overflow: hidden;
      padding: 64px 24px 0;
    }

    .cx-pin [class*="t-"] {
      animation-timeline: --pin;
      animation-fill-mode: both;
      animation-timing-function: linear;
      animation-duration: auto;
    }

    .cx-pin svg [class*="t-"] {
      transform-box: fill-box;
      transform-origin: center;
    }

    .t-text  { animation-name: cx-rise;     animation-range: entry 55% contain 12%; }
    .t-phone { animation-name: cx-rise-far; animation-range: contain 2% contain 30%; }
    .t-fan-l { animation-name: cx-fan-l;    animation-range: contain 30% contain 58%; }
    .t-fan-r { animation-name: cx-fan-r;    animation-range: contain 34% contain 62%; }
    .t-fade  { animation-name: cx-fade;     animation-range: contain 12% contain 28%; }
    .t-draw  { animation-name: cx-draw;     animation-range: contain 30% contain 80%; }
    .t-hall  { animation-name: cx-draw;     animation-range: contain 8% contain 34%; }
    .t-tilt  { animation-name: cx-tilt;     animation-range: contain 4% contain 34%; }
    .t-p1 { animation-name: cx-pop; animation-range: contain 35% contain 42%; }
    .t-p2 { animation-name: cx-pop; animation-range: contain 43% contain 50%; }
    .t-p3 { animation-name: cx-pop; animation-range: contain 51% contain 58%; }
    .t-p4 { animation-name: cx-pop; animation-range: contain 59% contain 66%; }
    .t-p5 { animation-name: cx-pop; animation-range: contain 67% contain 74%; }
    .t-p6 { animation-name: cx-pop; animation-range: contain 75% contain 82%; }
    .t-p7 { animation-name: cx-pop; animation-range: contain 83% contain 90%; }

    /* Same timing as the t-p steps, different effect. */
    .cx-pin .a-draw { animation-name: cx-draw; }
    .cx-pin .a-fade { animation-name: cx-fade; }

    /* Guide: route, closure, detour. */
    .t-ga { animation-name: cx-draw; animation-range: contain 20% contain 50%; }
    .t-s1 { animation-name: cx-pop;  animation-range: contain 27% contain 33%; }
    .t-s2 { animation-name: cx-pop;  animation-range: contain 43% contain 49%; }
    .t-s3 { animation-name: cx-pop;  animation-range: contain 50% contain 56%; }
    .t-gb { animation-name: cx-fade; animation-range: contain 56% contain 60%; }
    .t-gx { animation-name: cx-pop;  animation-range: contain 60% contain 66%; }
    .t-gl { animation-name: cx-pop;  animation-range: contain 65% contain 70%; }
    .t-gc { animation-name: cx-draw; animation-range: contain 70% contain 84%; }
    .t-s4 { animation-name: cx-pop;  animation-range: contain 84% contain 90%; }

    /* Account card: days get marked on the calendar one by one. */
    .t-k1   { animation-name: cx-draw; animation-range: contain 36% contain 46%; }
    .t-row1 { animation-name: cx-rise; animation-range: contain 42% contain 52%; }
    .t-k2   { animation-name: cx-draw; animation-range: contain 52% contain 62%; }
    .t-row2 { animation-name: cx-rise; animation-range: contain 58% contain 68%; }
    .t-k3   { animation-name: cx-draw; animation-range: contain 68% contain 74%; }
    .t-row3 { animation-name: cx-rise; animation-range: contain 72% contain 82%; }

    @media (max-height: 760px) {
      .cx-hide-short { display: none; }
    }
  }
}

@media (max-width: 720px) {
  .cx-hide-sm { display: none; }
  .cx-stage-in { gap: 32px; }
  .cx-card-wrap { position: static; width: 100%; }
}

@keyframes cx-swap-in { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes cx-swap-out { from { opacity: 1; } to { opacity: 0; } }

@media (max-width: 720px) and (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .cx-stage { align-items: flex-start; padding-top: 96px; }

    /* On phones the drawing plays first, then the screenshot fades in over
       the same spot and replaces it. The map scene keeps its phones. */
    .cx-swap {
      display: grid;
      grid-template-columns: minmax(0, 1fr);
      grid-template-areas: "text" "art";
      justify-items: center;
      gap: 28px;
    }

    .cx-swap > .cx-copy { display: contents; }
    .cx-swap .t-text { grid-area: text; justify-self: stretch; }

    .cx-swap .cx-figure.cx-hide-sm {
      grid-area: art;
      align-self: start;
      display: block;
      max-width: 340px !important;
      margin-top: 0;
    }

    .cx-swap > .cx-visual { grid-area: art; align-self: start; }

    .cx-swap-box {
      display: grid;
      grid-template-columns: minmax(0, 1fr);
      justify-content: center;
      justify-items: center;
      width: 100%;
    }

    .cx-swap-box > * { grid-area: 1 / 1; align-self: start; }
    .cx-swap-box > .cx-hide-sm { display: block; z-index: 3; }

    /* Large enough to read; the bottom of the phone runs off the screen. */
    .cx-swap .cx-fit,
    .cx-swap-box .cx-fit {
      width: min(72vw, 300px);
    }

    .cx-swap .t-phone,
    .cx-swap-box .t-phone {
      animation-name: cx-swap-in;
      animation-range: contain 86% contain 96%;
    }

    .cx-swap .cx-figure {
      animation: cx-swap-out linear both;
      animation-timeline: --pin;
      animation-range: contain 86% contain 96%;
    }

    .cx-swap-box .cx-card-wrap {
      max-width: 360px;
      animation-name: cx-tilt, cx-swap-out;
      animation-range: contain 4% contain 34%, contain 86% contain 96%;
    }
  }
}

.cx-phone-night {
  background: #26262b;
}

/* Dark appearance */

@media (prefers-color-scheme: dark) {
  .cx {
    --cx-accent: #5b9bff;
    --cx-text: #f5f5f7;
    --cx-text-2: #a1a1a6;
    --cx-text-3: #98989d;
  }

  .cx-hero { background: #0b0e14; }
  .cx-bg-white,
  .cx-hero-spacer,
  .cx-features,
  .cx-cta { background: #000000; }
  .cx-bg-sky { background: #0b2233; }
  .cx-bg-gray { background: #1c1c1e; }

  .cx-footnotes {
    border-top-color: #2c2c2e;
    background: #111113;
  }

  .cx-phone {
    box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14),
                0 40px 80px -30px rgba(0, 0, 0, 0.8);
  }

  /* Rings */
  .cx-hero-rings [stroke="#c9d6f5"],
  .cx-cta-rings [stroke="#e6ecfa"] { stroke: #26324d; }
  .cx-hero-rings [stroke="#dbe4f8"],
  .cx-cta-rings [stroke="#eef2fb"] { stroke: #1b2438; }

  /* Drawings: cards, booths and lines on dark grounds */
  :is(.cx-bg-white, .cx-bg-sky, .cx-bg-gray) .cx-figure [fill="#ffffff"] { fill: #2c2c2e; }
  :is(.cx-bg-white, .cx-bg-sky, .cx-bg-gray) .cx-figure [stroke="#e3e3e8"],
  :is(.cx-bg-white, .cx-bg-sky, .cx-bg-gray) .cx-figure [stroke="#dcdce2"] { stroke: #3a3a3c; }
  :is(.cx-bg-white, .cx-bg-sky, .cx-bg-gray) .cx-figure [stroke="#c9d6f5"] { stroke: #34405e; }
  :is(.cx-bg-white, .cx-bg-sky, .cx-bg-gray) .cx-figure [stroke="#b7c6ef"] { stroke: #4a5d93; }
  :is(.cx-bg-white, .cx-bg-sky, .cx-bg-gray) .cx-figure rect[fill="#f5f5f7"] { fill: #3a3a3c; }
  :is(.cx-bg-white, .cx-bg-sky, .cx-bg-gray) .cx-figure path[fill="#f5f5f7"] { fill: #0b2233; }
  :is(.cx-bg-white, .cx-bg-sky, .cx-bg-gray) .cx-figure [fill="#1d1d1f"] { fill: #f5f5f7; }
  :is(.cx-bg-white, .cx-bg-sky, .cx-bg-gray) .cx-figure [fill="#9a9aa0"] { fill: #8e8e93; }
  :is(.cx-bg-white, .cx-bg-sky, .cx-bg-gray) .cx-figure [fill="#c7c7cc"] { fill: #636366; }
}
