/*
 * EasyFin landing page.
 *
 * One stylesheet for the Arabic (right-to-left) page and the English page:
 * every side is written as "start" or "end", so the same rules serve both.
 * The page has no scripts.
 *
 * Colours are the brand's (docs/brand): deep petrol, cream, and the yellow
 * and orange beads of the abacus logo. The abacus is the page's one motif:
 * rods with beads behind the product pictures, and bead rows as markers.
 */

/* ---- Fonts: IBM Plex Sans Arabic, shipped with the page (no CDN) -------- */
@font-face {
  font-family: 'IBM Plex Sans Arabic';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/ibm-plex-sans-arabic-arabic-400-normal.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E,
    U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: 'IBM Plex Sans Arabic';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/ibm-plex-sans-arabic-arabic-500-normal.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E,
    U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: 'IBM Plex Sans Arabic';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/ibm-plex-sans-arabic-arabic-600-normal.woff2') format('woff2');
  unicode-range: U+0600-06FF, U+0750-077F, U+0870-088E, U+0890-0891, U+0897-08E1, U+08E3-08FF, U+200C-200E,
    U+2010-2011, U+204F, U+2E41, U+FB50-FDFF, U+FE70-FE74, U+FE76-FEFC;
}
@font-face {
  font-family: 'IBM Plex Sans Arabic';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('fonts/ibm-plex-sans-arabic-latin-400-normal.woff2') format('woff2');
  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-200B, U+200F, U+2012-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Sans Arabic';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('fonts/ibm-plex-sans-arabic-latin-500-normal.woff2') format('woff2');
  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-200B, U+200F, U+2012-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Sans Arabic';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('fonts/ibm-plex-sans-arabic-latin-600-normal.woff2') format('woff2');
  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-200B, U+200F, U+2012-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---- Colours and sizes -------------------------------------------------- */
:root {
  color-scheme: light;

  --petrol: #0e3b43;
  --petrol-deep: #0a2b31;
  --petrol-soft: #174e58;
  --cream: #f4f1de;
  --paper: #fbfaf4;
  --yellow: #f2c14e;
  --orange: #f78154;
  --teal: #7fa3a6;
  --gold: #8a5c00; /* yellow is too pale to read on a light page */
  --gold-word: #c98a12; /* "Fin" in the name, on light */

  --ink: var(--petrol);
  --ink-soft: #456368;
  --line: #dcd8c0;
  --on-dark: var(--cream);
  --on-dark-soft: #b9d0d2;
  --rod: rgb(127 163 166 / 0.45);

  --gutter: 20px;
  --bead: 20px;
  --flip: 1; /* -1 on the right-to-left page: turns sideways movement around */
}
[dir='rtl'] {
  --flip: -1;
}

/* ---- Base --------------------------------------------------------------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'IBM Plex Sans Arabic', 'Segoe UI', Tahoma, system-ui, sans-serif;
  font-size: 1.0625rem;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
html[lang='en'] body {
  line-height: 1.65;
}
img {
  max-width: 100%;
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1,
h2,
h3 {
  font-weight: 600;
  line-height: 1.4;
  text-wrap: balance;
}
html[lang='en'] :is(h1, h2, h3) {
  line-height: 1.15;
  letter-spacing: -0.02em;
}
p {
  text-wrap: pretty;
}
a {
  color: inherit;
}
:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 3px;
  border-radius: 6px;
}
.wrap {
  width: min(1120px, 100% - 2 * var(--gutter));
  margin-inline: auto;
}
.skip {
  position: absolute;
  inset-inline-start: 12px;
  top: -60px;
  z-index: 10;
  padding: 0.5rem 0.9rem;
  border-radius: 10px;
  background: var(--yellow);
  color: var(--petrol-deep);
  font-weight: 500;
  text-decoration: none;
}
.skip:focus {
  top: 12px;
}

/* ---- The name and the logo ---------------------------------------------- */
.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  text-decoration: none;
}
.brand svg {
  width: 38px;
  height: 38px;
  flex: none;
}
.word {
  direction: ltr;
  unicode-bidi: isolate;
  font-weight: 600;
  font-size: 1.5rem;
  line-height: 1;
  letter-spacing: -0.01em;
}
.word b {
  font-weight: inherit;
  color: var(--yellow);
}
.on-light .word b {
  color: var(--gold-word);
}

