/* GERGELY VASS — built from website_explanation.indd (1920 × 1080 px artboards).
   Headings: Roboto Mono Bold 100px, all caps, centred in 132px rows.
   Text: Roboto Mono Regular 20px / 24px, flush left, running edge to edge. */

:root {
  --ink: #000;
  --hover: #c4c4c4;
  --paper: #fff;

  /* 100px at 1920px wide, 44px on phones, and never wider than the window:
     "GERGELY VASS" is 7.2em wide in Roboto Mono */
  --h: min(clamp(44px, 5.21vw, 100px), calc(100cqw / 7.3));
  --row: calc(var(--h) * 1.32);
  /* Menu items and the ABOUT title: --h, but never wider than the window.
     SELECTED WORKS PDF, the longest, is 18 letters (10.8em in Roboto Mono).
     ABOUT shares it so it opens at the same size it had in the menu. */
  --menu: min(var(--h), calc(100cqw / 10.9));
  /* 20px at 1920px wide, 15px minimum */
  --t: clamp(15px, 1.042vw, 20px);
  --lead: 1.2;
  /* Space around all content on every page */
  --margin: 5px;
  /* Space at the left and right edges */
  --side: 20px;
  /* Extra side inset for text blocks, on top of --margin */
  --edge: 0px;
  /* The least space between the last text and the footer */
  --far: 150px;

  --ease: cubic-bezier(.2, .7, .2, 1);
}

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

@view-transition { navigation: auto; }
::view-transition-old(root),
::view-transition-new(root) { animation-duration: .45s; animation-timing-function: var(--ease); }

/* Always reserve the scrollbar's space, so centred items sit in the same
   place on short pages and on long ones (like About) that scroll. */
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }
body {
  min-height: 100svh;
  padding: var(--margin) var(--side);
  /* sizes below use cqw = the width between the side margins */
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: "Roboto Mono", ui-monospace, monospace;
  font-size: var(--t);
  line-height: var(--lead);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { display: block; }

/* GERGELY VASS keeps the narrow 5px edge margin instead of the 20px sides */
header { margin: 0 calc(var(--margin) - var(--side)); }

/* Big all-caps rows: brand, page titles, menu items */
.row {
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--row);
  font-size: var(--h);
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
  white-space: nowrap;
}

nav .row, .about-hero .row { font-size: var(--menu); }
/* INSTAGRAM and EMAIL share a row, one letter apart, each its own link */
.pair { gap: .6em; }

/* Every link or button: no edges, black to light grey on hover */
.link {
  transition: color .35s var(--ease);
  cursor: pointer;
}
.link:hover, .link:focus-visible { color: var(--hover); outline: none; }

main { flex: 1; }

/* Footer: one line, aligned left. The line is 46 characters (27.6em in
   Roboto Mono), so capping the size at 1/27.9 of the width keeps it on one line,
   with the page margin taken off. */
footer {
  --foot: min(var(--t), calc(100cqw / 27.9));
  padding: 0 var(--edge);
  text-align: left;
  white-space: nowrap;
  font-size: var(--foot);
  line-height: calc(36 / 20);
}
/* On About the footer sits at the bottom of the window when the text is
   short, and otherwise --far below the end of the text (the footer's taller
   line spacing is taken off, so the gap is measured to its letters) */
.text-page footer { margin-top: calc(var(--far) - (36 / 20 - var(--lead)) / 2 * var(--foot)); }

/* Text blocks */
.text { padding: 0 var(--edge); }
.text p + p { margin-top: 0; }

/* ---------- Landing ---------- */
/* The photos float on a field filling the whole window, behind GERGELY VASS
   and the footer. Only the GERGELY VASS link catches the cursor, so the field
   can be dragged from anywhere else. */
body.landing { height: 100svh; overflow: hidden; }
.landing header, .landing main, .landing footer { pointer-events: none; }
.landing header, .landing footer { position: relative; z-index: 1; }
.landing header .row { width: fit-content; margin: 0 auto; pointer-events: auto; }

.photo-field {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
.photo-field.dragging { cursor: grabbing; }

/* Each photo with its MENU label, moved around by the script */
.tile {
  position: absolute;
  top: 0;
  left: 0;
  opacity: 0;
  will-change: transform;
  transition: opacity .6s var(--ease);
}
.tile.on { opacity: 1; }
.tile img {
  display: block;
  width: 100%;
  height: 100%;
  transition: filter .6s var(--ease);
}
/* The main photo is sized from the 1920px InDesign page (759px tall), here
   x 1.1 x 0.85, and never taller than the window allows. The other photos
   are sized from it. */
.main-photo img {
  height: min(calc(var(--h) * 7.59 * 1.1 * 0.85), calc(77svh * 0.85), calc((100vw - 2 * var(--side)) * 4 / 3 * 0.85));
  width: auto;
}
/* That is the phone size. In the wide layout (a mouse and a window over
   720px, as the script decides) the photos are this size instead: */
@media (hover: hover) and (min-width: 721px) {
  .main-photo img {
    height: min(calc(var(--h) * 7.59 * 1.1 * 0.9), calc(77svh * 0.9), calc((100vw - 2 * var(--side)) * 4 / 3 * 0.9));
  }
}
.main-photo:focus-visible { outline: none; }

/* MENU in white at the top of the photo: on the photo under the cursor, or
   on every photo all the time in the phone layout (touch screens, which have
   no cursor, and narrow windows) */
.menu-label {
  position: absolute;
  inset: 0 0 auto;
  color: var(--paper);
  pointer-events: none;
  opacity: 0;
  transition: opacity .35s var(--ease);
}
@media (hover: hover) {
  .photo-field:not(.dragging) .tile:hover .menu-label,
  .main-photo:focus-visible .menu-label { opacity: 1; }
  .photo-field:not(.dragging) .tile:hover img { filter: brightness(.88); }
}
@media (hover: none) {
  .menu-label { opacity: 1; }
}
.photo-field.phone .menu-label { opacity: 1; }

/* ---------- About ---------- */
.about-hero {
  position: relative;
  height: calc(var(--row) * 3);
}
.about-hero img {
  width: auto;
  height: 100%;
  aspect-ratio: 246 / 396;
  object-fit: cover;
  margin: 0 auto;
}
.about-hero .row {
  position: absolute;
  inset: auto 0 0;
}
.intro { padding-top: calc(var(--t) * .2); }
.cv {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: 2px;
  margin-top: calc(var(--t) * var(--lead) * 1.45);
  padding: 0 var(--edge);
}
.cv h2 {
  font: inherit;
  margin-bottom: calc(var(--t) * var(--lead));
}
.cv p { margin-bottom: calc(var(--t) * var(--lead)); }
/* nothing under the last entries, so the footer gap is exactly --far */
.cv > div > p:last-child { margin-bottom: 0; }

@media (max-width: 720px) {
  .about-hero img { height: 100%; }
  .cv { grid-template-columns: 1fr; row-gap: calc(var(--t) * var(--lead)); }
  /* stacked: keep the empty line under each section but the last */
  .cv > div:not(:last-child) > p:last-child { margin-bottom: calc(var(--t) * var(--lead)); }
}

/* Phones held upright: GERGELY VASS at the top of every page spans the full
   width of the screen (the 12 characters are 7.2em wide in Roboto Mono) */
@media (max-width: 720px) and (orientation: portrait) {
  /* measured from the header's real width, so a scrollbar never throws it off */
  header { container-type: inline-size; }
  header .row {
    --title: calc(100cqw / 7.2);
    font-size: var(--title);
    height: calc(var(--title) * 1.32);
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
  @view-transition { navigation: none; }
}
