/* ---------- fonts: Noto family, self-hosted (OFL 1.1; the app is offline-first and the CSP only allows our own files) ----------
   TARAA Body = Noto Sans (Latin) + Noto Sans Thai Looped (Thai): body, buttons, menu.   TARAA Head = Noto Sans (Latin) + Noto Sans Thai (Thai): headings (20px and larger).
   Variable fonts (weights 400-800), Latin + Thai subsets only. Japanese, Korean, Chinese and Hindi use the device's matching fonts (stack below). */
@font-face { font-family: "TARAA Body"; font-style: normal; font-weight: 400 800; font-display: swap; src: url(fonts/NotoSans-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "TARAA Body"; font-style: normal; font-weight: 400 800; font-display: swap; src: url(fonts/NotoSansThaiLooped-thai.woff2) format("woff2"); unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC; }
@font-face { font-family: "TARAA Head"; font-style: normal; font-weight: 400 800; font-display: swap; src: url(fonts/NotoSans-latin.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "TARAA Head"; font-style: normal; font-weight: 400 800; font-display: swap; src: url(fonts/NotoSansThai-thai.woff2) format("woff2"); unicode-range: U+02D7, U+0303, U+0331, U+0E01-0E5B, U+200C-200D, U+25CC; }
:root { --font-system: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans JP", "Noto Sans KR", "Noto Sans SC", "Noto Sans Devanagari", "Hiragino Sans", "PingFang SC", "Apple SD Gothic Neo", "Kohinoor Devanagari", sans-serif;
  --font: "TARAA Body", var(--font-system); --font-head: "TARAA Head", var(--font-system); }
html:lang(th) body { line-height: 1.65; }                              /* Thai needs more air (stacked vowels and tone marks) */
:lang(th) :is(h1, h2, h3, .h) { line-height: 1.4; }

/* TARAA shared header + second row (site-chrome/chrome.src.js renders the markup). One theme for every page and app:
   it only uses the shared tokens (--surface --border --text --muted --primary --primary-ink --primary-soft --surface2 --head-h --font-head),
   which the site (mock.css) and the Naturalize app (naturalize.css) both define with the same values.
   --chrome-w = width of the header column (1180px, the home page width, on EVERY page; an app's own content may be narrower but the header never is).
   Typography is pinned here (Noto family, 16px base, weights) so the header, second row and drawer look identical in every host, whatever its own body/rem settings. */
.head, .subrow, .drawer { font-family: var(--font); font-size: 16px; line-height: 1.5; font-weight: 400; letter-spacing: normal; text-transform: none; -webkit-text-size-adjust: 100%; }
.head { --ctl-h: 40px; position: sticky; top: 0; z-index: 30; box-sizing: border-box; height: calc(var(--head-h) + env(safe-area-inset-top, 0px)); display: flex; align-items: center; gap: 12px;
  padding: env(safe-area-inset-top, 0px) max(20px, env(safe-area-inset-right, 0px), calc((100% - var(--chrome-w, 1180px)) / 2)) 0 max(20px, env(safe-area-inset-left, 0px), calc((100% - var(--chrome-w, 1180px)) / 2));
  background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.head .hl, .head .hr { display: flex; align-items: center; gap: 10px; }
.head .hl { gap: 8px; }
.head .hr { margin-left: auto; }
.head .icon, .drawer .icon { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* brand: cube logo + TARAA, vertically centred with the controls */
.brand { --bh: 19px; display: inline-flex; align-items: center; gap: 8px; line-height: 1; height: 44px; text-decoration: none; color: var(--text); }
.brand .logo-img { height: 38px; width: auto; display: block; }
/* the TARAA wordmark is an image (wordmark-outfit-v2.svg, drawn from the brand letters) painted in the text colour; the word stays in the DOM for screen readers */
.brand span { display: block; flex: none; width: calc(var(--bh) * 5.0549); height: var(--bh); font-size: 0; background: currentColor; -webkit-mask: url(wordmark-outfit-v2.svg) center / contain no-repeat; mask: url(wordmark-outfit-v2.svg) center / contain no-repeat; }

/* main menu: hidden on phones; centred between the logo and the buttons (720-1099px); from 1100px a 3-column grid puts it on the true centre of the header
   (equal side columns), so it can never run into the buttons however narrow the content column is */
.head .nav { display: none; gap: 4px; }
.head .nav a { display: inline-flex; align-items: center; height: var(--ctl-h); box-sizing: border-box; padding: 0 14px; border-radius: 999px; color: var(--muted); text-decoration: none; font-weight: 600; font-size: 15px; line-height: 1; white-space: nowrap; }
.head .nav a:hover, .head .nav a[aria-current] { color: var(--text); background: var(--primary-soft); }
@media (min-width: 720px) and (max-width: 1099px) { .head-nav:not(.head-wide):not(.head-dense) .nav { display: flex; margin-inline: auto; } .head-nav:not(.head-wide):not(.head-dense) .hr { margin-left: 0; } }   /* a long menu (more than 4 links) waits for 1100px; the hamburger drawer carries it until then */
@media (min-width: 960px) and (max-width: 1099px) { .head-nav.head-dense:not(.head-wide) .nav { display: flex; margin-inline: auto; } .head-nav.head-dense:not(.head-wide) .hr { margin-left: 0; } }   /* a busy header (menu button + extra tools) needs about 850px (895px in Thai) for brand + 3 links + tools: its nav waits for 960px, the drawer carries the links until then (measured 2026-11-20, design/TRACKER.md F1) */
@media (min-width: 1100px) { .head-nav:not(.head-wide) { display: grid; grid-template-columns: minmax(max-content, 1fr) auto minmax(max-content, 1fr); } .head-nav:not(.head-wide) .nav { display: flex; margin: 0; } .head-nav:not(.head-wide) .hr { justify-self: end; } }
@media (min-width: 1240px) { .head-wide { display: grid; grid-template-columns: minmax(max-content, 1fr) auto minmax(max-content, 1fr); } .head-wide .nav { display: flex; margin: 0; } .head-wide .hr { justify-self: end; } }   /* a long menu (more than 4 links, e.g. the site's 6) needs 1240px so even the Thai labels fit between the logo and the buttons */

/* header buttons (same look as the site's .btn; scoped so an app without mock.css gets them too) */
.head .btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface);
  font: inherit; font-size: 15px; font-weight: 600; line-height: 1; text-decoration: none; color: var(--text); cursor: pointer; height: var(--ctl-h); box-sizing: border-box; white-space: nowrap; }
/* the template owns its sizes: a host app's own .primary/.ghost/.sel min-height (touch targets) must not stretch a header control */
.head .btn, .head .btn.primary, .head .btn.ghost, .head .nav a { min-height: 0; max-height: var(--ctl-h); }
.head .btn:hover { background: var(--primary-soft); }
.head .btn.primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.head .btn.primary:hover { filter: brightness(1.08); background: var(--primary); }
.head .btn.round { padding: 0; width: var(--ctl-h); }
.head .btn[aria-current="page"] { border-color: var(--primary); }
.head .avatar { width: var(--ctl-h); height: var(--ctl-h); border-radius: 50%; background: var(--primary); color: var(--primary-ink); display: grid; place-items: center; font-weight: 700; font-size: 16px; line-height: 1; object-fit: cover; }
/* the signed-in avatar IS the button: no outer frame (2026-11-20) */
.head #btn-user { padding: 0; width: var(--ctl-h); border: 0; background: none; border-radius: 50%; }
.head #btn-user:hover { background: none; }
.head #btn-user:hover .avatar { filter: brightness(1.1); }
.head #btn-user:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.head #btn-user[aria-expanded="true"] .avatar { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--primary); }
.head .menu-wrap { position: relative; }

/* second row (optional on any menu set): title + links, sticky under the header, lined up with the same column */
.subrow { position: sticky; top: calc(var(--head-h) + env(safe-area-inset-top, 0px)); z-index: 29; background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 0 max(20px, env(safe-area-inset-right, 0px), calc((100% - var(--chrome-w, 1180px)) / 2)) 0 max(20px, env(safe-area-inset-left, 0px), calc((100% - var(--chrome-w, 1180px)) / 2)); }
.subrow-in { display: flex; align-items: center; gap: 12px; min-height: 52px; overflow-x: auto; scrollbar-width: none; }
.subrow-in::-webkit-scrollbar { display: none; }
.subtitle { margin: 0 8px 0 0; font-family: var(--font-head, inherit); font-weight: 700; font-size: 20.8px; white-space: nowrap; color: var(--text); }
.subsep { flex: none; width: 1px; height: 20px; background: color-mix(in srgb, var(--muted) 40%, transparent); margin: 0 4px 0 0; }
.subtitle + .subsep { margin-left: -4px; }
.subrow-in.is-center > :first-child { margin-left: auto; } .subrow-in.is-center > :last-child { margin-right: auto; }   /* sub.align = "center": centred while it fits, scrolls from the left edge when it does not */
.subnav { display: flex; gap: 4px; }
.subnav a { --ctl-h: 40px; box-sizing: border-box; height: var(--ctl-h); min-height: 0; padding: 0 14px; border-radius: 999px; font-size: 15px; font-weight: 600; line-height: 1; color: var(--muted); text-decoration: none; white-space: nowrap; display: inline-flex; align-items: center; }
.subnav a[aria-current="page"] { background: var(--primary-soft); color: var(--primary-fg, var(--primary)); }
.subnav a:hover { background: var(--surface2); }
@media (max-width: 719px) { .subrow[data-mobile="hide"] { display: none; } }

/* left drawer (opened by the menu button; links, icons and the tagline come from the set's "drawer" in the JSON) */
.scrim { position: fixed; inset: 0; background: rgba(11,27,58,.45); z-index: 50; opacity: 0; pointer-events: none; transition: opacity .2s; }
.scrim.on { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; bottom: 0; left: 0; width: min(330px, 88vw); background: var(--surface); color: var(--text); z-index: 60; transform: translateX(-102%); transition: transform .22s ease; visibility: hidden;
  display: flex; flex-direction: column; box-shadow: var(--shadow); overflow-y: auto; }
.drawer.on { transform: none; visibility: visible; }
.drawer-head { padding: 22px 20px; color: #fff; background: linear-gradient(135deg, #124a9c, #0a6c80); position: relative; }
.drawer-head .brand { color: #fff; --bh: 17px; }
.drawer-head .brand .logo-img { height: 44px; }
.drawer-head p { margin: 8px 0 0; font-size: 14.4px; opacity: .92; }
.drawer-head .x { position: absolute; top: 14px; right: 14px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(255,255,255,.2); color: #fff; cursor: pointer; display: grid; place-items: center; padding: 0; }
.drawer h2 { margin: 18px 20px 6px; font-family: inherit; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.drawer nav { padding: 0 10px; }
.drawer nav a { display: flex; align-items: center; gap: 14px; padding: 11px 10px; border-radius: 12px; color: var(--text); text-decoration: none; font-weight: 600; font-size: 16px; }
.drawer nav a:hover, .drawer nav a[aria-current] { background: var(--primary-soft); }
.drawer nav .ic { width: 38px; height: 38px; border-radius: 10px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; flex: none; }
.drawer .pills { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 20px 24px; }
.drawer .pills button { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface2); color: var(--text); font: inherit; font-weight: 700; font-size: 13.6px; cursor: pointer; }
.drawer .pills button[aria-pressed="true"] { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.drawer-pad { height: 24px; flex: none; }

/* phones: compact header (icon-only sign-in, no overflow) */
@media (max-width: 520px) {
  .head { gap: 6px; padding-left: max(10px, env(safe-area-inset-left, 0px)); padding-right: max(10px, env(safe-area-inset-right, 0px)); }
  .head #auth-slot .btn.primary { width: var(--ctl-h); padding: 0; }
  .head #auth-slot .btn.primary span { display: none; }
  .brand { --bh: 16px; }
  .head .hl, .head .hr { gap: 6px; }
  .head #btn-lang { padding: 0 12px; }
}
@media (max-width: 440px) { .head-dense #btn-lang .icon { display: none; } }   /* menu + settings + account on a small phone: the language button keeps only its code */
@media (max-width: 370px) { .head-dense .brand span { display: none; } }   /* busy header (menu + settings + account): the cube alone below 371px */
@media (max-width: 345px) { .brand span { display: none; } }                         /* any header on a very small phone: the cube alone */          /* very narrow: the cube alone is the brand */
@media print { .head, .subrow, .drawer, .scrim { display: none !important; } }
