/* ------------------------------------------------------------------
   a plus a studio — site styles

   Metrics taken off the design screenshots:
     content column 977px, 4 columns, 23px column gap, 29.5px row gap
     type: Outfit — body 13.5/17, titles 17/20, nav 16.5, footer 12
     body copy is justified; every image is greyscale until hovered
------------------------------------------------------------------ */

:root {
  --content: 977px;
  --col-gap: 23px;
  --row-gap: 29.5px;

  --ink: #111111;      /* headings, active nav */
  --body: #3a3a3a;     /* body copy */
  --muted: #9b9b9b;    /* inactive nav */
  --rule: #c2c2c2;     /* footer hairline */

  --fs-body: 13.5px;
  --lh-body: 17px;
  --fs-title: 17px;
  --lh-title: 20px;
  --fs-nav: 16.5px;
  --fs-foot: 12px;
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: #ffffff;
  color: var(--body);
  font-family: 'Outfit', 'Century Gothic', 'Futura', 'Trebuchet MS', sans-serif;
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a { color: inherit; text-decoration: none; }

/* ---------- page shell — footer is pushed to the bottom of the window ---------- */

.page {
  width: min(var(--content), calc(100% - 48px));
  margin: 0 auto;
  padding-top: 57px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

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

.site-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}

.logo { display: block; }
.logo img { width: 115px; height: 55px; }

.site-nav {
  display: flex;
  gap: 26px;
  font-size: var(--fs-nav);
  line-height: var(--lh-title);
  margin-bottom: -5px;   /* nav baseline sits just below the logo */
}

.site-nav a {
  color: var(--muted);
  font-weight: 400;
  transition: color 0.25s ease;
}

.site-nav a:hover { color: var(--ink); }

.site-nav a.is-active {
  color: var(--ink);
  font-weight: 500;
}

/* ---------- main ---------- */

main { margin-top: 70px; flex: 1 0 auto; }

/* ---------- the grid ---------- */

.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  column-gap: var(--col-gap);
  row-gap: var(--row-gap);
}

/* ---------- shared image behaviour: greyscale, colour on hover ---------- */

.shot {
  width: 100%;
  height: auto;
  object-fit: cover;
  filter: grayscale(1);
  transition: filter 0.45s ease;
}

.card:hover .shot,
.row:hover .shot { filter: grayscale(0); }

/* ---------- headings + copy ---------- */

h1, h2, h3 {
  margin: 0;
  font-size: var(--fs-title);
  line-height: var(--lh-title);
  font-weight: 400;
  color: var(--ink);
}

p {
  margin: 0;
  text-align: justify;
}

/* ---------- project / team card ---------- */

.card { display: block; }

.card .shot { aspect-ratio: 227 / 165; }

.card h2,
.card h3 { margin-top: 7.5px; }

.card p {
  margin-top: 5px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* team members are portraits and carry role lines instead of copy; the role
   block always reserves three lines so the rows stay on the grid */
.card--person .shot { aspect-ratio: 227 / 283; }

.card--person p {
  display: block;
  overflow: visible;
  min-height: 51px;
  text-align: left;
}

/* ---------- two-column rows (services, office intro) ---------- */

.row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: var(--col-gap);
  align-items: end;          /* copy sits on the baseline of the image */
  margin-bottom: 18.5px;     /* 23px from image bottom to the next image */
}

/* the copy runs 4.5px past the bottom of the image, as in the design */
.row .shot {
  aspect-ratio: 477 / 256;
  margin-bottom: 4.5px;
}

.row h2 { margin-bottom: 5px; }

main > .row:first-child { margin-top: 5px; }

.row--intro {
  margin-bottom: 0;
}

.row--intro .shot { aspect-ratio: 477 / 283; }

.row--intro + .grid { margin-top: 110.5px; }

/* ---------- project detail ---------- */

.hero {
  width: 100%;
  aspect-ratio: 976 / 548;
  object-fit: cover;
}

.detail h1 { margin-top: 43.5px; }

.facts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  column-gap: var(--col-gap);
  margin-top: 15px;
}

.facts .fact {
  display: grid;
  grid-template-columns: 79px 1fr;
  margin: 0;
}

.facts dt {
  font-weight: 500;
  color: var(--ink);
}

.facts dd { margin: 0; }

.detail > p { margin-top: 17px; }

.detail .grid { margin-top: 37.5px; }

/* ---------- footer ---------- */

.site-foot {
  margin-top: 24px;
  padding: 10.5px 0 52.5px;
  border-top: 1px solid var(--rule);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  column-gap: var(--col-gap);
  font-size: var(--fs-foot);
  line-height: 16px;
  color: var(--body);
  flex-shrink: 0;
}

.site-foot .foot-name { grid-column: 1 / span 2; }
.site-foot .foot-tel  { grid-column: 3; text-align: right; }
.site-foot .foot-mail { grid-column: 4; text-align: right; }

.site-foot a { transition: color 0.25s ease; }
.site-foot a:hover { color: var(--ink); }

/* ------------------------------------------------------------------
   Narrow screens

   The design only specifies desktop. Below 900px the four-up grid and
   the side-by-side rows stop working, so they collapse; below 560px the
   header stacks and the type steps up a little for phone reading.
------------------------------------------------------------------ */

@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(2, 1fr); }

  /* image over copy — side by side leaves the text far taller than the image */
  .row {
    grid-template-columns: 1fr;
    row-gap: 12px;
    margin-bottom: 44px;
  }
  .row .shot { margin-bottom: 0; }
  .row--intro { margin-bottom: 44px; }
  .row--intro + .grid { margin-top: 0; }

  .facts { grid-template-columns: repeat(2, 1fr); row-gap: 14px; }

  .site-foot .foot-tel  { grid-column: 3 / span 2; }
  .site-foot .foot-mail { grid-column: 3 / span 2; }
}

@media (max-width: 560px) {
  :root {
    --fs-body: 15px;
    --lh-body: 21px;
    --fs-title: 18px;
    --lh-title: 22px;
    --fs-nav: 17px;
    --fs-foot: 13px;
  }

  .page { padding-top: 34px; }
  main { margin-top: 40px; }

  /* logo keeps its size; the nav drops onto its own line beneath it */
  .site-head { flex-wrap: wrap; row-gap: 16px; }
  .logo { flex: 0 0 auto; }
  .site-nav {
    width: 100%;
    gap: 24px;
    margin-bottom: 0;
    line-height: 1.2;
  }

  /* justification opens ugly gaps in a narrow measure */
  p { text-align: left; }

  .grid { grid-template-columns: 1fr; row-gap: 34px; }
  .card p { -webkit-line-clamp: none; line-clamp: none; }
  .card--person p { min-height: 0; }

  .row, .row--intro { margin-bottom: 34px; }

  .facts { grid-template-columns: 1fr; row-gap: 12px; }
  .facts .fact { grid-template-columns: 90px 1fr; }

  .detail h1 { margin-top: 28px; }
  .detail .grid { margin-top: 30px; }

  .site-foot { grid-template-columns: 1fr; row-gap: 4px; padding-bottom: 36px; }
  .site-foot .foot-name,
  .site-foot .foot-tel,
  .site-foot .foot-mail { grid-column: 1; text-align: left; }
}

/* touch devices have no hover — show the images in colour */
@media (hover: none) {
  .shot { filter: grayscale(0); }
}
