/* Mack Furniture
   Layout: the existing Squarespace look kept as is. Grey ground, centred monogram, nav at left,
   three-column grid of square covers with bold titles. Project pages: hero bleeding off the left edge,
   right column with a lead image, then the text beside a third image, further images staggered below. */

@font-face {
  font-family: "Public Sans";
  src: url("fonts/public-sans-300.woff2") format("woff2");
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Public Sans";
  src: url("fonts/public-sans-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

:root {
  /* colour */
  --bg: hsl(240 10.5% 92.5%);
  --fg: hsl(0 0% 0%);
  --accent: hsl(204 79% 38%);
  --muted: hsl(240 5% 34%);
  --placeholder: hsl(240 8% 87%);
  --rule: hsl(240 6% 80%);
  /* type */
  --font: "Public Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --text: clamp(1rem, 0.86rem + 0.45vw, 1.275rem);      /* 16 to 20.4px */
  --title: clamp(1.25rem, 0.98rem + 0.95vw, 1.7rem);    /* 20 to 27.2px */
  --display: clamp(1.5rem, 1.1rem + 1.35vw, 2.125rem);  /* 24 to 34px */
  --small: 0.9375rem;
  /* space */
  --gutter: clamp(16px, 2.85vw, 41px);
  --gap: clamp(16px, 2.15vw, 31px);
  --col-gap: clamp(24px, 4.7vw, 68px);
  --hero: 49.1%;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font);
  font-weight: 300;
  font-size: var(--text);
  line-height: 1.3;
  letter-spacing: -0.04em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

.page { background: var(--bg); color: var(--fg); min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; }

img { display: block; max-width: 100%; height: auto; }
figure { margin: 0; }
a { color: inherit; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: 16px; top: -100px; z-index: 20;
  background: var(--fg); color: var(--bg); padding: 8px 14px; text-decoration: none;
}
.skip:focus { top: 12px; }

/* ---------- header ---------- */
.site-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding-block: 16px;
  padding-left: max(clamp(16px, 2vw, 29px), env(safe-area-inset-left, 0px));
  padding-right: max(clamp(16px, 2vw, 29px), env(safe-area-inset-right, 0px));
}
.nav { display: flex; gap: clamp(20px, 2.8vw, 40px); }
.nav a {
  font-size: 1.0625rem;
  text-decoration: none;
  text-underline-offset: 0.25em;
  text-decoration-thickness: 1px;
}
.nav a:hover, .nav a[aria-current="page"] { text-decoration: underline; }
.logo { display: block; color: var(--fg); }
.logo svg { display: block; height: 50px; width: auto; }

/* ---------- project grid ---------- */
.grid {
  list-style: none;
  margin: 0;
  padding: 3px var(--gutter) 0;
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: var(--gap);
  row-gap: clamp(32px, 4.2vw, 60px);
}
.grid-item a { display: block; text-decoration: none; }
.grid-img { aspect-ratio: 4 / 5; overflow: hidden; background: var(--placeholder); max-width: 100%; }
.grid-img img {
  width: 100%; height: 100%;
  object-fit: cover;
  object-position: 50% 50%;
  transition: opacity 0.3s ease;
}
.grid-title {
  margin: 20px 0 0;
  font-size: var(--title);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.05em;
  text-wrap: balance;
}

/* ---------- project page ---------- */
.project {
  display: grid;
  grid-template-columns: var(--hero) minmax(0, 1fr);
  column-gap: var(--col-gap);
  align-items: start;
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}
.p-hero img, .p-more img, .p-lead img, .p-third img { width: 100%; }

/* hero slideshow, only on projects with more than three images */
.p-hero { position: relative; min-width: 0; }
.slides {
  display: flex;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.slides::-webkit-scrollbar { display: none; }
.slides:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.slide { flex: 0 0 100%; height: 100%; scroll-snap-align: start; }
.has-js .slides { overflow: hidden; scroll-snap-type: none; touch-action: pan-y; }
.slides-strip { display: flex; flex: 0 0 100%; width: 100%; height: 100%; will-change: transform; }
.slide img { width: 100%; height: 100%; object-fit: cover; }
.has-js .slides { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'%3E%3Cpath d='M6.5 15h16M17.5 9.5l5.5 5.5-5.5 5.5' fill='none' stroke='black' stroke-width='1.35' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") 15 15, e-resize; }
.has-js .slides.is-back { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='30' height='30' viewBox='0 0 30 30'%3E%3Cpath d='M23.5 15h-16M12.5 9.5L7 15l5.5 5.5' fill='none' stroke='black' stroke-width='1.35' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") 15 15, w-resize; }
.slide-badge {
  position: absolute;
  top: 14px;
  left: max(16px, env(safe-area-inset-left, 0px));
  margin: 0;
  color: var(--fg);
  font-family: var(--font);
  font-weight: 300;
  font-size: 0.8125rem;
  line-height: 1.35;
  letter-spacing: -0.02em;
  pointer-events: none;
}
.p-browse { display: none; flex-wrap: wrap; align-items: baseline; gap: 6px 18px; margin: 28px 0 0; }
/* kept for keyboard and screen-reader users only: hidden until tabbed to */
.has-js .p-browse {
  display: flex;
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
.has-js .p-browse:focus-within { position: static; width: auto; height: auto; overflow: visible; clip: auto; }
.p-browse button {
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  letter-spacing: inherit;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
}
.p-browse button:hover { text-decoration-thickness: 2px; }
.p-browse button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.p-side { display: flex; flex-direction: column; gap: clamp(24px, 3.5vw, 51px); min-width: 0; }
.p-lead { width: 63%; }
.p-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: clamp(24px, 4.8vw, 69px);
  align-items: start;
}
.p-text { min-width: 0; }
.p-title {
  margin: 0 0 17px;
  font-size: var(--text);
  font-weight: 300;
  line-height: 1.3;
  text-transform: uppercase;
  letter-spacing: -0.02em;
}
.p-text p { margin: 0 0 16px; }
.p-label { list-style: none; margin: 0 0 20px; padding: 0; color: var(--muted); }
.p-label li { margin: 0; }
.p-text--about { max-width: 30em; }
.p-enquire a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1px;
}
.p-enquire a:hover { text-decoration-thickness: 2px; }

.p-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(8px, 1vw, 14px); }
.p-row img { width: 100%; }

.p-more {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: var(--hero) minmax(0, 1fr);
  column-gap: var(--col-gap);
  row-gap: clamp(32px, 4.7vw, 68px);
  margin-top: clamp(32px, 4.7vw, 68px);
}
.m-row { grid-column: 1 / -1; padding-left: max(var(--gutter), env(safe-area-inset-left, 0px)); }

.pager {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding-top: clamp(48px, 6vw, 96px);
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}
.pager a { display: flex; flex-direction: column; gap: 6px; text-decoration: none; min-width: 0; }
.pager-next { margin-left: auto; text-align: right; align-items: flex-end; }
.pager-name {
  font-size: var(--display);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.05em;
}
.pager a:hover .pager-name { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.15em; }

/* ---------- contact ---------- */
.contact {
  display: grid;
  gap: 14px;
  padding-block: clamp(32px, 6vw, 96px) 0;
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}
.statement {
  margin: 0;
  max-width: 24em;
  font-size: var(--title);
  font-weight: 700;
  line-height: 1.12;
  letter-spacing: -0.05em;
}
.statement a { color: var(--accent); text-decoration: none; }
.statement a:hover { text-decoration: underline; text-decoration-thickness: 2px; }
.contact-meta { margin: 10px 0 0; }
.contact-meta a { text-underline-offset: 0.2em; text-decoration-thickness: 1px; }

/* ---------- legal ---------- */
.legal {
  max-width: calc(40em + 2 * var(--gutter));
  padding-block: clamp(32px, 5vw, 80px) 0;
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
  font-size: 1.0625rem;
  letter-spacing: -0.02em;
  line-height: 1.45;
}
.legal h1 { margin: 0 0 28px; font-size: var(--title); font-weight: 700; letter-spacing: -0.05em; line-height: 1.1; }
.legal h2 { margin: 28px 0 6px; font-size: 1.0625rem; font-weight: 700; letter-spacing: -0.02em; }
.legal p { margin: 0 0 12px; overflow-wrap: anywhere; }
.legal a { color: var(--accent); }

/* ---------- footer ---------- */
.site-footer {
  padding-block: clamp(64px, 8vw, 120px) 32px;
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}
.footer-name, .footer-mail {
  margin: 0;
  font-size: var(--title);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.05em;
}
.footer-mail a { color: var(--accent); text-decoration: none; overflow-wrap: anywhere; }
.footer-mail a:hover { text-decoration: underline; text-decoration-thickness: 2px; }
.footer-links {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin: 28px 0 0;
  padding: 0;
  font-size: var(--small);
  letter-spacing: -0.02em;
  color: var(--muted);
}
.footer-links a { text-decoration: none; }
.footer-links a:hover { text-decoration: underline; color: var(--fg); }


/* ---------- homepage: hover reveal, view switch, index ---------- */
.grid-img { position: relative; }
.grid-hover {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  opacity: 0;
  transition: opacity 0.45s ease;
}
@media (hover: hover) {
  .grid-item a:hover .grid-hover { opacity: 1; }
  .grid-item a:hover .grid-img:not(.has-hover) img { opacity: 0.86; }
}
/* touch screens have no hover: drop the second image entirely */
@media (hover: none) {
  .grid-hover { display: none; }
}

.view-switch { justify-self: end; display: flex; gap: clamp(14px, 1.8vw, 26px); }
.view-switch button {
  padding: 0; border: 0; background: none; color: var(--fg);
  font: inherit; font-size: 1.0625rem; letter-spacing: -0.04em;
  cursor: pointer;
  text-underline-offset: 0.25em; text-decoration-thickness: 1px;
}
.view-switch button[aria-pressed="true"], .view-switch button:hover { text-decoration: underline; }
.view-switch button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.index {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 30%);
  column-gap: var(--col-gap);
  align-items: start;
  padding-top: 3px;
  padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
  padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
}
.index-list { list-style: none; margin: 0; padding: 0; }
.index-head, .index-row {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1.4fr) 4.5em;
  column-gap: 20px;
  align-items: baseline;
}
.index-head {
  padding-bottom: 10px;
  font-size: var(--small);
  letter-spacing: -0.02em;
  color: var(--muted);
}
.index-head span:last-child, .index-year { text-align: right; }
.no-year .index-head, .no-year .index-row { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1.4fr); }
.no-year .index-year, .no-year .index-head span:last-child { display: none; }
.index-row {
  padding: 12px 0 11px;
  border-top: 1px solid var(--rule);
  text-decoration: none;
  color: var(--fg);
}
.index-list li:last-child .index-row { border-bottom: 1px solid var(--rule); }
.index-thumb { display: none; }
.index-name { font-size: var(--title); font-weight: 700; letter-spacing: -0.05em; line-height: 1.1; }
.index-type, .index-mat, .index-year { color: var(--muted); }
.index-row:hover .index-name, .index-row:focus-visible .index-name { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 0.15em; }
.index-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.index-preview { position: sticky; top: 24px; aspect-ratio: 4 / 5; max-width: 100%; background: var(--placeholder); }
.index-shot { position: absolute; inset: 0; opacity: 0; transition: opacity 0.35s ease; }
.index-shot.is-on { opacity: 1; }
.index-shot img { width: 100%; height: 100%; object-fit: cover; }

