/*
 * QuestERP — questerp.io landing page styles.
 * Static file, no build step. Colours are the app's own design tokens
 * (DESIGN-G39-V1-tokens.md §3):
 *   light : day-sky canvas #d3e0f2→#dce3ee (the login page's light sky),
 *           text #0f172a, muted #475569, accent #1d4ed8, border #e2e8f0
 *   dark  : night canvas #04060d→#03050b, text #d7dfea, muted #94a3b8,
 *           accent text #cbd5e1, navy surface #0f1528
 * Themes: <html data-theme> is set by landing.js (stored choice, else the
 * OS setting). The prefers-color-scheme blocks below are the no-JS
 * fallback. With JS, the dark theme also runs the canvas star field
 * (landing.js); without it, the static CSS sky shows in both themes.
 */

/* ------------------------------------------------------------------ */
/* tokens                                                              */
/* ------------------------------------------------------------------ */

:root {
  color-scheme: light;

  --bg-base: #d3e0f2;                       /* behind everything: overscroll + sky fallback */
  --text: #0f172a;
  --text-muted: #475569;
  --accent: #1d4ed8;                        /* Corporate Blue */
  --accent-ink: #ffffff;
  --focus: #1d4ed8;
  --surface: rgba(255, 255, 255, 0.72);     /* glass surfaces over the sky */
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --scrim: rgba(230, 236, 246, 0.7);        /* soft veil that keeps text AA over the sky */
  --radius: 10px;                           /* card / control radius (theme-independent) */
  --radius-lg: 12px;                        /* large panel radius */

  /* The light theme's static sky: the login page's day frame —
     22 faint stars, three nebula washes, the base day-sky gradient. */
  --sky-light:
    radial-gradient(circle at 8% 14%, rgba(181, 211, 234, 0.50) 0 1px, transparent 1.6px),
    radial-gradient(circle at 15% 64%, rgba(233, 241, 252, 0.42) 0 0.8px, transparent 1.3px),
    radial-gradient(circle at 21% 32%, rgba(181, 211, 234, 0.34) 0 1.1px, transparent 1.7px),
    radial-gradient(circle at 28% 82%, rgba(181, 211, 234, 0.45) 0 0.9px, transparent 1.4px),
    radial-gradient(circle at 33% 10%, rgba(238, 223, 201, 0.38) 0 1px, transparent 1.6px),
    radial-gradient(circle at 38% 48%, rgba(181, 211, 234, 0.30) 0 0.8px, transparent 1.2px),
    radial-gradient(circle at 44% 74%, rgba(233, 241, 252, 0.36) 0 1.2px, transparent 1.8px),
    radial-gradient(circle at 49% 20%, rgba(181, 211, 234, 0.50) 0 1px, transparent 1.6px),
    radial-gradient(circle at 55% 58%, rgba(181, 211, 234, 0.32) 0 0.8px, transparent 1.3px),
    radial-gradient(circle at 61% 88%, rgba(233, 241, 252, 0.40) 0 0.9px, transparent 1.4px),
    radial-gradient(circle at 66% 12%, rgba(181, 211, 234, 0.44) 0 1.1px, transparent 1.7px),
    radial-gradient(circle at 71% 42%, rgba(238, 223, 201, 0.34) 0 0.8px, transparent 1.2px),
    radial-gradient(circle at 76% 68%, rgba(181, 211, 234, 0.48) 0 1.2px, transparent 1.8px),
    radial-gradient(circle at 82% 26%, rgba(233, 241, 252, 0.52) 0 1.3px, transparent 2px),
    radial-gradient(circle at 87% 54%, rgba(181, 211, 234, 0.36) 0 0.9px, transparent 1.4px),
    radial-gradient(circle at 92% 78%, rgba(181, 211, 234, 0.42) 0 1px, transparent 1.5px),
    radial-gradient(circle at 96% 34%, rgba(233, 241, 252, 0.38) 0 0.8px, transparent 1.2px),
    radial-gradient(circle at 5% 44%, rgba(181, 211, 234, 0.40) 0 0.9px, transparent 1.4px),
    radial-gradient(circle at 12% 88%, rgba(233, 241, 252, 0.34) 0 1px, transparent 1.5px),
    radial-gradient(circle at 58% 6%, rgba(181, 211, 234, 0.44) 0 0.8px, transparent 1.2px),
    radial-gradient(circle at 89% 8%, rgba(181, 211, 234, 0.36) 0 1.1px, transparent 1.6px),
    radial-gradient(circle at 45% 92%, rgba(181, 211, 234, 0.30) 0 0.8px, transparent 1.2px),
    radial-gradient(58% 44% at 74% 28%, rgba(120, 170, 210, 0.09), rgba(120, 170, 210, 0) 70%),
    radial-gradient(52% 40% at 24% 74%, rgba(150, 128, 188, 0.07), rgba(150, 128, 188, 0) 70%),
    radial-gradient(46% 36% at 62% 88%, rgba(86, 148, 176, 0.06), rgba(86, 148, 176, 0) 70%),
    linear-gradient(180deg, #d3e0f2 0%, #e4ebf6 45%, #dce3ee 100%);

  /* The dark static sky — shown when JS is off (with JS, the canvas
     star field replaces it). 24 stars, two with soft halos. */
  --sky-dark:
    radial-gradient(circle at 80% 22%, rgba(214, 236, 252, 0.95) 0 1.4px, rgba(190, 216, 238, 0.3) 2.8px, transparent 5px),
    radial-gradient(circle at 24% 44%, rgba(233, 241, 252, 0.9) 0 1.2px, rgba(181, 211, 234, 0.25) 2.4px, transparent 4.5px),
    radial-gradient(circle at 6% 18%, rgba(190, 216, 238, 0.75) 0 1.1px, transparent 1.7px),
    radial-gradient(circle at 11% 52%, rgba(158, 196, 228, 0.50) 0 0.9px, transparent 1.4px),
    radial-gradient(circle at 17% 78%, rgba(233, 241, 252, 0.85) 0 1.2px, transparent 1.8px),
    radial-gradient(circle at 23% 30%, rgba(190, 216, 238, 0.45) 0 0.8px, transparent 1.2px),
    radial-gradient(circle at 29% 62%, rgba(214, 236, 252, 0.60) 0 1px, transparent 1.5px),
    radial-gradient(circle at 34% 12%, rgba(158, 196, 228, 0.55) 0 0.9px, transparent 1.4px),
    radial-gradient(circle at 39% 86%, rgba(190, 216, 238, 0.40) 0 0.8px, transparent 1.2px),
    radial-gradient(circle at 43% 40%, rgba(238, 223, 201, 0.50) 0 1.1px, transparent 1.6px),
    radial-gradient(circle at 47% 68%, rgba(214, 236, 252, 0.65) 0 0.9px, transparent 1.4px),
    radial-gradient(circle at 52% 22%, rgba(190, 216, 238, 0.50) 0 1px, transparent 1.5px),
    radial-gradient(circle at 57% 90%, rgba(158, 196, 228, 0.42) 0 0.8px, transparent 1.2px),
    radial-gradient(circle at 62% 48%, rgba(233, 241, 252, 0.70) 0 1.2px, transparent 1.8px),
    radial-gradient(circle at 67% 8%, rgba(190, 216, 238, 0.48) 0 0.9px, transparent 1.3px),
    radial-gradient(circle at 72% 58%, rgba(214, 236, 252, 0.55) 0 1px, transparent 1.5px),
    radial-gradient(circle at 78% 34%, rgba(238, 223, 201, 0.55) 0 0.9px, transparent 1.4px),
    radial-gradient(circle at 83% 76%, rgba(190, 216, 238, 0.60) 0 1.1px, transparent 1.6px),
    radial-gradient(circle at 88% 16%, rgba(158, 196, 228, 0.50) 0 0.8px, transparent 1.2px),
    radial-gradient(circle at 93% 62%, rgba(233, 241, 252, 0.72) 0 1.2px, transparent 1.8px),
    radial-gradient(circle at 97% 40%, rgba(190, 216, 238, 0.45) 0 0.9px, transparent 1.3px),
    radial-gradient(circle at 3% 70%, rgba(214, 236, 252, 0.50) 0 1px, transparent 1.5px),
    radial-gradient(circle at 50% 4%, rgba(190, 216, 238, 0.40) 0 0.8px, transparent 1.2px),
    radial-gradient(circle at 36% 96%, rgba(158, 196, 228, 0.38) 0 0.8px, transparent 1.2px),
    radial-gradient(circle at 15% 94%, rgba(214, 236, 252, 0.55) 0 0.9px, transparent 1.4px),
    radial-gradient(circle at 68% 88%, rgba(190, 216, 238, 0.42) 0 1px, transparent 1.5px),
    radial-gradient(58% 44% at 74% 28%, rgba(120, 170, 210, 0.05), rgba(120, 170, 210, 0) 70%),
    radial-gradient(52% 40% at 24% 74%, rgba(150, 128, 188, 0.04), rgba(150, 128, 188, 0) 70%),
    radial-gradient(46% 36% at 62% 88%, rgba(86, 148, 176, 0.03), rgba(86, 148, 176, 0) 70%),
    linear-gradient(180deg, #04060d 0%, #03050b 100%);

  --sky: var(--sky-light);
}

/* no-JS fallback: follow the OS setting */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg-base: #04060d;
    --text: #d7dfea;
    --text-muted: #94a3b8;
    --accent: #cbd5e1;                      /* the app's dark accent-text token */
    --accent-ink: #0f1528;
    --focus: #cbd5e1;
    --surface: rgba(15, 21, 40, 0.55);
    --border: rgba(126, 144, 169, 0.45);    /* slate 215 20% 58%, the app's dark border */
    --border-strong: rgba(126, 144, 169, 0.8);
    --scrim: rgba(3, 5, 11, 0.62);
    --sky: var(--sky-dark);
  }
}

