/* GrantWrite — landing page.
 *
 * HAS green academy house style. The values below are the official tokens from
 * https://www.has.nl (dist/assets/style-*.css), not approximations:
 *
 *   --has-green      #1cd354   brand primary
 *   --has-green-dark #274232   brand dark; the HAS header colour
 *   --has-ink        #14221a   near-black
 *   --has-magenta    #ea1fb6   brand B
 *   --has-blue       #008aff   brand C
 *   --has-error      #ec3b00
 *
 * Type: HK Grotesk for everything, Rois for h1/h2 — the same two-font split
 * the HAS site uses. Neither is bundled here; both degrade to the documented
 * fallback stack rather than to Times.
 *
 * Measured contrast, because the brand green is a trap on white:
 *   #1cd354 on #ffffff  2.00:1  FAILS AA  -> never used for text on white
 *   #1cd354 on #274232  5.49:1  passes AA  -> the accent role
 *   #274232 on #ffffff 10.99:1  passes AA  -> links, primary button
 *   #14221a on #ffffff 16.49:1  passes AA  -> body text
 * Every foreground/background pair used below is one of these.
 */

:root {
  /* Brand */
  --has-green: #1cd354;
  --has-green-dark: #274232;
  --has-ink: #14221a;
  --has-magenta: #ea1fb6;
  --has-blue: #008aff;
  --has-error: #ec3b00;

  /* Neutrals, straight from the HAS tokens */
  --has-black: #2d2d2d;
  --has-gray-light: #f0f0f0;
  --has-gray-medium: #ccc;
  --has-gray-dark: #757575;
  --has-white: #fff;

  /* Roles. Anything not defined here is a mistake waiting to happen. */
  --page-bg: var(--has-white);
  --surface: var(--has-white);
  --surface-alt: var(--has-gray-light);
  --ink: var(--has-ink);            /* 16.49:1 on white */
  --ink-muted: #5c6b62;             /* 5.62:1 on white  — AA at body size */
  --ink-on-dark: var(--has-white);  /* 10.99:1 on --has-green-dark */
  --ink-on-accent: var(--has-ink);  /* 8.24:1 on --has-green */
  --accent: var(--has-green);       /* only ever on a dark surface */
  --border: #dcdcd9;
  --border-strong: var(--has-gray-medium);
  --focus: var(--has-green-dark);

  /* Type scale, matching the HAS clamp() values */
  --font-body: "HK Grotesk", system-ui, -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-display: Rois, "HK Grotesk", "Arial Black", "Arial Bold", Gadget, sans-serif;
  --h0: clamp(2rem, 4.6875vw - .25rem, 3.5rem);
  --h1: clamp(2rem, 1.25rem + 1.5625vw, 2.5rem);
  --h2: clamp(1.75rem, 1.55rem + .85vw, 2.125rem);
  --h3: clamp(1.5rem, 1.23rem + 1.13vw, 2rem);
  --space-small: 1rem;
  --space-base: 1.5rem;
  --space-large: 3rem;
  --radius: 2px;      /* HAS uses sharp corners; the app's 14px is not HAS */
}

*,
*::before,
*::after { box-sizing: border-box; }

[hidden] { display: none !important; }

html {
  scroll-behavior: smooth;
  /* The sticky header must not cover the target of an in-page anchor. */
  scroll-padding-block-start: 5rem;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
  color: var(--ink);
  background: var(--page-bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2 {
  font-family: var(--font-display);
  font-weight: 400;
  line-height: 1.15;
  margin: 0 0 var(--space-small);
}
h1 { font-size: var(--h0); }
h2 { font-size: var(--h1); }
h3 {
  font-size: 1.125rem;
  font-weight: 700;
  line-height: 1.3;
  margin: 0 0 .5rem;
}
h4 { font-size: 1rem; font-weight: 700; margin: 0 0 .35rem; }
p { margin: 0 0 var(--space-small); }

a {
  color: var(--has-green-dark);
  text-decoration-thickness: 1px;
  text-underline-offset: .2em;
}
a:hover { color: var(--has-ink); }

/* One focus style everywhere, and it is visible on both light and dark. */
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: 1px;
}
.on-dark :focus-visible,
.hero :focus-visible { outline-color: var(--has-green); }

img { max-width: 100%; height: auto; }

/* Only visible on focus: the first stop for a keyboard user. */
.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: .75rem 1.25rem;
  background: var(--has-green-dark);
  color: var(--has-white);
  font-weight: 700;
  text-decoration: none;
}
.skip-link:focus {
  left: 0;
  color: var(--has-white);
  outline: 3px solid var(--has-green);
  outline-offset: -3px;
}

/* ── Layout ─────────────────────────────────────────────────────────────── */
.wrap {
  width: min(72rem, 92vw);
  margin-inline: auto;
}

