@font-face {
  font-family: "Lufga";
  src: url("/assets/fonts/LufgaRegular.woff") format("woff"), url("/assets/fonts/LufgaRegular.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: block;
}
@font-face {
  font-family: "Lufga";
  src: url("/assets/fonts/LufgaSemiBold.woff") format("woff"), url("/assets/fonts/LufgaSemiBold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
  font-display: block;
}
@font-face {
  font-family: "Lufga";
  src: url("/assets/fonts/LufgaBlack.woff") format("woff"), url("/assets/fonts/LufgaBlack.ttf") format("truetype");
  font-weight: 900;
  font-style: normal;
  font-display: block;
}

:root {
  --text: #121212;
  --bg: #FFFAF7;
  --accent: #FF1700;
  --muted: rgba(18, 18, 18, 0.62);
  --toggle-bg: rgba(18, 18, 18, 0.07);
  --background:
    radial-gradient(60% 70% at 15% 20%, rgba(244, 172, 86, .22), transparent 70%),
    radial-gradient(55% 60% at 90% 85%, rgba(208, 63, 29, .14), transparent 70%),
    radial-gradient(50% 50% at 80% 10%, rgba(233, 129, 28, .12), transparent 70%);
  color-scheme: light;
}

:root[data-theme="dark"] {
  --text: #FFFAF7;
  --bg: #121212;
  --muted: rgba(255, 250, 247, 0.62);
  --toggle-bg: rgba(255, 250, 247, 0.1);
  --background:
    radial-gradient(60% 70% at 15% 20%, rgba(233, 129, 28, .16), transparent 70%),
    radial-gradient(55% 60% at 90% 85%, rgba(169, 31, 43, .18), transparent 70%);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --text: #FFFAF7;
    --bg: #121212;
    --muted: rgba(255, 250, 247, 0.62);
    --toggle-bg: rgba(255, 250, 247, 0.1);
    --background:
      radial-gradient(60% 70% at 15% 20%, rgba(233, 129, 28, .16), transparent 70%),
      radial-gradient(55% 60% at 90% 85%, rgba(169, 31, 43, .18), transparent 70%);
    color-scheme: dark;
  }
}

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

html { background-color: var(--bg); }

body {
  margin: 0;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  color: var(--text);
  background-color: var(--bg);
  /* Edge fade into the base colour (blends with Safari's bars), then the blobs, then the colour */
  background-image:
    linear-gradient(to bottom, var(--bg) 0, transparent calc(env(safe-area-inset-top, 0px) + 48px), transparent calc(100% - 64px), var(--bg) 100%),
    var(--background);
  background-repeat: no-repeat;
  font-family: "Lufga", system-ui, -apple-system, sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; }

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 4px;
}

/* Theme toggle and language picker: round 36 px buttons at the top of the page, scrolling with it (language sits beside the theme toggle) */
.theme-toggle {
  position: absolute;
  top: calc(16px + env(safe-area-inset-top, 0px));
  inset-inline-end: calc(16px + env(safe-area-inset-right, 0px));
  z-index: 10;
}
.theme-toggle,
.lang-toggle {
  width: 36px;
  height: 36px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--toggle-bg);
  color: var(--text);
  cursor: pointer;
  transition: background-color .2s ease;
}
.lang-picker[open] .lang-toggle { background: var(--accent); color: #fff; }
@media (hover: hover) and (pointer: fine) {
  .theme-toggle:hover,
  .lang-toggle:hover { background: var(--accent); color: #fff; }
}
.theme-toggle:focus-visible,
.lang-toggle:focus-visible { border-radius: 50%; }
.theme-toggle svg,
.lang-toggle svg { width: 18px; height: 18px; }
.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: block; }
  :root:not([data-theme="light"]) .icon-moon { display: none; }
}

