/* ==========================================================================
   Ben Tilford – styles
   Layout, colours and measurements taken from the original WordPress site:
   fixed white sidebar on the left, full-screen hero, masonry portfolio,
   project pages with images at their own size and side-by-side galleries.
   Fonts and colours are the variables below.
   ========================================================================== */

:root {
  --sidebar: 250px;
  --ink: #000;
  --text: #666;
  --link: #434343;
  --line: #e9ecee;
  --footer-bg: #f2f5f6;
  --footer-text: #616262;
  --focus: #1a6fa5;

  --f-body: "Merriweather", Georgia, "Times New Roman", serif;
  --f-head: "Roboto Condensed", "Arial Narrow", Arial, sans-serif;
  --f-ui: "Titillium Web", "Segoe UI", Arial, sans-serif;

  --gx: 19px;   /* gap between portfolio tiles, sideways */
  --gy: 16px;   /* gap between portfolio tiles, vertical */
  --para: 31.5px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }

body {
  margin: 0; background: #fff; color: var(--text);
  font-family: var(--f-body); font-size: 16px; line-height: 1.97;
}
img { max-width: 100%; height: auto; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: fixed; left: 10px; top: -60px; z-index: 100; background: #000; color: #fff; padding: 8px 14px; font-family: var(--f-ui); }
.skip-link:focus { top: 10px; }

/* ---- Sidebar ------------------------------------------------------------ */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 30;
  background: #fff; box-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
  padding: 28px 25px 14px;
  display: flex; flex-direction: column; justify-content: space-between;
  overflow-y: auto;
}
.sidebar__menu { display: contents; }
.brand__logo { display: inline-block; line-height: 0; }
.brand__logo img { width: 114px; height: 114px; border-radius: 50%; object-fit: cover; }
.brand__name { margin: 12px 0 0; font: 700 28px/1.2 var(--f-ui); text-transform: uppercase; }
.brand__name a { color: var(--ink); text-decoration: none; }
.brand__tag { margin: 4px 0 0; font: 400 12px/21px var(--f-head); color: var(--ink); }

.nav ul { list-style: none; margin: 0; padding: 0; }
.nav a { display: block; text-decoration: none; font: 600 17px/60px var(--f-ui); color: var(--ink); }
.nav a[aria-current="page"] { color: var(--link); }
.nav a:hover { color: var(--link); }

.social { list-style: none; margin: 0; padding: 0; display: flex; justify-content: center; gap: 21px; }
.social a { color: var(--ink); display: block; line-height: 0; }
.social a:hover { opacity: 0.6; }
.menu-toggle { display: none; }

/* ---- Main column -------------------------------------------------------- */
.site-main { margin-left: var(--sidebar); }

/* ---- Hero --------------------------------------------------------------- */
.hero { position: relative; overflow: hidden; background: #cfd2dc; }
.hero img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center top; }
.hero--home { height: 100vh; }
.hero--page { height: 33.2vh; min-height: 200px; }
/* hero_focus: the picture fills the banner's width and the banner is centred on a point
   --focus (a % of the width) down from the top of the picture. Bigger number = lower down. */
.hero--page { container-type: inline-size; }
.hero--page img.hero__img--focus { position: absolute; left: 0; width: 100%; height: auto; top: min(0px, calc(50% - var(--focus))); }
.hero--page::after { content: ""; position: absolute; inset: 0; background: rgba(0, 0, 0, 0.5); }
.hero__title {
  position: absolute; inset: 0; z-index: 1; margin: 0; padding: 0 24px;
  display: flex; align-items: center; justify-content: center; text-align: center;
  font: 700 38px/1.2 var(--f-ui); color: #fff;
}
.hero__scroll {
  position: absolute; left: 50%; bottom: 34px; transform: translateX(-50%); z-index: 1;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  color: #fff; text-decoration: none; font: 700 10px/1.4 var(--f-body); letter-spacing: 0.2em; text-transform: uppercase;
}

/* ---- Portfolio grid ----------------------------------------------------- */
.portfolio { padding-bottom: 8px; }
.portfolio__title { margin: 0; padding: 30px 20px 0; text-align: center; font: 700 36px/1.2 var(--f-head); color: var(--ink); }
.grid { margin-top: 36px; display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--gy) var(--gx); align-items: start; }
.grid.is-masonry { display: flex; align-items: flex-start; gap: var(--gx); }
.grid .col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: var(--gy); }

