/* The Cilio website. Same colors, sizes and spacing as the app (src/style.css). */

:root {
  --black: #080808;
  --dark: #161616;
  --dark-control: #242424;
  --dark-active: #333333;
  --white: #ffffff;
  --gray: #8e8e8e;
  --blue: #2b82e4;
  --red: #f87171;

  --text-main: 16px;
  --text-secondary: 14px;
  --text-small: 13px;

  /* Everything that moves uses this, so the whole site feels the same */
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--black);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  margin: 0;
  color: var(--white);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: var(--text-main);
  line-height: 1.5;
}

img,
svg {
  display: block;
}

a {
  color: inherit;
  text-decoration: none;
}

.wrap {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  /* A little in from the edges on a phone, like the cards in the app */
  padding: 0 22px;
}

/* ── The bar at the top ── */
.top {
  position: sticky;
  z-index: 5;
  top: 0;
  padding: 14px 22px;
  background: linear-gradient(var(--black) 60%, transparent);
}

.bar {
  position: relative;
  display: flex;
  animation: bar-in 500ms var(--ease) both;
  max-width: max-content;
  align-items: center;
  justify-content: center;
  margin: 0 auto;
  padding: 0 24px;
  border-radius: 999px;
  background: var(--dark-control);
}

/* It drops in when the page opens */
@keyframes bar-in {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
}

/* The logo stands apart from the menu */
.bar .mark {
  display: flex;
  margin-right: 30px;
  padding: 0;
}

.bar img {
  width: 26px;
  height: 26px;
  transition: transform 300ms var(--ease);
}

.bar .mark:hover img {
  transform: scale(1.08);
}

.menu {
  display: flex;
  align-items: center;
  gap: 14px;
}

.bar a {
  padding: 13px 0;
  color: var(--gray);
  font-size: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
  transition: color 200ms ease;
}

.bar a:hover,
.bar a.is-here {
  color: var(--white);
}

.bar .sign-in {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  justify-content: center;
  /* and so does the button at the end */
  margin: 0 -8px 0 30px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--dark-active);
  color: var(--blue);
  font-weight: 600;
  line-height: 1;
  gap: 6px;
  transition: background-color 200ms ease, color 200ms ease;
}

.bar .sign-in:hover,
.bar .sign-in.is-here {
  color: var(--blue);
}

/* The three lines that open the menu on a phone */
.menu-button {
  position: relative;
  display: none;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--dark-active);
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.menu-button span {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 15px;
  height: 1.5px;
  margin-top: -0.75px;
  margin-left: -7.5px;
  border-radius: 2px;
  background: var(--white);
  transition: transform 320ms var(--ease), opacity 160ms ease;
}

.menu-button span:nth-child(1) {
  transform: translateY(-5px);
}

.menu-button span:nth-child(3) {
  transform: translateY(5px);
}

/* and turn into a cross while it is open */
.bar.is-open .menu-button span:nth-child(1) {
  transform: rotate(45deg);
}

.bar.is-open .menu-button span:nth-child(2) {
  opacity: 0;
  transform: scaleX(0.3);
}

.bar.is-open .menu-button span:nth-child(3) {
  transform: rotate(-45deg);
}

