/* Ian Escher Vierck — site styles
   Colours and type sizes measured from the original Squarespace site. */

:root {
  --sand: #e2ded2;
  --ink: #293140;
  --red: #d93232;
  --gold: #fcc000;
  --forest: #1a4a31;
  --white: #ffffff;

  --font-head: "Jost", "Futura", "Century Gothic", sans-serif;   /* stand-in for futura-pt */
  --font-body: "Figtree", "Helvetica Neue", Arial, sans-serif;    /* stand-in for sofia-pro */

  --gutter: 6vw;      /* Squarespace mobile site gutter */
  --max-w: 1500px;
  --gap: 11px;

  /* section theme defaults ("white") */
  --s-bg: var(--sand);
  --s-head: var(--ink);
  --s-text: var(--ink);
  --s-link: var(--red);
}
@media (min-width: 768px) { :root { --gutter: 4vw; } }

/* Fluid type: same formula Squarespace uses, capped at the 1500px max width */
:root {
  --fs-h1: min(calc(3 * 1.2vw + 1rem), 70px);
  --fs-h2: min(calc(1.2 * 1.2vw + 1rem), 37.6px);
  --fs-h3: min(calc(1.2 * 1.2vw + 1rem), 37.6px);
  --fs-h4: min(calc(0.2 * 1.2vw + 1rem), 19.6px);
  --fs-large: min(calc(0.5 * 1.2vw + 1rem), 25px);
  --fs-p: min(calc(0.2 * 1.2vw + 1rem), 19.6px);
  --fs-site-title: min(calc(1 * 1.2vw + 1rem), 34px);
  --fs-nav: min(calc(0.2 * 1.2vw + 1rem), 19.6px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--sand);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.6;
}
img, video, iframe { display: block; max-width: 100%; }
a { color: inherit; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--white); padding: .5rem 1rem; z-index: 100; }

/* ───────── Header ───────── */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 0 var(--gutter);
  min-height: 42px;
  position: sticky;
  top: 0;
  background: var(--sand);
  z-index: 20;
}
.site-header::after {
  content: "";
  position: absolute;
  left: var(--gutter); right: var(--gutter); bottom: 0;
  border-bottom: 1px solid var(--ink);
}
.site-title {
  font-family: var(--font-head);
  font-weight: 500;
  font-size: var(--fs-site-title);
  line-height: 1.4;
  text-decoration: none;
  white-space: nowrap;
}
.site-nav { display: flex; align-items: center; gap: .55em; font-size: var(--fs-nav); }
.site-nav a { text-decoration: none; line-height: 1.6; }
.site-nav a[aria-current="page"],
.site-nav a:hover { background-image: linear-gradient(currentColor, currentColor); background-size: 100% 1px; background-repeat: no-repeat; background-position: 0 100%; }
.site-nav .social { margin-left: 1.4em; display: inline-flex; background: none !important; }
.site-nav .social svg { width: 18px; height: 18px; }
.menu-toggle { display: none; background: none; border: 0; padding: 8px; margin-right: -8px; cursor: pointer; color: inherit; }
.menu-toggle span { display: block; width: 26px; height: 1px; background: currentColor; margin: 7px 0; transition: transform .25s, opacity .25s; }

@media (max-width: 767px) {
  .menu-toggle { display: block; }
  .site-nav {
    position: fixed; inset: 0; z-index: 10;
    flex-direction: column; justify-content: center; gap: 1rem;
    background: var(--sand); font-size: 1.6rem;
    opacity: 0; visibility: hidden; transition: opacity .25s, visibility .25s;
  }
  .site-nav .social { margin: 1rem 0 0; }
  body.menu-open .site-nav { opacity: 1; visibility: visible; }
  body.menu-open { overflow: hidden; }
  body.menu-open .menu-toggle { position: relative; z-index: 11; }
  body.menu-open .menu-toggle span:nth-child(1) { transform: translateY(4px) rotate(45deg); }
  body.menu-open .menu-toggle span:nth-child(2) { transform: translateY(-4px) rotate(-45deg); }
}

