/* =========================================================
   cv.css (homepage)
   1. "View my CV" row   2. CV pages (images)
   3. CV sheet (dialog)
   The row's arrow, hover slide and peek come from .row (layout.css)
   and .row-peek (work.css); main.js (section 6) builds the pages
   and runs the sheet.
   ========================================================= */

/* ---------- 1. "View my CV" row ---------- */
/* A Work row at the skill-heading size (22px), in blue; hover and
   focus turn it red like the Work rows. It's a <button>, so the
   browser's button look is reset. */
.row--cv {
  width: 100%;
  margin-top: 48px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 22px;
  line-height: 1.75;
  text-align: left;
  color: var(--blue);
  cursor: pointer;
}

/* The CV peek: A4 (156 x 220) instead of the Work rows' 176 x 220 */
@media (min-width: 1280px) {
  .row--cv .row-peek {
    width: 156px;
    height: 220px;
  }
}

/* Side menu "— CV" (900px and up): the menu highlights the section
   crossing a line 25% down the screen. The button is short, so a jump
   to #cv puts it on that line (centred on it), rather than 96px from
   the top like the other items, where the line would miss it. */
@media (min-width: 900px) {
  .row--cv {
    scroll-margin-top: calc(25vh - 43px);
  }
}

/* While the sheet is open, page 1 is the flying copy: hide the peek */
.row--cv.is-lifted .row-peek {
  visibility: hidden;
}


/* ---------- 2. CV pages ---------- */
/* A4 (1 : 1.414): the box keeps its shape (white) while the image
   is still loading. */
.cv-page {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1.414;
  object-fit: contain;
  background: var(--white);
  border: 1px solid #D9D6CF;
}

/* In the peek the page fills the 156 x 220 box */
.cv-peek .cv-page {
  height: 100%;
}


/* ---------- 3. CV sheet (dialog) ---------- */
/* Covers the screen but draws nothing (no backdrop), so the page
   stays exactly as it is behind it. A click anywhere but the sheet
   closes it. */
.cv-view {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: hidden;
}

.cv-view::backdrop {
  background: transparent;
}

.cv-scroll {
  position: absolute;
  inset: 0;
  overflow: hidden auto;
  overscroll-behavior: contain;
}

/* The sheet: max 900px wide, centred, the pages one under the other */
.cv-sheet {
  position: relative;
  width: min(900px, 100% - 2 * var(--gutter));
  margin: 40px auto;
  padding: 0 40px 40px;
}

/* Background, border and the inner frame (10px inside). A separate
   layer so it can fade in after page 1 has landed. */
.cv-paper {
  position: absolute;
  inset: 0;
  background: var(--bg);
  border: 1px solid var(--ink);
}

.cv-paper::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 1px solid var(--ink);
}

/* Download (centred) + × (top right): sticks to the top of the screen
   while the sheet scrolls. Its side margins stretch it to the sheet's
   full width; its negative bottom margin cancels its height, so it
   takes no room: page 1 sits below it via .cv-pages' top padding. */
.cv-bar {
  position: sticky;
  top: 0;
  z-index: 1;
  height: 64px;
  margin-bottom: -64px;
  display: flex;
  justify-content: flex-end;
  align-items: flex-start;
  gap: 24px;
  padding: 18px 22px 0 0;
  margin-left: -40px;
  margin-right: -40px;
  pointer-events: none;
}

/* Each control sits on a small patch of paper, so it stays readable
   when the CV scrolls under it */
.cv-bar > * {
  pointer-events: auto;
  background: var(--bg);
  box-shadow: 0 0 0 6px var(--bg);
}

.cv-download {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--font-label);
  font-size: 15px;
  line-height: 20px;
  box-shadow: 0 0 0 4px var(--bg);   /* 4px: clears the inner frame */
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--blue);
  text-decoration: none;
}

/* × : 16px with an invisible 44 x 44 hit area (same as the Studio sheets) */
.cv-close {
  position: relative;
  width: 16px;
  height: 16px;
  padding: 0;
  border: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 16px;
  color: var(--ink);
  cursor: pointer;
}

.cv-close::before,
.cv-download::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: max(100%, 44px);
  height: 44px;
  transform: translate(-50%, -50%);
}

.cv-close:hover,
.cv-download:hover {
  color: var(--red);
}

.cv-pages {
  position: relative;
  display: grid;
  gap: 24px;
  padding-top: 64px;
}

/* The flying page 1 (main.js moves it with transform) */
.cv-pages > .cv-page:first-child {
  transform-origin: 0 0;
}

/* Phone: the sheet fills the screen width, pages full width */
@media (max-width: 599px) {
  .cv-sheet {
    width: 100%;
    min-height: 100%;
    margin: 0;
    padding: 0 20px 20px;
  }

  .cv-bar {
    margin-left: -20px;
    margin-right: -20px;
  }

  .cv-pages {
    gap: 20px;
    padding-top: 56px;
  }
}
