:root{
  --bg: #0a0a0a;
  --ink: #f4f4f0;
  --nav-w: 170px;             /* left menu column */
  --col-gap: 40px;            /* between the menu and the content */
  --side-pad: 40px;           /* page padding left and right */
  --gap: 18px;                /* between grid tiles */
  /* content column: 75% of what the viewport leaves next to the menu,
     between 700px (small laptops) and 1080px (2K/4K). Deliberately not
     filling the screen — a compact block floating in empty space, like a
     site from before fully optimised layouts. It depends only on the
     viewport, so it's the same on every page and the menu always sits in
     the same place. */
  --content-w: clamp(700px, calc((100vw - var(--nav-w) - var(--col-gap) - var(--side-pad) * 2) * 0.75), 1080px);
  --tile-w: calc((var(--content-w) - var(--gap)) / 2);
}
*{ box-sizing: border-box; }
html, body{
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: Verdana, Geneva, Tahoma, sans-serif;
  font-size: 12px;
  letter-spacing: 0.04em;
}

/* background only on <html>: a body background would paint over the
   z-index -1 canvas below */
html{ background: var(--bg); }

/* bead-chain canvas under the contacts panel (js/chains.js);
   positioned and sized from the layout by the script */
.bead-panel{
  position: fixed;
  display: none;
  z-index: -1;
  pointer-events: none;
}

/* ---------------------------------------------------------------
   Layout: menu column + content column, centred as one block. The
   content column has the same fixed width on every page, so the menu
   sits in exactly the same place everywhere.
   --------------------------------------------------------------- */
.site{
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: var(--col-gap);
  padding: 50px var(--side-pad) 80px;
}
.site-nav{
  flex: 0 0 var(--nav-w);
  position: sticky;
  top: 50px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.content{
  flex: 0 0 var(--content-w);
  max-width: var(--content-w);
}

/* ---------------------------------------------------------------
   The shared 2005-style box (same look as the main page's labels):
   1px frame with an inner hairline rule, hard 2px offset shadow, glossy
   top half, and a snappy "selected" state (light fill, dark text,
   dotted inner rule).
   --------------------------------------------------------------- */
.box{
  position: relative;
  display: block;
  color: var(--ink);
  text-decoration: none;
  background-color: var(--bg);
  background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.05) 50%, transparent 50%);
  background-repeat: no-repeat;
  border: 1px solid var(--ink);
  box-shadow:
    inset 0 0 0 1px var(--bg),
    inset 0 0 0 2px rgba(244, 244, 240, 0.28),
    2px 2px 0 rgba(244, 244, 240, 0.22);
  outline: 1px dotted transparent;
  outline-offset: -5px;
  transition: background-color 0.08s linear, color 0.08s linear;
}
.box:hover,
.box.is-current{
  background-color: var(--ink);
  color: var(--bg);
  outline-color: var(--bg);
}

