/* site.css (the new look, 2026-10-30): what every website page shares. The base, the column, the header with its
   phone menu and theme switch, the footer, the skip link, the shine, and the rules that keep motion calm. A page's
   own layout lives in its own file under assets/v2/pages/. Colours, faces and sizes come from tokens.css only, so
   both looks follow; the 4px grid throughout.

   The head of a page in this look, in this order (test_site_fonts.py holds it):
     <script src="assets/theme.js"></script>                    the look, before anything paints
     <link rel="preconnect" href="https://fonts.googleapis.com" />
     <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
     <link rel="preload" href="https://fonts.googleapis.com/css2?..." as="style" />
     <link rel="stylesheet" href="https://fonts.googleapis.com/css2?..." media="print" data-font-sheet />
     <link rel="stylesheet" href="assets/v2/fonts.css" />
     <link rel="stylesheet" href="assets/v2/tokens.css" />
     <link rel="stylesheet" href="assets/v2/site.css" />
     <script src="assets/v2/site.js" defer></script>
   The fonts' stylesheet (one address, display=swap) is fetched at once but never holds up the first paint: it waits
   as a print sheet and site.js turns it on, and the words meanwhile paint in the size-adjusted fallbacks of
   fonts.css, so nothing moves when the faces arrive. On every page that loads fonts.css (the dashboard too), the
   server puts the two main faces' files in front of the fonts' stylesheet (routes/pages.py font_preloads).

   The header's markup (the design's): .wrap > header.bar > a.logo, nav.nav, div.actions (a.signin, a.btn,
   button.icon-btn[data-theme-switch] with svg.theme-sun and svg.theme-moon, button.icon-btn.menu-btn
   [data-site-menu-button][aria-controls]), then nav.menu[id] for phones. site.js runs the menu and marks the
   current page; theme.js runs the switch. */

/* ---- base ---------------------------------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--ground);
  color: var(--text);
  font: 400 16px/24px var(--body);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
:lang(ar) body, body :lang(ar) { font-family: var(--arabic); }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
img, svg, video, canvas { max-width: 100%; }
img, video, canvas { height: auto; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

.wrap {
  width: 100%;
  max-width: calc(var(--container) + 2 * var(--margin));
  margin: 0 auto;
  padding-left: max(var(--margin), env(safe-area-inset-left, 0px));
  padding-right: max(var(--margin), env(safe-area-inset-right, 0px));
}

/* Words for screen readers only. */
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* The skip link: the first stop for the keyboard, in view only while it has focus. */
.skip-link {
  position: fixed; left: 12px; top: 12px; z-index: 100;
  height: 40px; padding: 0 16px; display: inline-flex; align-items: center;
  border-radius: var(--pill-radius); background: var(--pill); color: var(--pill-ink);
  font: 600 14px/20px var(--body);
  transform: translateY(-76px);   /* out of sight above the page; it slides in on focus, moved by the compositor */
  transition: transform .16s ease;
}
.skip-link:focus, .skip-link:focus-visible { transform: none; }

/* A long list or a section far below the fold is laid out only when it nears the screen. A page sets the height
   it expects with --cv-size, so the scroll bar does not jump. */
.cv-auto { content-visibility: auto; contain-intrinsic-size: auto var(--cv-size, 640px); }

/* ---- header -------------------------------------------------------------------------------------------------- */
.bar { height: var(--h-bar); display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px; }
.logo { justify-self: start; display: inline-flex; align-items: center; gap: 8px; height: 40px; }
.logo svg { width: 24px; height: 22px; flex: none; }
.logo span { font: 600 20px/24px var(--display); letter-spacing: -0.045em; }
.nav { display: flex; gap: 4px; }
.nav a, .signin {
  height: 32px; padding: 0 12px; display: inline-flex; align-items: center;
  border-radius: var(--radius-sm); color: var(--text-2); font: 500 14px/20px var(--body);
  transition: color .2s, background-color .2s;
}
.nav a:hover, .signin:hover, .nav a[aria-current="page"] { color: var(--text); }
.nav a:hover, .signin:hover { background: var(--line); }
.actions { justify-self: end; display: flex; align-items: center; gap: 8px; }

