/* ---------------------------------------------------------------
   Oleksii Pavlusenko — portfolio
   Fixed sidebar on the left, large images filling the rest.

   Type: Roboto for titles and reading, Roboto Mono for the
   interface — navigation, captions, dates. Both self-hosted.
   --------------------------------------------------------------- */

/* Latin covers everything currently on the site; latin-ext loads only
   if a page ever needs an accented character. */
@font-face {
  font-family: 'Roboto';
  src: url('../fonts/roboto-latin-normal-400-700.woff2') format('woff2');
  font-weight: 400 700; font-style: normal; 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: 'Roboto';
  src: url('../fonts/roboto-latin-ext-normal-400-700.woff2') format('woff2');
  font-weight: 400 700; font-style: normal; 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;
}
@font-face {
  font-family: 'Roboto';
  src: url('../fonts/roboto-latin-italic-400-700.woff2') format('woff2');
  font-weight: 400 700; font-style: italic; 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: 'Roboto';
  src: url('../fonts/roboto-latin-ext-italic-400-700.woff2') format('woff2');
  font-weight: 400 700; font-style: italic; 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;
}
@font-face {
  font-family: 'Roboto Mono';
  src: url('../fonts/roboto-mono-latin-normal-100-700.woff2') format('woff2');
  font-weight: 100 700; font-style: normal; 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: 'Roboto Mono';
  src: url('../fonts/roboto-mono-latin-ext-normal-100-700.woff2') format('woff2');
  font-weight: 100 700; font-style: normal; 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 {
  --ink: rgba(0, 0, 0, 0.82);
  --ink-strong: #000;
  --ink-soft: rgba(0, 0, 0, 0.55);
  --ink-faint: rgba(0, 0, 0, 0.35);
  --paper: #fff;
  --rule: rgba(0, 0, 0, 0.12);

  --sidebar: 30rem;        /* fixed menu column */
  --gap: 1rem;             /* space between stacked images */
  --pad: 3.2rem;
  /* Mono sets wider than Roboto, so it runs a size down with more
     leading to stay comfortable over a paragraph. Light weight keeps
     it from feeling heavy at this size. */
  --type: 1.5rem;
  --name: 2.1rem;          /* the name in the corner — the home button */
  --title: 3.5rem;         /* page headings, matching the original */
  --lead: 1.62;
  --weight: 300;           /* body weight — 100 is thinnest, 400 normal */

  --sans: 'Roboto', system-ui, "Segoe UI", Arial, sans-serif;
  --mono: 'Roboto Mono', ui-monospace, "Cascadia Mono", Consolas, monospace;
}

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

/* Fluid base size. Everything on the site is expressed in rem, so scaling
   the root scales the whole design together — type, sidebar, spacing.

   Below 1500px this sits at the old 10px and nothing changes. Above it the
   base grows with the viewport, capped at 14px, so a 4K screen gets type
   that is proportionally the same size as on a laptop instead of half of it.

   Written in rem rather than px so a visitor who has raised their browser's
   default font size still gets the benefit of it. */
html {
  font-size: clamp(0.625rem, calc(0.625rem + (100vw - 1500px) * 0.0017), 0.875rem);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--mono);
  font-size: var(--type);
  font-weight: var(--weight);
  line-height: var(--lead);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Roboto is reserved for the page titles and the name in the corner.
   Everything else — navigation, body copy, labels — is mono. */
.masthead__name,
.project__title {
  font-family: var(--sans);
}

img { display: block; max-width: 100%; height: auto; }

a { color: inherit; text-decoration: none; }
a:hover { color: var(--ink-faint); }

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--ink-strong);
  outline-offset: 3px;
}

.skip {
  position: absolute;
  left: -9999px;
  padding: 0.8rem 1.2rem;
  background: var(--paper);
  border: 1px solid var(--ink);
  z-index: 200;
}
.skip:focus { left: 1.6rem; top: 1.6rem; }

/* Present for screen readers and search engines, not on screen. */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---------------------------------------------------------------
   Sidebar — pinned to the left, stays put while images scroll
   --------------------------------------------------------------- */

.masthead {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar);
  height: 100vh;
  padding: var(--pad) 1.6rem var(--pad) var(--pad);
  overflow-y: auto;
  overscroll-behavior: contain;
  z-index: 50;
  background: var(--paper);
}

