/*
  Telegraph Post — site styles.

  Fluid sizing:
  - Type:   size = (value - 1) * unit + 1rem
            unit = min(1.2vw, 24px) at >= 768px, 1.2% of min(100vh, 900px) below.
  - Grid:   24 columns (8 on mobile) inside a 4vw (6vw mobile) gutter, 11px gaps,
            desktop rows = container width * 0.0215.
  Each block is placed with a grid-area per layout:
  --m (mobile) and --d (desktop, >= 768px).
*/

@import url("https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,400;1,400&display=swap");

/* Cooper Hewitt: Book is the body text (400), Bold is the button text (700). */
@font-face {
  font-family: "Cooper Hewitt";
  src: url("../fonts/cooper-hewitt-book.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Cooper Hewitt";
  src: url("../fonts/cooper-hewitt-book-italic.woff2") format("woff2");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Cooper Hewitt";
  src: url("../fonts/cooper-hewitt-bold.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --navy: #253551;
  --stone: #e0e0db;
  --white: #ffffff;
  --black: #000000;
  --hero-base: rgb(37, 57, 86);

  --heading-font: "Roboto", Arial, sans-serif;
  --body-font: "Cooper Hewitt", "Arial Narrow", Arial, sans-serif;

  /* Fluid type unit */
  --u: min(1.2vw, 24px);
  --fs-h1: calc(3 * var(--u) + 1rem);
  --fs-h2: calc(1.5 * var(--u) + 1rem);
  --fs-h3: calc(1.1 * var(--u) + 1rem);
  --fs-h4: calc(0.4 * var(--u) + 1rem);
  --fs-large: calc(0.3 * var(--u) + 1rem);
  --fs-normal: calc(0.2 * var(--u) + 1rem);
  --fs-small: calc(0.1 * var(--u) + 1rem);
  --fs-button: 0.8rem;

  /* Layout grid */
  --gutter: 4vw;
  --gap: 11px;
  --cols: 24;
  --container: min(2000px, calc(100vw - var(--gutter) * 2));
  --col: calc((var(--container) - var(--gap) * (var(--cols) - 1)) / var(--cols));
  --row: calc(var(--container) * 0.0215);

  /* Header */
  --header-pad-y: 2vw;
  --header-pad-x: 4vw;
  --logo-h: 65px;
  --header-h: calc(var(--header-pad-y) * 2 + var(--logo-h));
}

@media (max-width: 799px) {
  :root {
    --header-pad-y: 6vw;
    --header-pad-x: 6vw;
  }
}

@media (max-width: 767px) {
  :root {
    --u: calc(min(100vh, 900px) * 0.012);
    --gutter: 6vw;
    --cols: 8;
    --row: 24px;
    --logo-h: 40px;
  }
}

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

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

body {
  margin: 0;
  background: var(--navy);
  color: var(--white);
  font-family: var(--body-font);
  font-weight: 400;
  font-size: var(--fs-normal);
  line-height: 1.3;
  letter-spacing: -0.02em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
}

h1,
h2,
h3,
h4 {
  margin: 2rem 0;
  font-family: var(--heading-font);
  font-weight: 400;
  font-style: normal;
  letter-spacing: -0.02em;
  white-space: pre-wrap;
}

/* line-height = 1.1 * (1 + (1 - size) / 25): tighter leading for larger headings */
h1 {
  font-size: var(--fs-h1);
  line-height: 0.968;
}

h2 {
  font-size: var(--fs-h2);
  line-height: 1.034;
}

h3 {
  font-size: var(--fs-h3);
  line-height: 1.0516;
}

h4 {
  font-size: var(--fs-h4);
  line-height: 1.0824;
}

p {
  margin: 1rem 0;
  font-size: var(--fs-normal);
  line-height: 1.3;
  letter-spacing: inherit;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}

p.large {
  font-size: var(--fs-large);
}

p.small {
  font-size: var(--fs-small);
}

ul {
  margin: 1em 0;
  padding-left: 40px;
}

li {
  list-style: none;
}

li > p {
  margin: 0.5em 0;
}

li > p::before {
  content: "•";
  display: inline-block;
  width: 40px;
  margin-left: -40px;
  text-align: center;
}

em {
  font-style: italic;
}

.text > :first-child {
  margin-top: 0;
}

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

.text a {
  white-space: normal;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

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

.site-header {
  position: absolute;
  inset: 0 0 auto;
  z-index: 30;
  padding: var(--header-pad-y) var(--header-pad-x);
}

.site-header__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: var(--logo-h);
}

.site-logo img {
  width: auto;
  height: 65px;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 2vw;
}

.site-nav a {
  padding: 0.1em 0;
  font-size: var(--fs-small);
  line-height: 1.3;
  letter-spacing: -0.02em;
  text-decoration: none;
  color: var(--white);
}

.site-nav a[aria-current="page"] {
  background-image: linear-gradient(currentColor, currentColor);
  background-repeat: repeat-x;
  background-size: 1px 1px;
  background-position: 0 calc(100% - 0.1em);
}

.burger {
  display: none;
  position: relative;
  width: 47px;
  height: 37px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.burger span {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 6px;
  width: 35px;
  height: 1px;
  margin: auto;
  background: var(--white);
  transition:
    transform 250ms cubic-bezier(0.2, 0.6, 0.3, 1),
    width 250ms cubic-bezier(0.2, 0.6, 0.3, 1),
    background-color 250ms ease;
}

.burger span:first-child {
  transform: translateY(-5.5px);
}

.burger span:last-child {
  transform: translateY(5.5px);
}

.menu-open .burger span {
  width: 28px;
  background: var(--black);
}

.menu-open .burger span:first-child {
  transform: translateX(3.5px) rotate(-135deg);
}

.menu-open .burger span:last-child {
  transform: translateX(3.5px) rotate(135deg);
}

.mobile-menu {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  align-items: center;
  justify-content: center;
  padding-top: var(--header-h);
  background: var(--stone);
  opacity: 0;
  visibility: hidden;
  transition:
    visibility 0.6s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-menu nav {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.mobile-menu a {
  margin: 3vw 5vw;
  font-size: 8.5vmin;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--black);
  text-decoration: none;
  transition: opacity 250ms cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-menu a:hover {
  opacity: 0.9;
}

.menu-open .mobile-menu {
  opacity: 1;
  visibility: visible;
}

.menu-open {
  overflow: hidden;
}

@media (max-width: 799px) {
  .site-nav {
    display: none;
  }

  .burger,
  .mobile-menu {
    display: flex;
  }
}

@media (max-width: 767px) {
  .site-logo img {
    height: 40px;
  }
}

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

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 24px 35.2px;
  border: 0;
  border-radius: 300px;
  background: var(--white);
  color: var(--black);
  font-family: var(--body-font);
  font-size: var(--fs-button);
  font-weight: 700;
  line-height: normal;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  transition: opacity 0.1s linear;
}

/* Trim the label to cap height so the all-caps text is optically centered
   (otherwise the descender space pushes it ~2-4px above center). */
.button__label {
  text-box: trim-both cap alphabetic;
}

.button:hover,
.button:focus-visible {
  opacity: 0.8;
}

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

.section {
  position: relative;
}

.section--content {
  min-height: 33vh;
}

.section--content > .grid {
  padding-top: 4vw;
  padding-bottom: 6.6vmax;
}

.section--first {
  padding-top: var(--header-h);
}

.section--stone {
  background: var(--stone);
  color: var(--black);
}

.section--stone :is(h1, h2, h3, h4),
.section--stone .text a {
  color: var(--navy);
}

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

.section--navy :is(h1, h2, h3, h4) {
  color: var(--stone);
}

/* ---------- Layout grid ---------- */

.grid {
  display: grid;
  grid-template-columns:
    minmax(calc(var(--gutter) - var(--gap)), 1fr)
    repeat(var(--cols), minmax(0, calc((2000px - var(--gap) * (var(--cols) - 1)) / var(--cols))))
    minmax(calc(var(--gutter) - var(--gap)), 1fr);
  grid-template-rows: repeat(var(--rows-m), minmax(var(--row), auto));
  gap: var(--gap);
}

/* Blocks stay display: block (so text margins collapse normally)
   and are vertically aligned inside their grid area with align-self. */
.grid > * {
  grid-area: var(--m);
  align-self: var(--jm, flex-start);
  min-width: 0;
}

@media (min-width: 768px) {
  .grid {
    grid-template-rows: repeat(var(--rows), minmax(var(--row), auto));
  }

  .grid > * {
    grid-area: var(--d);
    align-self: var(--jd, flex-start);
  }
}

/* Image blocks fill their grid area and never push row heights. */
.grid > .media {
  position: relative;
  align-self: stretch;
  overflow: hidden;
}

.media img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media--contain img {
  object-fit: contain;
}

/* Image overlays: a colored layer blended over the photo. */
.media--overlay::after {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--overlay-color);
  mix-blend-mode: var(--overlay-blend);
  pointer-events: none;
}

/* Deepens shadows and adds contrast (Technical Infrastructure photo). */
.media--overlay-contrast {
  --overlay-color: rgba(0, 0, 0, 0.5);
  --overlay-blend: overlay;
}

/* Tints white areas to the stone color (Little Brick House logo). */
.media--overlay-tint {
  --overlay-color: var(--stone);
  --overlay-blend: darken;
}

/* On phones, stack this grid's blocks in source order with even spacing
   instead of the fixed row spans (which leave large, uneven gaps). */
@media (max-width: 767px) {
  .grid--stack-mobile {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding-left: var(--gutter);
    padding-right: var(--gutter);
  }

  .grid--stack-mobile > * {
    align-self: stretch;
    margin: 0;
  }

  .grid--stack-mobile > .media {
    aspect-ratio: 5 / 3;
    margin-top: 48px;
  }

  /* Letterboxed images (logo cloud) show at their natural shape. */
  .grid--stack-mobile > .media--contain {
    aspect-ratio: auto;
  }

  .grid--stack-mobile > .media--contain img {
    position: static;
    height: auto;
  }

  /* Even padding for stacked content sections (desktop uses 4vw top / 6.6vmax bottom). */
  .section--content > .grid--stack-mobile {
    padding-top: 40px;
    padding-bottom: 48px;
  }

  /* Height follows content (drops the 33vh minimum that pads tall phones). */
  .section--content:has(> .grid--stack-mobile) {
    min-height: 0;
  }

  /* The small, light logos read as a bigger gap, so tighten below them. */
  .section--content > .grid--stack-mobile:has(> .media--contain:last-child) {
    padding-bottom: 32px;
  }

  .grid--stack-mobile > :first-child + .media {
    margin-top: 24px;
  }

  .grid--stack-mobile > .media + * {
    margin-top: 16px;
  }

  .grid--stack-mobile > * + .text:not(.media + *) {
    margin-top: 8px;
  }
}

/* ---------- Home hero ---------- */

.hero {
  position: relative;
  overflow: hidden;
  padding: 96px 0 28px;
  background: var(--hero-base);
}

.hero__canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.hero__content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 78px var(--gutter) 36px;
  text-align: center;
}

.hero h1 {
  width: min(100%, calc(12 * var(--col) + 11 * var(--gap)));
  margin: 0 0 40px;
  color: var(--stone);
}

/* 10 grid columns, but never narrower than the ~532px it measures at a
   1406px-wide window, so the text keeps that measure down to the phone layout. */
.hero p {
  width: min(100%, max(calc(10 * var(--col) + 9 * var(--gap)), 532px));
  margin: 0 0 22px;
}

.hero p:last-of-type {
  margin-bottom: 34px;
}

/* Buttons keep one size at every width (their size at a 1158px-wide window).
   Send shares the height. */
.hero .button,
.contact-form .button {
  height: 52.8px;
  padding-top: 0;
  padding-bottom: 0;
}

.hero .button {
  width: 168.4px;
  white-space: nowrap;
}

.hero__pause {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 2;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.5);
  -webkit-backdrop-filter: blur(15px);
  backdrop-filter: blur(15px);
  cursor: pointer;
}

.hero__pause::after {
  content: "";
  position: absolute;
  top: 10px;
  left: 11px;
  width: 10px;
  height: 12px;
  border-left: 10px double var(--white);
}

.hero__pause[aria-pressed="true"]::after {
  top: 9px;
  left: 12px;
  width: 0;
  height: 0;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 11px solid var(--white);
}

@media (max-width: 767px) {
  /* Start the headline a fixed 40px below the header instead of a large fixed offset. */
  .hero {
    padding-top: var(--header-h);
  }

  .hero__content {
    padding-top: 40px;
  }
}

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

.footer-logo img {
  width: 100%;
  height: auto;
}

.footer-email p {
  margin: 0;
}

.footer-email a {
  display: inline-block;
}

/* Below the grid breakpoint, use a compact footer: header-size logo and
   email instead of the full-width grid layout. */
@media (max-width: 767px) {
  .site-footer .grid {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 16px 24px;
    padding: 40px var(--gutter);
  }

  .site-footer .footer-logo {
    order: 1;
    align-self: center;
    width: 156px;
  }
}

@media (max-width: 479px) {
  .site-footer .grid {
    flex-direction: column;
    align-items: flex-start;
  }

  .site-footer .footer-logo {
    order: 0;
    align-self: flex-start;
  }
}

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

.contact-form {
  margin: 0;
}

.contact-form fieldset {
  display: flex;
  flex-wrap: wrap;
  gap: 0 10px;
  margin: 0;
  padding: 0;
  border: 0;
}

.contact-form legend,
.contact-form .field-title {
  display: block;
  width: 100%;
  padding: 0 0 4px;
  font-size: var(--fs-normal);
  line-height: 1.3;
}

.contact-form .field {
  display: grid;
  margin: 0 0 20px;
}

.contact-form fieldset .field {
  flex: 1 1 0;
  min-width: 0;
}

.contact-form .field-caption {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  margin: 4px 0 0;
  padding: 0 0 2px;
  font-size: var(--fs-small);
  line-height: 1.3;
}

.contact-form .required {
  margin-left: 0.5em;
  font-size: var(--fs-small);
  opacity: 0.7;
}

.contact-form .field-caption .required {
  line-height: 1;
}

.contact-form input,
.contact-form textarea {
  display: block;
  width: 100%;
  margin: 0;
  padding: 8px 15px;
  border: 1px solid var(--black);
  border-radius: 1.2692em;
  background: rgba(255, 255, 255, 0);
  color: var(--black);
  font: inherit;
  font-size: var(--fs-normal);
  line-height: 1.3;
  letter-spacing: -0.02em;
  outline: none;
  box-shadow: 0 0 0 1px transparent;
  transition: background-color 0.15s cubic-bezier(0.33, 1, 0.68, 1);
}

.contact-form input:focus,
.contact-form textarea:focus {
  background: rgba(255, 255, 255, 0.1);
}

.contact-form textarea {
  height: 100px;
  resize: vertical;
}

.contact-form .button {
  color: var(--navy);
}

.contact-form__note {
  margin: 12px 0 0;
  font-size: var(--fs-small);
}

.contact-form__note:empty {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .burger span,
  .mobile-menu,
  .mobile-menu a,
  .button {
    transition: none;
  }
}
