/* ---------- Colours and type ---------- */
:root {
  --espresso: #2E221B;   /* sidebar, text */
  --walnut:   #5C4033;   /* secondary brown */
  --clay:     #B08968;   /* warm accent */
  --moss:     #4F5D43;   /* dark sage for text and links */
  --sage:     #A9B598;   /* the sage itself */
  --mist:     #E3E7D9;   /* page background */
  --paper:    #F2F4EB;   /* label plates */

  /* FONT. The site uses Titillium Web, a free typeface close in feel to Emigre Base 9.
     If you buy a web licence for Base 9 or Base 12 from Emigre, add their @font-face
     code at the top of this file and put the font's name first on the two lines below. */
  --display: "Titillium Web", "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  --text: "Titillium Web", "Trebuchet MS", "Segoe UI", system-ui, sans-serif;

  --side-w: 288px;
  --pad: clamp(20px, 4vw, 56px);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--mist);
  color: var(--espresso);
  font-family: var(--text);
  font-size: 17px;
  line-height: 1.55;
}
img, video { display: block; max-width: 100%; }
a { color: var(--moss); text-underline-offset: 3px; }
a:hover { color: var(--walnut); }
h1, h2 { font-family: var(--display); font-weight: 600; line-height: 1.08; margin: 0; letter-spacing: -0.015em; }
p { margin: 0 0 1em; }
button { font: inherit; color: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--clay); outline-offset: 3px; }
main:focus { outline: none; }

.skip {
  position: absolute; left: 12px; top: -60px; z-index: 50;
  background: var(--paper); color: var(--espresso); padding: 10px 14px;
}
.skip:focus { top: 12px; }

/* ---------- Sidebar ---------- */
.side {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w);
  background: var(--espresso); color: var(--sage);
  display: flex; flex-direction: column;
  padding: 44px 34px 30px;
  z-index: 10;
}
.brand { text-decoration: none; color: inherit; display: block; }
.brand-name {
  display: block; font-family: var(--display); font-weight: 600; letter-spacing: -0.01em;
  font-size: 34px; line-height: 1.05; color: var(--mist);
}
.brand-role { display: block; margin-top: 12px; font-size: 14.5px; line-height: 1.4; color: var(--sage); max-width: 20ch; }

.nav { margin-top: 52px; }
.nav ul { list-style: none; margin: 0; padding: 0; }
.nav li + li { margin-top: 2px; }
.nav li.gap { margin-top: 22px; }
.nav a {
  position: relative; display: block; padding: 7px 0 7px 26px;
  color: var(--mist); text-decoration: none; font-size: 18px;
}
.nav a::before {            /* registration mark, shown on the current section */
  content: ""; position: absolute; left: 0; top: 50%; width: 14px; height: 14px;
  transform: translateY(-50%) scale(.4); opacity: 0;
  background:
    linear-gradient(var(--sage), var(--sage)) center / 100% 1px no-repeat,
    linear-gradient(var(--sage), var(--sage)) center / 1px 100% no-repeat;
  transition: transform .2s ease, opacity .2s ease;
}
.nav a::after {
  content: ""; position: absolute; left: 3px; top: 50%; width: 8px; height: 8px;
  margin-top: -4px; border: 1px solid var(--sage); border-radius: 50%; opacity: 0;
  transition: opacity .2s ease;
}
.nav a:hover { color: var(--sage); }
.nav a[aria-current="page"] { color: var(--sage); }
.nav a[aria-current="page"]::before { opacity: 1; transform: translateY(-50%) scale(1); }
.nav a[aria-current="page"]::after { opacity: 1; }

.menu-btn { display: none; }

