/* =========================================================
   Luize Sproģe — portfolio
   Desktop layout follows the design proportionally (vw units),
   so it looks the same on any wide screen.
   Below 800px it switches to a simple stacked mobile layout.
   ========================================================= */

/* Rivet gun — Luize's own variable typeface (used on the Rivet gun page) */
@font-face {
  font-family: "Rivet Gun";
  src: url("fonts/rivet-gun.ttf") format("truetype");
  font-display: swap;
}

:root {
  --ink: #111;
  --paper: #fff;
  /* Design artboard is 1920px wide: 20pt text, 26 line height, tracking -5.
     Sizes are converted to vw so the layout scales with the screen. */
  --fs: calc(20 / 1920 * 100vw);   /* 20pt  */
  --lh: calc(26 / 1920 * 100vw);   /* 26 line height */
  --ls: -0.05em;                   /* Figma letter spacing -5% */
  --col: 24.5vw;                   /* width of the main text column */
}

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

html {
  background: var(--paper);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
a, button { -webkit-tap-highlight-color: transparent; }

body {
  font-family: "Sometype Mono", ui-monospace, Menlo, monospace;
  font-size: var(--fs);
  line-height: var(--lh);
  letter-spacing: var(--ls);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul { list-style: none; }

/* hand-drawn elements shouldn't be draggable/selectable */
img { -webkit-user-drag: none; user-select: none; }


/* =========================================================
   HOME — par mani
   ========================================================= */

.home {
  position: relative;
  width: 100%;
  height: 185vw;          /* total page length for the 6 cards */
  overflow: hidden;
}

.home > * { position: absolute; }
.home > .project { position: static; }   /* card + caption position against .home */

.logo      { left: 2vw;    top: 5.1vw;  width: 15.8vw; display: block; }
.subtitle  { left: 2vw;    top: 7.9vw; }

.bio {
  left: 26.25vw;
  top: 5.1vw;
  width: var(--col);
}

.par-mani  { left: 15vw;   top: 36.6vw; width: 10.4vw; }
.bio-pager, .arc-line-flat { display: none; }
.nav-current { display: none; }   /* only used on phones */   /* only used on phones */

.contacts  { left: 2.25vw; top: 46.7vw; width: 27vw; }
.contacts li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 0.9vw;
}
.contacts li img { width: 100%; height: auto; max-height: 1.2vw; object-fit: fill; }
.contacts a:hover { text-decoration: underline; }

.portrait   { left: 56.3vw; top: 4.26vw; width: 39.6vw; }
.home .stopmotion--portrets { --frame: 0.5s; position: absolute; aspect-ratio: 1400 / 1119; }
.home .stopmotion--portrets img { animation-duration: calc(var(--frame) * 6); animation-delay: 0s; }
/* loop = 6 × --frame: p1 1×, p2 1×, p3 (the photo) 3×, p2 1× */
.home .stopmotion--portrets img:nth-child(1) { animation-name: portrets-1; }
.home .stopmotion--portrets img:nth-child(2) { animation-name: portrets-2; }
.home .stopmotion--portrets img:nth-child(3) { animation-name: portrets-3; }
.home .stopmotion--portrets img:nth-child(4) { animation-name: portrets-4; }
@keyframes portrets-1 { 0% { visibility: visible; } 16.6667% { visibility: hidden; } 100% { visibility: hidden; } }
@keyframes portrets-2 { 0% { visibility: hidden; } 16.6667% { visibility: visible; } 33.3333% { visibility: hidden; } 100% { visibility: hidden; } }
@keyframes portrets-3 { 0% { visibility: hidden; } 33.3333% { visibility: visible; } 83.3333% { visibility: hidden; } 100% { visibility: hidden; } }
@keyframes portrets-4 { 0% { visibility: hidden; } 83.3333% { visibility: visible; } 100% { visibility: visible; } }
.arc        { left: 56.5vw; top: 32.3vw; width: 12vw; height: 18vw; z-index: 2; }
.arc img    { position: absolute; }
.arc-line   { left: 12.5%; top: 13.1%; width: 64.5%; }
.arc-x1     { left: 70.8%; top: 9.5%;  width: 12.5%; }
.arc-x2     { left: 7.9%;  top: 87.8%; width: 12.5%; }
.arc-label  { left: 22.8%; top: 38.3%; width: 45%; transform: translate(-50%, -50%) rotate(-70deg); }
.footnote { left: 2vw; bottom: 0.8vw; width: 96vw; }   /* hand-written line at the very bottom (3 lines on phones) */
.footnote img { display: block; width: 100%; height: auto; }
/* long arrow at the right: stays on screen while scrolling and grows longer towards the
   end of the page.
   Top and length are set by the script; the head keeps its shape (border-image). */
.home > .long-arrow {
  position: fixed;
  left: 96.3vw; top: 27vw; width: 1.4vw;
  height: max(6vw, min(29.5vw, calc(100vh - 27vw - 2vw)));   /* before the script runs */
  box-sizing: border-box;
  border-style: solid;
  border-width: 0 0 0.7vw 0;
  border-image: url("img/hand/arrow-down-thick.png") 0 0 55 0 fill / 0 0 0.7vw 0 stretch;
  z-index: 3;
  pointer-events: none;
  transition: opacity .3s ease;
}
.home > .long-arrow.is-hidden { opacity: 0; }   /* at the very bottom and while scrolling up */


/* =========================================================
   PROJEKTU KARTĪTES — sneak peek
   Change --x / --y / --w / --r (card) and --cx / --cy (caption)
   to move things around.
   ========================================================= */

.project .card {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--w);
  transform: rotate(var(--r));
}
.project .card img { width: 100%; }
/* hover: paper 2 replaces paper 1 (paper 1 is hidden, not covered) */
.project .img-b {
  position: absolute;
  inset: 0;
  height: 100%;
  object-fit: contain;
  visibility: hidden;
}
@media (hover: hover) {
  .project:not(.has-mask):hover .img-a,
  .project.is-hover .img-a,
  .project:focus-visible .img-a { visibility: hidden; }
  .project:not(.has-mask):hover .img-b,
  .project.is-hover .img-b,
  .project:focus-visible .img-b { visibility: visible; }
}

