/* ============================================================
   DANIEL GRÜNFELD — Photography
   Index-style layout: fixed sidebar with the page list, content
   on the right. System fonts only: Arial (UI), Times italic
   (quotes), Courier (captions/labels). Accent: classic link blue,
   plus the red of the old site for the current page.
   ============================================================ */

:root {
  --ink: #111111;
  --paper: #ffffff;
  --blue: #0000EE;
  --red: #e02b20;
  --mute: #555555;
  --hair: #d9d9d9;
  --sans: Arial, "Helvetica Neue", Helvetica, sans-serif;
  --serif: "Times New Roman", Times, serif;
  --mono: "Courier New", Courier, monospace;
  --side: 280px;
  --gap: 20px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

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

body {
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--blue); color: #fff; }

a { color: var(--blue); text-decoration: underline; text-underline-offset: 2px; }
a:hover { background: var(--blue); color: #fff; text-decoration: none; }
a:focus-visible, button:focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }

img, video { max-width: 100%; height: auto; }

.mono {
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.02em;
}

/* ---------- Frame: fixed index column + content ---------- */

.frame {
  display: grid;
  grid-template-columns: var(--side) minmax(0, 1fr);
  min-height: 100vh;
}

/* ---------- Sidebar / index ---------- */

.side {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  padding: 28px 28px 24px;
  border-right: 1px solid var(--hair);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.side h1 {
  font-size: 22px;
  font-weight: bold;
  letter-spacing: -0.01em;
  line-height: 1.1;
}
.side h1 a { color: var(--ink); text-decoration: none; }
.side h1 a:hover { background: none; color: var(--blue); }

.side .role {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--mute);
  margin-top: 6px;
}

.side nav { margin-top: 42px; }

.side nav ol {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.side nav a { font-size: 15px; }
.side nav a[aria-current] {
  color: var(--red);
  text-decoration: none;
}
.side nav a[aria-current]:hover { background: var(--red); color: #fff; }

.side nav .num {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--mute);
  margin-right: 10px;
}

.side nav .sep { height: 10px; }
.side nav .group {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--mute);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 14px;
}

.side .foot {
  margin-top: auto;
  padding-top: 24px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--mute);
  line-height: 1.7;
}
.side .foot a { color: var(--blue); }

/* ---------- Main area ---------- */

main { padding: 28px 40px 120px; min-width: 0; }

.topline {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--mute);
  border-bottom: 1px solid var(--hair);
  padding-bottom: 14px;
  margin-bottom: 56px;
}
.topline span:first-child { color: var(--ink); }

.page { max-width: 1200px; }

/* ---------- Text (markdown) ---------- */

.page p, .page ul, .page ol, .page blockquote, .page h2, .page h3, .page h4 {
  max-width: 64ch;
}

.page p {
  font-size: 16px;
  line-height: 1.6;
  margin-bottom: 1.1em;
}
.page p:last-child { margin-bottom: 0; }

.page ul, .page ol { margin: 0 0 1.1em 1.2em; font-size: 16px; line-height: 1.6; }

.page h2 {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: normal;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink);
  margin: 88px 0 20px;
  padding-top: 14px;
  border-top: 1px solid var(--hair);
  max-width: none;
}
.page > h2:first-child { margin-top: 0; border-top: none; padding-top: 0; }
.page hr + h2 { margin-top: 0; border-top: none; padding-top: 0; }

.page h3 {
  font-size: 16px;
  font-weight: bold;
  margin: 56px 0 8px;
}
.page h4 { font-size: 15px; font-weight: bold; margin: 32px 0 8px; }

.page blockquote {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(22px, 2.4vw, 32px);
  line-height: 1.2;
  letter-spacing: -0.01em;
  max-width: 28ch;
  margin: 64px 0;
}
.page blockquote p { font-size: inherit; line-height: inherit; }

.page hr {
  border: none;
  border-top: 1px solid var(--hair);
  margin: 88px 0 20px;
}

.page code { font-family: var(--mono); font-size: 0.9em; }

/* ---------- Pictures ---------- */

