/* Kaset design system — tokens mirrored from the app's src/ui/theme.ts so the
   web and the app cannot drift. Shared by the landing page and the legal pages. */

@font-face {
  font-family: "Thmanyah Sans";
  src: url("/fonts/ThmanyahSans-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Thmanyah Sans";
  src: url("/fonts/ThmanyahSans-Bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Thmanyah Display";
  src: url("/fonts/ThmanyahSerifDisplay-Black.woff2") format("woff2");
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;

  --bg: #070708;
  --surface: #141416;
  --surface-2: #1c1c1f;
  --divider: #26262a;
  --hairline: rgba(255, 255, 255, 0.06);
  --rim: rgba(255, 255, 255, 0.14);
  --veil: rgba(255, 255, 255, 0.07);

  --ink: #fafafa;
  --ink-dim: #a1a1aa;
  --ink-muted: #71717a;

  --accent: #10b981;
  --accent-dim: #059669;
  --accent-bright: #34d399;
  --accent-soft: rgba(16, 185, 129, 0.16);
  --accent-ink: #ecfdf5;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --r-xxl: 34px;
  --r-pill: 999px;

  --sans: "Thmanyah Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --display: "Thmanyah Display", "Thmanyah Sans", Georgia, serif;

  --gutter: 20px;
  --maxw: 1080px;
  --prose: 760px;

  /* Apple's critically-damped default: no overshoot on anything that did not
     begin as a gesture. §4 of the apple-design notes. */
  --ease-standard: cubic-bezier(0.32, 0.72, 0, 1);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

/* Type scale. Tracking is size-specific — large display text reads too loose at
   its default spacing, body text does not. Never one letter-spacing for all. */
.display {
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(2.5rem, 7.5vw, 4.75rem);
  line-height: 1.02;
  letter-spacing: -0.03em;
  margin: 0;
}

.title-1 {
  font-family: var(--display);
  font-weight: 900;
  font-size: clamp(1.9rem, 4.2vw, 2.9rem);
  line-height: 1.12;
  letter-spacing: -0.022em;
  margin: 0;
}

.title-2 {
  font-weight: 700;
  font-size: clamp(1.25rem, 2.2vw, 1.5rem);
  line-height: 1.25;
  letter-spacing: -0.012em;
  margin: 0;
}

.lede {
  font-size: clamp(1.0625rem, 1.7vw, 1.25rem);
  line-height: 1.55;
  letter-spacing: -0.003em;
  color: var(--ink-dim);
  margin: 0;
}

.eyebrow {
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent);
  margin: 0;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  color: var(--accent-bright);
}

.wrap {
  width: 100%;
  max-width: var(--maxw);
  margin: 0 auto;
  padding-inline: var(--gutter);
}

/* ── Chrome ─────────────────────────────────────────────────────────────── */
/* A translucent layer content scrolls *under*, not an opaque strip that eats a
   fixed band of the viewport. */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(7, 7, 8, 0.72);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid transparent;
  transition: border-color 200ms var(--ease-standard), background 200ms var(--ease-standard);
}
.nav[data-scrolled="true"] {
  border-bottom-color: var(--hairline);
  background: rgba(7, 7, 8, 0.86);
}
.nav-inner {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 60px;
}
.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--display);
  font-weight: 900;
  font-size: 1.1rem;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-inline-end: auto;
}
.wordmark img {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  display: block;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 22px;
  font-size: 0.9375rem;
  color: var(--ink-dim);
}
.nav-links a {
  color: var(--ink-dim);
}
.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--ink);
}
@media (max-width: 720px) {
  .nav-links {
    display: none;
  }
}

/* ── Buttons ────────────────────────────────────────────────────────────── */
/* Feedback lands on pointer-down, not on release. */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-family: inherit;
  font-size: 0.9875rem;
  font-weight: 700;
  letter-spacing: -0.006em;
  padding: 13px 22px;
  border-radius: var(--r-pill);
  border: 1px solid transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: transform 110ms var(--ease-standard), background 160ms var(--ease-standard),
    border-color 160ms var(--ease-standard);
}
.btn:active {
  transform: scale(0.97);
}
.btn-primary {
  background: var(--accent);
  color: #04120c;
  box-shadow: 0 8px 28px rgba(16, 185, 129, 0.28);
}
.btn-primary:hover {
  background: var(--accent-bright);
  color: #04120c;
}
.btn-secondary {
  background: var(--veil);
  color: var(--ink);
  border-color: var(--rim);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--ink);
}
.btn-sm {
  padding: 9px 16px;
  font-size: 0.875rem;
}

