/*
 * Atrium res Informatica: the whole site's style, in one file.
 *
 * Mobile first: the base rules are the phone layout, and wider screens only
 * get more room. No web font (system fonts render at once and call no third
 * party) and no framework.
 *
 * Every text/background pair below meets WCAG AA (4.5:1) in both themes;
 * tools/check.py measures it on the rendered pages.
 */

:root {
  color-scheme: light dark;

  --bg: #ffffff;
  --surface: #f7f4ef;
  --text: #1c282c;
  --muted: #4a5b60;
  --line: #e4ded6;
  /* The centre column of the logo. Too light for text on white (1.8:1):
     it is a background for dark text, never a text colour here. */
  --brand: #fcb046;
  --brand-hover: #f59a2a;
  --on-brand: #1c282c;
  --underline: #b85c00;
  --field: #7d898e; /* 3.6:1 on white */
  --error: #b3261e;

  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  /* Only headings are fluid. Body text stays in fixed rem, which browser
     zoom always scales; a heading's max stays under 2.5 x its min so that
     zooming to 200 % still doubles it (WCAG 1.4.4). */
  --h1: clamp(2rem, 1.45rem + 2.4vw, 3.25rem);
  --h2: clamp(1.5rem, 1.3rem + 0.9vw, 2rem);
  --h3: 1.1875rem;
  --small: 0.875rem;

  --gutter: clamp(1rem, 0.5rem + 2.5vw, 2.5rem);
  --section: clamp(3rem, 2rem + 4vw, 5.5rem);
  --wide: 72rem;
  --measure: 65ch;
  --radius: 0.75rem;
  --target: 2.75rem; /* 44 px at the default text size */
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111618;
    --surface: #182024;
    --text: #e8eef0;
    --muted: #a7bdc1; /* the grey of the logo's wordmark */
    --line: #2b363a;
    --brand-hover: #fdc06a;
    --underline: #fcb046;
    --field: #74878c;
    --error: #f2a39d;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  /* The header stays on screen: whatever is scrolled to, an anchor or the
     element taking the focus, lands below it and never under it (WCAG
     2.4.11). */
  scroll-padding-block-start: 6rem;
}

/* Narrower, the header may hold two lines, depending on the system font:
   so does the room left above. */
@media (max-width: 24em) {
  html {
    scroll-padding-block-start: 8.5rem;
  }
}

/* Wins over the display of .button, which would show a hidden button. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  /* The footer stays at the bottom of a short page. */
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
}

@media (min-width: 48em) {
  body {
    font-size: 1.125rem;
  }
}

/* The nine colours of the logo, as a band across the top of the header. */
.site-header::before {
  content: "";
  display: block;
  height: 0.375rem;
  background: linear-gradient(
    90deg,
    #fd8949 0 11.11%,
    #fd9348 0 22.22%,
    #fd9c47 0 33.33%,
    #fca647 0 44.44%,
    #fcb046 0 55.56%,
    #fcb746 0 66.67%,
    #fbc145 0 77.78%,
    #fbcb44 0 88.89%,
    #fad443 0
  );
}

main {
  flex: 1;
}

img,
svg {
  max-inline-size: 100%;
  block-size: auto;
}

h1,
h2,
h3 {
  line-height: 1.15;
  text-wrap: balance;
}

h1 {
  margin: 0 0 1.25rem;
  max-inline-size: 22ch;
  font-size: var(--h1);
  letter-spacing: -0.02em;
}

h2 {
  margin: 0 0 1.5rem;
  font-size: var(--h2);
  letter-spacing: -0.01em;
}

h3 {
  margin: 0 0 0.5rem;
  font-size: var(--h3);
}

p,
ul,
dl {
  margin: 0 0 1rem;
}

a {
  color: inherit;
  text-decoration-color: var(--underline);
  text-decoration-thickness: 0.125em;
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 0.2em;
}

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

.wrap {
  inline-size: min(100% - 2 * var(--gutter), var(--wide));
  margin-inline: auto;
}

/* Text pages keep the left edge of the header; only their lines are
   limited, to a readable length. */
.prose > * {
  max-inline-size: var(--measure);
}

/* Lists that are layouts, not enumerations. role="list" in the markup
   keeps their semantics in Safari, which drops them with the bullets. */
.plain {
  margin: 0;
  padding: 0;
  list-style: none;
}

/* Above the sticky header, which would otherwise cover it. */
.skip-link {
  position: absolute;
  inset-inline-start: 1rem;
  inset-block-start: 1rem;
  z-index: 2;
  padding: 0.75rem 1rem;
  background: var(--bg);
  color: var(--text);
  transform: translateY(-200%);
}