/* menu items */
.nav-item{
  padding: 4px 26px 5px 8px;
  line-height: 1.2;
  white-space: pre-line; /* the home item's name wraps onto two lines */
}
.nav-item:not(.nav-home)::before{
  content: "\00BB\00A0";
  opacity: 0.55;
  display: inline-block;
  transition: transform 0.12s steps(3, end);
}
.nav-item:hover::before{ transform: translateX(3px); }
.nav-home{
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

/* ---------------------------------------------------------------
   Selected works grid: 2 columns, as many rows as there are projects
   --------------------------------------------------------------- */
.works-grid{
  display: grid;
  grid-template-columns: repeat(2, var(--tile-w));
  gap: var(--gap);
}
.tile{
  padding: 5px;
}
.tile-cover{
  display: block;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: #000;
  border: 1px solid rgba(244, 244, 240, 0.25);
}
.tile-cover img{
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
/* no cover image yet: a 2005-ish hatched placeholder */
.tile-cover.no-cover,
.gallery-view.no-cover,
.gallery-thumb.no-cover{
  position: relative;
  background:
    repeating-linear-gradient(45deg, rgba(244, 244, 240, 0.07) 0 1px, transparent 1px 6px),
    #000;
}
.tile-cover.no-cover::after,
.gallery-view.no-cover::after{
  content: "no cover";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 10px;
  color: rgba(244, 244, 240, 0.45);
}
.gallery-view.no-cover{ position: absolute; } /* stays filling the stage */
.gallery-view.no-cover::after{ content: "no media"; }
.tile-title{
  display: block;
  padding: 6px 3px 1px;
  line-height: 1.2;
}
.tile-title::before{
  content: "\00BB\00A0";
  opacity: 0.55;
}

/* ---------------------------------------------------------------
   Plain text pages (about, contacts)
   --------------------------------------------------------------- */
.panel{
  padding: 14px 16px 16px;
  /* keep the glossy top half the height of a one-line panel, so tall
     panels get a gloss strip behind the heading rather than half a box */
  background-size: 100% 76px;
}
.panel h1{
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.panel p{ margin: 0; line-height: 1.6; }
.panel p + p{ margin-top: 0.9em; }

/* ---------------------------------------------------------------
   About: tall photo with text beside it, more text (and optional
   photos) underneath
   --------------------------------------------------------------- */
.about-top{
  display: grid;
  grid-template-columns: 38% minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}
.about-photo,
.about-photos img{
  display: block;
  overflow: hidden;
  background: #000;
  border: 1px solid rgba(244, 244, 240, 0.25);
}
.about-photo{ aspect-ratio: 3 / 4; }
.about-photo img{
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.about-photo.no-cover{
  position: relative;
  background:
    repeating-linear-gradient(45deg, rgba(244, 244, 240, 0.07) 0 1px, transparent 1px 6px),
    #000;
}
.about-photo.no-cover::after{
  content: "no photo";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 10px;
  color: rgba(244, 244, 240, 0.45);
}
.about-more{ margin-top: 16px; }
/* core skills: a centred heading between two dotted rules, then the skills
   as centred chips that wrap — each a glossy strip with a small square
   bullet (the status-LED look), details inside as tiny inverted boxes */
.skills{ margin-top: 22px; text-align: center; }
.skills-title{
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0 0 12px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(244, 244, 240, 0.7);
}
.skills-title::before,
.skills-title::after{
  content: "";
  flex: 1;
  border-top: 1px dotted rgba(244, 244, 240, 0.35);
}
.skills ul{
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 8px;
  max-width: 88%;
  margin: 0 auto;
  padding: 0;
  list-style: none;
}
.skills li{
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px 4px 8px;
  line-height: 1.3;
  white-space: nowrap;
  background-size: 100% 100%;
}
.skills li::before{
  content: "";
  width: 5px;
  height: 5px;
  margin-right: 3px;
  background: rgba(244, 244, 240, 0.75);
  box-shadow: 0 0 0 1px var(--bg), 0 0 0 2px rgba(244, 244, 240, 0.3);
}
.skills .sub{
  padding: 0 4px;
  font-size: 10px;
  font-weight: 700;
  color: var(--bg);
  background: rgba(244, 244, 240, 0.8);
}
/* not links: hovering only brightens the frame */
.skills li:hover{ border-color: var(--ink); color: var(--ink); }

/* inline tags inside the text: a quieter cousin of .box — dim frame,
   inner hairline and offset shadow at lower strength, faint gloss, not
   clickable. Kept tight vertically so they don't push the lines apart. */
.tag{
  display: inline-block;
  padding: 0 5px 1px;
  line-height: 1.35;
  white-space: nowrap;
}
.tag,
.info-field,
.skills li{
  color: rgba(244, 244, 240, 0.85);
  background-color: var(--bg);
  background-image: linear-gradient(to bottom, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03) 50%, transparent 50%);
  border: 1px solid rgba(244, 244, 240, 0.45);
  box-shadow:
    inset 0 0 0 1px var(--bg),
    inset 0 0 0 2px rgba(244, 244, 240, 0.12),
    1px 1px 0 rgba(244, 244, 240, 0.15);
}
.about-photos{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}
.about-photos img{
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
}
.panel:hover{ /* text panels aren't links: no selected state */
  background-color: var(--bg);
  color: var(--ink);
  outline-color: transparent;
}

/* ---------------------------------------------------------------
   Project pages (projects/<slug>.html): cover, text, and a pager to the
   previous project / all works / next project
   --------------------------------------------------------------- */
/* media slider (js/gallery.js): a 16:9 stage showing one photo or
   YouTube video at a time, arrow boxes at its sides, and a strip of
   previews underneath (7-10 fill the row; more scroll sideways) */
.gallery-stage{
  position: relative;
  aspect-ratio: 16 / 9;
  background: #000;
  border: 1px solid rgba(244, 244, 240, 0.25);
  overflow: hidden;
  touch-action: pan-y;
}
.gallery-view{
  position: absolute;
  inset: 0;
}
/* photos are shown whole (letterboxed on black) */
.gallery-view > img{
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
/* videos: the YouTube poster fills the stage while the player loads on
   top of it */
.gallery-view > img.gallery-poster{ object-fit: cover; }
.gallery-view iframe{
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}
.gallery-arrow{
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 1;
  padding: 6px 9px 7px;
  font: inherit;
  letter-spacing: inherit;
  cursor: pointer;
}
.gallery-arrow--prev{ left: 10px; }
.gallery-arrow--next{ right: 10px; }
/* full screen box, bottom right: mobile version only (touch screens or a
   narrow window; keep the query in sync with FULL_MQ in js/gallery.js) */
.gallery-full{
  display: none;
  position: absolute;
  bottom: 10px;
  right: 10px;
  z-index: 2;
  width: 28px;          /* same size as the « » arrow boxes */
  height: 29px;
  padding: 0;
  cursor: pointer;
}
.gallery-full svg{ display: block; margin: auto; }
@media (pointer: coarse), (max-width: 560px){
  .gallery-full{ display: block; }
  .gallery-stage .gallery-count{ right: 46px; } /* moves left of the box */
}
/* full screen: the real API, or (iPhone) the stage pinned over the page */
.gallery-stage:fullscreen,
.gallery-stage.is-full{
  aspect-ratio: auto;
  border: 0;
}
.gallery-stage.is-full{
  position: fixed;
  inset: 0;
  z-index: 100;
  width: 100%;
  height: 100%;
}
html.gallery-locked,
html.gallery-locked body{ overflow: hidden; }
.gallery-count{
  position: absolute;
  right: 8px;
  bottom: 6px;
  z-index: 1;
  font-size: 10px;
  color: rgba(244, 244, 240, 0.55);
  pointer-events: none;
}
.gallery-thumbs{
  display: flex;
  gap: 6px;
  margin-top: 8px;
  padding-bottom: 3px; /* room for the offset shadow */
  overflow-x: auto;
}
.gallery-thumb{
  position: relative;
  flex: 1 1 0;
  min-width: 64px;
  max-width: calc((100% - 6px * 6) / 7);
  aspect-ratio: 16 / 9;
  padding: 0;
  background: #000;
  border: 1px solid rgba(244, 244, 240, 0.3);
  cursor: pointer;
  overflow: hidden;
}
.gallery-thumb img{
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.55;
  transition: opacity 0.08s linear;
}
.gallery-thumb:hover img{ opacity: 0.85; }
.gallery-thumb.is-current{
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--bg), 2px 2px 0 rgba(244, 244, 240, 0.22);
  outline: 1px dotted var(--ink);
  outline-offset: 1px;
}
.gallery-thumb.is-current img{ opacity: 1; }
/* video previews carry a small play mark */
.gallery-thumb--video::after{
  content: "\25B6";
  position: absolute;
  left: 4px;
  bottom: 2px;
  font-size: 9px;
  color: var(--ink);
  text-shadow: 1px 1px 0 var(--bg);
}

/* the 3 info fields under the previews: client / collaboration /
   location, each a subtle box (same look as the about page's tags) */
.project-info{
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0 0;
}
.info-field{
  padding: 5px 8px 7px;
}
.info-field dt{
  display: flex;
  align-items: center;
  height: 14px;
  margin-bottom: 3px;
  font-size: 10px;
  color: rgba(244, 244, 240, 0.55);
}
.info-field dt svg{ display: block; }
.info-field dd{
  margin: 0;
  line-height: 1.5;
}
.info-field a,
.project-text a{
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px dotted rgba(244, 244, 240, 0.6);
}
.info-field a:hover,
.project-text a:hover{
  background: var(--ink);
  color: var(--bg);
  border-bottom-color: var(--ink);
}
.project-text{ margin-top: 14px; }
/* bullet list in the text: square LED bullets like the core skills chips */
.project-text ul{
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}
.project-text li{
  position: relative;
  padding-left: 16px;
  margin-bottom: 4px;
}
.project-text li::before{
  content: "";
  position: absolute;
  left: 3px;
  top: 0.55em;
  width: 5px;
  height: 5px;
  background: rgba(244, 244, 240, 0.75);
  box-shadow: 0 0 0 1px var(--bg), 0 0 0 2px rgba(244, 244, 240, 0.3);
}
/* year at the right end of the project title bar:
   <h1>Title <span class="project-year">2026</span></h1> */
.project h1{
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
.project-year{
  font-weight: 400;
  color: rgba(244, 244, 240, 0.6);
}

.project-pager{
  display: flex;
  justify-content: space-between;
  gap: var(--gap);
  margin-top: var(--gap);
}
.pager-item{
  padding: 4px 10px 5px;
  white-space: nowrap;
}
/* the neighbour's name sits in a <span> so it alone can be cut with "…"
   on narrow screens while the « » arrows stay */
.pager-item span{
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------------------------------------------------------------
   Contacts: big e-mail bottom-left, the other channels stacked on the
   right, split by a dotted rule
   --------------------------------------------------------------- */
.contacts h1{
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
/* "available" status at the right end of the title bar: a small LED
   that blinks hard (steps, no fade) like an old status icon */
.status{
  font-size: 10px;
  font-weight: 400;
  color: rgba(244, 244, 240, 0.6);
  white-space: nowrap;
}
.status-led{
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  vertical-align: 1px;
  background: var(--ink);
  border: 1px solid var(--ink);
  box-shadow: 0 0 0 1px var(--bg), 0 0 0 2px rgba(244, 244, 240, 0.35);
  animation: led-blink 1.6s steps(1, end) infinite;
}
@keyframes led-blink{
  60%{ background: transparent; }
}
.contacts-grid{
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  min-height: 340px;
  margin-top: 6px;
}
.contacts-main{
  display: flex;
  flex-direction: column;
  justify-content: flex-end; /* e-mail sits low, like the reference */
  padding: 20px 28px 8px 4px;
  border-right: 1px dotted rgba(244, 244, 240, 0.35);
}
.panel .contacts-mail-label{
  margin-bottom: 6px;
  font-size: 10px;
  color: rgba(244, 244, 240, 0.55);
}
.contacts-mail{
  align-self: flex-start;
  /* the biggest element on the page; scales with the content column */
  font-size: clamp(20px, calc(var(--content-w) * 0.033), 34px);
  letter-spacing: 0.01em;
  line-height: 1.25;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px dotted rgba(244, 244, 240, 0.6);
  white-space: nowrap; /* keep the cursor on the address line */
}
.contacts-mail:hover{
  background: var(--ink);
  color: var(--bg);
  border-bottom-color: var(--ink);
}
/* blinking block cursor after the address */
.contacts-mail::after{
  content: "";
  display: inline-block;
  width: 0.45em;
  height: 0.9em;
  margin-left: 0.12em;
  vertical-align: -0.08em;
  background: currentColor;
  animation: led-blink 1.1s steps(1, end) infinite;
}
.contacts-actions{
  display: flex;
  gap: 8px;
  margin: 14px 0 18px;
}
.contacts-btn{
  min-width: 72px;
  padding: 3px 10px 4px;
  font: inherit;
  text-align: center;
  cursor: pointer;
}
.contacts-btn::before{
  content: "\00BB\00A0";
  opacity: 0.55;
}
.contacts-lead{ max-width: 34em; }
.contacts-list{
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 20px 4px 8px 28px;
}
.contacts-list dl{ margin: 0; }
.contacts-list dd{ font-size: 13px; }
.panel .contacts-note{
  margin-top: 8px;
  color: rgba(244, 244, 240, 0.75);
}

/* ---------------------------------------------------------------
   Tablets and phones: menu on top, content full width, fewer but
   bigger grid columns (2 on tablets, 1 on phones)
   --------------------------------------------------------------- */
/* back-to-menu bar (js/nav.js): mobile version only. Once the menu has
   scrolled out of view it drops in at the top, as wide as the menu: a
   framed bar with "back to menu" in the title-bar caps between two
   ▲ ▲ ▲ runs, sliding smoothly down from above the screen. */
.to-top{
  display: none;
  position: fixed;
  top: 8px;
  left: 20px;
  right: 20px;
  max-width: 675px;
  margin: 0 auto;
  z-index: 50;
  padding: 10px 10px 12px; /* 25% taller than the first version */
  font: inherit;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  /* the usual box frame, plus a soft black fade all round (stacked
     blurred shadows, no hard edge), so the page scrolling underneath
     doesn't poke out around it */
  box-shadow:
    inset 0 0 0 1px var(--bg),
    inset 0 0 0 2px rgba(244, 244, 240, 0.28),
    2px 2px 0 rgba(244, 244, 240, 0.22),
    0 0 12px 6px var(--bg),
    0 0 28px 14px rgba(10, 10, 10, 0.9),
    0 0 48px 20px rgba(10, 10, 10, 0.6);
  transform: translateY(calc(-100% - 80px)); /* hidden: fade included */
  transition: transform 0.3s ease-out;
  pointer-events: none;
}
.to-top.is-shown{
  transform: none;
  pointer-events: auto;
}
.to-top-inner{
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}
.to-top-run{ display: inline-flex; gap: 5px; }
.to-top-run i{
  font-style: normal;
  font-size: 8px;
}
.to-top:hover,
.to-top:active{
  background-color: var(--ink);
  color: var(--bg);
  outline-color: var(--bg);
}
@media (max-width: 1000px){
  .to-top{ display: block; }
  .site{ flex-direction: column; align-items: stretch; gap: 24px; padding: 24px 20px 60px; }
  .site-nav{ position: static; flex-basis: auto; width: 100%; max-width: 675px; margin: 0 auto; }
  .content{ flex-basis: auto; width: 100%; max-width: 675px; margin: 0 auto; }
  .works-grid{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px){
  .works-grid{ grid-template-columns: minmax(0, 1fr); }
  .about-top{ grid-template-columns: minmax(0, 1fr); }
  .about-photos{ grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .skills ul{ max-width: none; }
  .skills li{ white-space: normal; flex-wrap: wrap; justify-content: center; }
  .project-info{ grid-template-columns: minmax(0, 1fr); gap: 6px; }
  /* info boxes: one line each, the value right after its label */
  .info-field{ display: flex; align-items: center; gap: 8px; min-height: 26px; padding: 3px 8px 4px; }
  .info-field dt{ flex: none; margin-bottom: 0; }
  .info-field dd{ min-width: 0; }
  .contacts-grid{ grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .contacts-main{ padding: 20px 4px 18px; border-right: 0; border-bottom: 1px dotted rgba(244, 244, 240, 0.35); }
  .contacts-list{ padding: 18px 4px 4px; }
  /* pager: prev / next side by side, each half the width, "all works"
     centred on its own row below */
  .project-pager{ display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
  .project-pager .pager-item{ display: flex; min-width: 0; }
  .project-pager .pager-item span{ min-width: 0; }
  .project-pager .pager-item:first-child{ grid-column: 1; grid-row: 1; }
  .project-pager .pager-item:last-child{ grid-column: 2; grid-row: 1; justify-content: flex-end; }
  .project-pager .pager-item:nth-child(2){ grid-column: 1 / -1; grid-row: 2; justify-self: center; }
}