/* The pill: every main action on the site. */
.btn {
  height: 40px; padding: 0 16px; border-radius: var(--pill-radius); border: 0; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap;
  background: var(--pill); color: var(--pill-ink); font: 600 14px/20px var(--body);
  transition: background-color .2s, transform .2s;
}
.btn:hover { background: var(--pill-hover); }
.btn:active { transform: scale(.98); }
.btn.ghost { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.btn.ghost:hover { background: var(--line); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: default; transform: none; }

/* Round outline buttons: the theme switch, the menu, small tools. Thin grey icons, no coloured chip. */
.icon-btn {
  width: 40px; height: 40px; border-radius: var(--pill-radius); border: 1px solid var(--line-2);
  background: transparent; display: inline-grid; place-items: center; cursor: pointer; padding: 0;
  color: var(--text-2); transition: color .2s, background-color .2s; flex: none;
}
.icon-btn:hover { color: var(--text); background: var(--line); }
.icon-btn svg { width: 16px; height: 16px; pointer-events: none; }
/* The switch shows where it goes: the sun on the dark look, the moon on the light one. */
.theme-moon, :root[data-site-theme="light"] .theme-sun { display: none; }
:root[data-site-theme="light"] .theme-moon { display: block; }
.menu-btn { display: none; }

/* The phone menu: a sheet under the header row. */
.menu {
  display: none; flex-direction: column; gap: 4px; padding-block: 8px 16px;
  border-bottom: 1px solid var(--line);
}
.menu a { height: 40px; display: flex; align-items: center; padding: 0 12px; border-radius: var(--radius-sm); color: var(--text-2); font: 500 16px/24px var(--body); }
.menu a:hover, .menu a[aria-current="page"] { color: var(--text); background: var(--line); }
.menu.open { display: flex; }

/* Sticky, on a frosted band as wide as the window. These rules lived in pages/common.css until the pages the design
   does not draw (setup, profile, pay, the legal pages, Security, 404, email-undo, unsubscribe) took this header
   too: here, every page carries the same header and footer. */
html, body { overflow-x: clip; }
/* An address with a fragment (contact.html#contact-form, after sign-in) lands below the sticky header, not under it. */
html { scroll-padding-top: calc(var(--h-bar) + 16px); }
.bar { position: sticky; top: 0; z-index: 30; }
.bar::before {
  content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 100vw; transform: translateX(-50%); z-index: -1;
  background: color-mix(in srgb, var(--ground) 94%, transparent);
  -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px);
  box-shadow: inset 0 -1px 0 transparent;
}
/* The hairline under the band once the page has scrolled (bidi-app.js marks the root [data-scrolled]). */
:root[data-scrolled] .bar::before { box-shadow: inset 0 -1px 0 var(--line); }
.nav a[aria-current="page"], .menu a[aria-current="page"] { color: var(--text); background: var(--line); }
/* The phone menu stays under the sticky header wherever the page is scrolled. */
.menu.open { position: sticky; top: var(--h-bar); z-index: 29; }
.menu.open::before { content: ""; position: absolute; top: 0; bottom: 0; left: 50%; width: 100vw; transform: translateX(-50%); z-index: -1; background: var(--ground); }
/* One of Account and Sign in shows, by the visitor's sign-in state (bidi-app.js): the header keeps its place. */
.actions .signin[hidden], .menu .m-signin[hidden] { display: none; }
/* The bar has no room for Get started at 400 px and under (the design hides it there): the phone's menu carries it
   as its last item then (U15), so a phone always has the way to the setup, or to the dashboard once signed in. */
.menu .m-start { display: none; }
@media (max-width: 400px) { .menu .m-start { display: flex; color: var(--text); font-weight: 600; } }

