/* Nadezhda Korostyleva — portfolio
   Palette is drawn from the work: antimicrobial blue (~450 nm) against
   lab-white and slate ink. Type is IBM Plex Sans (technical) + Newsreader
   (prose), the pairing you'd find in a device paper. */

:root {
  --ground: #f5f6f8;
  --paper: #ffffff;
  --ink: #151a21;
  --muted: #59626e;
  --rule: #d8dce3;
  --blue: #1533cc;
  --blue-soft: #e9edfb;
  --tissue: #f2e4e2;

  --measure: 68ch;
  --pad: clamp(1.25rem, 5vw, 4rem);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: "Newsreader", Georgia, serif;
  font-size: clamp(1.02rem, 0.98rem + 0.2vw, 1.14rem);
  line-height: 1.62;
  font-variant-numeric: tabular-nums;
}

h1, h2, h3, .sans {
  font-family: "IBM Plex Sans", system-ui, -apple-system, sans-serif;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.18;
}

h1 { font-size: clamp(2.1rem, 1.4rem + 3.2vw, 3.6rem); margin: 0 0 0.6rem; }
h2 { font-size: clamp(1.35rem, 1.15rem + 0.9vw, 1.8rem); margin: 3.2rem 0 1rem; }
h3 { font-size: 1.08rem; margin: 2rem 0 0.5rem; font-weight: 600; }

p { margin: 0 0 1.1rem; max-width: var(--measure); }

a { color: var(--blue); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}

.wrap {
  max-width: 60rem;
  margin: 0 auto;
  padding: 0 var(--pad);
}

/* ---------- masthead ---------- */

.masthead {
  border-bottom: 1px solid var(--rule);
  background: var(--paper);
}

.masthead-inner {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.6rem;
  align-items: baseline;
  justify-content: space-between;
  padding-top: 1.1rem;
  padding-bottom: 1.1rem;
}

.wordmark {
  font-family: "IBM Plex Sans", sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.01em;
  color: var(--ink);
  text-decoration: none;
}

.masthead nav {
  display: flex;
  gap: 1.4rem;
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.9rem;
}

.masthead nav a { color: var(--muted); text-decoration: none; }
.masthead nav a:hover { color: var(--blue); }

/* ---------- hero ---------- */

.hero {
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  padding-top: clamp(2.5rem, 6vw, 4.5rem);
  padding-bottom: clamp(2rem, 5vw, 3.5rem);
}

.hero-lede {
  font-size: clamp(1.15rem, 1rem + 0.7vw, 1.4rem);
  max-width: 46ch;
  margin-bottom: 1.4rem;
}

.hero-facts {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.75;
  margin: 0;
}

/* ---------- sections ---------- */

section { padding-top: 0.5rem; }

.section-head {
  border-top: 1px solid var(--rule);
  padding-top: 0.7rem;
  margin-top: 3.4rem;
}

.section-head h2 { margin-top: 0; }

/* ---------- project index ---------- */

.projects { margin: 1.5rem 0 0; }

.project-row {
  display: block;
  text-decoration: none;
  color: inherit;
  border-top: 1px solid var(--rule);
  padding: 1.5rem 0;
}

.project-row:first-child { border-top: none; }

.project-row:hover .project-title,
.project-row:focus-visible .project-title { color: var(--blue); }

.project-title {
  font-family: "IBM Plex Sans", sans-serif;
  font-weight: 600;
  font-size: 1.22rem;
  line-height: 1.25;
  margin: 0 0 0.35rem;
  transition: color 0.15s ease;
}

.project-meta {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 0.6rem;
}

.project-blurb { margin: 0; max-width: 62ch; }

.project-tags {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.8rem;
  color: var(--muted);
  margin: 0.7rem 0 0;
}

.project-tags span {
  display: inline-block;
  border: 1px solid var(--rule);
  border-radius: 2px;
  padding: 0.1rem 0.45rem;
  margin: 0 0.3rem 0.3rem 0;
  background: var(--paper);
}

/* ---------- results strip ---------- */