/* ───────── Work index ───────── */
.work-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: 2.6vw;
  row-gap: 2.6vw;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 26px var(--gutter) 6vw;
}
.work-item { text-decoration: none; display: block; }
.work-item .thumb { aspect-ratio: 3 / 4; overflow: hidden; background: rgba(41, 49, 64, .06); }
.work-item img { width: 100%; height: 100%; object-fit: cover; transition: opacity .3s; }
.work-item:hover img { opacity: .85; }
.work-item h2 {
  font-family: var(--font-head);
  font-weight: 500;
  font-size: var(--fs-h4);
  line-height: 1.4;
  margin: .6em 0 0;
}
@media (max-width: 900px) { .work-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 540px) { .work-grid { grid-template-columns: 1fr; row-gap: 8vw; } }

/* ───────── Sections & themes ───────── */
.section { background: var(--s-bg); color: var(--s-text); padding: 10px 0; }
.section[data-theme="black"]      { --s-bg: var(--ink);    --s-head: var(--gold);  --s-text: var(--sand); --s-link: var(--white); }
.section[data-theme="black-bold"] { --s-bg: var(--ink);    --s-head: var(--white); --s-text: var(--sand); --s-link: var(--white); }
.section[data-theme="dark"]       { --s-bg: var(--forest); --s-head: var(--sand);  --s-text: var(--sand); --s-link: var(--white); }
.section[data-theme="dark-bold"]  { --s-bg: var(--forest); --s-head: var(--white); --s-text: var(--sand); --s-link: var(--white); }
.section[data-theme="bright"]     { --s-bg: var(--red);    --s-head: var(--white); --s-text: var(--white); --s-link: var(--white); }

/* ───────── Free-form grid (recreates Squarespace's "Fluid Engine" layout) ───────── */
.fe {
  --cols: 8;
  --col-max: calc((var(--max-w) - var(--gap) * (var(--cols) - 1)) / var(--cols));
  --edge: calc(var(--gutter) - var(--gap));
  display: grid;
  grid-template-columns: minmax(var(--edge), 1fr) repeat(8, minmax(0, var(--col-max))) minmax(var(--edge), 1fr);
  grid-template-rows: repeat(var(--rm), minmax(24px, auto));
  column-gap: var(--gap);
  row-gap: var(--rgap, var(--gap));
}
.fe > .b { grid-area: var(--m); z-index: var(--z, 1); min-width: 0; display: flex; flex-direction: column; }
@media (min-width: 768px) {
  .fe {
    --cols: 24;
    --cw: min(var(--max-w), calc(100vw - var(--gutter) * 2));
    grid-template-columns: minmax(var(--edge), 1fr) repeat(24, minmax(0, var(--col-max))) minmax(var(--edge), 1fr);
    grid-template-rows: repeat(var(--rd), minmax(calc(var(--cw) * 0.0215), auto));
  }
  .fe > .b { grid-area: var(--d); }
}

/* text blocks */
.txt { justify-content: flex-start; }
.txt h1, .txt h2, .txt h3, .txt h4 { font-family: var(--font-head); font-weight: 500; color: var(--s-head); text-transform: capitalize; margin: 0 0 .5em; }
.txt h1 { font-size: var(--fs-h1); line-height: 1.232; }
.txt h2 { font-size: var(--fs-h2); line-height: 1.2; }
.txt h3 { font-size: var(--fs-h3); line-height: 1.333; }
.txt h4 { font-size: var(--fs-h4); line-height: 1.389; }
.txt p { margin: 0 0 1rem; font-size: var(--fs-p); }
.txt.small p { font-size: 1rem; }
.txt.large p { font-size: var(--fs-large); }
.txt.center { text-align: center; }
.txt.right { text-align: right; }
.txt > :last-child, .txt > div > :last-child { margin-bottom: 0; }
.txt a { color: var(--s-link); }
.txt ul, .txt ol { padding-left: 1.4em; margin: 0 0 1rem; }

/* image blocks fill their grid cell */
.img { position: relative; }
.img > a, .img > figure { display: block; flex: 1; margin: 0; min-height: 0; position: relative; }
.img img { width: 100%; height: 100%; object-fit: var(--fit, cover); object-position: var(--fp, 50% 50%); position: absolute; inset: 0; }
.img figcaption { position: absolute; left: 0; right: 0; top: 100%; font-size: .85rem; padding-top: .3em; }
.img.multi { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--gap); }
.img.multi img { position: static; height: auto; }

/* video / embeds */
.vid video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.emb iframe { width: 100%; height: 100%; border: 0; min-height: 300px; }
.emb.code iframe { height: 100vh; min-height: 500px; }
.rule hr { width: 100%; border: 0; border-top: 1px solid currentColor; margin: auto 0; }