/* On a phone the menu drops down from the bar instead of sitting in it. */
@media (max-width: 559px) {
  .bar {
    min-height: 46px;
    max-width: none;
    justify-content: space-between;
    padding: 0 6px 0 16px;
  }

  .bar .mark {
    margin-right: 0;
  }

  .menu-button {
    display: block;
  }

  .menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    left: 0;
    display: grid;
    gap: 2px;
    padding: 8px;
    border-radius: 24px;
    background: var(--dark-control);
    visibility: hidden;
    opacity: 0;
    transform: translateY(-12px) scale(0.96);
    transform-origin: top right;
    transition: opacity 200ms var(--ease), transform 320ms var(--ease), visibility 0s 320ms;
  }

  .bar.is-open .menu {
    visibility: visible;
    opacity: 1;
    transform: none;
    transition: opacity 200ms var(--ease), transform 340ms var(--ease), visibility 0s;
  }

  .menu a {
    padding: 12px 14px;
    border-radius: 18px;
    font-size: var(--text-main);
    opacity: 0;
    text-align: center;
    transform: translateY(-8px);
    transition: opacity 220ms var(--ease), transform 280ms var(--ease), color 200ms ease;
  }

  .bar.is-open .menu a {
    opacity: 1;
    transform: none;
  }

  /* one after another, so the menu unfolds */
  .bar.is-open .menu a:nth-child(1) {
    transition-delay: 40ms;
  }

  .bar.is-open .menu a:nth-child(2) {
    transition-delay: 80ms;
  }

  .bar.is-open .menu a:nth-child(3) {
    transition-delay: 120ms;
  }

  .bar.is-open .menu a:nth-child(4) {
    transition-delay: 160ms;
  }

  .bar.is-open .menu a:nth-child(5) {
    transition-delay: 200ms;
  }

  /* Sign in stays last, as a button across the menu */
  .menu .sign-in {
    min-height: 44px;
    margin: 6px 0 0;
    padding: 0 14px;
    border-radius: 18px;
  }
}

/* ── Coming in as you scroll (site.js adds these) ── */
.comes-in {
  opacity: 0;
  transform: translateY(22px);
  transition: opacity 700ms var(--ease) var(--wait, 0ms), transform 700ms var(--ease) var(--wait, 0ms);
}

.comes-in.is-in {
  opacity: 1;
  transform: none;
}

/* ── Pages ── */
main {
  flex: 1;
  padding-bottom: 72px;
}

section {
  margin-top: 56px;
}

h1 {
  margin: 0;
  font-size: 32px;
  font-weight: 700;
  line-height: 40px;
  letter-spacing: -0.5px;
}

h2 {
  margin: 0 0 10px;
  color: var(--blue);
  font-size: var(--text-secondary);
  font-weight: 600;
}

h3 {
  margin: 0;
  font-size: var(--text-main);
  font-weight: 600;
}

.lead {
  max-width: 540px;
  margin: 14px 0 0;
  color: var(--gray);
}

/* ── The top of the home page ── */
.hero {
  display: grid;
  justify-items: center;
  margin-top: 24px;
  text-align: center;
}

.hero h1,
.hero .lead {
  max-width: 620px;
}

.hero .lead {
  margin-inline: auto;
}

/* Long headings break into even lines instead of leaving one word alone */
h1,
.title,
.lead {
  text-wrap: balance;
}

.cilio-box {
  margin-bottom: 12px;
}

/* Cilio floats gently in place */
.cilio {
  width: min(210px, 54vw);
  height: min(210px, 54vw);
  animation: float 6s ease-in-out infinite;
}

@keyframes float {
  50% {
    transform: translateY(-8px);
  }
}

/* He comes in a touch bigger than the words under him */
.comes-in.cilio-box {
  transform: translateY(14px) scale(0.94);
}

.comes-in.cilio-box.is-in {
  transform: none;
  transition-duration: 900ms;
}

.open {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  margin-top: 24px;
  padding: 0 18px;
  border-radius: 999px;
  background: var(--dark-control);
  color: var(--blue);
  font-size: var(--text-secondary);
  font-weight: 600;
  line-height: 1;
  transition: background-color 200ms ease, transform 220ms var(--ease);
}

/* ── A feature on the home page: what it is, what it does, and a video of it ── */
/* Every section after the top one reads from the left */
.feature,
.block,
.end {
  margin-top: 96px;
  text-align: left;
}

/* A feature reads from the left, in a column in the middle of the page.
   It stops below the bar when the page scrolls to it. */
.feature {
  max-width: 680px;
  margin-inline: auto;
  scroll-margin-top: 80px;
  text-align: left;
}

.kicker {
  margin: 0 0 10px;
  color: var(--blue);
  font-size: var(--text-secondary);
  font-weight: 600;
}

/* Smaller than the big text at the top, so that stays the main one */
.title {
  margin: 0;
  color: var(--white);
  font-size: 22px;
  font-weight: 700;
  line-height: 28px;
  letter-spacing: -0.3px;
}

