/* Joris Wintgens portfolio. Draft 9: archive, one page. */
@font-face {
  font-family: "Instrument Sans";
  src: url("fonts/instrument-sans-latin-wdth-normal.woff2") format("woff2");
  font-weight: 400 700; font-stretch: 75% 100%; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Instrument Sans";
  src: url("fonts/instrument-sans-latin-ext-wdth-normal.woff2") format("woff2");
  font-weight: 400 700; font-stretch: 75% 100%; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #FFFFFF;
  --ink: #1E1E1C;
  --mid: #8F8F8A;
  --line: #E6E6E2;
  --plate: #F2F2EF;
  --pad: 20px;
  --side: 420px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Instrument Sans", system-ui, sans-serif;
  font-size: 12px;            /* one size for everything */
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}
img { display: block; width: 100%; height: auto; }
a { color: inherit; text-decoration: none; }
a:focus-visible { outline: 1px solid var(--ink); outline-offset: 2px; }
h2, p, dl, dd, figure, ul { margin: 0; padding: 0; font: inherit; }
ul { list-style: none; }

.layout {
  display: grid;
  grid-template-columns: var(--side) 1fr;
  gap: 48px;
  padding: 0 var(--pad);
}

/* Left: the index stays put */
.side-inner {
  position: sticky; top: 0;
  height: 100vh; overflow-y: auto;
  padding: var(--pad) 0;
  display: flex; flex-direction: column;   /* about + contact sit at the bottom */
}
/* The name sits above the index. Its height is fixed so the line under the
   column heads on the left meets the line under the first project on the right. */
:root { --mark: 52px; }
.mark { display: block; height: var(--mark); font-weight: 600; }

.row {
  display: grid;
  grid-template-columns: 1fr 5rem 7rem 2.4rem;
  column-gap: 12px;
}
.row > span, .row > h2 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.c-year { text-align: right; }

.heads { font-weight: 600; padding-bottom: 4px; border-bottom: 1px solid var(--ink); }
.index .row { padding: 3px 0; border-bottom: 1px solid var(--line); color: var(--mid); transition: color .2s; }
.index .row:hover, .index .row[aria-current] { color: var(--ink); }
/* The signature: a small black square marks where you are (same square as the tab icon) */
.index .c-title { position: relative; transition: padding-left .25s ease; }
.index .c-title::before {
  content: ""; position: absolute; left: 0; top: 50%;
  width: 7px; height: 7px; margin-top: -3px;
  background: var(--ink); transform: scale(0); transition: transform .25s ease;
}
.index .row[aria-current] .c-title { padding-left: 14px; }
.index .row[aria-current] .c-title::before { transform: scale(1); }

.about { margin-top: auto; padding-top: 40px; max-width: 60ch; line-height: 1.4; scroll-margin-top: var(--pad); }
.about p + p { margin-top: 0.8em; }
.about a { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }

.contact { margin-top: 28px; }
.contact div { display: grid; grid-template-columns: 6rem 1fr; column-gap: 12px; }
.contact dt { color: var(--mid); }
.contact a:hover { text-decoration: underline; text-underline-offset: 2px; }

/* Right: every project, one after another */
.main { padding: calc(var(--pad) + var(--mark)) 0 var(--pad); min-width: 0; }
.entry { padding-bottom: 96px; scroll-margin-top: calc(var(--pad) + var(--mark)); }
.entry-head .c-title { font-weight: 600; }
.entry-head {
  grid-template-columns: 1fr 8rem 2.6rem;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--ink);
}
.entry-info {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 3fr);
  gap: 24px;
  padding: 12px 0 20px;
}
.facts div {
  display: grid; grid-template-columns: 6rem 1fr; column-gap: 12px;
  padding: 3px 0; border-bottom: 1px solid var(--line);
}
.facts dt { color: var(--mid); }
.text { max-width: 72ch; line-height: 1.4; }
.text p + p { margin-top: 0.8em; }