.lang-picker {
  position: absolute;
  top: calc(16px + env(safe-area-inset-top, 0px));
  inset-inline-end: calc(60px + env(safe-area-inset-right, 0px));
  z-index: 10;
}
:root[dir="rtl"] .theme-toggle { inset-inline-end: calc(16px + env(safe-area-inset-left, 0px)); }
:root[dir="rtl"] .lang-picker { inset-inline-end: calc(60px + env(safe-area-inset-left, 0px)); }
.lang-toggle { list-style: none; }
.lang-toggle::-webkit-details-marker { display: none; }
.lang-menu {
  position: absolute;
  top: 44px;
  inset-inline-end: 0;
  margin: 0;
  padding: 6px;
  list-style: none;
  width: max-content;
  min-width: 180px;
  max-width: calc(100vw - 72px);
  max-height: 60vh;
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--toggle-bg);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .12);
  font-size: 14px;
  line-height: 1.3;
}
.lang-menu a {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  text-decoration: none;
}
@media (hover: hover) and (pointer: fine) {
  .lang-menu a:hover { background: var(--toggle-bg); }
}
.lang-menu a[aria-current="true"] { font-weight: 600; color: var(--accent); }

/* Layout: mobile first */
.page {
  flex: 1 0 auto;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: calc(56px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) 8px max(16px, env(safe-area-inset-left, 0px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 440px;
  flex: none;
}

.brand { display: flex; align-items: center; justify-content: center; gap: 12px; }
.app-icon { width: 36px; height: 36px; display: block; flex: none; }
.wordmark { width: 120px; height: auto; display: block; }

h1 {
  margin: 14px 0 0;
  font-weight: 600;
  font-size: clamp(30px, 8.5vw, 36px);
  line-height: 1.08;
  letter-spacing: -0.02em;
}

.intro h1 { font-weight: 900; }
/* The wordmark text stays in Lufga Black in every script so the i-dot geometry below holds */
.joi-word { font-family: "Lufga", system-ui, sans-serif; font-weight: 900; }
/* Orange tittle on the slogan's "i": the stop sits midway between the Lufga Black dot (0.555em) and stem (0.51em) */
@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  .i-dot {
    background: linear-gradient(to bottom, var(--accent) 0 0.4375em, currentColor 0.4375em);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
  }
}
@media (forced-colors: active), print {
  .i-dot { background: none; -webkit-text-fill-color: currentColor; }
}

.lead {
  margin: 10px 0 0;
  font-size: 15px;
  line-height: 1.45;
  color: var(--muted);
}

.soon {
  margin: 12px 0 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--accent);
}

.social {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  gap: 8px;
}
.social a {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: var(--muted);
  transition: color .2s ease;
}
@media (hover: hover) and (pointer: fine) {
  .social a:hover { color: var(--text); }
}
.icon { display: block; }
.icon-x { width: 17.5px; height: auto; }
.icon-ig { width: 16.5px; height: 16.5px; }
.icon-tt { width: auto; height: 17.5px; }

.shot {
  position: relative;
  flex: 1 1 0;
  min-height: 112px;
  width: 100%;
}
.shot picture { display: contents; }
.shot img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Footer */
.footer {
  flex: none;
  width: 100%;
  max-width: 1180px;
  margin: 0 auto;
  padding: 8px max(16px, env(safe-area-inset-right, 0px)) calc(16px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--muted);
  text-align: center;
}
.footer a { text-decoration: none; transition: color .2s ease; }
@media (hover: hover) and (pointer: fine) {
  .footer a:hover { color: var(--text); text-decoration: underline; }
}
.footer-links,
.footer-credits {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: baseline;
  gap: 2px 14px;
}
.footer-links { flex-direction: column; align-items: center; gap: 2px; }
.footer-nav { display: flex; flex-wrap: wrap; justify-content: center; align-items: baseline; row-gap: 2px; }
.footer-links > span,
.footer-nav > a,
.footer-nav > .dot { white-space: nowrap; }
.dot.is-wrapped { visibility: hidden; }
.dot { margin: 0 8px; }
.dot-lead { display: none; }
.powered { display: inline-flex; align-items: baseline; gap: 5px; }
.music { height: 11px; width: auto; display: block; }