/* ── Surfaces ───────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-xl);
  padding: 26px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  border: 1px solid rgba(16, 185, 129, 0.24);
  color: var(--accent-bright);
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.005em;
}

section {
  padding-block: clamp(60px, 7.5vw, 98px);
}

/* ── Reveal on scroll ───────────────────────────────────────────────────── */
/* Opacity + a short rise. No overshoot: nothing here began as a gesture. */
[data-reveal] {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 620ms var(--ease-standard), transform 620ms var(--ease-standard);
}
[data-reveal].is-in {
  opacity: 1;
  transform: none;
}

/* ── Accessibility ──────────────────────────────────────────────────────── */
:focus-visible {
  outline: 2px solid var(--accent-bright);
  outline-offset: 3px;
  border-radius: 4px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Reduced motion is not "no feedback" — it is a gentler, non-vestibular
   equivalent. Keep the opacity cues, drop travel and rotation. */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 160ms !important;
  }
  [data-reveal] {
    transform: none;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .nav,
  .nav[data-scrolled="true"] {
    background: var(--bg);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}

@media (prefers-contrast: more) {
  :root {
    --ink-dim: #d4d4d8;
    --ink-muted: #a1a1aa;
    --hairline: rgba(255, 255, 255, 0.24);
    --rim: rgba(255, 255, 255, 0.34);
  }
}

/* ── Footer ─────────────────────────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--hairline);
  padding-block: 52px 64px;
  color: var(--ink-muted);
  font-size: 0.9rem;
}
.footer-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 40px 64px;
  justify-content: space-between;
}
.footer h3 {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-muted);
  margin: 0 0 14px;
}
.footer ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.footer ul a {
  color: var(--ink-dim);
}
.footer ul a:hover {
  color: var(--ink);
}
.footer-base {
  margin-top: 48px;
  padding-top: 26px;
  border-top: 1px solid var(--hairline);
  display: flex;
  flex-wrap: wrap;
  gap: 12px 28px;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8125rem;
  color: var(--ink-muted);
}

/* ── Prose (legal pages) ────────────────────────────────────────────────── */
.prose {
  max-width: var(--prose);
  margin: 0 auto;
}
.prose h2 {
  font-family: var(--display);
  font-weight: 900;
  font-size: 1.5rem;
  line-height: 1.25;
  letter-spacing: -0.016em;
  margin: 56px 0 14px;
  scroll-margin-top: 84px;
}
.prose h3 {
  font-size: 1.0625rem;
  font-weight: 700;
  margin: 30px 0 8px;
  letter-spacing: -0.006em;
}
.prose p {
  margin: 0 0 17px;
  color: var(--ink-dim);
}
.prose strong {
  color: var(--ink);
  font-weight: 700;
}
.prose ul,
.prose ol {
  margin: 0 0 17px;
  padding-inline-start: 24px;
  color: var(--ink-dim);
}
.prose li {
  margin-bottom: 9px;
}
.prose li::marker {
  color: var(--ink-muted);
}
.prose a {
  border-bottom: 1px solid rgba(16, 185, 129, 0.34);
}
.prose a:hover {
  border-bottom-color: var(--accent-bright);
}
.prose table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9375rem;
}
.prose .table-wrap {
  overflow-x: auto;
  margin: 0 0 17px;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
}
.prose th,
.prose td {
  text-align: start;
  padding: 12px 14px;
  border-bottom: 1px solid var(--hairline);
  vertical-align: top;
  color: var(--ink-dim);
}
.prose thead th {
  color: var(--ink);
  font-weight: 700;
  background: var(--surface);
}
.prose tbody tr:last-child td {
  border-bottom: 0;
}

.callout {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 22px 24px;
  color: var(--ink-dim);
  font-size: 1rem;
  margin: 0 0 20px;
}
.callout strong {
  color: var(--ink);
}

.toc {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 20px 24px;
  margin: 30px 0 8px;
}
.toc h2 {
  font-family: var(--sans);
  border: 0;
  margin: 0 0 12px;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--ink-muted);
}
.toc ol {
  margin: 0;
  padding-inline-start: 22px;
  font-size: 0.9375rem;
  display: grid;
  gap: 6px;
}

.doc-header {
  padding-block: 56px 8px;
}
.doc-meta {
  color: var(--ink-muted);
  font-size: 0.9375rem;
  margin: 10px 0 0;
}

/* RTL: the logical properties above carry most of it; these are the leftovers. */
[dir="rtl"] body {
  line-height: 1.85;
}
[dir="rtl"] .display,
[dir="rtl"] .title-1,
[dir="rtl"] .prose h2,
[dir="rtl"] .stat b {
  font-family: var(--sans);
  font-weight: 700;
  letter-spacing: 0;
}
/* what: tracking pulls joined Arabic letters apart, so RTL clears it everywhere */
[dir="rtl"] * {
  letter-spacing: 0 !important;
}
/* Digits stay Western across every locale, list markers included. */
[dir="rtl"] .toc ol,
[dir="rtl"] .prose ol {
  list-style-type: decimal;
}