.feature .lead {
  margin: 10px 0 0;
}

.end .lead {
  margin: 10px 0 0;
}

/* What a feature does, as a list starting on the left */
.points {
  display: grid;
  width: max-content;
  max-width: 100%;
  gap: 12px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
  text-align: left;
}

.points li {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: var(--text-main);
  font-weight: 500;
  line-height: 22px;
}

/* A small gray dot in front of each one */
.points li::before {
  width: 6px;
  height: 6px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--gray);
  content: "";
}

/* The video, shaped like a phone screen */
/* In the middle under the text, until there's room for it beside the text */
.clip {
  width: min(300px, 68vw);
  margin: 32px auto 0;
}

.screen {
  position: relative;
  display: grid;
  overflow: hidden;
  aspect-ratio: 9 / 16;
  place-items: center;
  border-radius: 28px;
  background: var(--dark);
}

.screen video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 500ms var(--ease);
}

/* Until the video is there, a play sign that softly pulses */
.play {
  position: relative;
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border-radius: 999px;
  background: var(--dark-control);
  color: var(--white);
  transition: opacity 300ms ease;
}

.play svg {
  margin-left: 3px;
}

.play::after {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  animation: pulse 2.4s var(--ease) infinite;
  box-shadow: 0 0 0 0 rgb(255 255 255 / 18%);
  content: "";
}

@keyframes pulse {
  70%,
  100% {
    box-shadow: 0 0 0 18px rgb(255 255 255 / 0%);
  }
}

.clip.has-video video {
  opacity: 1;
}

.clip.has-video .play {
  opacity: 0;
}

.clip figcaption {
  margin-top: 12px;
  text-align: center;
  color: var(--gray);
  font-size: var(--text-small);
}

/* ── The end of the home page ── */
.end {
  display: grid;
  justify-items: start;
}

.end-cilio {
  width: 64px;
  height: 64px;
  margin-bottom: 16px;
}

.open:hover {
  background: var(--dark-active);
  transform: translateY(-2px);
}

.open:active {
  transform: translateY(0);
}

/* ── Connect: the popup for signing in with Telegram ── */
/* The page behind it doesn't scroll while it's open */
html.is-locked {
  overflow: hidden;
}

.connect {
  width: min(380px, calc(100% - 32px));
  max-width: none;
  max-height: none;
  padding: 0;
  border: 0;
  border-radius: 24px;
  background: var(--dark);
  color: var(--white);
  animation: connect-in 340ms var(--ease);
}

.connect::backdrop {
  background: rgb(0 0 0 / 60%);
  animation: fade-in 340ms ease;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.connect.is-closing {
  animation: connect-out 200ms ease forwards;
}

.connect.is-closing::backdrop {
  animation: fade-out 200ms ease forwards;
}

@keyframes connect-in {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.97);
  }
}