.masthead__name {
  font-size: var(--name);
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 3.6rem;
  color: var(--ink-strong);
}

.nav {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav li { margin: 0 0 1.7rem; }

.nav a { display: inline-block; }

/* The original marks the current page in bold. */
.nav a[aria-current="page"] {
  font-weight: 700;
  color: var(--ink-strong);
}

/* Contact page */

.contact-page {
  max-width: 62rem;
  padding: 1.6rem 0.4rem 8rem;
}

.contact-list {
  margin: 2.4rem 0 0;
  display: grid;
  grid-template-columns: 12rem 1fr;
  gap: 1.2rem 2.4rem;
}

.backlink { border-bottom: 1px solid var(--rule); }

.contact-list dt { color: var(--ink-soft); }
.contact-list dd { margin: 0; }
.contact-list a { border-bottom: 1px solid var(--rule); }

/* ---------------------------------------------------------------
   Main column — large images, left of the sidebar
   --------------------------------------------------------------- */

main {
  margin-left: var(--sidebar);
  padding: var(--gap) var(--gap) var(--gap) 0;
}

/* Home — project index.
   One project per row, full width of the column, one after another. */

.index {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--gap);
}

.index__item { margin: 0; }

.index__figure { margin: 0; }

.index__img {
  width: 100%;
  background: rgba(0, 0, 0, 0.03);
  transition: opacity 0.25s ease;
}

.index__link:hover .index__img { opacity: 0.86; }

/* Project pages */

.project__header {
  max-width: 62rem;
  padding: 1.6rem 0.4rem 0;
  margin: 0 0 2.4rem;
}

.project__title {
  font-size: var(--title);
  font-weight: 400;
  line-height: 1.15;
  letter-spacing: -0.01em;
  margin: 0 0 1.2rem;
  color: var(--ink-strong);
}

.project__title i { font-style: italic; }

.project__subtitle, .project__medium { margin: 0; }
.project__medium { color: var(--ink-soft); }

.project__body {
  max-width: 62rem;
  padding: 0 0.4rem;
  margin: 0 0 3.2rem;
}

.project__body p { margin: 0 0 1.4em; }
.project__body p:last-child { margin-bottom: 0; }

.project__figure { margin: 0 0 var(--gap); }

.project__figure img {
  width: 100%;
  background: rgba(0, 0, 0, 0.03);
}

/* Stacked images. A figure can opt down to half width so one work can
   sit smaller among larger ones. */

.project__stack {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap);
  margin: 0 0 var(--gap);
}

.project__stack .project__figure {
  flex: 1 1 100%;
  margin: 0;
}

.project__stack .project__figure--half {
  flex: 1 1 calc(50% - (var(--gap) / 2));
  min-width: 28rem;
}

/* Full-screen layout: images run edge to edge, ignoring the page margin
   on the right and the gap on the left. */

.project__bleed {
  margin: 0 calc(var(--gap) * -1) var(--gap) 0;
}

.project__bleed .project__figure {
  margin: 0 0 var(--gap);
}

.project__bleed .project__figure:last-child { margin-bottom: 0; }

/* Video — same full-width footprint as a stacked image.
   The aspect ratio is set per-video from content.json. */

.project__video {
  margin: 0 0 var(--gap);
  width: 100%;
  aspect-ratio: var(--ratio, 16 / 9);
  background: rgba(0, 0, 0, 0.04);
}

.project__video iframe,
.project__video video {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

/* Three-column gallery, used by Selected works.
   Images keep their own proportions; each row is as tall as its
   tallest picture, so nothing gets cropped. */

.project__gallery {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: start;
  gap: 3.2rem;
  margin: 0 0 var(--gap);
}

.project__gallery .project__figure { margin: 0; }

.project__date {
  color: var(--ink-faint);
  padding: 0 0.4rem;
  margin: 2.4rem 0 0;
}

.pager {
  display: flex;
  justify-content: space-between;
  gap: 2.4rem;
  max-width: 62rem;
  margin: 4.8rem 0.4rem 0;
  padding-top: 1.6rem;
  border-top: 1px solid var(--rule);
}

/* Zoomable images get a magnify cursor. */
.zoomable { cursor: zoom-in; }

/* ---------------------------------------------------------------
   CV
   --------------------------------------------------------------- */

.cv {
  max-width: 74rem;
  padding: 1.6rem 0.4rem 8rem;
}

.cv__title { margin-bottom: 2.4rem; }

.cv__portrait { width: 22rem; margin: 0 0 3.2rem; }
.cv__portrait img { width: 100%; }

.cv__about p { margin: 0 0 1.4em; }

.cv__contact { margin: 0 0 4rem; }
.cv__contact a { border-bottom: 1px solid var(--rule); }

.cv__section { margin: 0 0 4rem; }

.cv__heading {
  font-size: var(--type);
  font-weight: 600;
  color: var(--ink-strong);
  margin: 0 0 1.6rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--rule);
}

