/* =============================================================================
 *  ui/rekhyt-ui.css
 *  The shared look for the new Rekhyt pages: two styles, Daylight (default)
 *  and Night (html[data-style="night"]). Purple only where something can be
 *  clicked, a book typeface for reading, one clear first step per screen.
 * ========================================================================== */
@import url("fonts.css");

:root {
  --page: #FAF8F3;
  --surface: #FFFFFF;
  --surface-2: #F3EFF9;
  --ink: #241B3D;
  --text: #3A3350;
  --muted: #6B6480;
  --line: #E6E0EE;
  --brand: #6B52B3;
  --brand-ink: #FFFFFF;
  --brand-soft: #EEE8FA;
  --brand-hover: #5A43A0;
  --spoken: #F6ECC6;
  --focus: #8E75E0;
  --shadow: 0 1px 2px rgba(36, 27, 61, .05), 0 12px 32px rgba(36, 27, 61, .08);
  --radius: 14px;
  --ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --read: "Literata", Georgia, "Times New Roman", serif;
  --brandface: "Jost", "Inter", system-ui, sans-serif;
  --arabic: "IBM Plex Sans Arabic", "Noto Naskh Arabic", "Segoe UI", Tahoma, sans-serif;
  /* The same colours as numbers, for iPhones on iOS 15 and older: they do not know
     color-mix(), so every color-mix line has an rgba(...) line before it. */
  --page-rgb: 250, 248, 243;
  --surface-rgb: 255, 255, 255;
  --ink-rgb: 36, 27, 61;
  --brand-rgb: 107, 82, 179;
  color-scheme: light;
}
html[data-style="night"] {
  --page: #17112B;
  --surface: #221A3C;
  --surface-2: #2B2249;
  --ink: #F4F0FF;
  --text: #DDD6F0;
  --muted: #A99FC6;
  --line: rgba(255, 255, 255, .10);
  --brand: #B9A6FF;
  --brand-ink: #17112B;
  --brand-soft: rgba(185, 166, 255, .14);
  --brand-hover: #CDBEFF;
  --spoken: rgba(246, 236, 198, .20);
  --focus: #CDBEFF;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 16px 40px rgba(0, 0, 0, .35);
  --page-rgb: 23, 17, 43;
  --surface-rgb: 34, 26, 60;
  --ink-rgb: 244, 240, 255;
  --brand-rgb: 185, 166, 255;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font: 400 16px/1.6 var(--ui);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; }
img, svg { display: block; max-width: 100%; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.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; }
.wrap { width: min(1180px, calc(100% - 48px)); margin-inline: auto; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: rgba(var(--page-rgb), .88);
  background: color-mix(in srgb, var(--page) 88%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner { display: flex; align-items: center; gap: 28px; height: 68px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font: 500 25px/1 var(--brandface); letter-spacing: .01em; }
.brand-logo { width: 34px; height: 34px; object-fit: contain; }
.mainnav { display: flex; align-items: center; gap: 26px; }
.mainnav a { text-decoration: none; color: var(--text); font-weight: 500; font-size: 15.5px; }
.mainnav a:hover, .mainnav a[aria-current="page"] { color: var(--brand); }
.topbar-end { margin-left: auto; display: flex; align-items: center; gap: 14px; }
.nav-account { display: flex; align-items: center; gap: 14px; }
.nav-account a { text-decoration: none; color: var(--text); font-weight: 500; font-size: 15px; white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis; }
.nav-account a:hover { color: var(--brand); }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  color: var(--text); cursor: pointer;
}
.icon-btn:hover { border-color: var(--brand); color: var(--brand); }
.icon-btn svg { width: 18px; height: 18px; }
.menu-btn { display: none; }
.mainnav a.nav-mirror { display: none; }   /* phones only, see below and topbar.js */

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 20px; border-radius: 11px;
  border: 1px solid transparent; text-decoration: none; cursor: pointer;
  font: 600 15.5px/1 var(--ui); white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand-hover); }
.btn-quiet { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-quiet:hover { border-color: var(--brand); color: var(--brand); }
.btn-sm { min-height: 38px; padding: 0 16px; font-size: 14.5px; border-radius: 10px; }

/* ---------- cards and small parts ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.kicker { margin: 0 0 14px; color: var(--brand); font: 600 13px/1.2 var(--ui); letter-spacing: .16em; text-transform: uppercase; }
.muted { color: var(--muted); }
.chip {
  display: inline-flex; align-items: center; min-height: 34px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  color: var(--text); font-size: 14.5px; text-decoration: none; cursor: pointer;
}
.chip[aria-pressed="true"], .chip.is-on { background: var(--ink); color: var(--page); border-color: var(--ink); }

/* ---------- footer ---------- */
.footer { margin-top: 72px; border-top: 1px solid var(--line); padding: 34px 0 44px; color: var(--muted); font-size: 14.5px; }
.footer-inner { display: flex; flex-wrap: wrap; gap: 18px 40px; align-items: flex-start; justify-content: space-between; }
.footer .brand { font-size: 21px; }
.footer-tag { margin: 6px 0 0; }
.footer nav { display: flex; flex-wrap: wrap; gap: 10px 22px; }
.footer nav a { text-decoration: none; }
.footer nav a:hover { color: var(--brand); }

/* ---------- phones ---------- */
@media (max-width: 900px) {
  .wrap { width: calc(100% - 32px); }
  .topbar-inner { gap: 12px; height: 60px; }
  .menu-btn { display: inline-grid; }
  .mainnav {
    position: absolute; left: 0; right: 0; top: 100%;
    flex-direction: column; align-items: stretch; gap: 0;
    padding: 8px 16px 14px; background: var(--page);
    border-bottom: 1px solid var(--line); box-shadow: var(--shadow);
  }
  .mainnav:not(.is-open) { display: none; }
  .mainnav a { padding: 12px 4px; font-size: 17px; border-bottom: 1px solid var(--line); }
  .mainnav a:last-child { border-bottom: 0; }
  .topbar-end .btn { display: none; }
  .topbar-end .nav-account { display: none; }
  .mainnav a.nav-mirror { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--brand); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