@media (max-width: 820px) {
  .index { grid-template-columns: minmax(0, 1fr); }
  .index-preview, .index-head { display: none; }
  .index .index-row { grid-template-columns: 56px minmax(0, 1fr); column-gap: 14px; align-items: center; padding: 10px 0; }
  .index-thumb { display: block; grid-row: 1 / span 2; width: 56px; aspect-ratio: 4 / 5; overflow: hidden; }
  .index-thumb img { width: 100%; height: 100%; object-fit: cover; }
  .index-name { grid-column: 2; }
  .index-type { grid-column: 2; font-size: var(--small); }
  .index-mat, .index-year { display: none; }
}
@media (max-width: 560px) {
  .view-switch { justify-self: center; }
}

/* ---------- smaller screens ---------- */
@media (max-width: 900px) {
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 820px) {
  .project { grid-template-columns: minmax(0, 1fr); padding-right: 0; row-gap: 28px; }
  .p-side {
    padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
    padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
    gap: 28px;
  }
  .p-pair { display: contents; }
  .p-text { order: -1; }
  .p-lead { width: 100%; }
  .p-more {
    grid-template-columns: minmax(0, 1fr);
    row-gap: 28px;
    margin-top: 28px;
    padding-left: max(var(--gutter), env(safe-area-inset-left, 0px));
    padding-right: max(var(--gutter), env(safe-area-inset-right, 0px));
  }
  .has-js .p-browse { display: none; }
  .m-row { padding-left: 0; }
}