.card a { display: block; position: relative; color: #fff; text-decoration: none; }
.card img { display: block; width: 100%; height: auto; }
.card__body {
  position: absolute; inset: 0; padding: 0 12px 12px;   /* 12px from the left and 12px from the bottom */
  display: flex; flex-direction: column; justify-content: flex-end;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, 0.3));
  transition: background-color 0.3s;
}
.card a:hover .card__body, .card a:focus-visible .card__body { background-color: rgba(0, 0, 0, 0.38); }
/* margin-bottom cancels the space under the letters so the baseline sits exactly 12px from the bottom */
.card__title { margin: 0 0 -0.26em; font: 700 24px/1.2 var(--f-head); text-shadow: 0 1px 8px rgba(0, 0, 0, 0.2); }

/* ---- About -------------------------------------------------------------- */
.home-about { margin-top: 36px; padding: 120px 0 130px; }
.home-about--page { margin-top: 0; padding-top: 63px; }
.about { display: grid; grid-template-columns: minmax(0, 1.07fr) minmax(0, 1fr); align-items: start; }
.about__text { padding: 0 30px 0 53px; }
.about__text p { margin: 0 0 var(--para); }
.about__photo img { display: block; width: 100%; height: auto; }

/* ---- Project / text pages ---------------------------------------------- */
/* Everything on a project page sits in one 820px column so left and right edges line up */
.entry { width: min(820px, calc(100% - 40px)); margin: 0 auto; padding: 63px 0 0; }
.entry p { margin: 0 0 var(--para); }
.entry a { color: var(--link); text-underline-offset: 3px; }
.entry .center { text-align: center; }
.entry figure { margin: 0 0 var(--para); }
.entry figcaption { margin-top: 0.5em; font-size: 13px; line-height: 1.6; color: #555; text-align: center; }
.entry img { display: block; width: 100%; max-width: 100%; height: auto; }
[data-zoom] { cursor: zoom-in; }

/* Side-by-side images, cropped to the same height (like the WordPress gallery).
   --cols is the number of pictures per row; an odd one out fills its row. */
.gallery { --c: var(--cols); display: flex; flex-wrap: wrap; gap: 0.5em; margin: 0 0 var(--para); }
.entry .gallery figure {
  margin: 0; display: flex; flex-direction: column; flex-grow: 1;
  width: calc((100% - 0.5em * (var(--c) - 1)) / var(--c));
}
.gallery img { flex: 1 0 0%; width: 100%; height: 100%; object-fit: cover; }
@media (max-width: 599px) { .gallery { --c: min(var(--cols), 2); } }

/* One row, same height, widths follow each picture's shape (nothing cropped) */
.tiled { display: flex; gap: 4px; margin: 0 0 var(--para); }
.entry .tiled figure { margin: 0; min-width: 0; flex: var(--r) 1 0; }
.tiled img { width: 100%; height: auto; }

.page-contact .entry { padding-bottom: 52px; }

/* ---- Project thumbnail menu (bottom of each project page) ---------------- */
.project-gallery { width: min(820px, calc(100% - 40px)); margin: 70px auto 80px; }
.project-gallery ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: 0.5em; }
.project-gallery a { position: relative; display: block; aspect-ratio: 1; overflow: hidden; background: #cfd2dc; color: #fff; text-decoration: none; }
.project-gallery img { display: block; width: 100%; height: 100%; object-fit: cover; }
.project-gallery__title {
  position: absolute; inset: auto 0 0 0; padding: 22px 7px 7px;
  font: 700 13px/1.2 var(--f-head); background: linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.7));
  opacity: 0; transition: opacity 0.2s;
}
.project-gallery a:hover .project-gallery__title, .project-gallery a:focus-visible .project-gallery__title { opacity: 1; }
.project-gallery a[aria-current="page"] img { opacity: 0.3; }
.project-gallery a[aria-current="page"] { cursor: default; }
@media (max-width: 599px) { .project-gallery ul { grid-template-columns: repeat(4, 1fr); } }
@media (prefers-reduced-motion: reduce) { .project-gallery__title { transition: none; } }