/* A short row of abacus beads; the last one is orange, as in the logo. */
.beads {
  display: inline-flex;
  gap: 3px;
  flex: none;
}
.beads i {
  width: var(--bead);
  height: var(--bead);
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: inset calc(-2px * var(--flip)) -2px 0 rgb(10 43 49 / 0.14);
}
.beads i.o {
  background: var(--orange);
}
.beads.small {
  --bead: 10px;
  gap: 2px;
}
.beads.small i {
  box-shadow: none;
}

/* ---- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 48px;
  padding: 0 1.3rem;
  border: 1.5px solid transparent;
  border-radius: 12px;
  font: inherit;
  font-weight: 500;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s, border-color 0.15s, transform 0.15s;
}
.btn:active {
  transform: translateY(1px);
}
.btn svg {
  width: 18px;
  height: 18px;
  flex: none;
}
[dir='rtl'] .btn svg.arrow {
  transform: scaleX(-1);
}
.btn-primary {
  background: var(--yellow);
  color: var(--petrol-deep);
}
.btn-primary:hover {
  background: #f6cf74;
}
.btn-ghost {
  border-color: rgb(244 241 222 / 0.4);
  color: var(--cream);
}
.btn-ghost:hover {
  border-color: rgb(244 241 222 / 0.75);
  background: rgb(244 241 222 / 0.07);
}
.btn-dark {
  background: var(--petrol);
  color: var(--cream);
}
.btn-dark:hover {
  background: var(--petrol-soft);
}
.btn-outline {
  border-color: rgb(14 59 67 / 0.35);
  color: var(--petrol);
}
.btn-outline:hover {
  border-color: var(--petrol);
  background: rgb(14 59 67 / 0.06);
}
.btn-small {
  min-height: 40px;
  padding: 0 0.95rem;
  border-radius: 10px;
  font-size: 0.95rem;
}

/* ---- Top of the page ---------------------------------------------------- */
.hero {
  --overlap: clamp(70px, 11vw, 150px);
  position: relative;
  color: var(--on-dark);
  /* Petrol down to the last part of the product picture, then the page colour:
     the picture stands half in the dark top and half in the light page. */
  background:
    radial-gradient(900px 480px at 50% -80px, rgb(31 100 112 / 0.55), transparent 70%),
    linear-gradient(to bottom, var(--petrol) calc(100% - var(--overlap)), var(--paper) calc(100% - var(--overlap)));
  overflow: clip;
}
.top {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding-block: 18px;
}
.top nav {
  display: none;
  gap: 1.75rem;
  margin-inline: auto;
}
.top nav a,
.lang {
  color: var(--on-dark-soft);
  font-size: 0.98rem;
  font-weight: 500;
  text-decoration: none;
}
.top nav a:hover,
.lang:hover {
  color: var(--cream);
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-inline-start: auto;
}
.hero-copy {
  max-width: 800px;
  margin-inline: auto;
  padding-block: clamp(2.25rem, 6vw, 4.75rem) clamp(2.25rem, 5vw, 3.75rem);
  text-align: center;
}
.kicker {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1.1rem;
  color: var(--on-dark-soft);
  font-size: 0.98rem;
  font-weight: 500;
}
h1 {
  font-size: clamp(2.2rem, 5.2vw + 0.9rem, 4.25rem);
}
.hero-copy > p {
  max-width: 620px;
  margin: 1.15rem auto 0;
  color: var(--on-dark-soft);
  font-size: clamp(1.05rem, 0.5vw + 1rem, 1.25rem);
}
.hero-cta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 1.9rem;
}