.skip-link:focus {
  transform: none;
}

/* Header ----------------------------------------------------------- */

/* Always on screen, with the contact button: CSS alone, no script. */
.site-header {
  position: sticky;
  inset-block-start: 0;
  z-index: 1;
  border-block-end: 1px solid var(--line);
  background: var(--bg);
}

.site-header .wrap {
  padding-block: 0.625rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  min-block-size: var(--target);
  text-decoration: none;
}

.brand img {
  inline-size: 2.5rem;
  block-size: 2.5rem;
}

/* The wordmark of the logo, set in text: "atrium" over "res Informatica". */
.brand-name {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-name strong {
  font-size: 1.25rem;
  letter-spacing: 0.01em;
}

.brand-name span {
  color: var(--muted);
  font-size: 0.875rem;
}

/* The languages and the contact button, side by side: on one line with
   the brand from 360 px wide. */
.site-nav {
  display: flex;
  align-items: center;
}

.site-nav .button {
  margin-inline-start: 0.5rem;
  padding-inline: 1rem;
}

/* Each language by its two-letter code, as tall as the button next to it
   and wider than the 24 px of WCAG 2.5.8: the page's own in the colour of
   the logo, the other greyed. */
.lang-switch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-inline-size: 1.75rem;
  min-block-size: var(--target);
  padding-inline: 0.25rem;
  border-radius: 0.5rem;
  color: var(--muted);
  font-size: var(--small);
  letter-spacing: 0.05em;
  text-decoration: none;
}

.lang-switch:hover {
  background: var(--surface);
}

/* The orange of the underlines: on a light background, the logo's own
   would not be legible. Bold too, so that the colour is not the only
   thing that tells it (WCAG 1.4.1). */
.lang-switch[aria-current] {
  color: var(--underline);
  font-weight: 700;
}

/* Language banner -------------------------------------------------- */

/* Offers the other language (assets/lang.js). Above the header, it
   scrolls away with the page. */
.lang-banner {
  border-block-end: 1px solid var(--line);
  background: var(--surface);
  font-size: var(--small);
}

.lang-banner .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 0.25rem;
}

.lang-banner p {
  margin: 0;
}

.lang-banner a {
  font-weight: 650;
}

.lang-banner-close {
  flex: none;
  inline-size: var(--target);
  block-size: var(--target);
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}

.lang-banner-close:hover {
  background: var(--bg);
}

/* Buttons ---------------------------------------------------------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-block-size: var(--target);
  padding: 0.5rem 1.25rem;
  border: 0;
  border-radius: 999px;
  background: var(--brand);
  color: var(--on-brand);
  font: inherit;
  font-weight: 650;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.button:hover {
  background: var(--brand-hover);
}

.button--quiet {
  background: transparent;
  color: var(--text);
  box-shadow: inset 0 0 0 2px var(--line);
}

.button--quiet:hover {
  background: var(--surface);
}

@media (prefers-reduced-motion: no-preference) {
  .button {
    transition: background-color 0.15s ease;
  }
}

/* Sections --------------------------------------------------------- */

.hero {
  padding-block: clamp(2rem, 1rem + 5vw, 5rem) var(--section);
}

