/*
 * Hemi marketing pages — direction C, "demonstration".
 *
 * The premise: the diagram makes the argument and the words get out of its way. Every section is
 * a headline, one sentence, and one visual. If a section needs a paragraph, it belongs in the
 * FAQ or it does not belong.
 *
 * Colour, radii, weights and the wordmark all come from design/tokens.css, which is copied in at
 * build time so there is one source shared with the app. Light and dark both come from there:
 * dark is the bare :root, light is :root[data-theme="light"]. Nothing here defines a colour.
 *
 * NEW VALUES, marked because tokens.css is explicit that the app has no heading scale to
 * extract — 81 of 99 of its size declarations sit at 12-14px and its largest is the 34px sign-in
 * wordmark. A page that introduces itself needs more. The ceiling here is 52px, not the 64px a
 * marketing page usually reaches for, because the product's argument is that it does not
 * oversell.
 */

:root {
  --display: clamp(32px, 5.6vw, 52px);
  --headline: clamp(22px, 3vw, 30px);
  --gutter: clamp(18px, 4.2vw, 40px);
  --section-y: clamp(54px, 7.6vw, 88px);
  --page-max: 1000px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

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

*:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

/* padding-INLINE, not the padding shorthand.
   Measured: `padding: 0 var(--gutter)` on .wrap zeroed the vertical padding of every
   `<section class="wrap">`, because a class selector outranks the `section` element selector.
   Every section on every page had 0px top and bottom padding, and all the apparent spacing was
   coming from element margins. Using the logical-inline property means the two rules set
   different things and neither can silently cancel the other. */
.wrap { max-width: var(--page-max); margin: 0 auto; padding-inline: var(--gutter); }

/* ------------------------------------------------------------------ header */

header.site {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-block: 26px;
}

.wordmark {
  font-family: var(--font-wordmark);
  font-size: 25px;
  font-weight: 600;
  letter-spacing: -0.6px;
  line-height: 1;
  color: var(--text);
  text-decoration: none;
}
.wordmark:hover { color: var(--accent-light); }

nav.site { display: flex; align-items: center; gap: 20px; }
nav.site a { color: var(--text-secondary); text-decoration: none; font-size: 13.5px; font-weight: 500; }
nav.site a:hover, nav.site a[aria-current="page"] { color: var(--text); }

/* Sign in is a button, not a link — it is the second thing a returning clinician looks for and
   the first thing they fail to find when it is set as quiet text among other quiet text. */
.signin {
  border: 1px solid var(--border-strong);
  border-radius: 20px;
  padding: 7px 16px;
  color: var(--text-body) !important;
  font-weight: 600 !important;
}
.signin:hover { border-color: var(--text-muted); color: var(--text) !important; }

.toggle {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 20px;
  padding: 6px 13px;
  font: inherit;
  font-size: 12.5px;
  cursor: pointer;
}
.toggle:hover { color: var(--text); border-color: var(--border-strong); }

/* ------------------------------------------------------------------ type */

h1, h2, h3 { margin: 0; font-weight: 600; color: var(--text); }

h1 {
  font-size: var(--display);
  line-height: 1.04;
  letter-spacing: -1.6px;
  max-width: 13ch;
  margin-inline: auto;
}

h2 {
  font-size: var(--headline);
  line-height: 1.12;
  letter-spacing: -0.9px;
  max-width: 19ch;
  margin-inline: auto;
}

h3 { font-size: 16px; letter-spacing: -0.2px; }

.sub {
  font-size: 17.5px;
  color: var(--text-secondary);
  margin: 22px auto 0;
  max-width: 42ch;
}

.cap {
  font-size: 16.5px;
  color: var(--text-secondary);
  margin: 14px auto 0;
  max-width: 40ch;
}

.tiny { font-size: 13px; color: var(--text-muted); }

/* ------------------------------------------------------------------ buttons */

.cta {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  padding: 13px 24px;
  border-radius: 12px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: background-color 120ms ease;
}
.cta:hover:not(:disabled) { background: var(--accent-hover); }
.cta:disabled { opacity: 0.6; cursor: default; }

.ghost {
  display: inline-block;
  margin-left: 18px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 15px;
  font-weight: 500;
}
.ghost:hover { color: var(--text); }

/* ------------------------------------------------------------------ sections */

.hero { text-align: center; padding-block: clamp(40px, 6vw, 68px) 0; }
.stage { margin: clamp(38px, 5vw, 58px) auto 0; }

section { padding-block: var(--section-y); text-align: center; }
/* Closer to its caption than to the next section. A visual that is equidistant from the words
   above it and the section below reads as floating between them rather than belonging to
   either — measured as too much dead space around the hero panels. */
.panel { margin: clamp(22px, 3vw, 30px) auto 0; max-width: 760px; }

/* ------------------------------------------------------------------ how it works */

.steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 34px;
  margin: clamp(28px, 4.2vw, 44px) auto 0;
  max-width: 820px;
  text-align: left;
}
.step-n {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.6px;
  color: var(--text-label);
  margin-bottom: 14px;
}
.steps p { margin: 8px 0 0; color: var(--text-secondary); font-size: 14.5px; }
.steps svg { margin-bottom: 16px; }