/* The product pictures stand on three abacus rods; beads show at both sides. */
.stage {
  position: relative;
  padding-inline: var(--gutter);
}
.rods {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.rod {
  position: absolute;
  inset-inline: 0;
  top: var(--y);
  height: 2px;
  background: var(--rod);
}
.rod .beads {
  position: absolute;
  top: 50%;
  translate: 0 -50%;
}
.rod .beads.s {
  inset-inline-start: 6px;
}
.rod .beads.e {
  inset-inline-end: 6px;
}
.rod .beads i:nth-child(n + 3) {
  display: none; /* a phone has room for two beads a side */
}
.rod .beads.s i {
  animation: bead-in 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  --from: -90px;
}
.rod .beads.e i {
  animation: bead-in 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  --from: 90px;
}
.rod:nth-child(2) .beads i {
  animation-delay: 0.12s;
}
.rod:nth-child(3) .beads i {
  animation-delay: 0.24s;
}
@keyframes bead-in {
  from {
    transform: translateX(calc(var(--from) * var(--flip)));
    opacity: 0;
  }
}
.devices {
  position: relative;
  z-index: 1;
  width: min(1000px, 100%);
  margin-inline: auto;
  animation: rise 0.8s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
@keyframes rise {
  from {
    transform: translateY(26px);
    opacity: 0;
  }
}
.browser {
  display: none;
  overflow: hidden;
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 0 0 1px rgb(244 241 222 / 0.14), 0 40px 80px -24px rgb(4 24 28 / 0.6);
}
.browser-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding-inline: 14px;
  border-bottom: 1px solid #d9d5c2;
  background: #ece9da;
  direction: ltr;
}
.browser-bar i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #c8c3ad;
}
.browser-bar span {
  margin-inline: auto;
  padding: 1px 16px;
  border-radius: 6px;
  background: #f8f6ec;
  color: #5c6e70;
  font-size: 0.75rem;
  line-height: 1.6;
  transform: translateX(-24px); /* centred over the window, not over what the dots leave */
}
.browser img {
  display: block;
  width: 100%;
  height: auto;
}
.handset {
  display: block;
  overflow: hidden;
  aspect-ratio: 390 / 780;
  border: 7px solid #071e22;
  border-radius: 34px;
  background: #071e22;
  box-shadow: 0 0 0 1px rgb(244 241 222 / 0.12), 0 34px 60px -18px rgb(4 24 28 / 0.6);
}
.handset img {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: 27px;
  object-fit: cover;
  object-position: top;
}
.hero .handset {
  width: min(270px, 70%);
  margin-inline: auto;
}
.demo-note {
  padding-block: 1.1rem 0;
  color: var(--ink-soft);
  font-size: 0.88rem;
  text-align: center;
}

/* ---- Sections ----------------------------------------------------------- */
.section {
  padding-block: clamp(3.75rem, 8vw, 6.75rem);
}
.section-head {
  max-width: 660px;
  margin-bottom: clamp(2.25rem, 5vw, 3.75rem);
}
.eyebrow {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.7rem;
  color: var(--gold);
  font-size: 0.98rem;
  font-weight: 500;
}
h2 {
  font-size: clamp(1.7rem, 2.4vw + 1rem, 2.6rem);
}
.section-head p:not(.eyebrow) {
  margin-top: 0.9rem;
  color: var(--ink-soft);
  font-size: 1.1rem;
}

/* Three screens, each with what it is for. */
.spot {
  display: grid;
  gap: clamp(1.75rem, 4vw, 4rem);
  align-items: center;
}
.spot + .spot {
  margin-top: clamp(3.5rem, 8vw, 6.5rem);
}
.spot h3 {
  font-size: clamp(1.45rem, 1.3vw + 1.05rem, 1.95rem);
}
.spot-text > p:not(.eyebrow) {
  margin-top: 0.9rem;
  color: var(--ink-soft);
}
.ticks {
  display: grid;
  gap: 0.55rem;
  margin: 1.4rem 0 0;
  padding: 0;
  list-style: none;
}
.ticks li {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}
.ticks li::before {
  content: '';
  flex: none;
  width: 0.62rem;
  height: 0.62rem;
  border-radius: 50%;
  background: var(--yellow);
}
.ticks li:last-child::before {
  background: var(--orange);
}
.shot {
  overflow: hidden;
  width: min(100%, 360px);
  margin-inline: auto;
  aspect-ratio: 390 / 500;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 30px 60px -30px rgb(14 59 67 / 0.4);
}
.shot img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

/* Everything else the books need. */
.band {
  background: var(--cream);
}
.cards {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
}
.card {
  padding: 1.5rem;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
}
.card .tile {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-bottom: 1.1rem;
  border-radius: 13px;
  background: var(--petrol);
  color: var(--yellow);
}
.card .tile svg {
  width: 24px;
  height: 24px;
}
.card h3 {
  font-size: 1.15rem;
}
.card p {
  margin-top: 0.4rem;
  color: var(--ink-soft);
  font-size: 1rem;
}

