/* Habi site. One typeface, black pages, white text, one green.
 *
 * Sizes follow one set of rules:
 *  - the base size is 20px on a wide screen and 16px on a narrow one;
 *  - every text size is the base size plus a step that grows with the screen;
 *  - sections are small, medium, large or a set height, with padding that grows with the screen;
 *  - the parts of a section sit on a grid of 24 columns (8 on a phone).
 */

@font-face {
  font-family: "DIN 2014";
  src: url("../fonts/DIN2014-Light.ttf") format("truetype");
  font-display: swap;
}

:root {
  --green: #16c089;
  --green-quote: #16c08a;
  --green-dark: #0b7d58;
  --grey: #2a2829;
  --light: #e0e0db;
  --red: #e21f26;
  --navy: #253551;
  --gut: 3vw;                              /* space at the left and right of the page */
  --hdr-h: calc(160px + 2vw);              /* height of the header: the logo plus the space above and below it */
  --dh: 6vw;                               /* height of a shaped section edge */
}

html { font-size: 20px; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

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

body {
  margin: 0;
  background: var(--grey);
  color: #fff;
  font-family: "DIN 2014", "DIN Alternate", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-weight: 300;
  font-size: 1rem;
  line-height: 1.8;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img, video, picture { display: block; max-width: 100%; }
img { height: auto; }

a { color: var(--green); text-decoration: none; }
:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }

h1, h2, h3, h4, p, ul, ol, figure, blockquote, fieldset, address { margin: 0; }
h1, h2, h3, h4 { font-weight: 300; }
strong, b { font-weight: 700; }
address { font-style: normal; }

.skip { position: absolute; left: -999px; top: 0; z-index: 400; background: #fff; color: #000; padding: 0.6rem 1rem; }
.skip:focus { left: 0; }

/* ---------- text sizes ---------- */

/* --v says how large a piece of text is: 1 is the base size. */
.fs, .h, .blk__in p, .blk__in li, .blk__in figcaption, .blk__in summary, .form__req, .form__half label {
  font-size: min(calc((var(--v, 1) - 1) * 1.2vw + 1rem), max(calc((var(--v, 1) - 1) * 36px + 1rem), calc(var(--v, 1) * 1rem)));
}
.hs--1 { --v: 3.2; }
.hs--2 { --v: 2.8; }
.hs--3 { --v: 2.2; }
.hs--4 { --v: 1.6; }
.ts--large { --v: 1.5; }
.ts--normal { --v: 1; }
.ts--small { --v: 0.9; }

.blk__in { overflow-wrap: break-word; }
.blk__in p, .blk__in ul, .blk__in ol { margin: 1rem 0; }
.blk__in p, .blk__in li, .blk__in figcaption { line-height: 1.8em; }
.blk__in .h, .h {
  margin: 2rem 0;
  line-height: calc(1.2em * (1 + (1 - var(--v)) / 25));
  letter-spacing: 0.01em;
}
.blk__in .h.hs--0 { --v: 1; margin: 1rem 0; font-weight: 700; line-height: 1.8em; letter-spacing: 0; }
.blk__in > :first-child, .blk__in > .h.hs--0:first-child, .blk__in > .prose:first-child > :first-child, .blk__in > blockquote > .h:first-child { margin-top: 0; }
.blk__in > :last-child, .blk__in > .prose:last-child > :last-child { margin-bottom: 0; }
.blk__in .rot, .blk__in .rotw { margin: 0; }
.blk__in .rot__item { font-size: inherit; line-height: inherit; }
.ta--center { text-align: center; }
.tj { text-align: justify; }
.prose ul { padding-left: 40px; list-style: none; }
.prose li { position: relative; }
.prose li + li { margin-top: 1rem; }
.prose li::before { content: "\2022"; position: absolute; left: -16px; }
.prose em { font-style: italic; }
.c { color: var(--c); }
.c a { color: inherit; }
.doc a { color: inherit; text-decoration: underline; text-underline-offset: 0.2em; }

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

.btn {
  display: inline-block;
  border: 2px solid currentColor;
  background: transparent;
  color: #fff;
  padding: 0.8rem 1.6rem;
  font: inherit;
  font-weight: 700;
  line-height: normal;
  white-space: nowrap;
  cursor: pointer;
  border-radius: 0;
  transition: background-color 0.2s, color 0.2s;
}
.btn:hover { background: #fff; color: #000; }

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

.hdr {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 300;
  display: flex;
  align-items: center;
  padding: 1vw var(--gut);
  line-height: 1.8;
}
.hdr__main { flex: 1 0 80%; display: flex; align-items: center; min-width: 0; }
.hdr__logo { flex: 1 1 33%; display: block; font-size: 0; }
.hdr__logo img { height: 160px; width: auto; max-width: none; }

.nav { flex: 1 1 90%; min-width: 0; }
.nav__list { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; }
.nav__item { position: relative; margin: 0 1.25vw; }
.nav__top {
  display: block;
  background: none;
  border: 0;
  margin: 0;
  padding: 2px 0;
  font: inherit;
  line-height: 1.8em;
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
}
.nav__txt { display: block; }
a.nav__top[aria-current="page"], .is-current > .nav__top .nav__txt { background: linear-gradient(currentColor, currentColor) 0 calc(100% - 2px) / 1px 1px repeat-x; }
.nav__sub {
  position: absolute;
  left: -1rem;
  top: 100%;
  z-index: 10;
  box-sizing: content-box;
  min-width: 200px;
  list-style: none;
  margin: 0;
  padding: 0.5rem 1rem;
  background: #000;
  display: none;
  white-space: nowrap;
  line-height: 1.3;
}
.nav__item--sub:hover .nav__sub,
.nav__item--sub:focus-within .nav__sub,
.nav__item--sub.is-open .nav__sub { display: block; }
.nav__sub a { display: inline-block; color: #fff; padding: 2px 0; }
.nav__sub a span { display: block; }
.nav__sub a:hover { opacity: 0.7; }
.nav__sub a[aria-current="page"] span { background: linear-gradient(currentColor, currentColor) 0 100% / 1px 1px repeat-x; }

.hdr__act { flex: 1 1 33%; display: flex; justify-content: flex-end; }
.hdr__phone { --v: 0.9; margin-left: var(--gut); letter-spacing: 0.2em; font-size: min(calc(-0.12vw + 1rem), 0.9rem); }

.burger { display: none; flex: none; width: 50px; height: 37px; margin: 0 0 0 auto; padding: 0; background: none; border: 0; cursor: pointer; position: relative; z-index: 320; }
.burger span { position: absolute; left: 9px; top: 50%; width: 35px; height: 2px; margin-top: -1px; background: #fff; transition: transform 0.25s cubic-bezier(0.2, 0.6, 0.3, 1), width 0.25s cubic-bezier(0.2, 0.6, 0.3, 1); }
.burger span:first-child { transform: translateY(-9.5px); }
.burger span:last-child { transform: translateY(9.5px); }
.menu-open .burger span { left: 12.5px; width: 28px; }
.menu-open .burger span:first-child { transform: rotate(45deg); }
.menu-open .burger span:nth-child(2) { transform: scale(0); }
.menu-open .burger span:last-child { transform: rotate(-45deg); }

.mnav {
  position: fixed;
  inset: 0;
  z-index: 310;
  background: var(--grey);
  display: flex;
  flex-direction: column;
  padding: var(--hdr-h) 0 0;
  overflow-y: auto;
}
.mnav[hidden] { display: none; }
.mnav__in { flex: 1; display: flex; align-items: center; }
.mnav__list { list-style: none; margin: 0; padding: 0; width: 100%; font-size: 8.5vmin; line-height: 1; }
.mnav__list[hidden] { display: none; }
.mnav__list li { margin: 0; padding: 0 3vw; }
.mnav__list a, .mnav__list button { display: inline-flex; align-items: center; margin: 3vw 5vw; color: #fff; background: none; border: 0; padding: 0; font: inherit; text-align: left; cursor: pointer; }
.mnav__chev { width: 1em; height: 0.66em; margin-left: 5px; flex: none; }
.mnav__back .mnav__chev { margin: 0 5px 0 -0.3em; }
.mnav__back { font-size: 0.85em; }
.mnav__list a[aria-current="page"] { background: linear-gradient(currentColor, currentColor) 0 100% / 1px 1px repeat-x; }
.mnav__phone { align-self: flex-start; margin: 4vw 6vw 6vw; font-size: 1.2rem; padding: 0.8rem 1.6rem; letter-spacing: 0.2em; }
.menu-open { overflow: hidden; }
.menu-open .hdr { position: fixed; z-index: 320; }

@media screen and (min-width: 576px) { .mnav__list { font-size: 6.6vmin; } }
@media screen and (min-width: 768px) { .mnav__list { font-size: 6vmin; } }

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

.sec {
  --g: 0px;
  position: relative;
  display: flex;
  align-items: center;
  min-height: 33vh;
  color: #fff;
}
.sec--medium { min-height: 66vh; }
.sec--large { min-height: 100vh; }
.sec--custom { min-height: calc(var(--vh) * 1vh); }
.va--top { align-items: flex-start; }
.va--bottom { align-items: flex-end; }
.sec--first { padding-top: var(--hdr-h); }
.sec--edge { padding-bottom: var(--dh); }

.sec__wrap { position: relative; z-index: 1; width: 100%; padding: 3.3vmax 0; }
.sec--medium > .sec__wrap { padding: 6.6vmax 0; }
.sec--large > .sec__wrap { padding: 10vmax 0; }
.sec--custom > .sec__wrap { padding: calc(var(--vh) * 0.1vmax) 0; }
.va--top > .sec__wrap { padding: 3vw 0 6.6vmax; }
.va--top.sec--medium > .sec__wrap { padding: 3vw 0 13.2vmax; }
.va--top.sec--large > .sec__wrap { padding: 3vw 0 20vmax; }

/* The background reaches up under the shaped edge of the section before. */
.sec__bg { position: absolute; inset: 0; z-index: 0; overflow: hidden; background: #000; }
.sec--under > .sec__bg { top: calc(var(--dh) * -1); }
.sec__bg picture, .sec__bg img, .sec__bg video { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; }
.sec__shade { position: absolute; inset: 0; background: #000; pointer-events: none; }

.tone--grey > .sec__bg { background: var(--grey); }
.tone--light { color: #000; }
.tone--light > .sec__bg { background: var(--light); }
.tone--white { color: #000; }
.tone--white > .sec__bg { background: #fff; }
.tone--light a { color: var(--green-dark); }

/* the grid: 8 columns on a phone, 24 on anything wider */
.fe {
  display: grid;
  gap: var(--g);
  grid-template-columns:
    minmax(calc(6vw - var(--g)), 1fr)
    repeat(8, minmax(0, calc((3000px - var(--g) * 7) / 8)))
    minmax(calc(6vw - var(--g)), 1fr);
  grid-template-rows: repeat(var(--rm, 2), minmax(24px, auto));
}
.blk { grid-area: var(--m); display: flex; flex-direction: column; justify-content: center; min-width: 0; position: relative; }
.vm--start { justify-content: flex-start; }
.vm--end { justify-content: flex-end; }
.blk--img picture { position: absolute; inset: 0; }
.blk--img img { width: 100%; height: 100%; object-fit: contain; }
.axm--left img { object-position: left center; }
.axm--right img { object-position: right center; }
.blk--sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.pic__cap { position: absolute; left: 0; right: 0; top: 100%; margin-top: 0.5rem; text-align: center; font-size: 0.9rem; opacity: 0.8; }

@media screen and (min-width: 768px) {
  .fe {
    grid-template-columns:
      minmax(calc(3vw - var(--g)), 1fr)
      repeat(24, minmax(0, calc((3000px - var(--g) * 23) / 24)))
      minmax(calc(3vw - var(--g)), 1fr);
    grid-template-rows: repeat(var(--rd, 2), minmax(calc(min(3000px, 94vw) * 0.0215), auto));
  }
  .blk { grid-area: var(--d); justify-content: center; }
  .blk--img img { object-position: center; }
  .ax--left img { object-position: left center; }
  .ax--right img { object-position: right center; }
  .v--start { justify-content: flex-start; }
  .v--end { justify-content: flex-end; }
}

/* parts one under another in a centred band */
.flow { width: calc(88vw + 34px); margin: 0 auto; }
.flow__part { padding: 17px; position: relative; }
.flow__gap { display: none; }
.flow__part picture, .flow__part img { width: 100%; height: auto; }
.flow__part--cut img { aspect-ratio: var(--ar); object-fit: cover; }
.flow--left { margin-left: calc(var(--gut) - 17px); }
@media screen and (min-width: 768px) {
  .flow { width: calc(94vw + 34px); }
  .flow__gap { display: block; }
  .flow > :first-child { padding-top: 0; }
  .flow > :last-child { padding-bottom: 0; }
  .flow--medium { width: calc(94vw * 0.75 + 34px); }
  .flow--narrow { width: calc(94vw * 0.5 + 34px); }
}

/* opening photo: headings that take turns */
.rot { position: relative; display: block; line-height: 1.2; min-height: 1.4em; margin: 0; letter-spacing: 0.01em; text-align: center; }
.rot__item { position: absolute; top: 0; left: 50%; transform: translateX(-50%); margin: 0 !important; font: inherit; letter-spacing: inherit; white-space: nowrap; opacity: 0; animation: rot var(--rot-time, 21s) linear infinite; }
.rot__item--first { animation-name: rot-first; }
.rot__item--last { color: var(--green); animation-name: rot-last; }
.rotw .rot { letter-spacing: inherit; }
.rotw .rot__item { display: block; }
@media (max-width: 768px) { .rot.h, .rotw.h { font-size: 1.4rem; } }
@media (prefers-reduced-motion: reduce) {
  .rot__item { animation: none; }
  .rot__item--first { opacity: 1; }
}

/* quote band */
.quote { color: var(--green-quote); }
.quote blockquote .h { margin-bottom: 2rem; }
.quote__in > blockquote:last-child .h { margin-bottom: 0; }
.quote figcaption { --v: 1; margin: 1rem 0 0; }

/* text */
.cols { columns: 2 16rem; list-style: none; padding: 0 !important; }
.next a { color: var(--green); }

/* questions and answers */
.faq__item { border-top: 1px solid rgba(255, 255, 255, 0.28); }
.faq__item:last-child { border-bottom: 1px solid rgba(255, 255, 255, 0.28); }
.faq__item summary { --v: 1.6; cursor: pointer; padding: 1rem 2.2rem 1rem 0; line-height: 1.25; list-style: none; position: relative; }
.faq__item summary::-webkit-details-marker { display: none; }
.faq__item summary::after { content: "+"; position: absolute; right: 0.2rem; top: 0.9rem; color: var(--green); }
.faq__item[open] summary::after { content: "\2212"; }
.faq__item .prose { padding: 0 0 1.4rem; }

/* row of pictures: edge to edge, no gaps */
.gal { display: block; min-height: 0; background: var(--grey); }
.gal__in { --c: 1; list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; }
.gal__in li { flex: 0 0 calc(100% / var(--c)); aspect-ratio: 1; position: relative; overflow: hidden; }
.gal__in picture, .gal__in img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
@media (min-width: 511px) { .gal__in { --c: var(--c2, 2); } }
@media (min-width: 791px) { .gal__in { --c: var(--c3, 3); } }
@media (min-width: 1076px) { .gal__in { --c: var(--c4, 4); } }
@media (min-width: 1371px) { .gal__in { --c: var(--c5, 5); } }
@media (min-width: 1656px) { .gal__in { --c: var(--c6, 6); } }

/* forms */
.frm__msg { --v: 1.5; margin: 0 0 1.5rem; color: var(--green); }
.frm__msg--bad { color: #ff8f8f; }
.form { width: 100%; line-height: 1.8; }
.form__row { border: 0; padding: 0; margin: 0 0 20px; min-width: 0; }
.form label, .form legend { display: block; padding: 0 0 4px; line-height: 1.8em; }
.form label { display: flex; flex-wrap: wrap; column-gap: 0.5rem; align-items: baseline; }
.form__row > label, .form legend { font-size: 1rem; }
.form__req { --v: 0.9; line-height: 1.8em; opacity: 0.7; }
.form input, .form textarea {
  display: block;
  width: 100%;
  margin: 0;
  background: rgba(42, 40, 41, 0.8);
  border: 1px solid transparent;
  border-radius: 0;
  color: inherit;
  font: inherit;
  font-size: 1rem;
  line-height: 1.8em;
  padding: 5px 10px;
  -webkit-appearance: none;
  appearance: none;
}
.form textarea { height: 100px; min-height: 100px; resize: vertical; }
.form input:focus, .form textarea:focus { outline: none; border-color: currentColor; }
.form__row--name { display: flex; flex-wrap: wrap; column-gap: 10px; margin-bottom: 0; }
.form__row--name legend { width: 100%; }
.form__half { flex: 1 1 0; min-width: 0; margin: 0 0 20px; }
.form__half label { --v: 0.9; padding: 4px 0 2px; align-items: center; }
.form__half .form__req { line-height: 1; }
.form__trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form__send { line-height: 0; }
.btn--form { --v: 1.25; line-height: 1.3; font-size: min(calc(0.3vw + 1rem), max(calc(9px + 1rem), 1.25rem)); }
.tone--light .form input, .tone--light .form textarea { background: rgba(255, 255, 255, 0.8); }
.tone--light .btn { color: var(--navy); }
.tone--light .btn:hover { background: var(--navy); color: #fff; }
.tone--light .frm__msg { color: var(--green-dark); }
.cf-turnstile { margin-bottom: 1rem; }

/* footer */
.ftr { position: relative; z-index: 100; display: flex; align-items: center; min-height: 10vh; background: var(--grey); color: #fff; }
.ftr > .sec__wrap { padding: 1vmax 0; }
.ftr__fe { --g: 0px; --rm: 16; --rd: 11; }
.ftr__text { --m: 2 / 2 / 13 / 10; --d: 2 / 2 / 9 / 26; }
.ftr__soc { --m: 11 / 2 / 17 / 5; --d: 8 / 2 / 12 / 6; align-items: flex-start; }
.ftr__lines > :first-child { margin-top: 0; }
.ftr a { color: #fff; }
.ftr .w3w { color: var(--red); }
.ftr__links { --v: 0.9; }
.ftr__social { display: block; width: 32px; height: 32px; position: relative; }
.ftr__social svg { position: absolute; left: -16px; top: -16px; width: 64px; height: 64px; max-width: none; }

/* ---------- coming into view ---------- */

/* As on the old site: each heading, paragraph, picture, header part and footer part appears when it enters the window.
   The larger headings, the pictures inside sections, the header's parts and the footer's block slide up by 30% of
   their own height while they fade in; smaller headings and paragraphs fade in. Each takes 0.6 seconds, and each
   starts a little after the one before it (the script sets that wait on each one). It happens once. */
.js .pre-fade { opacity: 0; transition: opacity 0.6s ease; }
.js .pre-slide { opacity: 0; transform: translate(0, 30%); transition: transform 0.6s ease, opacity 0.6s ease; }
.js .pre-fade.is-in, .js .pre-slide.is-in, .show-all .pre-fade, .show-all .pre-slide { opacity: 1; }
.js .pre-slide.is-in, .show-all .pre-slide { transform: translate(0, 0); }
@media (prefers-reduced-motion: reduce) {
  .js .pre-fade, .js .pre-slide { opacity: 1; transform: none; transition: none; }
}

/* ---------- snapping to sections ---------- */

/* As on the Walakine site: when the page is scrolled, it comes to rest with a section's top at the top of the
   window, or with the footer's foot at the window's foot. A section taller than the window can be read through
   before the next one snaps in. */
html { scroll-snap-type: y mandatory; }
main > .sec { scroll-snap-align: start; }
.ftr { scroll-snap-align: end; }

/* ---------- narrower screens ---------- */

@media screen and (max-width: 991px) {
  html { font-size: 16px; }
}

/* the header with the menu button: narrow windows, and tablets held upright */
@media only screen and (pointer: coarse) and (max-width: 1024px), screen and (max-width: 799px) {
  :root { --hdr-h: calc(160px + 12vw); }
  .hdr { padding: 6vw; }
  .nav, .hdr__act { display: none; }
  .hdr__main { flex: 1 1 auto; }
  .burger { display: block; }
}

@media screen and (max-width: 767px) {
  :root { --hdr-h: calc(101px + 12vw); --gut: 6vw; }
  .hdr__logo img { height: 101px; }
}

/* On a phone held upright, text sizes follow the height of the screen. */
@media screen and (max-width: 767px) and (orientation: portrait) {
  .fs, .h, .blk__in p, .blk__in li, .blk__in figcaption, .blk__in summary, .form__req, .form__half label {
    font-size: calc((var(--v, 1) - 1) * 0.012 * min(100vh, 900px) + 1rem);
  }
  .btn--form { font-size: calc(0.003 * min(100vh, 900px) + 1rem); }
}

@media print {
  .hdr, .mnav, .ftr__social, .burger { display: none; }
  body { background: #fff; color: #000; }
}
