/*
 * Copyright (c) 2026 Natural State Ltd.
 * Author: Omar Miranda <omiranda@naturalstate.org>
 *
 * NSA Portal look for the demo pages, copied by hand from nsa-platform/nsa-portal
 * (no build step, no link to the portal):
 *   - colour tokens: services/frontend/src/styles/index.css (stone light, graphite dark)
 *   - header bar and its tabs: components/layout/TopHeader.tsx and ServerLayout.tsx
 *     (sage-dark #4F544F in light, black in dark, white text, white underline tabs)
 *   - logo: components/Logo.tsx (white ring and a stacked wordmark drawn as text)
 *   - page ground and topography overlay: body / body::before in index.css
 * If the portal changes, copy the new values here.
 * The theme is set by the .dark class on <html> (see the inline script in index.html).
 */

:root {
  color-scheme: light;
  --background: 36 13% 93%;          /* #EFEDEA ground */
  --foreground: 60 4% 10%;           /* #1A1A18 ink */
  --card: 40 13% 96%;                /* #F6F4F1 paper */
  --border: 40 7% 83%;               /* #D7D5D1 hairline */
  --brand-green: 120 3% 32%;         /* #4F544F sage-dark */
  --header-bg: var(--brand-green);   /* TopHeader: bg-brand-green */
  --header-border: 120 3% 32%;
  --info: 180 38% 36%;               /* #3A8080 teal */
  /* Text under a title: sage-dark (about 7:1) instead of taupe (about 3.9:1). */
  --desc: var(--brand-green);
  /* Keyboard focus on the page ground (the portal's sage ring gives only about 2.2:1). */
  --focus: var(--brand-green);
  --radius: 0.5rem;
}

.dark {
  color-scheme: dark;
  --background: 0 0% 7%;             /* #121212 graphite */
  --foreground: 40 25% 97%;          /* #FAF7F2 */
  --card: 30 7% 12%;                 /* #1F1D1B */
  --border: 0 0% 16%;                /* #292929 */
  --header-bg: 0 0% 0%;              /* TopHeader: dark:bg-black */
  --header-border: 0 0% 16%;
  --info: 180 26% 50%;               /* #5FA0A0 */
  --desc: 35 12% 72%;                /* #C2BAB1 lifted taupe */
  --focus: 101 11% 67%;              /* #A8B5A2 */
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: hsl(var(--background));
  color: hsl(var(--foreground));
  /* Inter is used if the visitor has it installed; no font is fetched (CSP stays 'self'). */
  font: 16px/1.5 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Topography overlay, as in the portal: fixed behind all content, full strength on the
   stone ground, dimmed to a faint texture on graphite. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background: url('/assets/topography-overlay.webp') center / cover no-repeat;
  pointer-events: none;
  z-index: -1;
  opacity: 1;
}
.dark body::before { opacity: 0.12; filter: brightness(0.6); }

/* ---------- Header bar ---------- */
.ns-bar {
  position: relative;
  background: hsl(var(--header-bg));
  color: #fff;
  border-bottom: 1px solid hsl(var(--header-border));
}

.ns-bar-inner { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

.ns-brand {
  display: flex;
  justify-content: center;
  padding: 36px 0 28px;
}
.ns-brand a { color: inherit; text-decoration: none; border-radius: var(--radius); }

/* Logo.tsx "wide": ring isotype + stacked wordmark with a hairline between the lines. */
.ns-logo { display: inline-flex; align-items: center; gap: 0.75em; height: 3.25rem; font-size: 1.6rem; }
.ns-logo svg { height: 100%; width: auto; aspect-ratio: 1; flex: none; }
.ns-word { display: flex; flex-direction: column; line-height: 1; }
.ns-word .l1 { font-weight: 300; letter-spacing: 0.18em; font-size: 0.95em; text-transform: uppercase; }
.ns-word .rule { display: block; height: 1px; margin-top: 0.3em; background: currentColor; opacity: 0.3; }
.ns-word .l2 { margin-top: 0.3em; font-weight: 300; letter-spacing: 0.32em; font-size: 0.7em; text-transform: uppercase; opacity: 0.9; }

/* Theme toggle: ghost button on the bar (ServerLayout's "Back to Projects" style). */
.ns-toggle {
  position: absolute;
  top: 16px;
  right: 16px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px solid rgb(255 255 255 / 0.25);
  border-radius: var(--radius);
  background: transparent;
  color: rgb(255 255 255 / 0.85);
  font: inherit;
  font-size: 0.8125rem;
  cursor: pointer;
}
.ns-toggle:hover { background: rgb(255 255 255 / 0.1); color: #fff; }
.ns-toggle svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ns-toggle .ic-sun { display: none; }
.dark .ns-toggle .ic-sun { display: block; }
.dark .ns-toggle .ic-moon { display: none; }

/* Tabs along the foot of the bar (ServerLayout): white labels, white underline. */
.ns-tabs { display: flex; justify-content: center; gap: 4px; overflow-x: auto; margin-bottom: -1px; }
.ns-tabs a {
  white-space: nowrap;
  padding: 10px 14px;
  border-bottom: 2px solid transparent;
  color: rgb(255 255 255 / 0.75);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: color 120ms ease, border-color 120ms ease;
}
.ns-tabs a:hover { color: #fff; border-bottom-color: rgb(255 255 255 / 0.5); }
.ns-tabs a[aria-current='page'] { color: #fff; border-bottom-color: #fff; }

/* Focus on the bar is white (sage-dark and black both give > 7:1). */
.ns-bar a:focus-visible,
.ns-toggle:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
/* The tab row scrolls sideways (overflow-x), which clips anything drawn outside it,
   so the tabs draw their focus ring inside the link. */
.ns-tabs a:focus-visible { outline-offset: -4px; }
a:focus-visible { outline: 2px solid hsl(var(--focus)); outline-offset: 2px; }

/* ---------- Page body ---------- */
main { max-width: 880px; margin: 0 auto; padding: 48px 16px 64px; text-align: center; }
h1 { font-size: 1.5rem; font-weight: 600; margin: 0 0 6px; letter-spacing: -0.01em; }
.lead { color: hsl(var(--desc)); margin: 0; }

/* Below 760px the centred logo would reach the toggle in the top-right corner:
   push the logo down under it, and shrink it on phones. */
@media (max-width: 760px) {
  .ns-brand { padding: 60px 0 22px; }
}
@media (max-width: 480px) {
  .ns-logo { font-size: 1.15rem; height: 2.5rem; }
}

@media (prefers-reduced-motion: reduce) { .ns-tabs a { transition: none; } }
