/* Alistair Vlok — photography.
   The Squarespace layout, rebuilt: nav across the top left, name top right,
   sections as two full-bleed columns of pictures at their own proportions,
   and a project as one centred column with its title in the left margin.
   Black instead of white, and the same typeface as alvlok.com. */

:root{
  --bg:#000;
  --ink:#fff;
  --ink-dim:#8c8c8c;
  --ink-dimmer:#555;
  --pad:clamp(16px,1.9vw,26px);
  /* 108px, measured off the old Squarespace site: the gap above the first
     picture is the same there at every window width. */
  --head:108px;
  --small:9.5px;
  --track:.17em;
}

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

html,body{margin:0;background:var(--bg);color:var(--ink)}

body{
  font-family:"Instrument Sans","Helvetica Neue",Arial,sans-serif;
  font-weight:400;
  -webkit-font-smoothing:antialiased;
  text-rendering:optimizeLegibility;
  overflow-x:hidden;
}

body.is-locked{overflow:hidden}

a{color:inherit;text-decoration:none}
button{font:inherit;color:inherit;background:none;border:0;padding:0;cursor:pointer}
img{display:block;max-width:100%}

/* ---------- masthead: nav left, name right ---------- */

.masthead{
  position:fixed;
  inset:0 0 auto 0;
  z-index:40;
  display:flex;
  align-items:flex-start;
  justify-content:space-between;
  gap:20px;
  padding:var(--pad) var(--pad) calc(var(--pad) * .8);
  background:var(--bg);
}

.nav{display:flex;flex-wrap:wrap;align-items:baseline;gap:clamp(12px,1.6vw,26px)}

.nav button{
  font-size:var(--small);
  letter-spacing:var(--track);
  text-transform:uppercase;
  color:var(--ink-dim);
  transition:color .2s ease;
  white-space:nowrap;
}
.nav button:hover{color:var(--ink)}
.nav button.is-on{color:var(--ink)}

/* The name is set in Bebas Neue, the face the old Squarespace site used for
   it. The two lines underneath stay in Instrument Sans, like the rest. */
.identity{text-align:right;line-height:1.15}

.identity__name{
  display:block;
  font-family:"Bebas Neue","Instrument Sans",Arial,sans-serif;
  font-size:clamp(26px,2.6vw,38px);
  font-weight:400;
  letter-spacing:2px;
  text-transform:uppercase;
  white-space:nowrap;
  line-height:1;
}

.identity__meta{
  display:block;
  margin-top:3px;
  font-size:var(--small);
  letter-spacing:var(--track);
  text-transform:uppercase;
  color:var(--ink-dim);
  white-space:nowrap;
}

/* ---------- a section: two columns, full bleed, no gaps ---------- */

main{padding-top:var(--head)}

.section{display:none}
.section.is-on{display:block}

.mosaic{
  display:flex;
  align-items:flex-start;
  gap:0;
}
.mosaic__col{flex:1 1 0;min-width:0;position:relative}

.shot{
  display:block;
  width:100%;
  position:relative;
  cursor:pointer;
}

/* The hover zoom, copied from the old Squarespace site: the picture grows to
   one and a half times over 0.2s and spills out over its neighbours rather
   than being clipped. z-index lifts the one you are pointing at above the
   rest, or the others would cover it. */
.shot img{
  width:100%;
  height:auto;
  transform:scale(1);
  transform-origin:center center;
  transition:transform .2s ease-out;
  will-change:transform;
}
.shot:hover,
.shot:focus-visible{z-index:5}
.shot:hover img,
.shot:focus-visible img{transform:scale(1.5)}

/* a finger has no hover, so leave the pictures alone on a phone */
@media (hover:none){
  .shot img{transition:none}
  .shot:hover img,
  .shot:focus-visible img{transform:scale(1)}
}

/* the name of the project, only while the cursor is on it */
.shot__label{
  position:absolute;
  z-index:2;
  left:14px;
  bottom:12px;
  font-size:var(--small);
  letter-spacing:var(--track);
  text-transform:uppercase;
  color:#fff;
  text-shadow:0 1px 14px rgba(0,0,0,.85);
  opacity:0;
  transition:opacity .22s ease;
  pointer-events:none;
}
.shot:hover .shot__label,
.shot:focus-visible .shot__label{opacity:1}

@media (hover:none){
  .shot__label{opacity:1}
}

/* one column on a phone */
@media (max-width:700px){
  .mosaic{display:block}
  .mosaic__col{width:100%}
}

/* ---------- a project, opened: one centred column ---------- */

.project{
  position:fixed;
  inset:0;
  z-index:60;
  background:var(--bg);
  overflow-y:auto;
  -webkit-overflow-scrolling:touch;
}
.project[hidden]{display:none}

.project__inner{
  max-width:1180px;
  margin:0 auto;
  padding:calc(var(--head) + 14px) var(--pad) clamp(60px,8vw,110px);
  display:flex;
  gap:clamp(20px,3vw,48px);
  align-items:flex-start;
}

/* the title sits in the left margin, as on the old site */
.project__title{
  flex:0 0 clamp(120px,14vw,190px);
  position:sticky;
  top:calc(var(--head) + 14px);
  font-size:clamp(12px,1vw,14px);
  font-weight:500;
  letter-spacing:.1em;
  text-transform:uppercase;
  line-height:1.5;
}

.project__shots{flex:1 1 auto;min-width:0;display:flex;flex-direction:column;gap:clamp(14px,2vw,30px)}
.project__shots img{width:100%;height:auto;background:#111}

.project__close{
  position:fixed;
  top:var(--pad);
  right:var(--pad);
  z-index:61;
  width:26px;height:26px;
  min-width:44px;min-height:44px;
  display:grid;place-items:center;
  opacity:.65;
  transition:opacity .2s ease;
}
.project__close:hover{opacity:1}
.project__close svg{width:17px;height:17px;stroke:var(--ink);stroke-width:1.3;fill:none}

@media (max-width:700px){
  .project__inner{display:block;padding-top:calc(var(--head) + 6px)}
  .project__title{position:static;margin:0 0 14px}
  .project__shots{gap:10px}
}

/* ---------- iPhone ---------- */

@media (hover:none){
  .nav button{padding:6px 0}
}

@supports (padding:max(0px)){
  .masthead{
    padding-left:max(var(--pad),env(safe-area-inset-left));
    padding-right:max(var(--pad),env(safe-area-inset-right));
  }
  .project__inner{
    padding-left:max(var(--pad),env(safe-area-inset-left));
    padding-right:max(var(--pad),env(safe-area-inset-right));
    padding-bottom:max(clamp(60px,8vw,110px),env(safe-area-inset-bottom));
  }
}

@media (prefers-reduced-motion:reduce){
  *{transition-duration:.01ms !important}
}

/* a film in a project, same width as the pictures */
.project__film{
  width:100%;
  height:auto;
  background:#000;
  display:block;
}