/* the attribute set by landing.js always wins over the OS setting */
:root[data-theme="light"] {
  color-scheme: light;
  --bg-base: #d3e0f2;
  --text: #0f172a;
  --text-muted: #475569;
  --accent: #1d4ed8;
  --accent-ink: #ffffff;
  --focus: #1d4ed8;
  --surface: rgba(255, 255, 255, 0.72);
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --scrim: rgba(230, 236, 246, 0.7);
  --sky: var(--sky-light);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg-base: #04060d;
  --text: #d7dfea;
  --text-muted: #94a3b8;
  --accent: #cbd5e1;
  --accent-ink: #0f1528;
  --focus: #cbd5e1;
  --surface: rgba(15, 21, 40, 0.55);
  --border: rgba(126, 144, 169, 0.45);
  --border-strong: rgba(126, 144, 169, 0.8);
  --scrim: rgba(3, 5, 11, 0.62);
  --sky: var(--sky-dark);
}

/* ------------------------------------------------------------------ */
/* base                                                                */
/* ------------------------------------------------------------------ */

* { box-sizing: border-box; }

html { background: var(--bg-base); }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;               /* stable height on mobile (address bar) */
  display: flex;
  flex-direction: column;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-feature-settings: "cv02","cv03","cv04","cv11";
  line-height: 1.6;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* sky layers — fixed, behind everything (the canvas is driven by landing.js) */