@keyframes connect-out {
  to {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
}

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes fade-out {
  to {
    opacity: 0;
  }
}

.connect-box {
  position: relative;
  display: grid;
  justify-items: center;
  padding: 32px 24px 28px;
  text-align: center;
}

.connect-close {
  position: absolute;
  top: 14px;
  right: 14px;
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: var(--dark-control);
  color: var(--gray);
  cursor: pointer;
  transition: color 200ms ease;
}

.connect-close:hover {
  color: var(--white);
}

.connect-logo {
  width: 56px;
  height: 56px;
  margin-bottom: 12px;
}

.connect h2 {
  margin: 0;
  color: var(--white);
  font-size: 22px;
  font-weight: 700;
  line-height: 28px;
}

.connect .lead {
  max-width: 300px;
  margin: 8px auto 0;
  font-size: 15px;
  line-height: 22px;
}

.connect .open {
  margin-top: 22px;
}

.connect-out,
.connect-in {
  display: grid;
  width: 100%;
  justify-items: center;
}

.connect-out[hidden],
.connect-in[hidden] {
  display: none;
}

/* Inside the popup the card needs to stand out from it */
.connect .card.account {
  width: 100%;
  background: var(--dark-control);
}

.connect .account-picture {
  background: var(--dark-active);
}

/* On a phone it slides up from the bottom of the screen */
@media (max-width: 559px) {
  .connect {
    width: 100%;
    margin: auto 0 0;
    border-radius: 24px 24px 0 0;
    animation-name: sheet-in;
  }

  .connect.is-closing {
    animation-name: sheet-out;
  }

  .connect-box {
    padding-bottom: calc(28px + env(safe-area-inset-bottom));
  }
}

@keyframes sheet-in {
  from {
    transform: translateY(100%);
  }
}

@keyframes sheet-out {
  to {
    transform: translateY(100%);
  }
}

/* A button that looks like the Open Cilio pill, with an icon in front */
button.open {
  gap: 8px;
  border: 0;
  font-family: inherit;
  cursor: pointer;
}

/* Who is signed in: their Telegram picture, name and username */
.card.account {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 24px;
  padding: 14px 16px;
  text-align: left;
}

.account-picture {
  display: grid;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  overflow: hidden;
  place-items: center;
  border-radius: 50%;
  background: var(--dark-control);
  font-size: 20px;
  font-weight: 700;
}

.account-picture img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.account-who {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.account-who strong,
.account-who small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-who strong {
  font-weight: 600;
}

.account-who small {
  color: var(--gray);
  font-size: var(--text-secondary);
}

.account-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  margin-top: 24px;
}

.account-actions .open {
  gap: 8px;
  margin-top: 0;
}

.text-button {
  padding: 0;
  border: 0;
  background: none;
  color: var(--blue);
  font: inherit;
  font-size: var(--text-secondary);
  font-weight: 600;
  cursor: pointer;
}

.error {
  margin: 14px 0 0;
  color: var(--red);
  font-size: var(--text-small);
}

/* Disconnect is the one red button: it signs the person out */
.text-button.is-danger {
  color: var(--red);
}

/* ── The panel, after connecting ── */
.wrap.panel {
  max-width: 640px;
}

.panel section {
  margin-top: 32px;
}

.panel .panel-hello {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 40px;
}

.panel-hello .account-picture {
  width: 64px;
  height: 64px;
  font-size: 26px;
}

.panel h1 {
  font-size: 28px;
  line-height: 34px;
}

.panel-hello .lead {
  margin-top: 4px;
  font-size: var(--text-secondary);
}

/* Rows touch each other: a card is just its rows */
.card.rows {
  padding: 0 16px;
}

.card.rows:hover {
  background: var(--dark);
  transform: none;
}

.row {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 52px;
}

.card.rows .row svg {
  flex-shrink: 0;
  margin: 0;
}

.row-label {
  overflow: hidden;
  flex: 1;
  min-width: 0;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-value {
  flex-shrink: 0;
  color: var(--gray);
  font-size: var(--text-secondary);
}

.row.is-quiet,
.card.rows .row.is-quiet svg {
  color: var(--gray);
}

.row.is-quiet .row-label {
  font-weight: 400;
}

.panel .panel-end {
  margin-top: 40px;
  text-align: center;
}

.panel-end .note {
  margin: 0;
}

/* ── Cards ── */
.cards {
  display: grid;
  gap: 14px;
  grid-template-columns: 1fr;
}

.card {
  padding: 16px;
  border-radius: 18px;
  background: var(--dark);
  transition: background-color 300ms var(--ease), transform 300ms var(--ease);
}

@media (hover: hover) {
  .card:hover {
    background: #1c1c1c;
    transform: translateY(-3px);
  }
}

.card p {
  margin: 8px 0 0;
  color: var(--gray);
  font-size: var(--text-secondary);
}

.card svg {
  margin-bottom: 12px;
  color: var(--white);
}

/* A review: what someone said, and who said it */
.review p {
  margin: 0;
  color: var(--white);
}

.review small {
  display: block;
  margin-top: 10px;
  color: var(--gray);
  font-size: var(--text-small);
}

/* A plan on the pricing page */
.plan strong {
  display: block;
  margin-top: 6px;
  font-size: 26px;
  font-weight: 700;
  line-height: 34px;
}

.plan span {
  color: var(--gray);
  font-size: var(--text-small);
  font-weight: 400;
}

.plan ul {
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.plan li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 5px 0;
  font-size: var(--text-secondary);
}

.plan li svg {
  margin: 3px 0 0;
  color: var(--gray);
  flex-shrink: 0;
}

.note {
  margin: 18px 0 0;
  color: var(--gray);
  font-size: var(--text-small);
}

/* ── The bottom of every page ── */
footer {
  padding: 64px 0 40px;
  color: var(--gray);
  font-size: var(--text-small);
}

footer .wrap {
  display: grid;
  justify-items: center;
  gap: 16px;
  text-align: center;
}

/* The logo, the name and the rights, all on one line under the menu */
footer .who {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--white);
  font-size: var(--text-secondary);
  font-weight: 600;
}

footer img {
  width: 24px;
  height: 24px;
}

footer nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 20px;
}