/* ── Header ─────────────────────────────────────────────────────────────── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--has-green-dark);
  color: var(--ink-on-dark);
  border-bottom: 3px solid var(--has-green);
}
.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-base);
  min-height: 4.5rem;
  padding-block: .6rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: .8rem;
  color: var(--has-white);
  text-decoration: none;
}
.brand:hover { color: var(--has-white); }
.brand img {
  height: 2.5rem;
  width: auto;
  border-radius: 2px;
}
.brand-name {
  font-family: var(--font-display);
  font-size: 1.25rem;
  line-height: 1.1;
}
.brand-sub {
  display: block;
  font-family: var(--font-body);
  font-size: .75rem;
  font-weight: 400;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--has-green);
}

.topbar-right {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
}

/* Section nav, hidden until there is room for it. */
.topnav { display: none; }
.topnav ul {
  display: flex;
  gap: 1.5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}
.topnav a {
  color: var(--has-white);
  text-decoration: none;
  font-weight: 600;
  font-size: .95rem;
  padding-block: .4rem;
  border-bottom: 2px solid transparent;
}
.topnav a:hover { border-bottom-color: var(--has-green); color: var(--has-white); }

/* ── Login ──────────────────────────────────────────────────────────────── */
.login-panel {
  position: absolute;
  right: 0;
  top: calc(100% + .5rem);
  width: min(22rem, calc(100vw - 2rem));
  padding: var(--space-base);
  background: var(--has-white);
  color: var(--ink);
  border: 1px solid var(--border);
  border-top: 3px solid var(--has-green);
  box-shadow: 0 12px 32px rgb(20 34 26 / 18%);
}
.login-toggle { position: relative; }
/* The panel heading is an h2, so it needs the full h2 rule neutralised before it
   picks up the display face and the page-scale size. */
.panel-heading {
  font-family: var(--font-body);
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0 0 var(--space-small);
}
.field { display: grid; gap: .3rem; margin-bottom: var(--space-small); }
.field label { font-weight: 700; font-size: .9rem; }
input {
  width: 100%;
  padding: .65rem .75rem;
  font: inherit;
  color: var(--ink);
  background: var(--has-white);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
}
input::placeholder { color: var(--has-gray-dark); }
input:focus-visible { border-color: var(--focus); }
.login-error {
  margin: 0 0 var(--space-small);
  padding: .7rem .8rem;
  font-weight: 600;
  color: #8a1a00;         /* 7.1:1 on white */
  background: #fdece7;
  border-left: 3px solid var(--has-error);
}
.login-foot {
  margin: var(--space-small) 0 0;
  font-size: .9rem;
  color: var(--ink-muted);
}
.login-noscript {
  position: absolute;
  right: 0;
  top: calc(100% + .5rem);
  width: min(22rem, calc(100vw - 2rem));
  margin: 0;
  padding: .8rem 1rem;
  font-size: .9rem;
  color: var(--ink);
  background: var(--has-white);
  border: 1px solid var(--border);
  border-top: 3px solid var(--has-green);
}

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .8rem 1.5rem;
  font: inherit;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: var(--radius);
  transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}
@media (prefers-reduced-motion: reduce) { .btn { transition: none; } }

.btn-primary { background: var(--has-green-dark); color: var(--has-white); }
.btn-primary:hover { background: var(--has-ink); color: var(--has-white); }

.btn-accent { background: var(--has-green); color: var(--has-ink-on-accent); }
.btn-accent:hover { background: #35dd6b; color: var(--has-ink-on-accent); }

.btn-ghost { background: transparent; color: var(--has-white); border-color: currentColor; }
.btn-ghost:hover { background: var(--has-green); color: var(--has-ink-on-accent); border-color: var(--has-green); }

.btn-outline { background: var(--has-white); color: var(--has-green-dark); border-color: var(--has-green-dark); }
.btn-outline:hover { background: var(--has-green-dark); color: var(--has-white); }

.btn-lg { padding: 1rem 1.75rem; font-size: 1.125rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .65; cursor: progress; }
.btn-meta {
  font-weight: 400;
  font-size: .85em;
  padding: .1rem .45rem;
  background: rgb(255 255 255 / 18%);
  border-radius: 2px;
}

/* ── Hero ───────────────────────────────────────────────────────────────── */
.hero {
  background: var(--has-green-dark);
  color: var(--ink-on-dark);
  padding-block: clamp(3rem, 7vw, 5.5rem);
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(17rem, .75fr);
  gap: clamp(2rem, 5vw, 4rem);
  align-items: start;
}
.hero h1 { color: var(--has-white); }
.hero-eyebrow {
  margin: 0 0 .75rem;
  font-size: .9rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--has-green);     /* 5.49:1 on --has-green-dark */
}
.hero-lede {
  max-width: 34em;
  margin-bottom: var(--space-base);
  font-size: clamp(1.05rem, .95rem + .4vw, 1.25rem);
  color: #e8f3ea;              /* 13.3:1 */
}
.hero-actions { display: flex; flex-wrap: wrap; gap: .75rem; }
.hero-download-meta {
  margin: 1.25rem 0 0;
  font-size: .9rem;
  color: #cfe4d3;              /* 9.6:1 */
}
.hero-download-meta code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: .95em;
  color: var(--has-green);
}

