/*
 * The one stylesheet. Written from nothing to look like the Squarespace site
 * this one replaced: its colours, type sizes and spacing were read from that
 * site's stylesheet and screenshots, kept in baseline/. None of Squarespace's
 * own CSS is here.
 *
 * Nothing is loaded from another site. The fonts are in ../fonts/, beside
 * their licences. The Content-Security-Policy that Caddy sends refuses inline
 * styles, so every rule the pages need is in this file and no page carries a
 * style attribute.
 */

/* ---------- Fonts ----------
 *
 * Both are variable fonts: one file holds every weight, and the weight range
 * on each rule tells the browser so. Each family is split in two. The
 * "latin" file covers English, and "latin-ext" the accented letters of other
 * European languages. unicode-range makes the browser fetch a file only when
 * the page uses a character in it, so latin-ext is normally never fetched.
 * It is here for a name typed into the form.
 *
 * font-display: swap shows text at once in a fallback font and swaps when
 * the font arrives, so text is never invisible while a font loads.
 */
@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 100 1000;
  font-display: swap;
  src: url("../fonts/dm-sans-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "DM Sans";
  font-style: normal;
  font-weight: 100 1000;
  font-display: swap;
  src: url("../fonts/dm-sans-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("../fonts/bricolage-grotesque-latin.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("../fonts/bricolage-grotesque-latin-ext.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Colours and measures ----------
 *
 * The four colours of the live site. Every pair used for text passes WCAG AA
 * for normal text: navy on grey 11.9 to 1, navy on white 13.5, white on navy
 * 13.5, white on slate 5.6, and slate on grey 4.9, which is used only for
 * the "(required)" notes in the form.
 */
:root {
  --navy: #0f2a43;
  --grey: #e5e8eb;
  --slate: #546478;
  --white: #f6f6f4;
  /* The colour of a line to write on in the form, and of the outline of an
     unticked box. Paler than the text, as on the live site, and 3.3 to 1
     against the grey, which is over the 3 to 1 asked of a control's edge. */
  --line: #6f808f;
  --gutter: 6vw;
  --page-max: 1700px;
  --body-font: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --heading-font: "Bricolage Grotesque", "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

@media (min-width: 768px) {
  :root {
    --gutter: 4vw;
  }
}

/* ---------- Base ---------- */

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

/* The live site's text is 16px up to 991 pixels wide and 17px from there,
   where a browser's default is 16px. It is written as a percentage so that
   a visitor who has set a larger default in their browser still gets larger
   text. */
html {
  font-size: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

@media (min-width: 992px) {
  html {
    font-size: 106.25%;
  }
}

/* The body is a column as tall as the window, and <main> takes the spare
   height, so on a short page the footer still sits at the bottom. */
body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin: 0;
  background: var(--grey);
  color: var(--navy);
  font-family: var(--body-font);
  font-weight: 300;
  letter-spacing: -0.03em;
  line-height: 1.3;
  /* A long word or address breaks before it pushes the page wider than
     the screen, which matters most to a visitor with large text set. */
  overflow-wrap: break-word;
  /* The live site asks for this, and on a Mac it is the difference between
     its light text and noticeably heavier text. Other systems ignore it. */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.page-white {
  background: var(--white);
}

main {
  flex: 1 0 auto;
}

/* Headings are capitalised here and not in the text, as on the live site:
   the copy says "What is the process" and the page shows "What Is The
   Process". A heading's size comes from its class where the level that is
   right for the outline is not the size the design wants. */
h1,
h2,
h3,
h4 {
  margin: 0 0 1rem;
  font-family: var(--heading-font);
  font-weight: 400;
  letter-spacing: -0.04em;
  line-height: 1.1;
  text-transform: capitalize;
}

/* The live site's headings grow with the window: 1.2 hundredths of its
   width for each step of size, on top of the text size. The lines of a
   larger heading are set closer, as they are there. */
h1 {
  font-size: calc(3.6vw + 1rem);
  line-height: 0.968;
}

h2,
.h2 {
  font-size: calc(2.4vw + 1rem);
  line-height: 1.012;
}

.h3 {
  font-size: calc(1.2vw + 1rem);
  line-height: 1.056;
}

.h4 {
  font-size: 1rem;
  line-height: 1.1;
}

/* On a narrow screen held upright, the live site goes by the window's
   height in place of its width, up to 900 pixels of it. In a window 900
   tall that is about 3, 2.35 and 1.65 times the text size. */
@media (max-width: 767px) and (orientation: portrait) {
  h1 {
    font-size: calc(3.6 * min(1vh, 9px) + 1rem);
  }

  h2,
  .h2 {
    font-size: calc(2.4 * min(1vh, 9px) + 1rem);
  }

  .h3 {
    font-size: calc(1.2 * min(1vh, 9px) + 1rem);
  }
}

/* At 1440 pixels wide the rule above gives 4, 3 and 2 times the text size.
   Headings stop growing where the page does, at 1700 pixels. */
@media (min-width: 768px) {
  h1 {
    font-size: min(calc(3.6vw + 1rem), 4.6rem);
  }

  h2,
  .h2 {
    font-size: min(calc(2.4vw + 1rem), 3.4rem);
  }

  .h3 {
    font-size: min(calc(1.2vw + 1rem), 2.2rem);
  }
}

p {
  margin: 0 0 1rem;
}

ul {
  margin: 0 0 1rem;
  padding-left: 2.35rem;
}

li {
  margin-bottom: 0.55rem;
}

strong {
  font-weight: 700;
}

blockquote {
  margin: 0;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.9em;
  letter-spacing: 0;
}

a {
  color: inherit;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 2px;
}

/* A visible ring on whatever the keyboard is on. currentColor keeps it navy
   on the pale bands and pale on the dark ones. */
:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

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

.centre {
  text-align: center;
}

/* Large text follows the headings' rule, a fifth of a step up from the text
   size: by the window's width, by its height on a narrow screen held
   upright, and no larger than it is at 1700 pixels wide. */
.large,
.lead {
  font-size: min(calc(0.24vw + 1rem), 1.24rem);
}

@media (max-width: 767px) and (orientation: portrait) {
  .large,
  .lead {
    font-size: calc(0.24 * min(1vh, 9px) + 1rem);
  }
}

/* Hidden from sight, still read out by a screen reader. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Off the page until the keyboard reaches it, then the first thing shown. */
.skip-link {
  position: absolute;
  top: 0.5rem;
  left: -9999px;
  z-index: 30;
  padding: 0.8rem 1.2rem;
  background: var(--navy);
  color: var(--white);
}

.skip-link:focus {
  left: var(--gutter);
}

/* ---------- Bands ----------
 *
 * A page is a stack of full-width bands. .wrap inside each one holds the
 * content to the page's maximum width and keeps it off the screen's edges.
 */
.band {
  padding-block: clamp(1.75rem, 2.4vw, 2.75rem);
}

/* The band that opens a page under the header. On a wide screen it has more
   room around it than the others. On a narrow one the heading sits just
   above the band that follows, as on the live site. */
.band--opening {
  padding-block: 1rem 0.4rem;
}

@media (min-width: 768px) {
  .band--opening {
    padding-block: clamp(1rem, 3.3vw, 3.75rem) clamp(1.75rem, 3.7vw, 4.25rem);
  }

  /* The contact page's heading sits close under the header. */
  .band--opening-close {
    padding-top: 0.3rem;
  }
}

/* Where the header is navy, the opening band is the same navy and the two
   read as one block, so the band needs no space of its own at the top. */
.site-header--navy + main > .band--navy:first-child {
  padding-top: 0;
  padding-bottom: clamp(1rem, 1.2vw, 1.5rem);
}

.band--slate {
  background: var(--slate);
  color: var(--white);
}

.band--navy {
  background: var(--navy);
  color: var(--white);
}

/* The content is 92 hundredths of the window, up to 1700 pixels, as on the
   live site. The gutters are outside that measure, so past 1700 the content
   stays 1700 wide and only the margins grow. */
.wrap {
  max-width: calc(var(--page-max) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

.wrap--narrow {
  max-width: 54rem;
}

.wrap--form {
  max-width: 65rem;
}

.wrap > :last-child,
.split__text > :last-child,
.tier > :last-child,
.detail > :last-child,
.policy__text > :last-child {
  margin-bottom: 0;
}

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

.site-header--navy {
  background: var(--navy);
  color: var(--white);
}

/* Three columns: the menu, the logo, and an empty one the same width as the
   menu's, which is what puts the logo in the true centre. */
.site-header__inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  row-gap: 1rem;
  max-width: calc(var(--page-max) + 2 * var(--gutter));
  margin-inline: auto;
  padding: 10vw var(--gutter) 5vw;
}

.site-menu {
  grid-column: 1 / -1;
  grid-row: 2;
}

.site-menu ul {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem 1.8rem;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.9rem;
}

.site-menu li {
  margin: 0;
}

.site-menu a {
  display: inline-block;
  padding-block: 0.3rem;
  text-decoration-line: none;
}

.site-menu a:hover,
.site-menu a[aria-current="page"] {
  text-decoration-line: underline;
}

.site-logo {
  grid-column: 2;
  grid-row: 1;
}

.site-logo img {
  display: block;
  width: auto;
  height: 30px;
}

/* The wordmark is navy artwork on a clear background, so on the navy header
   it would not show. The filter turns every drawn pixel black and then
   inverts it to the site's off-white, which needs no second image file. */
.site-header--navy .site-logo img {
  filter: brightness(0) invert(0.96);
}

/* The menu button. It is in the markup of every page and shown by nothing
   here: only the rules further down, which apply once menu.js has marked the
   page, ever show it. So with no script there is no dead button. */
.menu-button {
  display: none;
}

@media (min-width: 768px) {
  .site-header__inner {
    padding-block: 3.3vw;
  }

  .site-menu {
    grid-column: 1;
    grid-row: 1;
  }

  .site-menu ul {
    justify-content: flex-start;
    gap: 0.6rem 2.6rem;
  }

  .site-logo img {
    height: 50px;
  }
}

/* A narrow screen with the script running: the list folds away behind the
   button, and opens as a sheet over the whole screen. */
@media (max-width: 767px) {
  .has-menu-button .menu-button {
    position: relative;
    z-index: 21;
    grid-column: 1;
    grid-row: 1;
    display: block;
    justify-self: start;
    width: 44px;
    height: 44px;
    margin: -7px 0;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    cursor: pointer;
  }

  .menu-button__bars::before,
  .menu-button__bars::after {
    content: "";
    position: absolute;
    left: 0;
    width: 35px;
    height: 1px;
    background: currentColor;
    transition: transform 0.25s ease;
  }

  .menu-button__bars::before {
    top: 16px;
  }

  .menu-button__bars::after {
    top: 27px;
  }

  .menu-open .menu-button__bars::before {
    transform: translateY(5.5px) rotate(45deg);
  }

  .menu-open .menu-button__bars::after {
    transform: translateY(-5.5px) rotate(-45deg);
  }

  .has-menu-button .site-menu {
    display: none;
  }

  .menu-open .site-menu {
    position: fixed;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--grey);
  }

  .menu-open .site-header--navy .site-menu {
    background: var(--navy);
  }

  .menu-open .site-menu ul {
    flex-direction: column;
    align-items: center;
    gap: 1.2rem;
    font-size: max(8.5vmin, 1.5rem);
  }

  .menu-open .site-logo {
    position: relative;
    z-index: 21;
  }

  /* The page behind the open menu must not scroll. */
  .menu-open body {
    overflow: hidden;
  }
}

/* ---------- Home: heading beside text ----------
 *
 * In the markup the heading always comes first, which is the order a screen
 * reader and a narrow screen want. On a wide screen the two sit side by
 * side, and --heading-right moves the heading to the right-hand column
 * without changing that order.
 */
/* On a narrow screen the live site sets these headings in a box about half
   the screen wide, so that most break into two lines. */
.split__heading {
  max-width: 47vw;
  margin: 0 auto 1.5rem;
  text-align: center;
}

@media (min-width: 768px) {
  .split {
    display: grid;
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  .split__heading {
    grid-column: 1;
    grid-row: 1;
    max-width: none;
    margin: 0;
  }

  .split__text {
    grid-column: 2;
    grid-row: 1;
  }

  .split--heading-right .split__heading {
    grid-column: 2;
  }

  .split--heading-right .split__text {
    grid-column: 1;
    padding-right: 1.2rem;
  }
}

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

.button {
  display: inline-block;
  min-width: min(100%, 17.9rem);
  padding: 1rem 2rem;
  border: 1px solid currentColor;
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.button:hover {
  background: var(--navy);
  color: var(--white);
}

/* On a narrow screen the contact page's button runs the width of the text,
   as on the live site. */
.button--full-narrow {
  display: block;
}

@media (min-width: 768px) {
  .button--large {
    padding-block: 1.7rem;
  }

  .button--full-narrow {
    display: inline-block;
    min-width: min(100%, 19.5rem);
  }
}

.button--wide {
  display: block;
  width: 100%;
  padding-block: 1.05rem;
}

/* ---------- Services ---------- */

.tiers {
  max-width: 66rem;
  margin: 0 auto 2.5rem;
  text-align: center;
}

/* A little narrower than the screen on a narrow one, as on the live site. */
.tier {
  max-width: 79vw;
  margin: 0 auto 2.5rem;
}

.tier .h3 {
  margin-bottom: 1.6rem;
}

.tier blockquote {
  margin-bottom: 1.6rem;
}

@media (min-width: 768px) {
  .tiers {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    column-gap: 5.5vw;
  }

  .tier {
    max-width: none;
    margin: 0;
  }

  .tier .h3 {
    margin-bottom: 2.2rem;
  }

  .tier blockquote {
    min-height: 4.6rem;
    margin-bottom: 1.4rem;
  }
}

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

.lead {
  max-width: 45rem;
  margin: 0 auto 1rem;
  text-align: center;
}

@media (min-width: 768px) {
  .lead {
    margin-top: 1.7rem;
  }
}

.details {
  margin-top: 2rem;
  text-align: center;
}

.detail {
  margin-bottom: 2rem;
}

.detail .h4 {
  margin-bottom: 1.2rem;
}

@media (min-width: 768px) {
  .details {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    column-gap: var(--gutter);
  }

  .detail {
    margin-bottom: 0;
  }

  .detail .h4 {
    margin-bottom: 1.9rem;
  }
}

/* ---------- Privacy policy ---------- */

.card {
  padding: clamp(1.4rem, 4vw, 3.4rem);
  border-radius: 0.6rem;
  background: var(--grey);
}

.policy__title {
  margin-bottom: 1.5rem;
}

.policy__text .h4 {
  margin: 2.2rem 0 1.6rem;
}

@media (min-width: 900px) {
  .policy {
    display: grid;
    grid-template-columns: 55% 45%;
    align-items: start;
  }
}

/* ---------- The enquiry form ---------- */

.enquiry {
  margin-top: 2.5rem;
}

.field,
.field-group {
  min-width: 0;
  margin: 0 0 0.7rem;
  padding: 0;
  border: 0;
}

.field-group .field {
  margin-bottom: 0;
}

.field-group legend {
  margin-bottom: 0.35rem;
  padding: 0;
}

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 0.6rem;
}

.field label {
  display: block;
}

/* "First Name" and "Last Name", under "Name", are a size smaller. */
.field-row label {
  font-size: 0.9rem;
}

.field__required {
  margin-left: 0.25rem;
  color: var(--slate);
}

/* A field is a line to write on: no box, a bottom border only. */
.field input,
.field textarea {
  display: block;
  width: 100%;
  padding: 0.9rem 0 0.5rem;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
}

.field textarea {
  min-height: 7rem;
  resize: vertical;
}

.field input:focus-visible,
.field textarea:focus-visible {
  outline-offset: 2px;
}

.field input:focus,
.field textarea:focus {
  border-bottom-color: currentColor;
}

.field [aria-invalid="true"] {
  border-bottom: 3px solid currentColor;
}

.field__error {
  margin: 0.4rem 0 0;
  font-weight: 700;
}

/* A tick box drawn as an outlined label, filled in when ticked. The real box
   is laid over the whole label and made see-through, not removed, so the
   keyboard and a screen reader still find it and a tap anywhere on the
   label lands on it. */
.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 0.85rem;
}

.choice {
  position: relative;
  cursor: pointer;
}

.choice input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

/* 24 pixels tall, as on the live site, which is also the least WCAG 2.2
   asks of something to be tapped. */
.choice span {
  display: inline-block;
  min-height: 24px;
  padding: 0.1rem 0.6rem;
  border: 1px solid var(--line);
  font-size: 0.9rem;
}

.choice input:checked + span {
  border-color: var(--navy);
  background: var(--navy);
  color: var(--white);
}

.choice input:focus-visible + span {
  outline: 2px solid var(--navy);
  outline-offset: 3px;
}

/* The trap field: see partials/enquiry-form.php. Moved off the page and not
   switched off with "display: none", which some programs look for. */
.field--trap {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

.enquiry__notice {
  margin-bottom: 1.8rem;
  padding: 1rem 1.2rem;
  border: 1px solid currentColor;
  border-left-width: 0.4rem;
}

.enquiry__notice > :last-child {
  margin-bottom: 0;
}

/* A browser moves to the notice when a form comes back with something
   wrong. The margin keeps the heading above it in view. The notice is not
   something to press, so it takes no focus ring. */
.enquiry__notice {
  scroll-margin-top: 6rem;
}

.enquiry__notice:focus {
  outline: none;
}

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

.site-footer {
  padding-block: 2.5rem 1.6rem;
  background: var(--grey);
}

.site-footer__inner {
  display: grid;
  row-gap: 1.6rem;
  max-width: calc(var(--page-max) + 2 * var(--gutter));
  margin-inline: auto;
  padding-inline: var(--gutter);
}

/* A column may shrink below the width of its longest word, which then
   wraps. Without this a visitor with very large text gets a page wider than
   the screen. */
.site-footer__inner > *,
.tier,
.detail,
.split > * {
  min-width: 0;
}

.site-footer__contact p {
  margin: 0 0 0.9rem;
}

.site-footer__contact p:last-child {
  margin-bottom: 0;
}

.site-footer__contact strong {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

.site-footer__logo {
  display: block;
  width: 100%;
}

.site-footer__links ul {
  margin: 0;
  padding: 0;
  list-style: none;
  text-align: right;
}

.site-footer__links li {
  margin: 0 0 0.9rem;
}

.site-footer__links li:last-child {
  margin-bottom: 0;
}

.site-footer__legal {
  margin: 0;
  text-align: center;
}

@media (min-width: 768px) {
  .site-footer__inner {
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    column-gap: 2rem;
  }

  .site-footer__logo {
    width: 20.5vw;
    max-width: 21rem;
  }

  .site-footer__legal {
    grid-column: 1 / -1;
  }
}

/* ---------- Movement ----------
 *
 * The few transitions above are switched off for a visitor who has asked
 * their system for less movement.
 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
  }
}