.results {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
  gap: 1.5rem 2rem;
  margin: 1.6rem 0 2rem;
  padding: 1.4rem 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.result-value {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 1.7rem;
  font-weight: 600;
  color: var(--blue);
  line-height: 1.1;
}

.result-label {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.86rem;
  color: var(--muted);
  margin-top: 0.3rem;
  line-height: 1.4;
}

/* ---------- figures & placeholders ---------- */

.figure { margin: 2rem 0; }

.figure img {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--rule);
  background: var(--paper);
}

.figure figcaption {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.84rem;
  color: var(--muted);
  margin-top: 0.6rem;
  max-width: 62ch;
  line-height: 1.5;
}

.ph {
  border: 1px dashed #b9c0cb;
  background:
    repeating-linear-gradient(
      -45deg,
      transparent 0 9px,
      rgba(21, 51, 204, 0.045) 9px 18px
    ),
    var(--paper);
  min-height: 13rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 1.5rem;
  font-family: "IBM Plex Sans", sans-serif;
}

.ph-file {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--blue);
  word-break: break-all;
}

.ph-note {
  font-size: 0.86rem;
  color: var(--muted);
  margin-top: 0.4rem;
  max-width: 50ch;
  line-height: 1.5;
}

.figure-pair {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1.5rem;
}

.figure-pair .figure { margin: 0; }

/* ---------- project page header ---------- */

.project-header {
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  padding-top: clamp(2rem, 5vw, 3.2rem);
  padding-bottom: clamp(1.6rem, 4vw, 2.4rem);
}

.eyebrow {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.88rem;
  color: var(--muted);
  margin: 0 0 0.9rem;
}

.eyebrow a { color: var(--muted); text-decoration: none; }
.eyebrow a:hover { color: var(--blue); text-decoration: underline; }

.project-header h1 { font-size: clamp(1.7rem, 1.2rem + 2.2vw, 2.7rem); }

.dek {
  font-size: clamp(1.05rem, 1rem + 0.4vw, 1.22rem);
  max-width: 52ch;
  color: var(--ink);
  margin-bottom: 1.2rem;
}

.factline {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.7;
  margin: 0;
}

/* ---------- lists ---------- */

.plain { padding-left: 1.15rem; max-width: var(--measure); }
.plain li { margin-bottom: 0.5rem; }

.skills {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 1.6rem 2.5rem;
  margin-top: 1.4rem;
}

.skills h3 { margin-top: 0; }

.skills p {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.6;
}

.pubs { margin: 1.4rem 0 0; padding: 0; list-style: none; }

.pubs li {
  border-top: 1px solid var(--rule);
  padding: 1.1rem 0;
  max-width: 68ch;
}

.pub-venue {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.85rem;
  color: var(--muted);
  display: block;
  margin-top: 0.3rem;
}

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--rule);
  margin-top: 4rem;
  padding: 2.2rem 0 3.5rem;
  background: var(--paper);
}

.site-footer p {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.9rem;
  color: var(--muted);
}