.sky,
.sky-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.sky {
  z-index: -3;
  background-color: var(--bg-base);   /* plain fallback if gradients unsupported */
  background-image: var(--sky);
}

.sky-canvas { z-index: -2; display: none; }

/* once the canvas is running (dark theme), it replaces the static sky */
:root.sky-on[data-theme="dark"] .sky { display: none; }
:root.sky-on[data-theme="dark"] .sky-canvas { display: block; }

/* a soft veil behind the text so contrast stays AA over the star field */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(58% 46% at 50% 54%, var(--scrim), transparent 72%);
}

:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}

/* "Skip to content" — off-screen until focused (instant, no transition) */
.skip-link {
  position: absolute;
  left: 0.9rem;
  top: 0.9rem;
  z-index: 30;
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0.5rem 1rem;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--accent-ink);
  background: var(--accent);
  border-radius: 8px;
  text-decoration: none;
  transform: translateY(-300%);
}

.skip-link:focus { transform: none; }

::selection {
  background: var(--accent);
  color: var(--accent-ink);
}

/* ------------------------------------------------------------------ */
/* layout: header / main / footer                                      */
/* ------------------------------------------------------------------ */

.site-header {
  display: flex;
  flex-wrap: wrap;                    /* narrow screens: the nav takes its own row */
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1.25rem;
  padding: clamp(0.75rem, 2vw, 1.25rem) clamp(1.25rem, 5vw, 2.5rem);
}

