/*
 * NSysNets' website basics, the same under every site's own look (the user's rule of 26 November 2026; the reasons and
 * measurements: company/claude-setup/notes/website-width-standard-2026-11-26.md). The site-builder adds this file
 * to every page of a site on site-builder 2.6 or newer, before the site's own styles, so a site's own rules win.
 *
 *   - Content at most 1320 px wide (82.5rem), centred.
 *   - Side margins from 16 px on phones to 50 px on wide screens, or the screen's safe area where that's wider.
 *   - Text 16 px on every screen, with every size in rem, so a reader's own text size and zoom work fully.
 *   - Running text at most 720 px wide (45rem); the extra width goes to cards, lists and photos.
 *   - Never the whole page, text included, scaled with the screen: no font size on html or :root that grows with it.
 *
 * A site uses the variables in its own rules, or the two classes:
 *   <div class="nsys-content"> ... </div>   the centred content, with its side margins as padding
 *   <p class="nsys-text"> ... </p>          running text, 45rem at most
 * Backgrounds and photos can still run edge to edge outside .nsys-content.
 *
 * From site-builder 2.7, five more (the user's rule of 26 November 2026; the details:
 * company/claude-setup/notes/website-basics-five-2026-11-26.md):
 *   - Reading text at least 14 px (--nsys-text-small, 0.875rem); 12 px (--nsys-label, 0.75rem) only for a label of a
 *     word or two. The build stops on text under 12 px.
 *   - On every screen, mouse or touch, everything tappable at least 44 by 44 px and 8 px apart, except links inside a
 *     sentence: .nsys-tap on a link or button, and --nsys-tap-gap between neighbours (the user's rule of 27 November
 *     2026: one design, as touch tills and laptops often report a mouse, and big targets are easier with a mouse too).
 *   - Tamil and Sinhala in the device's own fonts, never downloaded: --nsys-font-tamil and --nsys-font-sinhala, the
 *     page's own on a page in that language.
 *   - The language switch, for {{> nsys-languages.html}}: தமிழ் · සිංහල · English, or த · සි · EN on a phone.
 * Money, times, dates and phones are written by the site-builder's {{money}}, {{time}}, {{date}}, {{day}},
 * {{phone}}, {{tel}} and {{whatsapp}} (basics.py); a phone's first screen stays under 1 MB.
 */

:root {
  --nsys-content: 82.5rem;
  --nsys-margin: clamp(1rem, 4.4vw, 3.125rem);
  --nsys-margin-left: max(var(--nsys-margin), env(safe-area-inset-left, 0px));
  --nsys-margin-right: max(var(--nsys-margin), env(safe-area-inset-right, 0px));
  --nsys-text: 45rem;
  --nsys-text-small: 0.875rem;
  --nsys-label: 0.75rem;
  --nsys-tap: max(2.75rem, 44px);
  --nsys-tap-gap: max(0.5rem, 8px);
  --nsys-font-tamil: "Noto Sans Tamil", "Tamil Sangam MN", "Nirmala UI", "Latha", system-ui, sans-serif;
  --nsys-font-sinhala: "Noto Sans Sinhala", "Sinhala Sangam MN", "Sinhala MN", "Nirmala UI", "Iskoola Pota", system-ui, sans-serif;
}

/* A page in Tamil or Sinhala starts in the device's own font; a site's own rules for its parts still win. */
:where(html:lang(ta)) {
  font-family: var(--nsys-font-tamil);
}

:where(html:lang(si)) {
  font-family: var(--nsys-font-sinhala);
}

html {
  font-size: 100%;
}

.nsys-content {
  box-sizing: border-box;
  width: 100%;
  max-width: calc(var(--nsys-content) + var(--nsys-margin-left) + var(--nsys-margin-right));
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--nsys-margin-left);
  padding-right: var(--nsys-margin-right);
}

.nsys-text {
  max-width: var(--nsys-text);
}

/* Tappable parts, on every screen: 44 by 44 px at least, the words centred in them. */
.nsys-tap {
  box-sizing: border-box;
  min-width: var(--nsys-tap);
  min-height: var(--nsys-tap);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* The language switch: each language in its own script, in one row of tappable parts side by side. */
.nsys-languages {
  display: flex;
  align-items: center;
}

.nsys-languages__item {
  padding: 0 0.5rem;
  text-decoration: none;
  color: inherit;
}

.nsys-languages__item + .nsys-languages__item::before {
  content: "\00B7";
  margin-right: 1rem;
  margin-left: -0.5rem;
  opacity: 0.6;
}

.nsys-languages__item[aria-current] {
  font-weight: 700;
}

.nsys-languages__short {
  display: none;
}

/* Where space is tight, as in a phone's top bar: த · සි · EN, with the full names still read out. */
@media (max-width: 30em) {
  .nsys-languages__short {
    display: inline;
  }

  .nsys-languages__name {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}