.side-foot { margin-top: auto; }
.strip { display: flex; align-items: center; gap: 0; color: var(--sage); }
.strip i { width: 22px; height: 22px; display: block; }
.strip i:nth-child(1) { background: var(--mist); }
.strip i:nth-child(2) { background: var(--sage); }
.strip i:nth-child(3) { background: #7C8B69; }
.strip i:nth-child(4) { background: var(--clay); }
.strip i:nth-child(5) { background: var(--walnut); }
.strip .reg { margin-left: 12px; opacity: .8; }
.copyright { margin: 16px 0 0; font-size: 13px; color: var(--sage); opacity: .8; }

/* ---------- Main area ---------- */
main { margin-left: var(--side-w); min-height: 100vh; padding: var(--pad); }
.page { max-width: 1500px; }
.page-head { margin: 8px 0 clamp(28px, 4vw, 48px); max-width: 60ch; }
.page-head h1 { font-size: clamp(40px, 5.4vw, 76px); }
.page-head p { margin: 16px 0 0; font-size: 18px; color: var(--walnut); }

/* Printer's crop marks around a block */
.crop { position: relative; }
.crop::before {
  --c: var(--walnut);
  content: ""; position: absolute; inset: -18px; pointer-events: none;
  background:
    linear-gradient(var(--c), var(--c)) 0 18px / 11px 1px,
    linear-gradient(var(--c), var(--c)) 18px 0 / 1px 11px,
    linear-gradient(var(--c), var(--c)) 100% 18px / 11px 1px,
    linear-gradient(var(--c), var(--c)) calc(100% - 18px) 0 / 1px 11px,
    linear-gradient(var(--c), var(--c)) 0 calc(100% - 18px) / 11px 1px,
    linear-gradient(var(--c), var(--c)) 18px 100% / 1px 11px,
    linear-gradient(var(--c), var(--c)) 100% calc(100% - 18px) / 11px 1px,
    linear-gradient(var(--c), var(--c)) calc(100% - 18px) 100% / 1px 11px;
  background-repeat: no-repeat;
}

/* ---------- Home ---------- */
.home-intro {
  font-family: var(--display); font-weight: 600; font-size: clamp(26px, 3vw, 42px); line-height: 1.16;
  max-width: 24ch; margin: 8px 0 clamp(34px, 4.5vw, 56px);
}
.mosaic {
  display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px;
  margin: 18px;
}
.mosaic a {
  position: relative; display: block; overflow: hidden;
  height: clamp(240px, 40vh, 460px);
  background: var(--sage); color: var(--espresso); text-decoration: none;
}
.mosaic a:nth-child(4n + 1), .mosaic a:nth-child(4n + 4) { grid-column: span 7; }
.mosaic a:nth-child(4n + 2), .mosaic a:nth-child(4n + 3) { grid-column: span 5; }
.mosaic a:nth-child(4n + 2) { background: #C9B8A3; }
.mosaic a:nth-child(4n + 3) { background: #BFC8B0; }
.mosaic img, .mosaic video { width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2, .7, .2, 1); }
.mosaic a:hover img, .mosaic a:focus-visible img { transform: scale(1.035); }
.plate {
  position: absolute; left: 0; bottom: 0;
  background: var(--paper); padding: 14px 20px 13px 18px;
  display: flex; align-items: baseline; gap: 14px;
}
.plate b { font-family: var(--display); font-weight: 600; font-size: clamp(24px, 2.4vw, 34px); line-height: 1; }
.plate span { font-size: 14px; color: var(--walnut); white-space: nowrap; }
.mosaic a:hover .plate, .mosaic a:focus-visible .plate { background: var(--espresso); color: var(--mist); }
.mosaic a:hover .plate span, .mosaic a:focus-visible .plate span { color: var(--sage); }
.mosaic .hint { position: absolute; left: 18px; top: 16px; right: 18px; font-size: 15px; color: var(--espresso); }

/* ---------- Gallery ---------- */
.grid { display: flex; gap: 14px; align-items: flex-start; }
.grid .col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.tile {
  position: relative; display: block; width: 100%; padding: 0; border: 0;
  background: #D3D9C6; overflow: hidden; cursor: zoom-in;
}
.tile img, .tile video { width: 100%; height: 100%; object-fit: cover; transition: transform .5s cubic-bezier(.2, .7, .2, 1), opacity .3s; }
.tile.auto img, .tile.auto video { height: auto; }
.tile:hover img, .tile:hover video { transform: scale(1.025); }
.badge {
  position: absolute; left: 0; bottom: 0; background: var(--paper); color: var(--espresso);
  font-size: 13.5px; padding: 6px 12px 5px 10px;
}
.badge.play { display: flex; align-items: center; gap: 7px; }
.badge.play::before { content: ""; border-left: 8px solid var(--espresso); border-top: 5px solid transparent; border-bottom: 5px solid transparent; }

.empty {
  border: 1px dashed var(--walnut); padding: 34px; max-width: 58ch; background: rgba(242, 244, 235, .5);
}
.empty h2 { font-size: 26px; margin-bottom: 12px; }
.empty code { background: var(--paper); padding: 2px 6px; font-size: .92em; }
.empty p:last-child { margin-bottom: 0; }

/* ---------- About ---------- */
.about { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: clamp(36px, 5vw, 64px); align-items: start; }
.about .portrait { margin: 18px 0 18px 18px; }
.about .portrait img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; background: var(--sage); }
.about .words { max-width: 58ch; font-size: 18px; }
.about h2 { font-size: 24px; margin: 38px 0 14px; }
.tools { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.tools li { border: 1px solid var(--moss); color: var(--moss); padding: 5px 13px 4px; border-radius: 99px; font-size: 15px; }
.btn {
  display: inline-block; margin-top: 34px; padding: 13px 22px 12px;
  background: var(--espresso); color: var(--mist); text-decoration: none; border: 0;
}
.btn:hover { background: var(--moss); color: var(--paper); }
.btn.quiet { background: transparent; color: var(--espresso); box-shadow: inset 0 0 0 1px var(--espresso); }
.btn.quiet:hover { background: var(--espresso); color: var(--mist); }

/* ---------- Contact ---------- */
.contact .email {
  display: inline-block; font-family: var(--display); font-weight: 600;
  font-size: clamp(26px, 4.2vw, 60px); line-height: 1.1; color: var(--espresso);
  text-decoration-color: var(--sage); text-decoration-thickness: 3px; text-underline-offset: 8px;
  overflow-wrap: anywhere;
}
.contact .email:hover { color: var(--moss); }
.contact .row { display: flex; flex-wrap: wrap; gap: 12px; }
.contact .row .btn { margin-top: 30px; }
.contact dl { margin: 52px 0 0; display: grid; grid-template-columns: max-content 1fr; gap: 10px 28px; font-size: 18px; }
.contact dt { color: var(--walnut); }
.contact dd { margin: 0; }

/* ---------- Lightbox ---------- */
.lightbox {
  border: 0; padding: 0; margin: 0; width: 100vw; height: 100vh; height: 100dvh; max-width: none; max-height: none;
  background: #261C16; color: var(--mist);
}
.lightbox::backdrop { background: transparent; }
.lightbox[open] { display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: auto 1fr auto; }
.lb-bar { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; padding: 14px 20px; }
.lb-count { margin: 0; font-size: 15px; color: var(--sage); font-variant-numeric: tabular-nums; }
.lb-close { background: none; border: 1px solid var(--sage); color: var(--mist); padding: 7px 16px 6px; }
.lb-close:hover { background: var(--sage); color: var(--espresso); }
.lb-nav { background: none; border: 0; color: var(--sage); padding: 0 18px; align-self: stretch; }
.lb-nav:hover { color: var(--paper); }
.lb-nav[hidden] { display: block; visibility: hidden; }
.lb-stage { min-width: 0; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 18px; }
.lb-stage > img, .lb-stage > video { max-width: 100%; max-height: 100%; object-fit: contain; }
.lb-caption { grid-column: 1 / -1; margin: 0; padding: 10px 20px 18px; text-align: center; font-size: 15px; color: var(--sage); min-height: 46px; }

/* Before and after slider */
.ba { position: relative; --pos: 50%; max-width: 100%; max-height: 100%; display: flex; touch-action: pan-y; user-select: none; }
.ba img { max-width: 100%; max-height: calc(100dvh - 170px); object-fit: contain; }
.ba .before { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; clip-path: inset(0 calc(100% - var(--pos)) 0 0); }
.ba .line { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 2px; margin-left: -1px; background: var(--paper); pointer-events: none; }
.ba .line svg { position: absolute; top: 50%; left: 50%; width: 40px; height: 40px; margin: -20px 0 0 -20px; }
.ba input {
  position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: ew-resize;
}
.ba:focus-within .line { background: var(--clay); }
.ba .tag { position: absolute; top: 12px; background: var(--paper); color: var(--espresso); font-size: 13.5px; padding: 4px 10px 3px; pointer-events: none; }
.ba .tag.b { left: 12px; }
.ba .tag.a { right: 12px; }

/* ---------- Page change ---------- */
.page { animation: arrive .35s ease both; }
@keyframes arrive { from { opacity: 0; transform: translateY(6px); } }

/* ---------- Smaller screens ---------- */
@media (max-width: 900px) {
  .side {
    position: sticky; top: 0; inset: auto; width: auto;
    flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: space-between;
    padding: 14px 20px;
  }
  .brand-name { font-size: 23px; }
  .brand-role { display: none; }
  .menu-btn {
    display: block; background: none; border: 1px solid var(--sage); color: var(--mist);
    padding: 7px 16px 6px;
  }
  .nav { display: none; flex-basis: 100%; margin: 14px 0 8px; }
  .side.open .nav { display: block; }
  .nav a { font-size: 20px; padding-top: 9px; padding-bottom: 9px; }
  .side-foot { display: none; }
  main { margin-left: 0; }
  .mosaic { margin: 18px 4px; gap: 10px; }
  .mosaic a { grid-column: 1 / -1 !important; height: clamp(210px, 34vh, 340px); }
  .about { grid-template-columns: 1fr; }
  .about .portrait { max-width: 150px; }
  .lb-nav { padding: 0 6px; }
  .lb-stage { padding: 6px; }
}

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