/* ── Also by the same developer ─────────────────────────────────────── */
.also {
  padding: 72px 0 24px;
}
.also .wrap {
  text-align: center;
}
.also-card {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 32px auto 0;
  max-width: 640px;
  padding: 18px 20px;
  border-radius: var(--r-xl);
  background: var(--surface);
  border: 1px solid var(--hairline);
  color: inherit;
  text-decoration: none;
  text-align: start;
  transition: border-color 0.18s ease, transform 0.18s ease;
}
.also-card:hover {
  border-color: var(--accent-dim);
  transform: translateY(-1px);
}
.also-mark {
  width: 52px;
  height: 52px;
  flex: none;
  border-radius: 13px;
  object-fit: cover;
  box-shadow: 0 0 0 1px var(--rim);
}
.also-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.also-copy strong {
  color: var(--ink);
  font-size: 1.0625rem;
  letter-spacing: -0.01em;
}
.also-copy span {
  color: var(--ink-dim);
  font-size: 0.9375rem;
  line-height: 1.5;
}
.also-go {
  margin-inline-start: auto;
  flex: none;
  color: var(--ink-muted);
  font-size: 26px;
}
@media (max-width: 560px) {
  .also-go {
    display: none;
  }
}
[dir="rtl"] .also-go {
  transform: scaleX(-1);
}

/* what: language picker, a disclosure of real links rather than an ARIA menu */
.lang {
  position: relative;
}
.lang-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  background: var(--veil);
  border: 1px solid var(--rim);
  color: var(--ink-dim);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: transform 110ms var(--ease-standard), background 160ms var(--ease-standard),
    color 160ms var(--ease-standard);
}
.lang-btn:active {
  transform: scale(0.97);
}
.lang-btn:hover,
.lang-btn[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.12);
  color: var(--ink);
}
.lang-caret {
  transition: transform 200ms var(--ease-standard);
}
.lang-btn[aria-expanded="true"] .lang-caret {
  transform: rotate(180deg);
}
.lang-list {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  z-index: 60;
  min-width: 212px;
  margin: 0;
  padding: 6px;
  list-style: none;
  background: var(--surface-2);
  border: 1px solid var(--rim);
  border-radius: var(--r-lg);
  box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.7);
  transform-origin: top right;
  animation: lang-in 180ms var(--ease-standard);
}
[dir="rtl"] .lang-list {
  transform-origin: top left;
}
.lang-list[hidden] {
  display: none;
}
@keyframes lang-in {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
}
.lang-list a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  color: var(--ink-dim);
  font-size: 0.9375rem;
  line-height: 1.3;
}
.lang-list a:hover,
.lang-list a:focus-visible {
  background: var(--veil);
  color: var(--ink);
}
.lang-list a[aria-current="page"] {
  color: var(--ink);
  font-weight: 700;
}
.lang-list a[aria-current="page"]::after {
  content: "";
  width: 15px;
  height: 15px;
  flex: none;
  background: var(--accent);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E") center / contain no-repeat;
}
/* what: on phones the picker shrinks to its globe and opens as a full-width panel under the bar */
@media (max-width: 480px) {
  .nav-inner {
    gap: 10px;
  }
  .lang-btn {
    width: 38px;
    padding: 0;
    justify-content: center;
  }
  .lang-code,
  .lang-caret {
    display: none;
  }
  .lang {
    position: static;
  }
  .lang-list {
    top: 64px;
    inset-inline: var(--gutter);
    transform-origin: top center;
  }
}


.menu-btn {
  display: none;
  background: var(--veil);
  border: 1px solid var(--rim);
  color: var(--ink);
  width: 38px;
  height: 38px;
  border-radius: var(--r-pill);
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
@media (max-width: 720px) {
  .menu-btn {
    display: inline-flex;
  }
}
.menu {
  display: grid;
  gap: 2px;
  padding: 0 var(--gutter) 16px;
  overflow: hidden;
  max-height: 0;
  transition: max-height 320ms var(--ease-standard);
}
.menu[data-open="true"] {
  max-height: 360px;
}
.menu a {
  padding: 13px 4px;
  color: var(--ink-dim);
  border-bottom: 1px solid var(--hairline);
  font-size: 0.9875rem;
}

.doc {
  padding-bottom: clamp(64px, 9vw, 104px);
}
.doc-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin: 18px 0 0;
  font-size: 0.9375rem;
}
.scope {
  display: block;
  direction: ltr;
  text-align: left;
  overflow-x: auto;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  margin: 0 0 17px;
  font-size: 0.9rem;
  color: var(--accent-bright);
  white-space: nowrap;
}