/* Desktop */
@media (min-width: 900px) {
  .page {
    flex-direction: row;
    justify-content: center;
    gap: 64px;
    padding: calc(24px + env(safe-area-inset-top, 0px)) max(32px, env(safe-area-inset-right, 0px)) 24px max(32px, env(safe-area-inset-left, 0px));
  }
  .intro {
    flex: 0 1 440px;
    align-items: flex-start;
    text-align: start;
  }
  .brand { justify-content: flex-start; }
  .app-icon { width: 40px; height: 40px; }
  .wordmark { width: 150px; }
  h1 {
    margin-top: 28px;
    font-size: clamp(34px, 4vw, 54px);
    line-height: 1.04;
  }
  .lead { margin-top: 20px; font-size: 17px; line-height: 1.5; }
  .soon { margin-top: 24px; font-size: 18px; }
  .social { margin-top: 20px; gap: 4px; margin-inline-start: -8px; }
  .shot {
    flex: 1 1 0;
    min-width: 0;
    width: auto;
    height: min(76svh, 680px);
    min-height: 0;
  }
  .footer {
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    padding: 8px max(32px, env(safe-area-inset-right, 0px)) calc(20px + env(safe-area-inset-bottom, 0px)) max(32px, env(safe-area-inset-left, 0px));
    text-align: start;
  }
  .footer-links { flex-direction: row; flex-wrap: wrap; justify-content: flex-start; align-items: baseline; gap: 2px 0; }
  .dot-lead { display: inline; }
  .footer-nav { justify-content: flex-start; }
  .footer-credits { justify-content: flex-end; }
}

/* Short phones: tighten spacing so the mockup keeps as much height as possible */
@media (max-width: 899px) and (max-height: 700px) {
  .page { padding-top: calc(48px + env(safe-area-inset-top, 0px)); gap: 8px; }
  .wordmark { width: 96px; }
  h1 { margin-top: 8px; font-size: 28px; }
  .lead { margin-top: 6px; }
  .soon { margin-top: 8px; }
  .social { margin-top: 6px; }
}

/* Very narrow phones: keep the brand row clear of the top controls */
@media (max-width: 359px) {
  .page { padding-top: calc(64px + env(safe-area-inset-top, 0px)); }
}

/* Short viewports (any width): smaller app icon */
@media (max-height: 700px) {
  .app-icon { width: 32px; height: 32px; }
}

/* The page fills one screen where it fits and scrolls normally otherwise */
@media (max-height: 559px) {
  .page { flex: none; }
  .shot { flex: none; height: 320px; min-height: 0; }
}
@media (min-width: 900px) and (max-height: 559px) {
  .shot { width: 414px; height: 400px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* Document pages (Privacy, Terms): normal scrolling, one text column */
body.doc { height: auto; }
body.doc .doc-main {
  flex: 1 0 auto;
  width: 100%;
  max-width: 672px;
  margin: 0 auto;
  padding: calc(72px + env(safe-area-inset-top, 0px)) max(16px, env(safe-area-inset-right, 0px)) calc(48px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
}
body.doc .home-link { display: inline-block; line-height: 0; }
body.doc .home-link .wordmark { width: 110px; }
body.doc h1 {
  margin: 40px 0 0;
  font-size: clamp(30px, 5vw, 40px);
  line-height: 1.1;
}
body.doc .updated { margin: 8px 0 0; font-size: 14px; color: var(--muted); }
body.doc .translation-note { margin: 4px 0 0; font-size: 13px; line-height: 1.4; color: var(--muted); }
body.doc h2 { margin: 32px 0 0; font-size: 18px; font-weight: 600; line-height: 1.3; }
body.doc .doc-main p:not(.updated):not(.translation-note) { margin: 12px 0 0; font-size: 16px; line-height: 1.6; }
@media (min-width: 900px) {
  body.doc .doc-main p:not(.updated):not(.translation-note) { font-size: 17px; }
}
body.doc .doc-main a { text-decoration: underline; text-underline-offset: 2px; }

/* Colour emoji take the alpha of the text colour; keep the heart fully opaque */
.heart { color: var(--text); }

/* Scripts Lufga does not cover use the system font stack; the wordmark keeps Lufga */
:root[data-font="system"] body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "PingFang SC", "Hiragino Sans", "Apple SD Gothic Neo", sans-serif;
}