/* Control: four rows on four rods, counted in beads. */
.dark {
  background: var(--petrol);
  color: var(--on-dark);
}
.dark .eyebrow {
  color: var(--yellow);
}
.dark .section-head p:not(.eyebrow) {
  color: var(--on-dark-soft);
}
.control {
  display: grid;
  gap: clamp(2rem, 5vw, 4.5rem);
}
.control .section-head {
  margin-bottom: 0;
}
.rules {
  display: grid;
  gap: 2.4rem;
  margin: 0;
  padding: 0.6rem 0 0;
  list-style: none;
}
.rules li {
  position: relative;
  padding-top: 1.6rem;
  border-top: 2px solid var(--rod);
}
.rules .beads {
  position: absolute;
  top: calc(-1px - var(--bead) / 2);
  inset-inline-start: 0;
}
.rules h3 {
  font-size: 1.25rem;
}
.rules p {
  margin-top: 0.35rem;
  color: var(--on-dark-soft);
}

/* Two languages, any screen. */
.pair {
  display: flex;
  justify-content: center;
  gap: clamp(0.75rem, 3vw, 1.5rem);
  padding-bottom: 2.5rem;
}
.pair .handset {
  width: min(46%, 250px);
  border-color: var(--petrol-deep);
  background: var(--petrol-deep);
  box-shadow: 0 30px 60px -28px rgb(14 59 67 / 0.55);
}
.pair .handset:last-child {
  translate: 0 2.5rem;
}

/* The last call. */
.closing {
  text-align: center;
}
.closing .wrap {
  display: grid;
  justify-items: center;
  gap: 1.1rem;
}
.closing svg.mark {
  width: 64px;
  height: 64px;
}
.closing p {
  max-width: 520px;
  color: var(--ink-soft);
  font-size: 1.1rem;
}
.closing .actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin-top: 0.6rem;
}

/* ---- Foot --------------------------------------------------------------- */
.foot {
  padding-block: 2.5rem;
  background: var(--petrol-deep);
  color: var(--on-dark-soft);
  font-size: 0.95rem;
}
.foot .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.25rem 2rem;
}
.foot .brand {
  color: var(--cream);
}
.foot .line {
  color: var(--on-dark-soft);
}
.foot nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1.25rem;
  margin-inline-start: auto;
}
.foot nav a {
  text-decoration: none;
}
.foot nav a:hover {
  color: var(--cream);
}
.foot small {
  flex-basis: 100%;
  padding-top: 1.25rem;
  border-top: 1px solid rgb(127 163 166 / 0.25);
  font-size: 0.85rem;
}

/* ---- Wider screens ------------------------------------------------------ */
@media (min-width: 620px) {
  :root {
    --gutter: 32px;
  }
}
@media (min-width: 860px) {
  :root {
    --bead: 30px;
  }
  .top nav {
    display: flex;
  }
  .stage {
    padding-inline: clamp(88px, 11vw, 150px);
    padding-bottom: 44px;
  }
  .browser {
    display: block;
  }
  .hero .handset {
    position: absolute;
    inset-block-end: -44px;
    inset-inline-end: clamp(-56px, -4vw, -28px);
    width: clamp(170px, 21%, 215px);
    margin: 0;
    border-radius: 30px;
  }
  .hero .handset img {
    border-radius: 23px;
  }
  .rod .beads {
    gap: 4px;
  }
  .rod .beads.s {
    inset-inline-start: 10px;
  }
  .rod .beads.e {
    inset-inline-end: 10px;
  }
  .spot {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
  }
  .spot.flip {
    grid-template-columns: minmax(0, 7fr) minmax(0, 5fr);
  }
  .spot.flip .spot-shot {
    order: -1;
  }
  .shot {
    width: 100%;
    aspect-ratio: 1000 / 660;
  }
  .control {
    grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
    align-items: start;
  }
  .rules {
    grid-template-columns: 1fr 1fr;
    gap: 2.6rem 2rem;
  }
  .languages {
    display: grid;
    grid-template-columns: minmax(0, 6fr) minmax(0, 5fr);
    gap: clamp(2rem, 5vw, 4.5rem);
    align-items: center;
  }
  .languages .section-head {
    margin-bottom: 0;
  }
}
@media (min-width: 1280px) {
  :root {
    --bead: 36px;
  }
  .rod .beads i:nth-child(n + 3) {
    display: block;
  }
}

/* ---- For people who ask for less movement -------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
