/* SPDX-FileCopyrightText: Cadasto B.V. */
/* SPDX-License-Identifier: Apache-2.0 */

/* FerroHEALTH landing page: tokens and layout. Self-contained, in the same
   idiom as the product sites: a system font stack, no external asset, and
   light and dark through prefers-color-scheme. Relative URLs only, so the
   page works from a checkout, from a preview deployment, and from the apex
   domain without a rewrite.

   The accent is steel and belongs to no product. A product hue is used only
   where that product is named: the card's rule, its dot, its icon. Colour is
   how the page tells you which product it is talking about, so spending it
   anywhere else would cost that. */

:root {
  /* accent: steel, the parent's own voice (assets/brand/tokens.css) */
  --fh-accent: #3f6070;
  --fh-accent-600: #2e4a57;
  --fh-accent-050: #eef3f6;
  /* the four products of the data path, on a light ground */
  --fh-chart: #c2185b;
  --fh-ehr: #b7431b;
  --fh-term: #0d9488;
  --fh-bridge: #4f46e5;
  /* the four around it, from each product's own tokens.css */
  --fh-pix: #6b21a8;
  --fh-fed: #0369a1;
  --fh-sys: #5b6b16;
  --fh-task: #065f46;
  /* light theme */
  --fh-bg: #ffffff;
  --fh-surface: #f5f7fa;
  --fh-text: #0f172a;
  --fh-muted: #58616e;
  --fh-border: #dde3eb;
  --fh-shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.06);
  /* fonts */
  --fh-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --fh-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  /* layout */
  --fh-max: 1440px;   /* the diagram fills the wrap up to 1400, and three
                         product cards are 455px at full width */
  --fh-radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fh-accent: #8fb6c4;
    --fh-accent-600: #b6d5df;
    --fh-accent-050: #132029;
    --fh-chart: #e04f84;
    --fh-ehr: #d97742;
    --fh-term: #2dd4bf;
    --fh-bridge: #a5b4fc;
    --fh-pix: #c084fc;
    --fh-fed: #7dd3fc;
    --fh-sys: #bef264;
    --fh-task: #34d399;
    --fh-bg: #0b1020;
    --fh-surface: #131a26;
    --fh-text: #eef2f7;
    --fh-muted: #a4aebc;
    --fh-border: #243044;
    --fh-shadow: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.4);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--fh-sans);
  color: var(--fh-text);
  background: var(--fh-bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: var(--fh-accent); text-decoration: none; }
a:hover { color: var(--fh-accent-600); text-decoration: underline; }

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

code {
  font-family: var(--fh-mono);
  font-size: 0.88em;
  background: var(--fh-accent-050);
  padding: 0.1em 0.35em;
  border-radius: 5px;
}

:focus-visible {
  outline: 2px solid var(--fh-accent);
  outline-offset: 3px;
  border-radius: 4px;
}

.wrap {
  width: 100%;
  max-width: var(--fh-max);
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* The keyboard escape hatch past the sticky nav. */
.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  z-index: 100;
  padding: 0.6rem 1rem;
  background: var(--fh-bg);
  border: 1px solid var(--fh-border);
  border-radius: 8px;
  font-weight: 700;
}
.skip:focus { left: 1rem; top: 0.6rem; }