.cv__entry {
  display: grid;
  grid-template-columns: 12rem 1fr;
  gap: 0 2.4rem;
  margin: 0 0 1.6rem;
}

.cv__period { color: var(--ink-soft); }
.cv__lines p { margin: 0 0 0.4rem; }
.cv__lines p:last-child { margin-bottom: 0; }
.cv__lines p:not(:first-child) { color: var(--ink-soft); }

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

.footer {
  margin-left: var(--sidebar);
  padding: 3.2rem var(--gap) 3.2rem 0.4rem;
  color: var(--ink-faint);
}

.footer a { border-bottom: 1px solid var(--rule); }

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

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.985);
  cursor: zoom-out;
  padding: 2.4rem;
}

.lightbox[open],
.lightbox.is-open { display: flex; }

.lightbox__img {
  max-width: 100%;
  max-height: calc(100vh - 9rem);
  width: auto;
  height: auto;
  object-fit: contain;
}

.lightbox__bar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.6rem;
  padding: 1.6rem 2.4rem;
  color: var(--ink-soft);
  pointer-events: none;
}

.lightbox__caption {
  max-width: 60%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lightbox__btn {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 3.2rem;
  line-height: 1;
  color: var(--ink-faint);
  cursor: pointer;
  padding: 1.6rem;
}

.lightbox__btn:hover { color: var(--ink-strong); }
.lightbox__btn[hidden] { display: none; }

.lightbox__prev { left: 0.8rem; }
.lightbox__next { right: 0.8rem; }

.lightbox__close {
  position: absolute;
  top: 0.8rem;
  right: 1.6rem;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 2.8rem;
  line-height: 1;
  color: var(--ink-faint);
  cursor: pointer;
  padding: 1rem;
}

.lightbox__close:hover { color: var(--ink-strong); }

body.lightbox-open { overflow: hidden; }

/* ---------------------------------------------------------------
   Responsive
   --------------------------------------------------------------- */

@media (max-width: 1100px) {
  :root { --sidebar: 24rem; --pad: 2.4rem; --title: 3rem; }
  .project__gallery { gap: 2.4rem; }
}

/* Two-up gallery on tablets, single file on phones. */
@media (max-width: 820px) {
  .project__gallery {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.6rem;
  }
}

@media (max-width: 560px) {
  .project__gallery { grid-template-columns: 1fr; }
}

/* Below this the sidebar stops being a sidebar and sits on top. */
@media (max-width: 820px) {
  :root { --pad: 1.6rem; --gap: 0.8rem; --type: 1.6rem; --title: 2.6rem; }

  .masthead {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    padding: 1.6rem 1.6rem 0;
    border-bottom: 1px solid var(--rule);
  }

  .masthead__name { margin-bottom: 1.6rem; }

  .nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0 2rem;
  }

  .nav li { margin-bottom: 1rem; }

  .contact-page { padding: 1.6rem 1.6rem 6rem; }
  .contact-list { grid-template-columns: 1fr; gap: 0.3rem; }
  .contact-list dd { margin-bottom: 1.4rem; }

  main, .footer { margin-left: 0; }

  main { padding: var(--gap) var(--gap) 0; }

  .footer { padding: 2.4rem 1.6rem; }

  .cv { padding: 1.6rem 1.6rem 6rem; }

  .cv__entry { grid-template-columns: 1fr; gap: 0; margin-bottom: 2rem; }
  .cv__period { margin-bottom: 0.3rem; }
  .cv__portrait { width: 16rem; }

  .index__caption { flex-direction: column; gap: 0; }
  .index__meta { white-space: normal; }

  .lightbox { padding: 1.2rem; }
  .lightbox__btn { font-size: 2.6rem; padding: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

@media print {
  .masthead, .pager, .footer, .lightbox { display: none; }
  main { margin: 0; }
  body { color: #000; }
}
