/* Additions to the exported site. */

/* Slide counter between the slider arrows (js/slider-counter.js): looks like .carousel-arrow. */
.carousel-arrow.carousel-counter {
  position: absolute;
  z-index: 3;
  width: auto;
  padding: 0 14px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  cursor: default;
  user-select: none;
}

/* Opening animation of the project pages, the same as Home's page-load animation:
   the cover folds up in 1 s (outExpo) while the content fades in over 0.8 s (inExpo).
   build-static.py puts <div class="page-load-cover page-open"> first in each project page. */
.page-load-cover.page-open {
  display: block;
  width: 100%;
  animation: page-open-cover 1s cubic-bezier(0.19, 1, 0.22, 1) forwards;
}
.page-open ~ * .container,
.page-open ~ * .nav-container {
  animation: page-open-fade 0.8s cubic-bezier(0.95, 0.05, 0.795, 0.035) both;
}
@keyframes page-open-cover {
  from { height: 100%; }
  to { height: 0; visibility: hidden; }
}
@keyframes page-open-fade {
  from { opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .page-load-cover.page-open { display: none; }
  .page-open ~ * .container,
  .page-open ~ * .nav-container { animation: none; }
}

/* The template paints every <p> white at 80 %; on white pages, body text uses the dark equivalent. */
.page-light .rich-text p {
  color: var(--white-80);
}

/* Footer: "Legal notice" and "Privacy" side by side. */
.copyright-link + .copyright-link {
  margin-left: 24px;
}

/* A slider caption too wide to sit beside the arrows goes under them (phones). */
.tags-wrapper.caption-below {
  margin-top: 12px;
}

/* "Let's work together": the e-mail address cannot wrap, so it shrinks to fit the card
   (11.2 em wide; 8.5 % of the card keeps a margin) and never grows past the template size. */
.inset-card {
  container-type: inline-size;
}
.inset-card .email-link {
  display: block;
  font-size: min(1em, 8.5cqi);
}

/* Home and Work project grids read row by row, in Home order (cms-work.json);
   the template's 40 px card margin becomes the row gap, so none is left under the last row. */
@media screen and (min-width: 768px) {
  .work-grid {
    display: grid;
    row-gap: 40px;
  }
  .work-grid .work-item {
    margin-bottom: 0;
    order: var(--desktop-order); /* "desktop-order" in cms-work.json, else Home order */
  }
}

/* Fullscreen image viewer (js/lightbox.js): the site's black, the slider pills and arrows,
   bars as tall as the nav and aligned with its side padding. */
.lb-thumb {
  cursor: zoom-in;
}
html.lb-open {
  overflow: hidden;
}
.lightbox {
  --lb-x: 80px;
  --lb-bar: 76px;
  --lb-radius: 12px;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  background: none;
  color: var(--white);
  touch-action: none;
  overscroll-behavior: contain;
}
.lightbox::backdrop {
  background: none;
}
.lightbox:focus {
  outline: none;
}
.lb-bg {
  position: absolute;
  inset: 0;
  background-color: var(--black);
}
.lb-stage {
  position: absolute;
  inset: var(--lb-bar) var(--lb-x);
  visibility: hidden;
}
.lb-img {
  position: absolute;
  top: 0;
  left: 0;
  max-width: none;
  border-radius: var(--lb-radius);
  transform-origin: 0 0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
}
.lb-zoomable .lb-img {
  cursor: zoom-in;
}
.lb-zoomed .lb-img {
  cursor: grab;
}
.lb-dragging .lb-img {
  cursor: grabbing;
}
.lb-bar {
  position: absolute;
  left: 0;
  right: 0;
  height: var(--lb-bar);
  padding: 0 var(--lb-x);
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.lb-top {
  top: 0;
}
.lb-bottom {
  bottom: 0;
}
.lb-single .lb-bottom {
  display: none;
}
/* Opaque versions of the pills, so they stay readable over a zoomed image. */
.lightbox .carousel-arrow {
  position: static;
  border: 0;
  padding: 0;
  background-color: color-mix(in srgb, var(--white) 12%, var(--black));
  pointer-events: auto;
}
.lightbox .carousel-counter {
  padding: 0 14px;
}
.lightbox .lb-close {
  width: auto;
  padding: 0 16px;
}
.lightbox button.carousel-arrow {
  cursor: pointer;
  transition: background-color .2s;
}
.lightbox button.carousel-arrow:hover {
  background-color: color-mix(in srgb, var(--white) 20%, var(--black));
}
.lightbox button.carousel-arrow:focus-visible {
  outline: 2px solid var(--white-64);
  outline-offset: 2px;
}
@media screen and (max-width: 991px) {
  .lightbox { --lb-x: 64px; }
}
/* Phones: the image runs edge to edge with square corners, as on the pages. */
@media screen and (max-width: 479px) {
  .lightbox { --lb-x: 40px; --lb-radius: 0px; }
  .lb-stage { left: 0; right: 0; }
}
/* Short screens (phone on its side): the image takes the full height, the pills float over it. */
@media screen and (max-height: 560px) {
  .lb-stage { top: 0; bottom: 0; }
}

/* Slider caption with one label per slide: slider-counter.js marks the current one;
   !important wins over the opacity the arrows' click interaction writes inline. */
.tag-swap .swap-label {
  opacity: 0 !important;
}
.tag-swap .swap-label.swap-current {
  opacity: 1 !important;
}

/* Button to a project's own site (Virtual Shipyard), on the dark project page:
   the template's secondary button, in white like the tags. */
.button-secondary.site-link {
  color: var(--white);
  text-decoration: none;
}

/* Resume page (pages/resume.html, js/resume.js), on the light frame of About and Contact:
   the template's small secondary buttons switch the language (the chosen one inverted),
   the sheet is a white A4 page lifted off the white page, the downloads list like Contact's. */
.resume-switch {
  display: flex;
  gap: 8px;
  margin-bottom: 32px;
}
.resume-switch .button-secondary {
  border: 0;
  cursor: pointer;
}
.resume-switch .button-secondary[aria-pressed="true"] {
  background-color: var(--white);
  color: var(--black);
}
.resume-sheet {
  display: block;
  width: 100%;
  border: 1px solid var(--white-12);
  border-radius: 12px;
  box-shadow: 0 32px 64px -32px rgba(10, 10, 9, 0.35);
}
.resume-sheet[hidden] {
  display: none;
}
.resume-file {
  display: block;
  text-decoration: none;
}
.resume-file .heading {
  display: block;
  transition: color .2s;
}
.resume-file:hover .heading {
  color: var(--accent);
}
.resume-meta {
  display: block;
  margin-top: 8px;
  color: var(--white-64);
  font-size: 16px;
  letter-spacing: .02em;
}
.resume-switch .button-secondary:focus-visible,
.resume-file:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}
@media screen and (max-width: 479px) {
  .resume-switch .button-secondary { flex: 1; width: auto; }
}

/* Home: "More about me" and "My resume" side by side (stacked on phones, where the buttons are full width). */
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
}

/* Selene GA blocks: when the plans column is the taller one, the two renders on the left grow
   to its height (their sides are cropped, never their height), so both columns end level. */
.ga-renders {
  display: flex;
  flex-direction: column;
}
.ga-renders .project-image {
  flex: 1 0 auto;
  object-fit: cover;
}