footer a {
  transition: color 200ms ease;
}

footer a:hover {
  color: var(--white);
}

footer .who small {
  color: var(--gray);
  font-size: 12px;
  font-weight: 400;
}

@media (min-width: 720px) {
  .wrap {
    padding: 0 24px;
  }

  section {
    margin-top: 72px;
  }

  h1 {
    font-size: 44px;
    line-height: 52px;
  }

  .lead {
    font-size: 17px;
  }

  .hero {
    margin-top: 40px;
  }

  .cilio {
    width: 240px;
    height: 240px;
  }

  .feature,
  .block,
  .end {
    margin-top: 136px;
  }

  .title {
    font-size: 26px;
    line-height: 32px;
  }

  .clip {
    width: 320px;
  }

  .cards {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* On a computer the page uses more of the screen, and everything on it grows with it. */
@media (min-width: 1080px) {
  .wrap {
    max-width: 1200px;
    padding: 0 40px;
  }

  h1 {
    font-size: 56px;
    line-height: 64px;
    letter-spacing: -1px;
  }

  .hero h1 {
    max-width: 820px;
  }

  .lead,
  .hero .lead {
    max-width: 680px;
    font-size: 18px;
    line-height: 28px;
  }

  .cilio {
    width: 280px;
    height: 280px;
  }

  .title {
    font-size: 30px;
    line-height: 38px;
    letter-spacing: -0.5px;
  }

  .points {
    gap: 14px;
  }

  .points li {
    font-size: 17px;
  }

  .clip {
    width: 360px;
  }

  /* There's room for the video next to what it shows, so it moves beside the text, in the middle of its height. */
  /* The home page keeps its text and videos close together */
  .wrap.home {
    max-width: 1040px;
  }

  .feature {
    display: grid;
    max-width: none;
    align-items: start;
    justify-content: center;
    column-gap: 64px;
    grid-template-columns: minmax(0, 460px) 360px;
    grid-template-rows: 1fr auto auto auto auto 1fr;
  }

  .feature > * {
    grid-column: 1;
  }

  .feature .kicker {
    grid-row: 2;
  }

  .feature .title {
    grid-row: 3;
  }

  .feature .lead {
    grid-row: 4;
  }

  .feature .points {
    grid-row: 5;
  }

  .feature .clip {
    margin: 0;
    grid-column: 2;
    grid-row: 1 / -1;
  }

  /* Groups swaps sides, so the page doesn't read the same way three times */
  #groups {
    grid-template-columns: 360px minmax(0, 460px);
  }

  #groups > * {
    grid-column: 2;
  }

  #groups .clip {
    grid-column: 1;
  }

  .cards {
    gap: 18px;
  }

  .card {
    padding: 22px;
  }
}

/* ── For anyone who asked their phone to keep still ── */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    transition-duration: 1ms !important;
  }

  .comes-in,
  .comes-in.cilio-box {
    opacity: 1;
    transform: none;
  }

  .cilio,
  .play::after {
    animation: none;
  }

  .card:hover,
  .open:hover {
    transform: none;
  }
}

/* The account card in the popup stays still under the pointer */
.connect .card.account:hover {
  transform: none;
}