/* Nav */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: saturate(180%) blur(12px);
  background: color-mix(in srgb, var(--fh-bg) 82%, transparent);
  border-bottom: 1px solid var(--fh-border);
}
.nav .wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
  height: 60px;
}
.brand { display: inline-flex; align-items: center; }
.brand:hover { text-decoration: none; }
.brand img { width: 168px; height: 37px; display: block; }
.nav-links {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 1.4rem;
  font-weight: 600;
  font-size: 0.95rem;
}
.nav-links a { color: var(--fh-muted); }
.nav-links a:hover { color: var(--fh-accent); text-decoration: none; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.7rem 1.25rem;
  border-radius: 8px;
  font-weight: 700;
  font-size: 1rem;
  border: 1.5px solid transparent;
  transition: transform 0.06s ease, background 0.15s ease, border-color 0.15s ease;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn-primary { background: var(--fh-accent); color: #fff; }
.btn-primary:hover { background: var(--fh-accent-600); color: #fff; }
.btn-ghost { border-color: var(--fh-border); color: var(--fh-text); background: var(--fh-surface); }
.btn-ghost:hover { border-color: var(--fh-accent); color: var(--fh-accent); }
@media (prefers-color-scheme: dark) {
  /* Steel is light on a dark ground, so the label takes the tile colour. */
  .btn-primary { color: #0b1020; }
  .btn-primary:hover { color: #0b1020; }
}

/* Hero. The glow is the four strokes of the mark in their fixed order, which
   is the only place on the page a product hue appears without its product
   being named. The four around the data path have no stroke and so no glow. */
.hero {
  position: relative;
  padding: clamp(3rem, 8vw, 5.5rem) 0 clamp(2.5rem, 6vw, 4rem);
  text-align: center;
  overflow: hidden;
}
.hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(32% 46% at 12% 0%, color-mix(in srgb, var(--fh-chart) 15%, transparent), transparent 70%),
    radial-gradient(32% 46% at 38% 0%, color-mix(in srgb, var(--fh-ehr) 15%, transparent), transparent 70%),
    radial-gradient(32% 46% at 63% 0%, color-mix(in srgb, var(--fh-term) 15%, transparent), transparent 70%),
    radial-gradient(32% 46% at 88% 0%, color-mix(in srgb, var(--fh-bridge) 15%, transparent), transparent 70%);
  pointer-events: none;
}
.hero > * { position: relative; }
.hero-logo { width: min(340px, 76%); margin: 0 auto 1.75rem; display: block; }
.hero h1 {
  font-size: clamp(1.7rem, 3.8vw, 2.6rem);
  line-height: 1.2;
  margin: 0 auto 1rem;
  max-width: 22ch;
  letter-spacing: -0.015em;
}
.hero .sub {
  color: var(--fh-muted);
  font-size: clamp(1rem, 1.6vw, 1.2rem);
  max-width: 64ch;
  margin: 0 auto 2rem;
}
.hero-cta { display: flex; gap: 0.85rem; justify-content: center; flex-wrap: wrap; }
.hero .note { margin-top: 1.25rem; color: var(--fh-muted); font-size: 0.85rem; max-width: 58ch; margin-inline: auto; }

/* Section scaffolding */
section { padding: clamp(3rem, 7vw, 4.5rem) 0; }
.surface { background: var(--fh-surface); border-block: 1px solid var(--fh-border); }
.section-head { text-align: center; max-width: 62ch; margin: 0 auto 2.5rem; }
.section-head h2 {
  font-size: clamp(1.4rem, 3vw, 2rem);
  margin: 0 0 0.6rem;
  letter-spacing: -0.015em;
}
.section-head p { color: var(--fh-muted); margin: 0; font-size: 1.05rem; }
.section-cta { display: flex; justify-content: center; gap: 0.85rem; flex-wrap: wrap; margin-top: 2.25rem; }
.eyebrow {
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--fh-accent);
  margin-bottom: 0.5rem;
}

/* Product cards. Each one sets --hue to its own product colour, and every
   coloured part of the card reads that one property. */
.products {
  display: grid;
  /* Column counts are explicit rather than auto-fit, and a short last row is
     centred: the grid has twice as many tracks as columns and every card
     spans two, so a card can start half a column in. Five cards read three
     and two, three read as one row, and nothing sits alone on the left. */
  grid-template-columns: 1fr;
  gap: 1.1rem;
  align-items: stretch;
}
@media (min-width: 680px) {
  .products { grid-template-columns: repeat(4, 1fr); }
  .product { grid-column: span 2; }
  .product:last-child:nth-child(odd) { grid-column: 2 / span 2; }
}
/* 1100 is where three cards keep the 320px a card head needs on one line: an
   icon, a product name and a status badge need about 270px of content box. */
@media (min-width: 1100px) {
  .products { grid-template-columns: repeat(6, 1fr); }
  .product:last-child:nth-child(odd) { grid-column: span 2; }
  .product:last-child:nth-child(3n+1) { grid-column: 3 / span 2; }
  .product:nth-last-child(2):nth-child(3n+1) { grid-column: 2 / span 2; }
}
.product {
  /* A grid item defaults to min-width:auto, so its min-content width can push
     the track wider than the column and overflow the page. The card head is a
     flex row of an icon, a name and a status badge, which is exactly such a
     min-content floor. Both this and the head's text block have to be allowed
     to shrink, or a narrow screen scrolls sideways. */
  min-width: 0;
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--fh-bg);
  border: 1px solid var(--fh-border);
  border-radius: var(--fh-radius);
  padding: 1.6rem 1.5rem 1.4rem;
  overflow: hidden;
  transition: transform 0.1s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.product::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: var(--hue);
}
.product:hover {
  transform: translateY(-3px);
  box-shadow: var(--fh-shadow);
  border-color: color-mix(in srgb, var(--hue) 45%, var(--fh-border));
}
.product-chart { --hue: var(--fh-chart); }
.product-ehr { --hue: var(--fh-ehr); }
.product-term { --hue: var(--fh-term); }
.product-bridge { --hue: var(--fh-bridge); }
.product-pix { --hue: var(--fh-pix); }
.product-fed { --hue: var(--fh-fed); }
.product-sys { --hue: var(--fh-sys); }
.product-task { --hue: var(--fh-task); }
.product-head { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.9rem; }
.product-head > div { min-width: 0; }
.product-head img { width: 40px; height: 40px; flex: none; }
.product h3 { margin: 0; font-size: 1.25rem; letter-spacing: -0.01em; }
.product h3 a { color: var(--fh-text); }
.product h3 a:hover { color: var(--hue); text-decoration: none; }
.product .role { display: block; color: var(--fh-muted); font-size: 0.9rem; font-weight: 600; }
.product p { color: var(--fh-muted); margin: 0 0 1rem; font-size: 0.95rem; }
.product .facts { list-style: none; margin: 0 0 1.25rem; padding: 0; font-size: 0.9rem; }
.product .facts li { position: relative; padding-left: 1.05rem; margin: 0.4rem 0; color: var(--fh-muted); }
.product .facts li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.58em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--hue);
}
.product .facts code { white-space: nowrap; }
.product .product-cta { margin-top: auto; display: flex; gap: 0.6rem; flex-wrap: wrap; }
.product .btn { padding: 0.55rem 1rem; font-size: 0.92rem; }
.product .btn-primary { background: var(--hue); color: #fff; }
.product .btn-primary:hover { background: color-mix(in srgb, var(--hue) 82%, #000); color: #fff; }
.product .btn-ghost:hover { border-color: var(--hue); color: var(--hue); }
@media (prefers-color-scheme: dark) {
  .product .btn-primary { color: #0b1020; }
  .product .btn-primary:hover { background: color-mix(in srgb, var(--hue) 84%, #fff); color: #0b1020; }
}

/* A planned product: the same card, drawn dashed like its box in the
   diagram, so the row reads as planned before a word is read. It has no site
   to link, so the domain is a chip and the head carries no badge; the badge
   sits beside the chip and the GitHub button, where it has room. */
.planned-head { text-align: center; max-width: 66ch; margin: 3rem auto 1.75rem; }
.planned-head h3 { font-size: clamp(1.15rem, 2.2vw, 1.45rem); margin: 0 0 0.5rem; letter-spacing: -0.01em; }
.planned-head p { color: var(--fh-muted); margin: 0; font-size: 1rem; }
.product.planned { border-style: dashed; }
.product.planned::before {
  background: repeating-linear-gradient(90deg, var(--hue) 0 10px, transparent 10px 16px);
}
.product.planned h3 { color: var(--fh-text); }
.product .domain {
  display: inline-flex;
  align-items: center;
  padding: 0.5rem 0.85rem;
  border: 1.5px dashed var(--fh-border);
  border-radius: 8px;
  font-family: var(--fh-mono);
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--fh-muted);
}
/* Sized so the longest domain and "no repository yet" share one line in a
   four-column card. */
.product .product-cta .status { align-self: center; font-size: 0.72rem; padding: 0.25rem 0.6rem; }

/* The status badge on a product card, and the one in the hero. */
.status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.25rem 0.7rem;
  border-radius: 999px;
  background: color-mix(in srgb, var(--hue, var(--fh-accent)) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--hue, var(--fh-accent)) 38%, transparent);
  color: var(--hue, var(--fh-accent));
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.product-head .status { margin-left: auto; font-family: var(--fh-mono); font-weight: 700; }

/* How the eight fit together. The diagram is one file in assets/diagrams/,
   which carries its own palette and swaps it on prefers-color-scheme, so this
   page holds its size and nothing else. Below the min-width the labels stop
   being readable, so it scrolls inside its own box. */
.flow-scroll { overflow-x: auto; }
/* The drawing is 1200x756 and fills the wrap. At 900px its 10.5px edge labels
   render at under 8px; the min-width is the point below which they stop being
   readable at all, and below that the box scrolls. */
.flow { display: block; width: 100%; min-width: 1100px; max-width: 1400px; margin: 0 auto; height: auto; }
.flow-note { text-align: left; color: var(--fh-muted); font-size: 0.9rem; max-width: 76ch; margin: 1.5rem auto 0; }
.flow-note + .flow-note { margin-top: 1rem; }

/* Principle cards */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.1rem;
}
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
@media (min-width: 780px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
.card {
  background: var(--fh-bg);
  border: 1px solid var(--fh-border);
  border-radius: var(--fh-radius);
  padding: 1.5rem;
  transition: transform 0.1s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.surface .card { background: var(--fh-bg); }
.card:hover {
  transform: translateY(-3px);
  box-shadow: var(--fh-shadow);
  border-color: color-mix(in srgb, var(--fh-accent) 40%, var(--fh-border));
}
.card .ico {
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--fh-accent-050);
  color: var(--fh-accent);
  margin-bottom: 0.9rem;
}
.card .ico svg { width: 22px; height: 22px; }
.card h3 { margin: 0 0 0.4rem; font-size: 1.08rem; }
.card p { margin: 0; color: var(--fh-muted); font-size: 0.95rem; }

/* Standards */
.standards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.75rem 2.5rem; }
/* Four groups, so two columns keep the fourth off a row of its own. */
@media (min-width: 780px) { .standards { grid-template-columns: repeat(2, 1fr); } }
.standards h3 { margin: 0 0 0.5rem; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--fh-muted); }
.chips { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.chip {
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--fh-border);
  background: var(--fh-bg);
  color: var(--fh-text);
  font-weight: 600;
  font-size: 0.88rem;
}

/* Quick start */
.code {
  max-width: 820px;
  margin: 0 auto;
  background: var(--fh-bg);
  border: 1px solid var(--fh-border);
  border-radius: var(--fh-radius);
  box-shadow: var(--fh-shadow);
  overflow: hidden;
}
.code-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--fh-border);
  background: var(--fh-accent-050);
  font-size: 0.85rem;
  color: var(--fh-muted);
  font-weight: 600;
}
.code-head .lights { display: flex; gap: 0.35rem; }
.code-head .lights i { width: 11px; height: 11px; border-radius: 50%; display: inline-block; }
.code-head .lights i:nth-child(1) { background: var(--fh-chart); }
.code-head .lights i:nth-child(2) { background: var(--fh-ehr); }
.code-head .lights i:nth-child(3) { background: var(--fh-term); }
.code-head .lights i:nth-child(4) { background: var(--fh-bridge); }
.code pre {
  margin: 0;
  padding: 1.25rem 1.35rem;
  overflow-x: auto;
  font-family: var(--fh-mono);
  font-size: 0.86rem;
  line-height: 1.7;
}
.code pre code { white-space: pre; background: none; padding: 0; }
.code .cmt { color: var(--fh-muted); }
.code .prompt { color: var(--fh-accent); font-weight: 700; }