.project .caption {
  position: absolute;
  left: var(--cx);
  top: var(--cy);
  white-space: nowrap;
}
.project .nr { width: 3.2vw; margin-bottom: 0.5vw; }
@media (hover: hover) { .project:not(.has-mask):hover .caption, .project.is-hover .caption { text-decoration: underline; text-underline-offset: 0.2em; } }
.project.has-mask .card { cursor: default; }
.project.has-mask.is-hover .card { cursor: pointer; }

.p1 { --x: 47.9vw; --y: 51.3vw; --w: 33vw;   --r: 0deg;  --cx: 82.6vw; --cy: 63.3vw; }
.p2 { --x: 4.2vw;  --y: 68.8vw; --w: 34.3vw; --r: -1deg; --cx: 39.5vw; --cy: 81vw; }
.p3 { --x: 62vw;  --y: 84vw;  --w: 27vw; --r: 0deg;  --cx: 50.4vw; --cy: 96.5vw; }
.p4 { --x: 5.5vw; --y: 111vw; --w: 35vw; --r: 1deg;  --cx: 42.5vw; --cy: 117vw; }
.p5 { --x: 59.4vw; --y: 123.3vw; --w: 22.4vw; --r: 0deg;  --cx: 82.6vw; --cy: 148vw; }
.p6 { --x: 16vw;  --y: 139vw; --w: 25vw; --r: -2deg; --cx: 44vw;   --cy: 167vw; }

/* stop-motion eye (Mākslinieka pašportrets): 14 stacked frames shown one after another.
   SPEED: --frame = how long each frame stays on screen (bigger = slower). */
.stopmotion {
  --frame: 0.25s;
  position: relative;
  display: block;
  aspect-ratio: 1100 / 658;
}
.stopmotion img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  visibility: hidden;
  animation: stopmotion calc(var(--frame) * 14) steps(1, end) infinite;
  animation-delay: calc(var(--frame) * var(--i));
}
@keyframes stopmotion {
  0%        { visibility: visible; }
  7.142857% { visibility: hidden; }   /* 1/14 of the loop */
  100%      { visibility: hidden; }
}
/* "Laika palagos" publication: 24 frames */
.stopmotion--laika {
  --frame: 0.5s;                 /* own speed: each page stays 0.5s */
  /* the box fits the normal open pages, so it fills the column like "rivet gun";
     frames that stick out further (page turn #17) can go past the box */
  aspect-ratio: 3250 / 2507;
}
.project-photos .stopmotion--laika img {
  left: -8.677%;
  top: -8.616%;
  width: 117.785%;
  height: 110.770%;
  max-width: none;   /* allow wider than the box, so nothing is squeezed */
}
.stopmotion--laika img { animation-name: stopmotion-24; animation-duration: calc(var(--frame) * 24); }
@keyframes stopmotion-24 {
  0%        { visibility: visible; }
  4.166667% { visibility: hidden; }   /* 1/24 of the loop */
  100%      { visibility: hidden; }
}
/* "Māksla un bizness" newspaper: 10 frames, same setup as "Laika palagos" */
.stopmotion--avize {
  --frame: 0.5s;                 /* each page stays 0.5s */
  aspect-ratio: 3218 / 2797;     /* box fits the open spreads */
}
.project-photos .stopmotion--avize img {
  left: 0;
  top: -2.503%;
  width: 101.554%;
  height: 104.398%;
  max-width: none;
}
.stopmotion--avize img { animation-name: stopmotion-10; animation-duration: calc(var(--frame) * 10); }
@keyframes stopmotion-10 {
  0%   { visibility: visible; }
  10%  { visibility: hidden; }   /* 1/10 of the loop */
  100% { visibility: hidden; }
}
/* "durvis" first visual: door collage 1-2-3-2-1-4-5-4-1-6-7-6 (12 frames) */
.stopmotion--durvis-a {
  --frame: 0.35s;                /* each frame stays 0.35s */
  aspect-ratio: 1400 / 1504;
  width: 95%; margin-left: auto; margin-right: auto;
  z-index: 1;                    /* stays on top if the two touch */
}
.stopmotion--durvis-a img { animation-name: stopmotion-12; animation-duration: calc(var(--frame) * 12); }
@keyframes stopmotion-12 {
  0%      { visibility: visible; }
  8.3333% { visibility: hidden; }   /* 1/12 of the loop */
  100%    { visibility: hidden; }
}
/* "durvis" layers d6 → d1 and back: 10 frames (6-5-4-3-2-1-2-3-4-5) */
.stopmotion--durvis {
  --frame: 0.5s;                 /* each frame stays 0.5s */
  aspect-ratio: 1400 / 1867;
  width: 85%; margin-left: auto; margin-right: auto;
  margin-top: -2.8vw;            /* sits just under the first animation, so its top peeks in on screen */
}
.stopmotion--durvis img { animation-name: stopmotion-10; animation-duration: calc(var(--frame) * 10); }
/* "Izpētes tehnikas" poster layers: 3 frames */
.stopmotion--plakati {
  --frame: 0.6s;                 /* each frame stays 0.6s */
  aspect-ratio: 1600 / 1632;
  width: 92%;                    /* newspaper base ≈ same size as the poster above */
}
.stopmotion--plakati img { animation-name: stopmotion-3; animation-duration: calc(var(--frame) * 3); }
/* hovering a stop-motion in the archive pauses it */
@media (hover: hover) {
  .project-photos .stopmotion:not(.stopmotion--masked):hover img,
  .project-photos .stopmotion--masked.is-hover img { animation-play-state: paused; }
}