.contact-links {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.95rem;
  display: flex;
  flex-wrap: wrap;
  gap: 1.4rem;
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.next-project {
  border-top: 1px solid var(--rule);
  margin-top: 3.5rem;
  padding-top: 1.2rem;
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.95rem;
}

.spacer { height: 1.5rem; }

/* ---------- alternating full-bleed bands ----------
   Each band is roughly one laptop viewport. Text and pictures swap sides down
   the page, and the background alternates with them so the seam between two
   bands is legible without a rule. */

.bands { display: block; }

/* the paragraph that sets up the bands, between header and first band */
.lead-note {
  max-width: 60ch;
  margin: clamp(1.8rem, 4vw, 2.6rem) auto clamp(1.8rem, 4vw, 2.6rem);
  font-size: clamp(1.02rem, 1rem + 0.3vw, 1.15rem);
}

.band {
  padding: clamp(3rem, 7vh, 5.5rem) 0;
  border-bottom: 1px solid var(--rule);
  overflow: hidden; /* contains the slide-in transform before it settles */
}

@media (min-width: 900px) {
  .band { min-height: 88vh; display: flex; align-items: center; }
}

.band:nth-child(odd) { background: var(--paper); }
.band:nth-child(even) { background: var(--ground); }

.band-inner {
  width: 100%;
  max-width: 78rem;
  margin: 0 auto;
  padding: 0 var(--pad);
  display: grid;
  gap: clamp(1.8rem, 4vw, 3.5rem);
  align-items: center;
}

@media (min-width: 900px) {
  .band-inner { grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }

  /* chess order: on even bands the pictures take the left column instead */
  .band:nth-child(even) .band-media { order: -1; }

  /* a band with no pictures centres its column rather than leaving a gap */
  .band-solo .band-inner { grid-template-columns: minmax(0, 62ch); justify-content: center; }
}

.band-text > :first-child { margin-top: 0; }
.band-text h2 { margin-top: 0; }
.band-text p:last-child { margin-bottom: 0; }

.band-num {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blue);
  margin: 0 0 0.7rem;
}

/* ---------- picture mosaics inside a band ---------- */

.band-media { display: grid; gap: 0.9rem; }

/* Tiles are cropped to a fixed shape rather than sized by the photo, so a band
   holds its height whatever mix of landscape and portrait shots goes in it. */
.band-media img {
  width: 100%;
  height: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  object-position: center;
  display: block;
  border: 1px solid var(--rule);
  background: var(--paper);
}

.band-media figure { margin: 0; display: grid; }

.band-media figcaption {
  font-family: "IBM Plex Sans", sans-serif;
  font-size: 0.82rem;
  color: var(--muted);
  margin-top: 0.5rem;
  line-height: 1.45;
}

/* Plots, screenshots and CAD drawings must not lose their edges to a crop, so
   they sit inside the tile whole and the tile takes the letterboxing. */
.band-media .fit img {
  object-fit: contain;
  background: var(--paper);
  padding: 0.6rem;
}

/* for portrait sources that a landscape crop would gut */
.band-media .tall img { aspect-ratio: 3 / 4; }

/* two side by side — cropped to portrait so the pair still fills the band */
.mosaic-2 { grid-template-columns: 1fr 1fr; }
.mosaic-2 img { aspect-ratio: 3 / 4; }

/* one tall on the left, two stacked on the right */
.mosaic-3 { grid-template-columns: 1fr 1fr; }
.mosaic-3 > :first-child { grid-row: span 2; }
.mosaic-3 > :first-child img { aspect-ratio: 3 / 4; }
.mosaic-3 > :not(:first-child) img { aspect-ratio: 16 / 10; }

.mosaic-4 { grid-template-columns: 1fr 1fr; }
.mosaic-4 img { aspect-ratio: 4 / 3; }

@media (max-width: 620px) {
  .mosaic-2,
  .mosaic-3,
  .mosaic-4 { grid-template-columns: 1fr; }
  .mosaic-3 > :first-child { grid-row: auto; }
  .band-media img { aspect-ratio: 4 / 3; }
}

/* ---------- scroll reveal ----------
   Bands enter from the side they live on and leave the same way, so scrolling
   back up replays it. Everything is opt-in: without JS the .reveal class is
   never activated and the content sits in its final position. */

.js .reveal {
  opacity: 0;
  transform: translateX(var(--from, 3rem));
  transition: opacity 0.6s ease, transform 0.7s cubic-bezier(0.22, 0.68, 0.28, 1);
  will-change: opacity, transform;
}

.js .reveal.is-in {
  opacity: 1;
  transform: none;
}

.band-text { --from: -3.5rem; }
.band-media { --from: 3.5rem; }
.band:nth-child(even) .band-text { --from: 3.5rem; }
.band:nth-child(even) .band-media { --from: -3.5rem; }

/* the media half trails the text half slightly */
.js .band-media.reveal { transition-delay: 0.08s; }

@media (prefers-reduced-motion: reduce) {
  .js .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }
}