.shots {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-auto-flow: row dense;   /* a later portrait fills a gap left by a landscape photo */
  gap: 8px;
  align-items: start;
}
.shots figure { background: var(--plate); }
.shots .lead { grid-column: 1 / -1; }
.shots button { display: block; width: 100%; padding: 0; border: 0; background: none; cursor: zoom-in; }
.shots img { opacity: 0; transition: opacity .5s ease; }
.shots img.in { opacity: 1; }

/* Full-screen viewer */
#viewer {
  width: 100vw; height: 100vh; max-width: none; max-height: none;
  margin: 0; padding: 0; border: 0;
  background: var(--bg); color: var(--ink);
}
#viewer::backdrop { background: var(--bg); }
#viewer[open] { display: grid; grid-template-rows: auto 1fr; }
#viewer img {
  width: 100%; height: 100%; min-height: 0;
  object-fit: contain; padding: 0 var(--pad) var(--pad);
  cursor: e-resize;
}
.v-bar { display: grid; grid-template-columns: 1fr auto auto; gap: 24px; padding: var(--pad); }
.v-title { font-weight: 600; }
.v-count { color: var(--mid); }
#viewer button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
.v-close:hover { text-decoration: underline; text-underline-offset: 2px; }
#viewer .v-prev, #viewer .v-next { position: absolute; top: 60px; bottom: 0; width: 30%; }
.v-prev { left: 0; cursor: w-resize !important; }
.v-next { right: 0; cursor: e-resize !important; }

.bar { display: none; }

/* End of the archive */
.end {
  grid-template-columns: 1fr auto;
  padding-top: 4px; border-top: 1px solid var(--ink); color: var(--mid);
}
.end a:hover { color: var(--ink); }

::selection { background: var(--ink); color: var(--bg); }
.skip { position: absolute; left: var(--pad); top: -40px; z-index: 10; background: var(--bg); padding: 4px 8px; border: 1px solid var(--ink); }
.skip:focus { top: var(--pad); }

/* Narrower screens: drop the material column */
@media (max-width: 980px) {
  :root { --side: 340px; }
  .row { grid-template-columns: 1fr 5.5rem 2.6rem; }
  .row .c-mat { display: none; }
  .entry-head { grid-template-columns: 1fr 6rem 2.6rem; }
  .end { grid-template-columns: 1fr auto; }
}
/* Phone: index on top, projects below, a slim bar keeps you oriented */
@media (max-width: 760px) {
  :root { --barh: 44px; }
  body { font-size: 13px; }
  .layout { grid-template-columns: 1fr; gap: 0; }
  .side-inner { position: static; height: auto; padding-bottom: 64px; }
  .mark { height: 48px; }
  .main { padding-top: 0; }
  .entry { padding-bottom: 72px; scroll-margin-top: var(--barh); }

  /* Easy to tap, and no grey state: on a phone the list is a menu */
  .index .row { padding: 12px 0; color: var(--ink); }
  .heads { padding-bottom: 6px; }

  .entry-info { grid-template-columns: 1fr; gap: 16px; }
  .shots { grid-template-columns: 1fr 1fr; gap: 6px; }

  .bar {
    display: grid; grid-template-columns: auto 1fr auto; gap: 16px; align-items: center;
    position: fixed; top: 0; left: 0; right: 0; z-index: 5;
    height: var(--barh); padding: 0 var(--pad);
    background: var(--bg); border-bottom: 1px solid var(--line);
    transform: translateY(-100%); transition: transform .25s ease;
  }
  .bar.show { transform: none; }
  .bar-name { font-weight: 600; }
  .bar-now { color: var(--mid); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  #viewer .v-prev, #viewer .v-next { width: 50%; }
  .about { max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .index .row, .bar, .index .c-title, .index .c-title::before { transition: none; }
  .shots img { transition: none; }
}