/* Release matrix */
.matrix-scroll { overflow-x: auto; }
.matrix {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.94rem;
  min-width: 620px;
}
.matrix caption { caption-side: bottom; color: var(--fh-muted); font-size: 0.85rem; padding-top: 1rem; text-align: left; }
.matrix th, .matrix td { text-align: left; padding: 0.85rem 1rem; border-bottom: 1px solid var(--fh-border); }
.matrix thead th { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--fh-muted); }
.matrix tbody th { font-weight: 700; }
.matrix tbody th .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 0.5rem; background: var(--hue); }
.matrix .row-chart { --hue: var(--fh-chart); }
.matrix .row-ehr { --hue: var(--fh-ehr); }
.matrix .row-term { --hue: var(--fh-term); }
.matrix .row-bridge { --hue: var(--fh-bridge); }
.matrix .row-fed { --hue: var(--fh-fed); }
.matrix td.num { font-family: var(--fh-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Licensing. The verdict column is the answer a reader came for, so it reads
   as a badge and keeps its colour in both themes; free and paid are told apart
   by the word, and the colour only reinforces it. */
.matrix.licence { min-width: 720px; }
.matrix.licence tbody th { font-weight: 600; }
.matrix.licence td:last-child { color: var(--fh-muted); font-size: 0.9rem; }
.verdict {
  display: inline-block;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
  border: 1px solid;
}
.verdict.free { color: var(--fh-term); border-color: color-mix(in srgb, var(--fh-term) 45%, transparent); background: color-mix(in srgb, var(--fh-term) 12%, transparent); }
.verdict.paid { color: var(--fh-ehr); border-color: color-mix(in srgb, var(--fh-ehr) 45%, transparent); background: color-mix(in srgb, var(--fh-ehr) 12%, transparent); }

.licences {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.1rem;
  margin-top: 2.25rem;
}
.lic {
  background: var(--fh-bg);
  border: 1px solid var(--fh-border);
  border-left: 3px solid var(--hue);
  border-radius: var(--fh-radius);
  padding: 1.25rem 1.35rem;
}
.lic h3 { margin: 0 0 0.4rem; font-size: 1.05rem; }
.lic p { margin: 0 0 0.8rem; color: var(--fh-muted); font-size: 0.92rem; }
.lic a { font-weight: 700; }
.lic a code { background: none; padding: 0; font-size: 0.86em; }

.lic-notes { max-width: 72ch; margin: 2.25rem auto 0; }
.lic-notes p { color: var(--fh-muted); font-size: 0.94rem; margin: 0 0 1rem; }
.lic-notes strong { color: var(--fh-text); }

/* The closing panel */
.panel {
  max-width: 760px;
  margin: 0 auto;
  text-align: center;
  background: var(--fh-bg);
  border: 1px solid var(--fh-border);
  border-radius: var(--fh-radius);
  padding: clamp(1.75rem, 4vw, 2.75rem);
  box-shadow: var(--fh-shadow);
}
.panel h2 { margin: 0 0 0.6rem; font-size: clamp(1.3rem, 2.6vw, 1.7rem); letter-spacing: -0.015em; }
.panel p { color: var(--fh-muted); margin: 0 auto 1.75rem; max-width: 54ch; }

/* Footer */
.footer {
  border-top: 1px solid var(--fh-border);
  background: var(--fh-surface);
  padding: 3rem 0 2.5rem;
  font-size: 0.92rem;
}
.footer-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  justify-content: space-between;
  align-items: flex-start;
}
.footer-brand { max-width: 44ch; }
.footer-brand .brand { margin-bottom: 0.85rem; }
.footer-brand p { color: var(--fh-muted); margin: 0.35rem 0; }
.footer-links { display: flex; gap: 2.5rem; flex-wrap: wrap; }
.footer-links ul { list-style: none; margin: 0; padding: 0; }
.footer-links h4 { margin: 0 0 0.6rem; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--fh-text); }
.footer-links li { margin: 0.35rem 0; }
.footer-links a { color: var(--fh-muted); }
.footer-links a:hover { color: var(--fh-accent); }
.footer-note {
  margin-top: 2.25rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--fh-border);
  color: var(--fh-muted);
  font-size: 0.85rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

/* Responsive */
@media (max-width: 760px) {
  .nav-links { gap: 1rem; font-size: 0.9rem; }
  .nav-links .hide-sm { display: none; }
  .brand img { width: 148px; height: 33px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}

/* 404. One centred hero, so the page needs no second stylesheet and no inline
   style attribute (which style-src 'self' would block anyway). */
.notfound { min-height: 100vh; display: grid; place-items: center; }
.notfound .eyebrow { font-size: clamp(2.5rem, 10vw, 5rem); letter-spacing: -0.02em; line-height: 1; margin-bottom: 0.75rem; }