/* ------------------------------------------------------------------ about strip */

.strip {
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: clamp(38px, 5vw, 54px) 0;
}
.strip p { margin: 0 auto; max-width: 44ch; font-size: 17px; color: var(--text-body); }

/* ------------------------------------------------------------------ form */

form.early { max-width: 420px; margin: clamp(26px, 3.4vw, 34px) auto 0; text-align: left; }
.field { display: block; margin-bottom: 14px; }
.field > span {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-label);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
input, textarea {
  width: 100%;
  font-family: inherit;
  background: var(--block);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  color: var(--text);
  padding: 11px 13px;
  font-size: 15px;
}
textarea { min-height: 76px; resize: vertical; line-height: 1.5; }
.status { margin: 14px 0 0; font-size: 14px; min-height: 1.4em; }
.status.ok { color: var(--accent-light); }
.status.bad { color: var(--alert); }

/* ------------------------------------------------------------------ faq */

.qa { max-width: 640px; margin: clamp(28px, 4.2vw, 41px) auto 0; text-align: left; }
.qa > div { padding: 20px 0; border-top: 1px solid var(--border); }
.qa > div:last-child { border-bottom: 1px solid var(--border); }
.qa h3 { margin-bottom: 6px; }
.qa p { margin: 0; color: var(--text-secondary); font-size: 15px; }

/* ------------------------------------------------------------------ footer */

footer.site {
  border-top: 1px solid var(--border);
  padding-block: 26px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
  color: var(--text-muted);
}
footer.site a { color: var(--text-secondary); text-decoration: none; }
footer.site a:hover { color: var(--text); }

/* ------------------------------------------------------------------ narrow */

@media (max-width: 640px) {
  /* Measured at 560px: without this the wordmark and the nav collide and render as
     "HemiAbout". Caught in the mockup review. */
  header.site { flex-wrap: wrap; gap: 12px; }
  nav.site { gap: 14px; flex-wrap: wrap; }
  h1 { letter-spacing: -1px; }
  .steps { grid-template-columns: 1fr; gap: 26px; }
  .ghost { display: block; margin: 16px 0 0; }
}

/* ==================================================================== motion
 *
 * Six small things, all opacity and transform only, so nothing here triggers layout.
 *
 * THE HIDDEN STATE IS APPLIED BY JAVASCRIPT, NOT BY THIS FILE.
 * marketing.js adds .js-motion to <html>, and only then does anything become invisible. If the
 * script fails to load, every element is simply visible — rather than a blank page of content
 * waiting for an observer that never ran. A decorative feature must not be able to blank the
 * page, and this is the whole reason the selectors below are prefixed.
 * ========================================================================= */

.reveal {
  transition:
    opacity 500ms cubic-bezier(0.2, 0.7, 0.3, 1),
    transform 500ms cubic-bezier(0.2, 0.7, 0.3, 1);
}
/* :not(.shown) rather than a .shown override. A hide rule plus a more-specific show rule is a
   specificity contest, and one that measurably did not resolve — three elements on /about kept
   opacity 0 while carrying .shown and sitting under .js-motion. Excluding the revealed state
   from the hide rule means there is no contest to lose: a shown element matches nothing that
   hides it. */
.js-motion .reveal:not(.shown) { opacity: 0; transform: translateY(10px); }
.js-motion .reveal.rise:not(.shown) { transform: translateY(14px); }

/* The hero waveform: the only looping animation on the site. Bars scale from their centre, so
   they grow like a level meter rather than sprouting from a baseline, and each is offset from
   the last so it reads as a travelling ripple instead of seven bars breathing together. */
@keyframes hemi-pulse {
  0%, 100% { transform: scaleY(0.82); }
  50% { transform: scaleY(1); }
}
.wave rect {
  transform-box: fill-box;
  transform-origin: center;
  animation: hemi-pulse 2s ease-in-out infinite;
}
.wave rect:nth-of-type(2) { animation-delay: 0.12s; }
.wave rect:nth-of-type(3) { animation-delay: 0.24s; }
.wave rect:nth-of-type(4) { animation-delay: 0.36s; }
.wave rect:nth-of-type(5) { animation-delay: 0.48s; }
.wave rect:nth-of-type(6) { animation-delay: 0.60s; }
.wave rect:nth-of-type(7) { animation-delay: 0.72s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  /* Belt and braces: suppressing the transition alone would leave anything the observer had
     not yet reached stuck at opacity 0. */
  .js-motion .reveal:not(.shown) { opacity: 1 !important; transform: none !important; }
}