/* section with a full-bleed background photo */
.section.has-bg { position: relative; isolation: isolate; }
.section-bg { position: absolute; inset: 0; z-index: -1; overflow: hidden; }
.section-bg img { width: 100%; height: 100%; object-fit: cover; }
.section-bg .overlay { position: absolute; inset: 0; background: var(--s-bg); }
.section.has-bg { background: transparent; }

/* ───────── Galleries ───────── */
.gallery-section { padding: 3vw 0; }
.gallery-title { font-family: var(--font-head); font-weight: 500; font-size: var(--fs-h2); color: var(--s-head); margin: 0 var(--gutter) 1.5rem; }
.gallery { position: relative; padding: 0 var(--gutter); }
.gallery figure { margin: 0; }
.gallery img { width: 100%; height: 100%; object-fit: cover; }
.gallery a { display: block; height: 100%; }
.gallery figcaption { font-size: .95rem; padding-top: .6em; }

.g-grid .g-track { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; }
.g-grid figure { aspect-ratio: 4 / 3; }

.g-masonry .g-track { columns: 3 260px; column-gap: 20px; }
.g-masonry figure { break-inside: avoid; margin-bottom: 20px; }
.g-masonry img { height: auto; }

.g-strips .g-track { display: flex; flex-wrap: wrap; gap: 12px; }
.g-strips figure { flex: 1 1 300px; height: clamp(220px, 28vw, 420px); }

.g-reel .g-track, .g-carousel .g-track, .g-slideshow .g-track {
  display: flex; gap: 20px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
}
.g-track::-webkit-scrollbar { display: none; }
.g-reel figure { flex: 0 0 auto; height: clamp(260px, 45vw, 640px); scroll-snap-align: start; }
.g-reel img { width: auto; }
.g-carousel figure { flex: 0 0 calc((100% - 40px) / 3); aspect-ratio: 4 / 3; scroll-snap-align: start; }
@media (max-width: 767px) { .g-carousel figure { flex-basis: 85%; } }
.g-slideshow figure { flex: 0 0 100%; scroll-snap-align: start; display: flex; flex-direction: column; align-items: center; }
.g-slideshow a { height: clamp(260px, 50vw, 720px); width: 100%; }
.g-slideshow img { object-fit: contain; }
.g-slideshow figcaption { text-align: center; max-width: 60ch; }

.g-prev, .g-next {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(226, 222, 210, .85); color: var(--ink); font-size: 1.3rem; line-height: 1;
}
.g-prev { left: calc(var(--gutter) + 10px); }
.g-next { right: calc(var(--gutter) + 10px); }

/* lightbox */
.lightbox { border: 0; padding: 0; background: transparent; max-width: 100vw; max-height: 100vh; width: 100vw; height: 100vh; }
.lightbox::backdrop { background: rgba(20, 24, 32, .92); }
.lightbox img { width: 100%; height: 100%; object-fit: contain; padding: 4vw; cursor: zoom-out; }

/* ───────── Contact form ───────── */
.contact-form { display: grid; gap: 1rem; }
.contact-form fieldset { border: 0; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.contact-form legend { padding: 0; margin-bottom: .4rem; }
.contact-form label { display: grid; gap: .3rem; font-size: .95rem; }
.contact-form input, .contact-form textarea {
  font: inherit; color: var(--ink); background: #fafaf7;
  border: 1px solid #b9b5a9; border-radius: 0; padding: .7rem .8rem; width: 100%;
}
.contact-form textarea { min-height: 9rem; resize: vertical; }
.contact-form button {
  justify-self: start; font: inherit; font-family: var(--font-head); font-weight: 500;
  background: var(--s-head); color: var(--s-bg); border: 0; padding: .8rem 2rem; cursor: pointer;
}
.contact-form button:hover { background: var(--red); color: var(--white); }
.req { opacity: .7; font-size: .85em; }
.form-note { margin: 0; }
.form-off { display: grid; gap: 1rem; border: 0; padding: 0; margin: 0; min-width: 0; opacity: .45; }

/* ───────── Footer ───────── */
.site-footer { padding: 2vw var(--gutter) 3vw; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2vw; }
.site-footer img { width: 100%; height: auto; }
.site-footer .social svg { width: 20px; height: 20px; }