@media (max-width: 560px) {
  .site-header { grid-template-columns: 1fr; justify-items: center; gap: 14px; }
  .logo { order: -1; }
  .logo svg { height: 46px; }
  .grid { grid-template-columns: minmax(0, 1fr); }
  .pager { flex-direction: column; }
  .pager-next { margin-left: 0; text-align: left; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* cover crops (cover_focus in the project files) */
.f-pluto-table img { object-position: 50% 90%; }

/* slideshow frames follow the first image */
.r-crescent-cabinet .slides { aspect-ratio: 1000 / 1250; }
.r-atlas-shelf .slides { aspect-ratio: 1000 / 1250; }
.r-paris-chair .slides { aspect-ratio: 1000 / 1250; }
.r-round-commode .slides { aspect-ratio: 1000 / 1334; }
.r-dreamy-bed .slides { aspect-ratio: 1000 / 1250; }
.r-fracture-table .slides { aspect-ratio: 1000 / 1499; }
.r-pluto-stool .slides { aspect-ratio: 1000 / 1500; }
.r-silhouette-table .slides { aspect-ratio: 1000 / 1499; }
.r-quilted-table .slides { aspect-ratio: 1000 / 1500; }
.r-pie-cabinet .slides { aspect-ratio: 1000 / 800; }
.r-new-york-table .slides { aspect-ratio: 1000 / 1250; }
.r-pattern-shelf .slides { aspect-ratio: 1000 / 1500; }
.r-stools .slides { aspect-ratio: 1000 / 1500; }
.r-odd-table .slides { aspect-ratio: 1000 / 1500; }
.r-shiny-nightstand .slides { aspect-ratio: 1000 / 1500; }
.r-pluto-table .slides { aspect-ratio: 1000 / 1250; }