/* ---- footer -------------------------------------------------------------------------------------------------- */
.foot {
  border-top: 1px solid var(--line); padding-block: 40px;
  display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap;
}
.foot nav { display: flex; flex-wrap: wrap; gap: 4px 20px; }
.foot nav a { color: var(--text-2); font: 500 14px/20px var(--body); }
.foot nav a:hover, .foot nav a[aria-current="page"] { color: var(--text); }
.foot small { color: var(--text-3); font: 400 13px/20px var(--body); }
.foot .social { display: flex; gap: 8px; }
.foot .social a { width: 32px; height: 32px; display: inline-grid; place-items: center; border-radius: var(--pill-radius); color: var(--text-2); }
.foot .social a:hover { color: var(--text); background: var(--line); }
.foot .social svg { width: 16px; height: 16px; }
/* The design's row, with the docs, the social links and the company line. */
.foot-end { display: flex; align-items: center; gap: 16px; }
.foot-entity { flex-basis: 100%; }
.foot-entity:empty { display: none; }
@media (max-width: 640px) {
  .foot nav a { min-height: 40px; min-width: 40px; display: inline-flex; align-items: center; }
  .foot .social a { width: 40px; height: 40px; }
}
/* Forced colours paint over the current page's tint: an outline marks it in the row and the phone's menu. */
@media (forced-colors: active) {
  .nav a[aria-current="page"], .menu a[aria-current="page"] { outline: 2px solid CanvasText; outline-offset: -2px; }
}

/* ---- the shine ----------------------------------------------------------------------------------------------- */
/* Three wide, slow pools of light that stay put while the page scrolls (a fixed layer the compositor keeps). */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(45% 40% at 0% 100%, var(--sh1), transparent 70%),
    radial-gradient(40% 45% at 100% 55%, var(--sh2), transparent 70%),
    radial-gradient(60% 30% at 70% 0%, var(--sh3), transparent 70%);
}
/* A card in the shine: the light in a different corner for every second and third card. */
.shine {
  background-image:
    radial-gradient(70% 45% at 0% 100%, var(--sh1), transparent 70%),
    radial-gradient(60% 50% at 100% 60%, var(--sh2), transparent 70%),
    radial-gradient(80% 35% at 70% 0%, var(--sh3), transparent 70%);
}
.shine:nth-child(3n+2) {
  background-image:
    radial-gradient(70% 45% at 100% 0%, var(--sh2), transparent 70%),
    radial-gradient(60% 55% at 0% 40%, var(--sh1), transparent 70%),
    radial-gradient(80% 35% at 30% 100%, var(--sh3), transparent 70%);
}
.shine:nth-child(3n) {
  background-image:
    radial-gradient(60% 50% at 50% 110%, var(--sh2), transparent 70%),
    radial-gradient(55% 45% at 100% 100%, var(--sh1), transparent 70%),
    radial-gradient(70% 40% at 0% 0%, var(--sh3), transparent 70%);
}

/* ---- calm motion --------------------------------------------------------------------------------------------- */
/* Pages cross-fade into each other; the header and the chat button stay put. */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .22s; }
.bar { view-transition-name: site-bar; }
/* An animation rests while it is off screen (site.js marks [data-rest-offscreen] elements), and while nobody has
   touched the page for a while (mark the element [data-rest-idle]: site.js gives it the class idle-rest then, and
   [data-site-idle] to the root for scripts).
   tools/smoothness.py fails a page where anything still moves on screen once it is idle, or out of view at its end,
   but inside [data-idle-ok]: the one place an animation may keep going while idle (a spinner while work is
   pending). Opt in per element, never with a selector over the whole page: the switch to idle and back must not
   restyle every element, so no rule here reads the root's attribute (a rule under it restyles the whole document
   when it changes; a class on the marked elements restyles only them). The glows and pulses drawn on ::before and
   ::after rest too: `*` matches no pseudo-element, and animation-play-state is not inherited. */
.off-screen, .off-screen *, .off-screen::before, .off-screen::after, .off-screen *::before, .off-screen *::after,
.idle-rest, .idle-rest *, .idle-rest::before, .idle-rest::after,
.idle-rest *::before, .idle-rest *::after { animation-play-state: paused !important; }

/* ---- breakpoints --------------------------------------------------------------------------------------------- */
@media (min-width: 901px) {
  .menu.open { display: none; }
}
@media (max-width: 900px) {
  .nav { display: none; }
  .bar { display: flex; justify-content: space-between; }
  .menu-btn { display: inline-grid; }
}
@media (min-width: 641px) {
  .menu .m-signin { display: none; }
}
@media (max-width: 640px) {
  .signin { display: none; }
  .foot { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 400px) {
  .bar .btn { display: none; }
}
@media (forced-colors: active) {
  .btn, .icon-btn { border: 1px solid ButtonText; }
}
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; scroll-behavior: auto !important; }
}