/* click a stop-motion in the archive to see it over the whole window */
/* hand-drawn plus as the "open full screen" pointer */
.project-photos .stopmotion:not(.stopmotion--masked),
.project-photos .stopmotion--masked.is-hover,
.project-photos .hover-swap:not([data-mask]),
.project-photos .hover-swap.is-hover {
  cursor: url("img/hand/pointer-plus-24-thin.png") 12 12, zoom-in;
  cursor: -webkit-image-set(url("img/hand/pointer-plus-24-thin.png") 1x, url("img/hand/pointer-plus-24-thin@2x.png") 2x) 12 12, zoom-in;
}
/* paused while its full-screen view is open */
.stopmotion.is-paused img { animation-play-state: paused; }
.stopmotion.is-restarting img { animation: none; }

/* full-screen flip-through viewer */
.stopmotion-full {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.55);   /* page stays visible behind… */
  -webkit-backdrop-filter: blur(14px);      /* …but blurred */
  backdrop-filter: blur(14px);
}
.stopmotion-full .viewer {
  position: absolute;
  inset: 2vw;                     /* same 2vw margin all around */
}
.stopmotion-full .viewer img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;            /* whole page, nothing cut */
  visibility: hidden;
}
.stopmotion-full .viewer img.is-current { visibility: visible; }
/* switching between animations in full screen: short slide up / down */
.stopmotion-full .viewer.slide-up   { animation: full-slide-up .35s ease-out; }
.stopmotion-full .viewer.slide-down { animation: full-slide-down .35s ease-out; }
@keyframes full-slide-up   { from { transform: translateY(6vh);  opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes full-slide-down { from { transform: translateY(-6vh); opacity: 0; } to { transform: none; opacity: 1; } }
/* left half = previous page, right half = next page */
.stopmotion-full .prev,
.stopmotion-full .next {
  position: absolute;
  top: 0; bottom: 0;
  width: 50%;
  background: none;
  border: 0;
  padding: 0;
}
.stopmotion-full .prev,
.stopmotion-full .next,
.stopmotion-full .close { outline: none; -webkit-tap-highlight-color: transparent; }
/* hand-drawn arrows as mouse pointers (centre of the arrow = click point).
   If you change a pointer image, give it a NEW file name – Safari keeps old pointer images. */
.stopmotion-full .prev {
  left: 0;
  cursor: url("img/hand/pointer-left-24.png") 12 12, w-resize;
  cursor: -webkit-image-set(url("img/hand/pointer-left-24.png") 1x, url("img/hand/pointer-left-24@2x.png") 2x) 12 12, w-resize;
}
.stopmotion-full .next {
  right: 0;
  cursor: url("img/hand/pointer-right-24.png") 12 12, e-resize;
  cursor: -webkit-image-set(url("img/hand/pointer-right-24.png") 1x, url("img/hand/pointer-right-24@2x.png") 2x) 12 12, e-resize;
}
/* centre of the top / bottom edge = previous / next visual (hand-drawn up / down arrows as pointers);
   hidden when there is nothing above / below */
.stopmotion-full .up,
.stopmotion-full .down {
  position: absolute;
  left: 30%; width: 40%;
  height: 18%;
  z-index: 1;                     /* above the left / right halves */
  background: none; border: 0; padding: 0;
  outline: none; -webkit-tap-highlight-color: transparent;
}
.stopmotion-full .up[hidden],
.stopmotion-full .down[hidden] { display: none; }
.stopmotion-full .up {
  top: 0;
  cursor: url("img/hand/pointer-up-24.png") 12 12, n-resize;
  cursor: -webkit-image-set(url("img/hand/pointer-up-24.png") 1x, url("img/hand/pointer-up-24@2x.png") 2x) 12 12, n-resize;
}
.stopmotion-full .down {
  bottom: 0;
  cursor: url("img/hand/pointer-down-24.png") 12 12, s-resize;
  cursor: -webkit-image-set(url("img/hand/pointer-down-24.png") 1x, url("img/hand/pointer-down-24@2x.png") 2x) 12 12, s-resize;
}
.stopmotion-full .counter {
  position: absolute;
  left: 2vw; bottom: 2vw;
  pointer-events: none;
}
/* mirrors the page counter, bottom-right (text set with data-full-caption in arhivs.html) */
.stopmotion-full .full-caption {
  position: absolute;
  right: 2vw; bottom: 2vw;
  text-align: right;
  pointer-events: none;
}
.stopmotion-full .close {
  position: absolute;
  top: 2vw; right: 2vw;
  z-index: 1;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}
.stopmotion-full .close img { width: max(22px, 1.6vw); }
@media (max-width: 1024px) {
  .stopmotion-full .viewer { inset: 16px; }
  .stopmotion-full .close { top: 16px; right: 16px; }
  .stopmotion-full .counter { left: 16px; bottom: 16px; }
  .stopmotion-full .full-caption { right: 16px; bottom: 16px; }
}
/* home #2 "Laika palagos": 3 family photos */
/* home #5 "Māksla un bizness": 3 frames of stamps */
.stopmotion--zimogi {
  --frame: 0.6s;                 /* each frame stays 0.6s */
  aspect-ratio: 1200 / 2033;
}
/* plays 1 → 2 → 3 → 2 → 1 → … (4 steps per loop) */
.stopmotion--zimogi img { animation-duration: calc(var(--frame) * 4); animation-delay: 0s; }
/* home #6 "Izpētes tehnikas": pl-s1 → pl-s2 → pl-s3 → pl-s2 (same 1-2-3-2 loop as the stamps) */
.stopmotion--zimogi.stopmotion--plakati-home { --frame: 0.5s; aspect-ratio: 1100 / 1509; }
.stopmotion--zimogi img:nth-child(1) { animation-name: zim-1; }
.stopmotion--zimogi img:nth-child(2) { animation-name: zim-2; }
.stopmotion--zimogi img:nth-child(3) { animation-name: zim-3; }
@keyframes zim-1 { 0% { visibility: visible; } 25%, 100% { visibility: hidden; } }
@keyframes zim-2 { 0% { visibility: hidden; } 25% { visibility: visible; } 50% { visibility: hidden; } 75%, 100% { visibility: visible; } }
@keyframes zim-3 { 0% { visibility: hidden; } 50% { visibility: visible; } 75%, 100% { visibility: hidden; } }
.stopmotion--bildes {
  --frame: 0.5s;                 /* each photo stays 0.5s */
  aspect-ratio: 1200 / 875;
}
.stopmotion--bildes img { animation-name: stopmotion-3; animation-duration: calc(var(--frame) * 3); }
@keyframes stopmotion-3 {
  0%        { visibility: visible; }
  33.3333%  { visibility: hidden; }   /* 1/3 of the loop */
  100%      { visibility: hidden; }
}
@media (prefers-reduced-motion: reduce) {
  .stopmotion img { animation: none; }
  .stopmotion img:first-child { visibility: visible; }
}
/* hovering the eye pauses the animation on the current frame */
@media (hover: hover) {
  .project.no-hover:not(.has-mask):hover .stopmotion img { animation-play-state: paused; }
}
/* no other hover effects on the eye */
.project.no-hover:hover .caption { text-decoration: none; }


/* =========================================================
   ARHĪVS — three columns, text and photos scroll separately
   ========================================================= */

.page-archive { overflow: hidden; height: 100vh; }

/* header (logo + subtitle) uses exactly the same .logo / .subtitle
   coordinates as the home page, so it stays put when switching pages */
.archive-nav {
  position: fixed;
  left: 0; top: 0;
  width: 24vw; height: 100vh;
}
.archive-nav .logo,
.archive-nav .subtitle { position: absolute; }
.archive-nav .logo img { width: 100%; }
.archive-nav ul { position: absolute; left: 2vw; top: calc(7.9vw + 3.5vw); }
/* hovered project slides slightly to the right */
.archive-nav ul a {
  display: inline-block;
  transition: transform .25s ease;
}
@media (hover: hover) { .archive-nav ul a:hover { transform: translateX(0.8em); } }
.archive-nav a[aria-current="true"] { text-decoration: underline; text-underline-offset: 0.2em; }



.archive-project { display: none; }
.archive-project.is-active { display: block; }

.project-text,
.project-photos {
  position: fixed;
  top: 0; bottom: 0;
  overflow-y: auto;
  overflow-x: hidden;            /* never scroll sideways (wide animation frames) */
  overscroll-behavior: contain;
  scrollbar-width: none;              /* hide scrollbars (Firefox) */
}
.project-text::-webkit-scrollbar,
.project-photos::-webkit-scrollbar { display: none; }   /* Safari/Chrome */

.project-text {
  left: 26.25vw;
  width: calc(var(--col) + 2vw);
  padding: 7.9vw 2vw 8vw 0;          /* same top as the subtitle */
}

/* project title line sits on the same line as "Arhīvs" */

/* categories: start on the same line as the project list */
.project-meta { height: 3.5vw; }   /* fixed, so categories always line up with the project list, even if the title wraps */
.categories { margin-top: 0; }
.category-list button {
  font: inherit;
  letter-spacing: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-align: left;
  display: inline-block;
  transition: transform .25s ease;     /* slide on hover, same as project list */
}
@media (hover: hover) { .category-list button:hover { transform: translateX(0.8em); } }
.category-list button.is-open {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}
/* text always appears in the same place: one empty line under the list */
.category-body { margin-top: var(--lh); }
.category-body { padding-left: 3.5vw; position: relative; }
/* arrow beside long texts (added by script only when the text needs scrolling) */
.category-body.is-long::before {
  content: "";
  position: absolute;
  left: 0.9vw;
  top: 0;
  height: var(--arrow-h);   /* set by script: fits inside the window */
  width: 1.2vw;
  background: url("img/hand/arrow-down.png") center / 100% 100% no-repeat;
}
.category-body p + p { margin-top: var(--lh); }

.project-photos {
  left: 53.5vw;   /* closer to the middle */
  right: 2vw;     /* same margin as the left side (logo, lists) */
  padding: 3.5vw 0 8vw;
  display: flex;
  flex-direction: column;
  gap: 4vw;
}
.project-photos img { width: 100%; }
.project-photos video { width: 100%; display: block; background: #000; }
/* hand-drawn video controls */
.vplayer video { cursor: url("img/hand/pointer-plus-24-thin.png") 12 12, zoom-in;
  cursor: -webkit-image-set(url("img/hand/pointer-plus-24-thin.png") 1x, url("img/hand/pointer-plus-24-thin@2x.png") 2x) 12 12, zoom-in; }
.video-full .vplayer video { cursor: default; }
.vctrl {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1.2vw;
  margin-top: 0.8vw;
  height: 2.4vw;
}
.vctrl button { background: none; border: 0; padding: 0; cursor: pointer; display: block; -webkit-tap-highlight-color: transparent; }
.vctrl img { display: block; height: 100%; width: auto; }
.v-back, .v-fwd { height: 1.9vw; }
.v-play { height: 2.1vw; width: 1.7vw; position: relative; }
.v-play img { position: absolute; left: 0; top: 0; }
.v-play .i-pause { left: 0.2vw; }
.vplayer .i-pause, .vplayer.is-playing .i-play { visibility: hidden; }
.vplayer.is-playing .i-pause { visibility: visible; }
.v-sound { margin-left: auto; position: relative; }
.v-mute { height: 2.1vw; width: 3.2vw; position: relative; }
.v-mute img { position: absolute; left: 0; top: 0; }
.vplayer .i-off, .vplayer.is-muted .i-on { visibility: hidden; }
.vplayer.is-muted .i-off { visibility: visible; }
/* volume line: appears under the speaker on hover.
   .v-vol is a wide invisible grab area (starts right under the speaker, no gap);
   the drawn line sits in .v-vol-track inside it. */
.v-vol {
  position: absolute;
  left: 1vw; top: 100%;
  width: 4.4vw; margin-left: -2.2vw;
  padding: 1vw 0 1.4vw;
  cursor: pointer;
  touch-action: none;
  visibility: hidden;
  transition: visibility 0s linear 0.6s;   /* stays a moment if the mouse slips off */
}
.v-vol-track { position: relative; height: 8vw; }
.v-sound:hover .v-vol, .v-vol:focus-visible, .vplayer.is-dragging .v-vol { visibility: visible; transition-delay: 0s; }
.v-vol img { pointer-events: none; -webkit-user-drag: none; user-select: none; }
.v-vol .v-vol-line { position: absolute; left: 50%; top: 0; height: 100%; width: auto; transform: translateX(-50%); }
.v-vol .v-vol-mark { position: absolute; left: 50%; height: auto; width: 1.1vw; transform: translate(-50%, -50%); }
/* full screen video */
.video-full {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(255, 255, 255, 0.55);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  display: flex; align-items: center; justify-content: center;
}
.video-full .v-vol { display: none; }          /* full screen: speaker is only on/off */
.video-full .vplayer { width: min(92vw, calc((100vh - 16vw) * 16 / 9)); }
.video-full .vplayer video { width: 100%; display: block; background: #000; }
.video-full .close { position: absolute; top: 2vw; right: 2vw; background: none; border: 0; padding: 0; cursor: pointer; }
.video-full .close img { width: max(22px, 1.6vw); }
@media (max-width: 1024px) {
  .vctrl { height: 26px; gap: 14px; margin-top: 10px; }
  .v-back, .v-fwd { height: 20px; } .v-play { height: 22px; width: 18px; } .v-mute { height: 22px; width: 34px; }
  .v-vol { left: 12px; width: 48px; margin-left: -24px; padding: 10px 0 14px; } .v-vol-track { height: 90px; } .v-vol .v-vol-mark { width: 12px; }
}
.project-photos .portrait-format { width: 70%; margin: 0 auto; }
/* third "Izpētes tehnikas" poster: paper ≈ same size as the first poster */
.hover-swap--tresais { width: 64.2%; margin: 0 auto; }
/* "Laika palagos" photos: sit closer to the publication animation above */
.hover-swap--laika-m { margin-top: -5.5vw; }
/* "Laika palagos" upright photos: narrower so it isn't much taller than the others */
.hover-swap--laika-l2 { width: 75%; margin: 0 auto; }
/* collage of separate prints, each placed by % of the collage box */
.collage { position: relative; aspect-ratio: 414.6 / 860; }
.collage img { position: absolute; height: auto; max-width: none; }
.collage--maksla { margin-top: -2vw; }
.collage .swap { position: absolute; display: block; }
.collage .swap img { position: static; width: 100%; display: block; }
.collage .swap .img-b { position: absolute; left: 0; top: 0; visibility: hidden; }
.collage .swap.is-hover .img-a { visibility: hidden; }
.collage .swap.is-hover .img-b { visibility: visible; }
/* stamps collage: click for full screen */
.project-photos .collage {
  cursor: url("img/hand/pointer-plus-24-thin.png") 12 12, zoom-in;
  cursor: -webkit-image-set(url("img/hand/pointer-plus-24-thin.png") 1x, url("img/hand/pointer-plus-24-thin@2x.png") 2x) 12 12, zoom-in;
}
/* full screen: the stamps sit in the same viewer as the other visuals,
   laid out wide (positions from data-wide); no flipping arrows there */
.stopmotion-full .collage-stage {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
}
.stopmotion-full .collage--wide {
  width: min(100%, calc((100vh - 10vw) * 900 / 440));
  aspect-ratio: 900 / 440; margin: 0; cursor: default;
}
.stopmotion-full .viewer .collage img { position: absolute; inset: auto; width: auto; height: auto; object-fit: initial; visibility: visible; }
.stopmotion-full .viewer .collage .swap img { position: static; width: 100%; }
.stopmotion-full .viewer .collage .swap .img-b { position: absolute; left: 0; top: 0; visibility: hidden; }
.stopmotion-full .viewer .collage .swap.is-hover .img-a { visibility: hidden; }
.stopmotion-full .viewer .collage .swap.is-hover .img-b { visibility: visible; }
.stopmotion-full .collage--tall { height: 100%; width: auto; max-width: 100%; aspect-ratio: 414.6 / 860; margin: 0; cursor: default; }
.stopmotion-full.is-collage .prev,
.stopmotion-full.is-collage .next { display: none; }
/* hover swap in the archive: second image replaces the first on hover */
.hover-swap { position: relative; display: block; }
.hover-swap .img-b {
  position: absolute;
  inset: 0;
  height: 100%;
  object-fit: contain;
  visibility: hidden;
}
@media (hover: hover) {
  .hover-swap:not([data-mask]):hover .img-a,
  .hover-swap.is-hover .img-a { visibility: hidden; }
  .hover-swap:not([data-mask]):hover .img-b,
  .hover-swap.is-hover .img-b { visibility: visible; }
}
.project-photos { container-type: inline-size; }

/* "rivet / gun" set in the Rivet gun font, filling the photo column */
.rivet-title {
  font-family: "Rivet Gun", sans-serif;
  font-variation-settings: "wdth" 1;   /* 1 = heavy end, 100 = light end */
  /* loops heavy → light → heavy; change 4s to make it faster/slower */
  animation: rivet-vary 4s ease-in-out infinite alternate;
  font-size: 44cqw;
  line-height: 0.68;                   /* the font has tall built-in spacing */
  letter-spacing: 0;
  /* the letters sit a hair below the line box; this padding keeps them inside it,
     so Safari repaints the bottom edge on every frame (no leftover streaks),
     and the negative margin keeps the layout exactly the same */
  padding-bottom: 0.08em;
  margin-bottom: -0.08em;
}
/* home #3: one large "r" in the Rivet Gun font */
.rivet-letter {
  display: block;
  font-family: "Rivet Gun", sans-serif;
  font-size: 44vw;
  line-height: 0.7;
  padding-bottom: 0.08em;             /* same Safari repaint fix as the archive title */
  margin-bottom: -0.08em;
  letter-spacing: 0;
  text-align: center;
  color: var(--ink);
  font-variation-settings: "wdth" 1;
  animation: rivet-vary 4s ease-in-out infinite alternate;
}
.project.no-hover:hover .rivet-letter { animation-play-state: paused; }
@media (max-width: 1024px) { .rivet-letter { font-size: 70vw; margin-top: -0.2em; } }   /* phones: no empty band above the r */
/* the archive title is a type-tester: click and type */
.rivet-title[contenteditable] {
  flex-shrink: 0;                     /* grow with the text, never squeeze */
  position: relative;
  overflow-x: clip;                   /* no sideways scrolling… */
  overflow-y: visible;                /* …but letters may reach below the box */
  cursor: text;
  outline: none;
  text-transform: lowercase;          /* the font is drawn in lowercase */
  overflow-wrap: normal;
  white-space: pre-wrap;
  caret-color: transparent;           /* replaced by .type-caret, sized to the letters */
  min-height: 0.7em;
}
/* custom text cursor: only as tall as the letters, blinks like a normal one */
.type-caret {
  position: absolute;
  width: 2px;
  background: var(--ink);
  pointer-events: none;
  animation: caret-blink 1s steps(1) infinite;
}
@keyframes caret-blink { 50% { opacity: 0; } }
.rivet-title.is-broken { overflow-wrap: anywhere; }   /* a word too long even at the smallest size */
.rivet-title[contenteditable]:empty::before {   /* hint when everything is deleted */
  content: "raksti";
  opacity: .25;
}
@keyframes rivet-vary {
  from { font-variation-settings: "wdth" 1; }
  to   { font-variation-settings: "wdth" 100; }
}
/* people who switched off animations in their system settings see it still */
@media (prefers-reduced-motion: reduce) {
  .rivet-title, .rivet-letter { animation: none; }
}

.placeholder { opacity: .45; font-style: italic; }


/* =========================================================
   MOBILE + TABLET (up to 1024px wide): everything in one column
   ========================================================= */
@media (max-width: 1024px) {
  :root { --fs: 15px; --lh: 19.5px; }

  body {
    padding: 24px 20px 64px;
    max-width: 680px;           /* comfortable column on tablets */
    margin: 0 auto;
  }

  /* home: stack everything */
  .home { height: auto; overflow: visible; display: flex; flex-direction: column; }
  .home > * { position: static; }

  .logo { width: 200px; order: 1; }
  .subtitle { order: 2; margin-top: 4px; }
  .portrait { width: 100%; order: 3; margin: 32px 0; }
  .home .stopmotion--portrets { position: relative; left: 0; top: 0; }
  .bio { width: auto; max-width: 46ch; order: 4; }
  /* "about me": three pages side by side, swiped sideways */
  .bio {
    display: flex; align-items: flex-start;
    overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .bio::-webkit-scrollbar { display: none; }
  .bio { overflow-y: hidden; touch-action: pan-x pan-y; }   /* the text only moves sideways inside its box */
  .bio { column-gap: 56px; }                     /* empty space between the pages while swiping */
  .bio p { flex: 0 0 100%; scroll-snap-align: start; margin: 0; }
  .bio { transition: height .25s ease; overscroll-behavior-x: contain; }
  .bio-pager { order: 4; display: flex; align-items: center; justify-content: space-between; margin-top: 12px; max-width: 46ch; }
  .bio-next { background: none; border: 0; padding: 8px 0 8px 16px; cursor: pointer; }
  .bio-next img { width: 18px; height: 18px; display: block; }
  .bio-next.is-back img { transform: scaleX(-1); }
  .par-mani { display: none; }
  .contacts { width: 100%; max-width: 360px; order: 5; margin-top: 32px; }
  .contacts li { gap: 10px; }
  .contacts li img { max-height: 10px; }
  /* x — arhīvs — x: a straight line across the whole width (the line from the video volume),
     the ✕ at both ends, "arhīvs" above it */
  .arc { order: 6; position: relative; left: 0; top: 0; width: 100%; height: 58px; aspect-ratio: auto; margin: 40px 0 0; }
  .arc img { position: absolute; }
  .arc .arc-line { display: none; }
  .arc .arc-line-flat { display: block; left: 32px; right: 32px; top: 40px; width: calc(100% - 64px); height: 5px; object-fit: fill; }
  .arc .arc-x1 { left: auto; right: 0; top: 32px; width: 22px; }
  .arc .arc-x2 { left: 0; top: 32px; bottom: auto; width: 22px; }
  .arc .arc-label { left: 50%; top: 14px; width: 96px; transform: translate(-50%, -50%); }
  .long-arrow { display: none; }
  .footnote { order: 99; width: 100%; max-width: 420px; margin: 48px 0 0; }
  body.page-home { padding-bottom: 10px; }   /* the P.S. sits right at the bottom */

  .project {
    order: 7;
    display: flex;
    flex-direction: column;
    margin-top: 28px;               /* same small gap before every work */
  }
  .home > .project:first-of-type { margin-top: 40px; }
  .project .card,
  .project .caption { position: relative; left: auto; top: auto; }
  /* each work (picture + caption) always fits on one screen: the picture is never taller
     than the screen minus room for the caption (--ar = picture height / width) */
  .project .card { width: min(82%, 440px, calc((100svh - 130px) / var(--ar, 1))); }
  .p1 { --ar: 0.8975; } .p2 { --ar: 0.7292; } .p3 { --ar: 0.75; } .p4 { --ar: 0.5982; } .p5 { --ar: 1.6942; } .p6 { --ar: 1.3718; }
  .p2 .card, .p4 .card, .p6 .card { margin-left: auto; }
  .p2 .caption, .p4 .caption, .p6 .caption { align-self: flex-end; }
  .project .caption { margin-top: 10px; white-space: normal; }
  .project .nr { width: 40px; margin-bottom: 6px; }

  /* archive: normal page flow */
  .page-archive { overflow: auto; height: auto; }
  .archive-nav { position: static; width: auto; height: auto; }
  .archive-nav .logo,
  .archive-nav .subtitle,
  .archive-nav ul { position: static; }
  .archive-nav .logo { width: 200px; }
  .archive-nav .subtitle { margin-top: 4px; }
  /* phones: the list is folded to the open project ("“durvis ⌄   1 / 6"); a tap unfolds it */
  .archive-nav ul { display: none; margin-top: 8px; padding-left: 16px; }
  .archive-nav.is-open ul { display: block; }
  .archive-nav .nav-current {
    display: flex; align-items: center; gap: 8px; width: 100%; margin-top: 18px; padding: 6px 0;
    font: inherit; letter-spacing: inherit; color: inherit; background: none; border: 0; text-align: left; cursor: pointer;
  }
  .nav-current .nc-name { text-decoration: underline; text-underline-offset: 0.2em; }
  .nav-current img { width: 14px; height: 14px; transition: transform .2s; }
  .archive-nav.is-open .nav-current img { transform: rotate(180deg); }
  .nav-current .nc-count { margin-left: auto; opacity: .5; }
  .archive-nav ul a[aria-current="true"] { display: none; }   /* the open project is already named above */
  /* project line: only work type and year (the name is in the menu) */
  .project-meta .pm-name { display: none; }
  /* bigger tap targets in the lists */
  .archive-nav ul a,
  .category-list button { padding: 3px 0; }
  .category-body.is-long::before { display: none; }
  .project-text,
  .project-photos {
    position: static;
    width: auto;
    overflow: visible;
    padding: 0;
  }
  .project-text { margin-top: 36px; max-width: 46ch; }
  .project-meta { height: auto; }
  .categories { margin-top: 18px; }
  .category-body { padding-left: 2em; }
  .project-photos { margin-top: 36px; gap: 28px; overflow-x: clip; }   /* wide animation frames never make the page scroll sideways */
}
/* phones / tablets (no hover): pictures with a second version switch by themselves */
@media (hover: none) {
  .hover-swap .img-a,
  .project .card .img-a,
  .collage .swap .img-a { animation: swap-a 5s steps(1, end) infinite; }
  .hover-swap .img-b,
  .project .card .img-b,
  .collage .swap .img-b { animation: swap-b 5s steps(1, end) infinite; }
  /* the stamps don't all switch at once */
  .collage .swap:nth-child(2) img { animation-delay: -0.8s; }
  .collage .swap:nth-child(3) img { animation-delay: -1.6s; }
  .collage .swap:nth-child(4) img { animation-delay: -2.4s; }
  .collage .swap:nth-child(5) img { animation-delay: -3.2s; }
  .collage .swap:nth-child(6) img { animation-delay: -4s; }
}
/* phones: the home durvis picture switches faster (0.5 s per version) */
@media (hover: none) { .project.p1 .card .img-a, .project.p1 .card .img-b { animation-duration: 1.4s; } }   /* 0.7 s per version */
/* phone held sideways: portrait on the left half, "about me" on the right half */
@media (max-width: 1024px) and (orientation: landscape) {
  .home { flex-direction: row; flex-wrap: wrap; align-items: flex-start; }
  .home > * { width: 100%; }
  .home > .logo { width: 200px; }
  .home > .subtitle { flex-basis: 100%; }
  .home > .portrait { width: 48%; margin: 24px 0 0; }
  .home > .bio { width: 48%; max-width: none; margin: 24px 0 0 4%; }
  .home > .bio-pager { width: 48%; max-width: none; margin-left: 52%; }
  .home > .contacts { width: 100%; }
  .rivet-letter { font-size: min(70vw, 55svh); }
  /* the works: picture as tall as the screen allows, caption beside it */
  .project { flex-direction: row !important; align-items: flex-end; gap: 24px; margin-top: 56px !important; }
  .p2, .p4, .p6 { flex-direction: row-reverse !important; }
  /* every picture the same height (70% of the screen), so none looks bigger or smaller */
  .project .card { width: min(66%, calc(70svh / var(--ar, 1))) !important; margin-left: 0 !important; }
  .p3 .card { width: auto !important; }
  .p3 .rivet-letter { font-size: calc(70svh / 0.7); line-height: 0.7; margin-top: 0; text-align: left; }
  .project .caption { margin: 0 0 4px; align-self: flex-end !important; }
}
@keyframes swap-a { 0% { visibility: visible; } 50%, 100% { visibility: hidden; } }
@keyframes swap-b { 0% { visibility: hidden; } 50%, 100% { visibility: visible; } }

/* =========================================================
   PHONES & TABLETS (touch)
   ========================================================= */
/* a quick double tap never zooms the page (pinching still zooms) */
html { touch-action: manipulation; }
/* full screen on phones: no visible arrows — swipe / tap the halves; the counter shows where you are */
.stopmotion-full .tap-arrow { display: none; }
@media (hover: none) {
  /* "Izpētes tehnikas" posters switch at the same pace as the poster animation (0.6 s) */
  #izpetes-tehnikas .hover-swap img { animation-duration: 1.2s; }
  /* rivet boxes and the Laika photos switch faster too (0.6 s per version) */
  #rivet-gun .hover-swap img, #laika-palagos .hover-swap img { animation-duration: 1.2s; }
}
@media (max-width: 1024px) {
  /* bigger ✕ to tap */
  .stopmotion-full .close, .video-full .close { top: 2px; right: 2px; padding: 14px; z-index: 5; }
  .stopmotion-full .close img, .video-full .close img { width: 26px; }
  .stopmotion-full .counter { bottom: 44px; }
  .stopmotion-full .full-caption { bottom: 44px; }
  /* video full screen: no hand-drawn buttons, just the picture (tap = play / pause) */
  .video-full .vctrl { display: none; }
  .video-full .vplayer { width: min(100vw, calc(100svh * 16 / 9)); }
  .video-full { background: #000; }
  .video-full .close img { filter: invert(1); }
  /* end of each project: previous / next project with hand-drawn arrows */
  .project-nav { display: flex; justify-content: space-between; gap: 16px; margin-top: 48px; padding-top: 6px; }
  .project-nav a { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; padding: 8px 0; max-width: 48%; }
  .project-nav img { width: 18px; height: 18px; flex: none; }
  .project-nav .pn-next { text-align: right; margin-left: auto; }
}
/* the video fills the screen width when the phone is upright, and the whole screen when it's turned sideways */
.project-nav { display: none; }
@media (max-width: 1024px) { .project-nav { display: flex; } }


/* phones: speaker = sound on / off only (no volume line; loudness comes from the phone's buttons) */
@media (hover: none) {
  .vplayer .v-vol { display: none !important; }
}
/* full screen with the phone sideways: the work stays between the ✕ at the top and the caption line at the bottom */
@media (max-width: 1024px) and (orientation: landscape) {
  .stopmotion-full .viewer { top: 44px; bottom: 40px; left: 56px; right: 56px; }
  .stopmotion-full .counter, .stopmotion-full .full-caption { bottom: 12px; }
}