/* The 4-step card, right of the hero. */
.hero-card {
  padding: var(--space-base);
  background: var(--has-ink);
  border-top: 3px solid var(--has-green);
}
.hero-card h2 {
  font-size: 1.25rem;
  margin-bottom: var(--space-small);
  color: var(--has-white);
}
.steps { margin: 0; padding-left: 1.25rem; }
.steps li { margin-bottom: .6rem; }
.steps li:last-child { margin-bottom: 0; }
.steps li::marker { color: var(--has-green); font-weight: 700; }

/* ── Sections ───────────────────────────────────────────────────────────── */
.section { padding-block: clamp(2.5rem, 5vw, 4rem); }
.section-alt { background: var(--surface-alt); }
.section-head { max-width: 46em; margin-bottom: var(--space-base); }
.section-head h2 { margin-bottom: .5rem; }
.section-head p { margin: 0; color: var(--ink-muted); font-size: 1.05rem; }

.eyebrow-dark {
  margin: 0 0 .5rem;
  font-size: .85rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--has-green-dark);
}

/* Feature cards */
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: var(--space-base); }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(18rem, 1fr)); gap: var(--space-base); }

.card {
  padding: var(--space-base);
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--has-green);
}
.card p { margin: 0; color: var(--ink-muted); }
.card-icon { font-size: 1.5rem; line-height: 1; }

/* Install cards */
.install-card h3 { display: flex; align-items: baseline; gap: .5rem; }
.step-badge {
  flex: none;
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  font-size: .9rem;
  font-weight: 700;
  color: var(--has-white);
  background: var(--has-green-dark);
  border-radius: 50%;
}
.install-card ol { margin: 0 0 var(--space-small); padding-left: 1.25rem; }
.install-card ol li { margin-bottom: .4rem; }
.install-card p { margin: 0 0 var(--space-small); }
.install-card p:last-child { margin-bottom: 0; }

.muted { color: var(--ink-muted); }
.small { font-size: .9rem; }

pre {
  margin: 0 0 var(--space-small);
  padding: .85rem 1rem;
  overflow-x: auto;
  background: var(--has-ink);
  color: #dcefe1;              /* 14.6:1 */
  border-left: 3px solid var(--has-green);
  border-radius: var(--radius);
  font-size: .9rem;
  line-height: 1.5;
}
/* Inside a <pre> the code has to sit directly on the dark panel. The generic
   `code` rule below gives every code element a light chip background, and `pre`
   sets the text colour to a pale green — `pre code` outranks both on
   specificity but originally declared neither, so the two combined: pale text
   on a pale chip, measured 1.05:1. Declare both properties here. */
pre,
pre code {
  background: transparent;
  padding: 0;
  border-radius: 0;
}
pre code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: inherit;
  color: #dcefe1;              /* 13.72:1 on the --has-ink panel */
}

code {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: .9em;
  background: var(--has-gray-light);
  padding: .1em .35em;
  border-radius: 2px;
}
a > code { color: inherit; }

.callout {
  margin-top: var(--space-large);
  padding: var(--space-base);
  background: var(--has-white);
  border-left: 4px solid var(--has-green-dark);
}
.callout h3 { margin-bottom: .5rem; }
.callout p:last-child { margin-bottom: 0; }

/* Architecture facts */
.defs { margin: 0; }
.defs dt {
  margin-top: var(--space-small);
  font-weight: 700;
  color: var(--has-green-dark);
}
.defs dt:first-child { margin-top: 0; }
.defs dd {
  margin: .2rem 0 0;
  color: var(--ink-muted);
}
.checklist { margin: 0; padding: 0; list-style: none; }
.checklist li {
  position: relative;
  margin-bottom: .85rem;
  padding-left: 1.75rem;
  color: var(--ink-muted);
}
.checklist li::before {
  content: "";
  position: absolute;
  left: 0;
  top: .3em;
  width: .7rem;
  height: .7rem;
  /* Solid dark green: the brand green on white is only 2:1, which a small
     marker cannot be read at. It is decoration, not information — the text
     beside it carries the meaning — but it still has to be visible. */
  background: var(--has-green-dark);
}
.checklist strong { color: var(--ink); }

.architecture-note {
  margin-top: var(--space-large);
  margin-bottom: 0;
  max-width: 60em;
}

/* ── Footer ─────────────────────────────────────────────────────────────── */
.footer {
  padding-block: var(--space-large);
  background: var(--has-ink);
  color: #cfd8d1;              /* 10.6:1 */
}
.footer a { color: var(--has-green); }   /* 8.24:1 on #14221a */
.footer a:hover { color: var(--has-white); }
.footer p { margin: 0; }
.footer-meta { margin-top: .5rem; font-size: .9rem; color: #a9b5ac; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (min-width: 62rem) {
  .topnav { display: block; }
}
@media (max-width: 56rem) {
  .hero-grid { grid-template-columns: 1fr; }
  .topbar-inner { flex-wrap: wrap; }
  .topbar-right { width: 100%; justify-content: flex-end; }
}

/* ── Print ──────────────────────────────────────────────────────────────── */
@media print {
  .topbar, .hero-actions, .login-panel, .login-noscript, .footer { display: none; }
  .hero { background: none; color: #000; padding: 0; }
  .hero h1, .hero-lede { color: #000; }
  body { font-size: 11pt; }
}