/* ---- Contact form ------------------------------------------------------- */
.form { display: grid; gap: 22px; margin: 0 0 var(--para); }
.form label { display: grid; gap: 6px; font-size: 16px; color: var(--text); }
.form input[type="text"], .form input[type="email"], .form textarea {
  width: 100%; padding: 12px 14px; font: 400 16px/1.6 var(--f-body); color: #434343;
  background: #f9f9f9; border: 1px solid #e3e6e8; border-radius: 0;
}
.form textarea { resize: vertical; min-height: 140px; }
.form input:focus, .form textarea:focus { background: #fff; border-color: #9aa0a4; outline: 0; box-shadow: 0 0 0 2px rgba(26, 111, 165, 0.35); }
.form__hint { margin: -10px 0 0; font-size: 14px; line-height: 1.6; color: #757575; }
.form__actions { display: flex; justify-content: flex-end; }
.form button {
  padding: 12px 38px; border: 0; background: #000; color: #fff; cursor: pointer;
  font: 600 16px/1.4 var(--f-ui); letter-spacing: 0.03em;
}
.form button:hover { background: #434343; }
.form button:disabled { opacity: 0.6; cursor: default; }
.form__status { margin: 0; padding: 12px 14px; background: var(--footer-bg); color: var(--text); font-size: 15px; line-height: 1.6; }
.form__status.is-error { background: #fbeeee; color: #7a2d2d; }
.form__trap { position: absolute; left: -9999px; }

/* ---- Footer ------------------------------------------------------------- */
.site-footer { background: var(--footer-bg); color: var(--footer-text); text-align: center; padding: 33px 20px; font-size: 16px; line-height: 32px; }
.site-footer p { margin: 0; }
.site-footer a { text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

/* ---- Image viewer ------------------------------------------------------- */
.lightbox { width: 100vw; height: 100vh; max-width: none; max-height: none; padding: 24px; border: 0; background: rgba(255, 255, 255, 0.97); }
.lightbox[open] { display: flex; align-items: center; justify-content: center; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; cursor: zoom-out; }
.lightbox__close { position: absolute; top: 12px; right: 12px; width: 44px; height: 44px; border: 0; background: none; color: #000; cursor: pointer; display: grid; place-items: center; }
.lightbox::backdrop { background: transparent; }

/* ---- Small screens: header on top, menu drops down and pushes content --- */
@media (max-width: 1023px) {
  .site-main { margin-left: 0; }
  .sidebar {
    position: static; width: auto; box-shadow: none; overflow: visible;
    display: block; padding: 12px 28px 0;
  }
  .sidebar__top { display: flex; justify-content: space-between; align-items: center; padding-bottom: 14px; }
  .brand__name, .brand__tag { display: none; }
  .brand__logo img { width: 104px; height: 104px; }
  .menu-toggle {
    display: grid; place-items: center; width: 44px; height: 44px; padding: 0;
    border: 0; background: none; color: #333; cursor: pointer;
  }
  .menu-toggle__close, .menu-toggle[aria-expanded="true"] .menu-toggle__open { display: none; }
  .menu-toggle[aria-expanded="true"] .menu-toggle__close { display: block; }
  .sidebar__menu { display: none; }
  .menu-open .sidebar__menu { display: block; margin: 0 -28px; padding: 8px 28px 27px; border-top: 1px solid var(--line); }
  .nav a { font-size: 18px; line-height: 47px; }
  .tools { padding-top: 22px; }
  .hero--home { height: calc(100vh - 130px); min-height: 380px; }
  .hero--page { height: 240px; }
  .hero--page img.hero__img--focus { position: static; height: 100%; object-fit: cover; object-position: 50% 40%; }
  .hero__title { font-size: 30px; }
  .portfolio__title { font-size: 30px; }
  .card__title { font-size: 20px; }
  .about { grid-template-columns: 1fr; gap: 40px; }
  .about__text { padding: 0 24px; }
  .home-about { padding: 70px 0 80px; }
}
@media (max-width: 559px) {
  .grid { grid-template-columns: 1fr; }
  .entry { padding-top: 40px; }
}
@media (prefers-reduced-motion: reduce) { .card__body { transition: none; } }