.eyebrow {
  margin-block-end: 1rem;
  color: var(--muted);
  font-size: var(--small);
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.lead {
  max-inline-size: 58ch;
  margin-block-end: 2rem;
  color: var(--muted);
  font-size: 1.125rem;
}

@media (min-width: 48em) {
  .lead {
    font-size: 1.25rem;
  }
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1.25rem;
}

.note {
  margin: 0;
  color: var(--muted);
  font-size: var(--small);
}

.section {
  padding-block: var(--section);
}

.section--alt {
  background: var(--surface);
}

/* Two plain sections in a row share one gap, not two. */
.section:not(.section--alt) + .section:not(.section--alt) {
  padding-block-start: 0;
}

/* Cards stack on a phone, go two by two, then four or three abreast: the
   steps are chosen so that no card is left alone on a row. em, not px, so
   that a larger default text size moves the steps with it. */
.grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 40em) {
  .grid--4 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 64em) {
  .grid--4 {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (min-width: 52em) {
  .grid--3 {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* The cards of a row are as tall as the tallest: their buttons line up at
   the bottom. */
.card {
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
}

.card p {
  margin: 0 0 1.25rem;
  color: var(--muted);
}

.card .button {
  align-self: flex-start;
  margin-block-start: auto;
}

/* The title is the card's link: underlined on hover only, the button below
   saying it already to the eye. */
.card h3 a {
  text-decoration: none;
}

.card h3 a:hover {
  text-decoration: underline;
  text-decoration-color: var(--underline);
}

/* Mission pages --------------------------------------------------- */

.breadcrumb {
  margin-block-end: 1rem;
  color: var(--muted);
  font-size: var(--small);
}

.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.5rem;
}

.breadcrumb li + li::before {
  content: "›";
  margin-inline-end: 0.5rem;
}

.breadcrumb a {
  display: inline-flex;
  align-items: center;
  min-block-size: 1.5rem;
}

/* A point of the method, or of what a mission covers: marked by the brand
   colour. */
.point {
  padding-inline-start: 1rem;
  border-inline-start: 4px solid var(--brand);
}

.point p {
  margin: 0;
  color: var(--muted);
}

/* The call to action closing a page. */
.cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem 2rem;
  padding: clamp(1.5rem, 1rem + 2.5vw, 3rem);
  border-radius: var(--radius);
  background: var(--surface);
}

.cta h2 {
  margin-block-end: 0.5rem;
}

.cta p {
  margin: 0;
  max-inline-size: 50ch;
  color: var(--muted);
}

/* The steps of a mission: cards numbered by a counter. */
.steps {
  counter-reset: step;
}

.step {
  counter-increment: step;
}

.step::before {
  content: counter(step);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  inline-size: 2.25rem;
  block-size: 2.25rem;
  margin-block-end: 0.75rem;
  border-radius: 999px;
  background: var(--brand);
  color: var(--on-brand);
  font-weight: 700;
}

.step p {
  margin: 0;
}

/* What the client receives, ticked off. */
.checklist {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 20rem), 1fr));
  gap: 0.75rem 2rem;
}

.checklist li {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
}

.checklist li::before {
  content: "✓";
  color: var(--underline);
  font-weight: 700;
}

/* Questions that open on a click: <details>, no script. */
.faq {
  display: grid;
  gap: 0.75rem;
  max-inline-size: 48rem;
}

.faq details {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
}

.faq summary {
  min-block-size: var(--target);
  padding: 0.75rem 1.25rem;
  font-weight: 650;
  cursor: pointer;
}

.faq details p {
  margin: 0;
  padding: 0 1.25rem 1.25rem;
  color: var(--muted);
}

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

.form {
  display: grid;
  gap: 1.25rem;
  margin-block-end: 2rem;
}

.field {
  display: grid;
  gap: 0.375rem;
}

.field label {
  font-weight: 600;
}

.optional {
  color: var(--muted);
  font-weight: 400;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: var(--small);
}

/* 1rem at least: below, iOS zooms in on the field. */
input,
select,
textarea {
  inline-size: 100%;
  min-block-size: var(--target);
  padding: 0.625rem 0.75rem;
  border: 2px solid var(--field);
  border-radius: 0.5rem;
  background: var(--bg);
  color: var(--text);
  font: inherit;
}

textarea {
  min-block-size: 10rem;
  resize: vertical;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline-offset: 1px;
  border-color: var(--text);
}

/* Only once the visitor has left the field or sent the form: an empty
   field in red before anything was typed reads as a reproach. */
input:user-invalid,
textarea:user-invalid {
  border-color: var(--error);
}

/* Legal notice ----------------------------------------------------- */

.legal h2 {
  margin-block-start: 2.5rem;
  font-size: 1.375rem;
}

.legal address {
  font-style: normal;
}

.legal dl {
  display: grid;
  gap: 0.25rem 1rem;
}

@media (min-width: 40em) {
  .legal dl {
    grid-template-columns: max-content 1fr;
  }
}

.legal dt {
  font-weight: 600;
}

.legal dd {
  margin: 0 0 0.5rem;
}

/* A link alone in its line is no longer "in a sentence": it gets the
   24 px of WCAG 2.5.8. */
.legal dd a {
  display: inline-block;
  padding-block: 0.25rem;
}

/* Footer ----------------------------------------------------------- */

.site-footer {
  padding-block: 1.5rem;
  border-block-start: 1px solid var(--line);
  color: var(--muted);
  font-size: var(--small);
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 2rem;
}

.site-footer p {
  margin: 0;
}

.site-footer ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0 1.25rem;
}

/* Tall enough for a thumb, without looking like buttons. */
.site-footer a {
  display: inline-flex;
  align-items: center;
  min-block-size: var(--target);
}

@media print {
  .site-header::before,
  .skip-link,
  .lang-banner,
  .site-header nav,
  .button {
    display: none;
  }

  .section--alt,
  .cta {
    background: none;
  }
}