.wordmark {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.wordmark-mark {                      /* the 404 page's <img> tile */
  display: block;
  width: 28px;
  height: 28px;
  border-radius: 7px;
}

.wordmark-text { white-space: nowrap; }

.wordmark-erp {
  font-weight: 400;
  color: var(--text-muted);
}

/* the Q tile (inline SVG symbol, see the sprite in index.html) */
.qmark {
  display: block;
  flex: none;
}

.qmark-sm { width: 38px; height: 38px; }
.qmark-lg { width: 72px; height: 72px; }

/* the hidden sprite that defines the mark — never display:none, so the
   gradient inside keeps painting through <use> */
.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* in-page section nav (plain wrapped links; works with JS off) */
.site-nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.15rem 0.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;                   /* comfortable target */
  padding: 0.3rem 0.75rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 0.25em;
}

@media (max-width: 48rem) {
  .site-nav { flex-basis: 100%; }     /* nav moves below the brand row */
}

.site-main {
  flex: 1;
  display: grid;
  place-items: center;
  align-content: center; /* h1 and status stay together, centred (grid rows otherwise stretch apart) */
  padding: clamp(3rem, 10vh, 5.5rem) clamp(1.25rem, 5vw, 2.5rem);
  text-align: center;
}

.site-main h1 {
  max-width: 44rem;
  margin: 0 auto;
  font-size: clamp(1.75rem, 1rem + 2.6vw, 3rem);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.status {
  max-width: 36rem;
  margin: 1.15rem auto 0;
  font-size: clamp(1rem, 0.95rem + 0.3vw, 1.125rem);
  color: var(--text-muted);
  text-wrap: balance;
}

/* the one link (404 page back-link) */
.status a {
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

.status a:hover { text-decoration-thickness: 2px; }

.site-footer {
  padding: 0 clamp(1.25rem, 5vw, 2.5rem) clamp(1.25rem, 3vw, 1.75rem);
  text-align: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.site-footer p { margin: 0; }

/* ------------------------------------------------------------------ */
/* theme toggle                                                        */
/* ------------------------------------------------------------------ */

.theme-toggle {
  display: none;                     /* no JS: no button, the OS setting rules */
  align-items: center;
  gap: 0.5rem;
  min-height: 44px;                  /* comfortable target */
  min-width: 44px;
  padding: 0.5rem 0.95rem;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.2;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;                /* the app's 0.5rem radius */
  cursor: pointer;
}

:root.js .theme-toggle { display: inline-flex; }

@media (prefers-reduced-motion: no-preference) {
  .theme-toggle {
    transition: border-color 0.2s ease, background-color 0.2s ease;
  }
}

.theme-toggle:hover { border-color: var(--border-strong); }

.theme-toggle .ico {
  width: 18px;
  height: 18px;
  flex: none;
}

/* the visible label and icon state the theme you would switch TO;
   landing.js keeps aria-label in step for icon-only widths below */
.theme-toggle .to-light,
.theme-toggle .ico-sun { display: none; }

:root[data-theme="dark"] .theme-toggle .to-light { display: inline; }
:root[data-theme="dark"] .theme-toggle .ico-sun { display: inline-block; }
:root[data-theme="dark"] .theme-toggle .to-dark,
:root[data-theme="dark"] .theme-toggle .ico-moon { display: none; }

/* narrow screens: icon-only button (accessible name kept via aria-label) */
@media (max-width: 30rem) {
  .theme-toggle .to-dark,
  .theme-toggle .to-light { display: none; }
  :root[data-theme="dark"] .theme-toggle .to-light { display: none; }
}

/* ------------------------------------------------------------------ */
/* layout: the landing page (index) — hero, sections, cards            */
/* (.site-main above stays for the 404 page)                           */
/* ------------------------------------------------------------------ */

.landing-main {
  flex: 1;
  width: 100%;
  padding: 0 clamp(1.25rem, 5vw, 2.5rem);
}

/* hero — airy and centred, straight over the sky (the scrim keeps AA) */
.hero {
  max-width: 44rem;
  margin: 0 auto;
  padding: clamp(3rem, 9vh, 5.5rem) 0 clamp(2.25rem, 6vh, 4rem);
  text-align: center;
}

.hero-lockup {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-bottom: clamp(1.25rem, 3vh, 2rem);
}

.lockup-word {
  font-size: clamp(1.7rem, 1.2rem + 2.2vw, 2.5rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.1;
}

.lockup-erp {
  font-weight: 300;
  color: var(--text-muted);
}

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 1.2rem + 3.4vw, 3.4rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.hero .lead {
  max-width: 36rem;
  margin: 1.1rem auto 0;
  font-size: clamp(1.05rem, 0.95rem + 0.5vw, 1.3rem);
  color: var(--text-muted);
  text-wrap: balance;
}

/* the status line, as a quiet badge on glass */
.hero .status {
  display: inline-flex;
  align-items: center;
  margin: 1.5rem 0 0;
  padding: 0.35rem 0.95rem;
  font-size: 0.95rem;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
}

/* the one call to action */
.cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  margin-top: 1.9rem;
  padding: 0.65rem 1.6rem;
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--accent-ink);
  background: var(--accent);
  border: 1px solid transparent;
  border-radius: var(--radius);
  text-decoration: none;
}

.cta:hover {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

/* sections */
.section {
  max-width: 71rem;
  margin: 0 auto;
  padding-top: clamp(2.5rem, 7vh, 4.5rem);
}

.section h2 {
  margin: 0 0 0.75rem;
  font-size: clamp(1.5rem, 1.05rem + 1.8vw, 2.1rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.section-intro {
  max-width: 40rem;
  margin: 0 0 2rem;
  font-size: clamp(1rem, 0.95rem + 0.35vw, 1.15rem);
  color: var(--text-muted);
}

/* card grids: three columns wide, two on tablets, one on phones */
.card-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.card {
  background: var(--surface);          /* glass panel over the sky */
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem 1.25rem;
}

.card h3 {
  margin: 0 0 0.3rem;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

.card p {
  margin: 0;
  font-size: 0.96rem;
  color: var(--text-muted);
}

@media (min-width: 40rem) {
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 64rem) {
  .card-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* the "What is coming" list — one tidy panel, no table */
.coming-list {
  max-width: 44rem;
  margin: 0;
  padding: 0.4rem 1.4rem;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.coming-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.95rem 0.25rem;
  font-size: 1rem;
}

.coming-list li + li { border-top: 1px solid var(--border); }

.coming-list li::before {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  margin-top: 0.55em;
  border-radius: 50%;
  background: var(--accent);
}

/* contact — one glass panel, the address as one large tappable link */
.section-contact {
  max-width: 44rem;
  margin-top: clamp(2.5rem, 7vh, 4.5rem);   /* the panel has a background: the section padding-top would sit INSIDE it */
  margin-bottom: clamp(2.5rem, 7vh, 4.5rem);
  padding: clamp(1.75rem, 4vw, 2.5rem) clamp(1.25rem, 4vw, 2.25rem);
  text-align: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.section-contact .section-intro { margin-bottom: 0.5rem; }

.contact-mail {
  display: inline-block;
  min-height: 48px;
  padding: 0.7rem 0.9rem;
  font-size: clamp(1.15rem, 0.95rem + 1vw, 1.45rem);
  font-weight: 600;
  color: var(--accent);
  text-decoration-thickness: 1px;
  text-underline-offset: 0.18em;
  overflow-wrap: anywhere;
}

.contact-mail:hover { text-decoration-thickness: 2px; }