.fig { margin: 40px 0; }
.page > .fig:first-child, .page > .row:first-child { margin-top: 0; }
.fig + .fig, .row + .fig, .fig + .row, .row + .row { margin-top: var(--gap); }

.fig .fig-link {
  display: inline-block;
  max-width: 100%;
  text-decoration: none;
  background: none;
  cursor: zoom-in;
  line-height: 0;
}
.fig .fig-link:not([data-lightbox]) { cursor: pointer; }

.fig img {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 88vh;
  outline: 1px solid transparent;
  outline-offset: 6px;
  transition: outline-color 0.15s ease-out;
}
.fig .fig-link:hover img { outline-color: var(--blue); }

.fig figcaption {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--mute);
  margin-top: 10px;
  max-width: 64ch;
}

.fig.size-medium img { max-width: 66%; }
.fig.size-small  img { max-width: 42%; }
.fig.size-wide   img { max-width: 100%; max-height: none; }

/* Several pictures on one line → one row, equal height */
.row {
  display: flex;
  gap: var(--gap);
  align-items: flex-start;
  margin: 40px 0;
}
.row .fig {
  margin: 0;
  flex: calc(var(--ar, 1.5)) 1 0%;
  min-width: 0;
}
.row .fig .fig-link { display: block; }
.row .fig img { width: 100%; max-height: none; }

/* Photo roll (images not placed in the text) */
.roll { margin-top: 56px; }
.page > .roll:first-child { margin-top: 0; }
.roll .fig { margin: 0 0 64px; }
.roll .fig:last-child { margin-bottom: 0; }

/* Video */
.fig.video video {
  display: block;
  width: 100%;
  max-width: 1200px;
  background: #000;
}
.fig.video video a { color: #fff; }

/* Start page: landing picture fits the window */
.page-home .fig img { max-height: calc(100vh - 56px); }

/* ---------- Footer line ---------- */

.section {
  margin-top: 140px;
  border-top: 1px solid var(--hair);
  padding-top: 16px;
}
.footer-line { color: var(--mute); }

/* ---------- Lightbox ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  background: var(--paper);
  z-index: 10;
  display: none;
  flex-direction: column;
  padding: 20px;
}
.lightbox.open { display: flex; }

.lightbox .bar {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-family: var(--mono);
  font-size: 12px;
}

.lightbox .stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 0;
}
.lightbox .stage img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  display: block;
  cursor: e-resize;
}

.lightbox .caption {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--mute);
  text-align: center;
  min-height: 1.5em;
}

.lightbox button {
  font-family: var(--mono);
  font-size: 12px;
  background: none;
  border: none;
  color: var(--blue);
  text-decoration: underline;
  cursor: pointer;
  padding: 4px 6px;
}
.lightbox button:hover { background: var(--blue); color: #fff; text-decoration: none; }

.lightbox .nav-btns { display: flex; gap: 12px; }

/* ---------- Tablet / mobile ---------- */

@media (max-width: 900px) {
  .frame { grid-template-columns: 1fr; }
  .side {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--hair);
    padding: 20px;
    overflow: visible;
  }
  .side nav { margin-top: 20px; }
  .side nav ol { flex-direction: row; flex-wrap: wrap; gap: 8px 20px; align-items: baseline; }
  .side nav .sep { display: none; }
  .side nav .group { margin-top: 0; width: 100%; }
  .side nav .num { display: none; }
  .side .foot { display: none; }
  main { padding: 20px 20px 80px; }
  .topline { margin-bottom: 36px; }
  .page h2 { margin-top: 64px; }
  .page hr { margin-top: 64px; }
  .roll .fig { margin-bottom: 40px; }
  .section { margin-top: 96px; }
  .fig img { max-height: none; }
  .page-home .fig img { max-height: none; }
}

@media (max-width: 640px) {
  .row { flex-direction: column; gap: var(--gap); }
  .row .fig { flex: none; width: 100%; }
  .fig.size-medium img, .fig.size-small img { max-width: 100%; }
  .page blockquote { font-size: 22px; }
}
