/* ==========================================================================
   REFORMIQA — main stylesheet
   One file, no frameworks. Sections:
   1. Font          5. Hero                9.  Privacy page
   2. Tokens        6. Approach            10. Foldable and dual-screen devices
   3. Base          7. Contact             11. Reduced motion
   4. Header        8. Footer
   ========================================================================== */

/* 1. Font ----------------------------------------------------------------- */
/* Outfit (SIL Open Font License), variable weight, Latin subset, self-hosted. */
@font-face {
  font-family: "Outfit";
  src: url("../fonts/outfit-latin-var.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

/* 2. Tokens --------------------------------------------------------------- */
:root {
  --bg: #F4F4F1;          /* light grey, primary brand background */
  --ink: #000000;         /* brand black */
  --red: #E5322D;         /* brand red: the point */
  --muted: #55554F;       /* secondary text, 6.8:1 on --bg */
  --body: #3E3E3A;        /* long-form text */
  --rule: #DCDCD6;        /* hairlines */
  --field: #BDBDB7;       /* form underlines */

  --font: "Outfit", system-ui, -apple-system, "Segoe UI", sans-serif;
  --margin: clamp(20px, 6vw, 120px);
  --container: min(100% - 2 * var(--margin), 1240px);
  --header-h: 96px;

  /* Read by hero.js to choose how the hero is composed. */
  --hero-mode: stack;

  color-scheme: light;
}

/* 3. Base ----------------------------------------------------------------- */
*,
*::before,
*::after { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  scroll-padding-top: env(safe-area-inset-top, 0px);
}

body {
  margin: 0;
  min-width: 280px;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { font-weight: 500; text-wrap: balance; }
p { text-wrap: pretty; }

:focus-visible { outline: 2px solid var(--red); outline-offset: 4px; }

.container { width: var(--container); margin-inline: auto; }

.skip-link {
  position: absolute;
  z-index: 10;
  left: var(--margin);
  top: 12px;
  padding: 10px 16px;
  background: var(--ink);
  color: #FFFFFF;
  text-decoration: none;
  transform: translateY(-200%);
}
.skip-link:focus { transform: none; }

.title {
  font-size: clamp(36px, 4.6vw, 64px);
  line-height: 1.04;
  letter-spacing: -0.025em;
}

.lead { font-size: 18px; color: var(--muted); max-width: 460px; }

.button {
  display: inline-flex;
  align-items: center;
  min-height: 54px;
  padding: 0 28px;
  border: 0;
  background: var(--ink);
  color: #FFFFFF;
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
}
.button:hover { background: #1F1F1F; }

.text-link {
  font-size: 16px;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: 3px;
}
.text-link:hover { color: var(--red); }

/* 4. Header --------------------------------------------------------------- */
.site-header {
  --logo-w: clamp(132px, 15vw, 210px);
  position: absolute;
  z-index: 3;
  top: env(safe-area-inset-top, 0px);
  left: env(safe-area-inset-left, 0px);
  right: env(safe-area-inset-right, 0px);
}
.site-header__inner {
  height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.site-header__logo { display: flex; }
.site-header__logo img { width: var(--logo-w); height: auto; }
.site-nav { display: flex; gap: clamp(20px, 3vw, 40px); font-size: 15px; }
.site-header .text-link { font-size: 15px; white-space: nowrap; }
/* The logo's capitals fill only its bottom 694 of 1685.4 units, under the symbol, so the links
   are lowered from the logo's middle to the capitals' middle: text on the same level. A text
   link's underline adds 4 px under its text, so it is lowered 2 px more. */
.site-nav,
.site-header .text-link {
  --lower: calc(var(--logo-w) * (1685.4 - 694) / (2 * 9760.4));
  position: relative;
  top: var(--lower);
}
.site-header .text-link { top: calc(var(--lower) + 2px); }
.site-nav a { text-decoration: none; }
.site-nav a:hover { color: var(--red); }

/* 5. Hero ----------------------------------------------------------------- */
/* Layout is pure CSS; hero.js only measures it to place the animated symbol. */
.hero {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  padding-top: calc(var(--header-h) + env(safe-area-inset-top, 0px));
  overflow: hidden;
}
.hero__field,
.hero__mark {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.hero__inner {
  position: relative;
  z-index: 2;
  flex: 1;
  width: var(--container);
  margin-inline: auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  padding: 24px 0 64px;
}
.hero__copy { max-width: 680px; }
.hero__title {
  /* "is still wrong." is 5.31 em wide; this keeps it on one line down to 280 px. */
  font-size: min(60px, calc((100vw - 2 * var(--margin)) / 5.6));
  line-height: 1.02;
  letter-spacing: -0.03em;
  margin-bottom: 22px;
}
.hero__title .word { display: inline-block; white-space: nowrap; }
.hero__title .char { display: inline-block; transition: transform 420ms cubic-bezier(.2, .8, .2, 1); }
.hero__promise {
  font-size: clamp(21px, 2.1vw, 30px);
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.25;
  margin-bottom: 16px;
}
.hero__body { max-width: 500px; color: var(--muted); }
.hero__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 18px 30px; margin-top: 30px; }

/* Space reserved under the copy for the symbol on narrow screens. */
.hero__slot {
  width: var(--slot);
  height: var(--slot);
  --slot: clamp(150px, min(58vw, 34svh), 300px);
  margin: 48px auto 0;
  flex: none;
}

/* Split layout: text on the left, symbol on the right, centred on each other. */
@media (min-width: 900px), (min-width: 640px) and (orientation: landscape) {
  :root { --hero-mode: split; }
  .hero__inner { justify-content: center; padding: 0 0 40px; }
  .hero__copy { max-width: min(680px, 54%); }
  .hero__title { font-size: clamp(44px, 6vw, 92px); margin-bottom: 30px; }
  .hero__promise { margin-bottom: 18px; }
  .hero__actions { margin-top: 36px; }
  .hero__slot { display: none; }
}

/* Short landscape phones: tighter type so the whole message fits on one screen. */
@media (orientation: landscape) and (max-height: 560px) {
  :root { --header-h: 72px; }
  .hero__title { font-size: clamp(36px, 5vw, 56px); margin-bottom: 16px; }
  .hero__promise { font-size: 20px; margin-bottom: 10px; }
  .hero__body { font-size: 15px; }
  .hero__actions { margin-top: 20px; }
  .button { min-height: 46px; }
}

/* Entrance: only hidden when JavaScript is running and motion is welcome. */
@media (prefers-reduced-motion: no-preference) {
  .js .hero__title { opacity: 0; transition: opacity 900ms ease; }
  .js .hero__promise,
  .js .hero__body,
  .js .hero__actions {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 700ms ease, transform 700ms cubic-bezier(.2, .8, .2, 1);
  }
  .js .hero .is-in { opacity: 1; transform: none; }
  /* A keyboard user can reach the buttons before the entrance shows them; a tap can't find them unseen. */
  .js .hero__actions:focus-within { opacity: 1; transform: none; }
  .js .hero__actions:not(.is-in):not(:focus-within) { pointer-events: none; }
  /* If the script ever stops before the entrance ends, everything still appears. */
  .js .hero__title,
  .js .hero__promise,
  .js .hero__body,
  .js .hero__actions { animation: hero-failsafe 0s 15s forwards; }
}
@keyframes hero-failsafe { to { opacity: 1; transform: none; pointer-events: auto; } }

/* 6. Approach ------------------------------------------------------------- */
.approach { padding: clamp(40px, 5vw, 72px) 0 clamp(96px, 10vw, 144px); }
.approach .container { border-top: 1px solid var(--rule); padding-top: clamp(56px, 6vw, 88px); }
.approach__head {
  display: grid;
  grid-template-columns: 1fr minmax(0, 460px);
  gap: 24px 48px;
  align-items: end;
  margin-bottom: clamp(56px, 7vw, 104px);
}
.steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: clamp(32px, 4vw, 64px);
  margin: 0;
  padding: 0;
  list-style: none;
}
.step { border-top: 1px solid var(--rule); padding-top: 36px; }
.step__glyph { width: 50px; height: 50px; margin-bottom: 40px; overflow: visible; }
.step__element { font-size: 14px; color: var(--muted); margin-bottom: 10px; }
.step__title { font-size: 26px; letter-spacing: -0.01em; margin-bottom: 14px; }
.step__text { color: var(--muted); max-width: 340px; }
.step__text strong { font-weight: 500; color: var(--ink); }

/* 7. Contact -------------------------------------------------------------- */
.contact { padding: 0 0 clamp(96px, 12vw, 160px); }
.contact .container {
  border-top: 1px solid var(--rule);
  padding-top: clamp(56px, 6vw, 88px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 520px);
  gap: 56px clamp(48px, 8vw, 140px);
}
.contact__point {
  display: inline-block;
  width: 0.19em;
  height: 0.19em;
  margin-left: 0.04em;
  border-radius: 50%;
  background: var(--red);
}
.contact .lead { margin-top: 28px; }
.contact__mail {
  display: inline-block;
  margin-top: 36px;
  font-size: clamp(19px, 2vw, 22px);
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  padding-bottom: 4px;
  overflow-wrap: anywhere;
}
.contact__mail:hover { color: var(--red); }

.form__row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 28px; }
.form__field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 30px; min-width: 0; }
.form__field label { font-size: 14px; color: var(--muted); }
.form__field input,
.form__field textarea {
  width: 100%;
  min-width: 0;
  padding: 10px 0;
  border: 0;
  border-bottom: 1px solid var(--field);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 18px;
  outline: 2px solid transparent; /* invisible here, but shown by Windows High Contrast */
  -webkit-appearance: none;
  appearance: none;
}
.form__field textarea { min-height: 120px; resize: vertical; line-height: 1.5; }
.form__field input:focus,
.form__field textarea:focus { border-bottom-color: var(--ink); box-shadow: 0 1px 0 0 var(--ink); }
.form__status { margin-top: 18px; min-height: 1.5em; font-size: 15px; color: var(--muted); }
.form .button[aria-disabled="true"] { opacity: 0.6; cursor: progress; }
/* A trap for spam bots: hidden from people, but bots fill in every field. */
.form__trap { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

/* 8. Footer --------------------------------------------------------------- */
.site-footer { border-top: 1px solid var(--rule); font-size: 14px; color: var(--muted); }
.site-footer__main {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px 24px;
  padding: 36px 0 22px;
}
.site-footer__brand,
.site-footer__meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px 28px; }
.site-footer__brand img { width: 140px; height: auto; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { color: var(--ink); }
.site-footer__place { display: inline-flex; align-items: baseline; gap: 10px; }
.flag { width: 25px; height: 15px; box-shadow: 0 0 0 0.5px rgba(0, 0, 0, 0.18); transform: translateY(2.6px); }
.site-footer__legal {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 0;
  margin: 0;
  padding: 0 0 calc(32px + env(safe-area-inset-bottom, 0px));
  list-style: none;
  font-size: 13px;
}
.site-footer__legal li + li::before { content: "·"; content: "·" / ""; margin: 0 10px; color: #B5B5AF; }

/* Narrow screens ---------------------------------------------------------- */
@media (max-width: 899px) {
  :root { --header-h: 72px; }
  .approach__head { grid-template-columns: 1fr; }
  .steps { grid-template-columns: 1fr; gap: 48px; }
  .step__glyph { margin-bottom: 32px; }
  .contact .container { grid-template-columns: 1fr; }
}
@media (max-width: 599px) {
  .form__row { grid-template-columns: 1fr; }
  .site-footer__main { flex-direction: column; }
  .site-footer__legal { flex-direction: column; }
  .site-footer__legal li + li::before { content: none; }
}
/* The smallest phones (down to a folded Galaxy Z Fold's 280 px): a smaller logo and tighter
   links, so all three still fit on one line. */
@media (max-width: 359px) {
  .site-header { --logo-w: 112px; }
}
@media (max-width: 319px) {
  .site-header { --logo-w: 100px; }
  .site-header__inner { gap: 12px; }
  .site-nav { gap: 14px; font-size: 14px; }
}

/* Phones, and tablets held upright: the single column is centred. Landscape phones and wider
   screens keep the left-aligned layout. */
@media (max-width: 639px), (max-width: 899px) and (orientation: portrait) {
  .hero__copy,
  .approach__head,
  .step,
  .contact .container > div,
  .form,
  .not-found,
  .site-footer { text-align: center; }
  .hero__copy,
  .hero__body,
  .lead,
  .step__glyph,
  .step__text { margin-inline: auto; }
  .hero__actions,
  .site-footer__brand,
  .site-footer__meta,
  .site-footer__legal { justify-content: center; }
  /* Each glyph's viewBox puts its shape's left edge on the text's edge; shift the point and the
     line so that their centres, like the plane's, sit on the column's centre. */
  .step__glyph[data-glyph="point"] { position: relative; left: calc(7 / 28 * 50px); }
  .step__glyph[data-glyph="line"] { position: relative; left: calc(3.7 / 28 * 50px); }
  /* Labels and typing stay left-aligned, as forms are easier to fill in that way. */
  .form__field { text-align: left; }
  .site-footer__main { flex-direction: column; align-items: center; }
  .site-footer__legal { align-items: center; }
}

/* 9. Privacy page --------------------------------------------------------- */
.page .site-header { position: static; }
.legal-page { width: min(100% - 2 * var(--margin), 720px); margin: 0 auto; padding: clamp(32px, 6vw, 80px) 0 120px; }
.legal-page h1 { font-size: clamp(36px, 4.6vw, 64px); line-height: 1.04; letter-spacing: -0.025em; margin-bottom: 12px; }
.legal-page h2 { font-size: 22px; letter-spacing: -0.01em; margin: 48px 0 14px; }
.legal-page p,
.legal-page li { color: var(--body); line-height: 1.65; }
.legal-page p { margin-bottom: 14px; }
.legal-page ul { margin: 0 0 14px; padding-left: 20px; }
.legal-page li { margin-bottom: 10px; }
.legal-page strong { font-weight: 500; color: var(--ink); }
.legal-page .legal-page__date { font-size: 15px; color: var(--muted); margin-bottom: 40px; }
.legal-page a { overflow-wrap: anywhere; }
.legal-page a:hover { color: var(--red); }

.not-found { min-height: 60vh; display: grid; align-content: center; gap: 24px; padding: 48px 0 96px; }

/* 10. Foldable and dual-screen devices ------------------------------------ */
/* fold.js sets data-fold and the segment sizes when the page spans two screens. */

/* Side by side (e.g. Surface Duo, or a foldable held like a book). */
[data-fold="h"] { --hero-mode: dual-h; }
[data-fold="h"] .hero__inner {
  width: calc(var(--seg-a-w) - 2 * var(--margin));
  margin-left: var(--margin);
  justify-content: center;
  padding: 0 0 40px;
}
[data-fold="h"] .hero__copy { max-width: none; }
[data-fold="h"] .hero__title { font-size: min(72px, calc((var(--seg-a-w) - 2 * var(--margin)) / 5.6)); }
[data-fold="h"] .hero__slot {
  display: block;
  position: absolute;
  --slot: min(calc(var(--seg-b-w) * 0.55), 58svh);
  left: calc(var(--seg-a-w) + var(--seg-gap) + (var(--seg-b-w) - var(--slot)) / 2 - var(--margin));
  top: calc(50% - var(--slot) / 2 - 20px);
  margin: 0;
}
[data-fold="h"] .site-header__inner,
[data-fold="h"] .approach .container,
[data-fold="h"] .contact .container,
[data-fold="h"] .site-footer .container { width: auto; margin-inline: var(--margin); }
[data-fold="h"] .approach__head,
[data-fold="h"] .steps,
[data-fold="h"] .contact .container {
  grid-template-columns: calc(var(--seg-a-w) - 2 * var(--margin)) calc(var(--seg-b-w) - 2 * var(--margin));
  column-gap: calc(var(--seg-gap) + 2 * var(--margin));
}
[data-fold="h"] .site-footer__legal { flex-direction: column; max-width: calc(var(--seg-a-w) - 2 * var(--margin)); }
[data-fold="h"] .site-footer__legal li + li::before { content: none; }

[data-fold="h"] .legal-page,
[data-fold="h"] .not-found { width: calc(var(--seg-a-w) - 2 * var(--margin)); margin-left: var(--margin); }

/* Top and bottom (a foldable half-opened like a laptop). */
[data-fold="v"] { --hero-mode: dual-v; }
[data-fold="v"] .hero { min-height: calc(var(--seg-a-h) + var(--seg-gap) + var(--seg-b-h)); }
[data-fold="v"] .hero__inner {
  flex: none;
  height: calc(var(--seg-a-h) - var(--header-h));
  justify-content: center;
  padding: 0;
}
[data-fold="v"] .hero__slot {
  display: block;
  position: absolute;
  --slot: min(calc(var(--seg-b-h) * 0.6), 60vw);
  top: calc(var(--seg-a-h) + var(--seg-gap) + (var(--seg-b-h) - var(--slot)) / 2 - var(--header-h));
  left: calc(50% - var(--slot) / 2);
  margin: 0;
}

/* 11. Reduced motion ------------------------------------------------------ */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
