/* ==========================================================================
   VLADIMÍR MRÁZ PORTFOLIO — STYLE SHEET  (design: VM-WEBDESIGN-edit3)
   Strict 8-Column Grid System, fluid full-width layout
   Typography: Inter (Google Fonts)
   Methodology: BEM (Block Element Modifier)
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. CSS CUSTOM PROPERTIES (DESIGN TOKENS)
   Anchored to the 1920px Illustrator artboard:
   - 43px side margins, 8 columns (~214px) + 7 gutters (17.35px)
   - Grid tracks stay fluid; type sizes match the PDF at 1920px.
   -------------------------------------------------------------------------- */
:root {
  color-scheme: light;
  /* Colors */
  --color-bg: #ffffff;
  --color-text-main: #000000;
  --color-tile: #050707;
  --color-border: #000000;
  --color-paper: #dfe6e7;
  --color-lightbox-backdrop: rgba(6, 6, 8, 0.94);

  /* Typography */
  --font-family-base: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-weight-light: 300;
  --font-weight-regular: 400;
  --font-weight-medium: 500;
  --font-weight-semibold: 600;

  /* Type scale (measured from the PDF) */
  --font-size-hero: 61.4px;      /* headlines — SemiBold */
  --font-size-section: 61.4px;
  --font-size-contact-lg: 50px;  /* e-mail / phone — Medium */
  --font-size-intro: 27px;       /* intro, tile labels, form — SemiBold */
  --font-size-tile: 20px;
  --font-size-nav: 17px;         /* header, footer */
  --font-size-meta: 17px;

  /* Line heights */
  --line-height-hero: 0.993;
  --line-height-tight: 1.08;
  --line-height-intro: 1.25;

  /* 8-column grid */
  --grid-columns: 8;
  --grid-gutter: 17.35px;
  --grid-padding-x: clamp(20px, 2.24vw, 44px);

  /* Vertical rhythm (1920px artboard) */
  --space-header-top: 35px;
  --space-hero-top: 171px;
  --space-hero-curtain: 40px;   /* read-more button -> video */
  --space-about-toggle: 64px;   /* intro -> read-more button */
  --space-about-top: 108px;     /* intro -> photo when open */
  --font-size-about: 20px;
  --space-hero-bottom: 206px;
  --space-works-title: 119px;
  --space-section: 150px;

  /* Tile label inset */
  --tile-inset-x: 32px;
  --tile-inset-y: 30px;

  /* Transitions */
  --transition-fast: 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  --transition-smooth: 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Dark colour tokens (not switched on anywhere at the moment) */
:root[data-vm-theme="dark"] {
  --color-bg: #0d0d0e;
  --color-text-main: #f1f1f1;
  --color-border: #f1f1f1;
  color-scheme: dark;
}

:root[data-vm-theme="dark"] .header__logo,
:root[data-vm-theme="dark"] .contact__logo {
  filter: invert(1);
}

/* --------------------------------------------------------------------------
   2. GLOBAL RESET & BASE STYLES
   -------------------------------------------------------------------------- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-family-base);
  font-weight: var(--font-weight-regular);
  color: var(--color-text-main);
  background-color: var(--color-bg);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  text-rendering: optimizeLegibility;
  transition: background-color 0.4s ease, color 0.4s ease;
}

img, video {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
  transition: opacity var(--transition-fast);
}

a:hover {
  opacity: 0.65;
}

button {
  font-family: inherit;
  border: none;
  background: none;
  cursor: pointer;
  color: inherit;
}

.page__wrapper {
  width: 100%;
  padding-left: var(--grid-padding-x);
  padding-right: var(--grid-padding-x);
  position: relative;
}

/* --------------------------------------------------------------------------
   3. HEADER
   Column 1: Logo + identity | Columns 6, 7, 8: navigation (right-aligned)
   -------------------------------------------------------------------------- */
.header {
  --island-ease: cubic-bezier(0.65, 0, 0.2, 1);
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: flex-start; /* name and nav share the top line (PDF) */
  padding: var(--space-header-top) var(--grid-padding-x) 24px;
  z-index: 1000;
  background-color: var(--color-bg);
  color: var(--color-text-main);
  border-radius: 0;
  box-shadow: 0 0 0 1px rgba(127, 127, 127, 0), 0 10px 30px rgba(0, 0, 0, 0);
  transition:
    width 0.7s var(--island-ease),
    top 0.7s var(--island-ease),
    padding 0.7s var(--island-ease),
    border-radius 0.7s var(--island-ease),
    box-shadow 0.7s var(--island-ease),
    background-color 0.5s ease,
    color 0.5s ease;
}

.header__brand {
  flex: none;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  transition: gap 0.7s var(--island-ease);
}

.header__logo-link {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

/* Logo — M-logo-black-new.svg has a 1080 x 1080 artboard; the mark itself
   spans x 157.8–921.1, y 342.5–736.9. Negative margins trim the empty
   artboard so --logo-w is the width of the visible mark. */
.header {
  --logo-w: 64px;                                  /* width of the visible mark */
  --mark-h: calc(var(--logo-w) * 394.4 / 763.3);   /* its height */
}

.contact__logo {
  --logo-w: 64px;
}

.header__logo,
.contact__logo {
  display: block;
  width: calc(var(--logo-w) * 1080 / 763.3);
  max-width: none;
  height: auto;
  aspect-ratio: 1 / 1;
  margin:
    calc(var(--logo-w) * -342.5 / 763.3)
    calc(var(--logo-w) * -158.9 / 763.3)
    calc(var(--logo-w) * -343.1 / 763.3)
    calc(var(--logo-w) * -157.8 / 763.3);
}

.header__author {
  /* Name + role span exactly the logo's height: the cap top of the name sits
     on the logo's top edge, the baseline of the role on its bottom edge.
     text-box trims each line to cap height … baseline, so the block is exact
     whatever the font metrics. */
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  height: var(--mark-h);
  font-size: calc(var(--mark-h) * 0.5);
  line-height: 1;
  transition: font-size 0.7s var(--island-ease), height 0.7s var(--island-ease);
}

.header__name,
.header__role,
.header__nav-link {
  text-box: trim-both cap alphabetic;
}

.header__name,
.header__role {
  display: block;
  font-size: 1em;
  font-weight: var(--font-weight-semibold);
  color: var(--color-text-main);
}

/* browsers without text-box: trim the half-leading by Inter's metrics */
@supports not (text-box: trim-both cap alphabetic) {
  .header__name { margin-top: -0.125em; }
  .header__role { margin-bottom: -0.15em; }
  .header__nav-link { margin-top: -0.125em; }
}

.header__nav {
  /* columns 6-8 of the 8-column grid (percentages of the header's content box) */
  width: calc((100% - 7 * var(--grid-gutter)) / 8 * 3 + 2 * var(--grid-gutter));
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  column-gap: var(--grid-gutter);
  align-items: baseline;
  transition: width 0.7s var(--island-ease), margin 0.7s var(--island-ease);
}

/* fixed cells: About col 6, Work col 7, Contact col 8 (all right-aligned);
   the language switch takes the right edge of column 8 and Contact moves
   left by its width plus a gap */
.header__nav-link {
  grid-row: 1;
  white-space: nowrap;
}

.header__nav-link--about { grid-column: 1; }
.header__nav-link--work { grid-column: 2; }
.header__nav-link--contact {
  grid-column: 3;
}

/* language switch: under Contact, its baseline on the logo's bottom edge
   (the line of "Creative 3D artist"), so it never runs into Contact */
.header__nav-link--lang {
  grid-column: 3;
  justify-self: end;
  align-self: start;
}

.header__nav-link.header__nav-link--lang {
  font-weight: var(--font-weight-regular);   /* language switch stays light */
  margin-top: calc(var(--mark-h) - 1cap + 12px);
}

/* --- Dynamic island: once the page scrolls, the bar contracts into a
   centred white pill and expands again back at the top ------------------- */
.header__logo,
.header__name,
.header__role,
.header__nav-link {
  transition: color 0.5s ease, font-size 0.7s var(--island-ease), filter 0.5s ease, width 0.7s var(--island-ease), margin 0.7s var(--island-ease);
}

.header.is-island {
  top: 14px;
  width: min(560px, calc(100% - 2 * var(--grid-padding-x)));
  padding: 10px 26px 10px 18px;
  border-radius: 999px;
  --logo-w: 52px;
  background-color: rgba(255, 255, 255, 0.68);
  -webkit-backdrop-filter: blur(18px) saturate(1.6);
  backdrop-filter: blur(18px) saturate(1.6);
  color: #000000;
  /* soft shadow lifts the frosted pill off white sections */
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0), 0 10px 30px rgba(0, 0, 0, 0.14);
}

.header.is-island .header__brand {
  gap: 10px;
}

/* always the black mark on the white pill, also in dark mode */
.header.is-island .header__logo,
:root[data-vm-theme="dark"] .header.is-island .header__logo {
  filter: none;
}

.header.is-island .header__name,
.header.is-island .header__role,
.header.is-island .header__nav-link {
  color: #000000;
}

/* in the island only the name stays, centred on the logo */
.header__name {
  transition: color 0.5s ease, margin 0.7s var(--island-ease);
}

.header__role {
  transition: color 0.5s ease, opacity 0.35s ease;
}

.header.is-island .header__name {
  margin-top: calc((var(--mark-h) - 1cap) / 2);
}

.header.is-island .header__role {
  opacity: 0;
  visibility: hidden;
  transition: color 0.5s ease, opacity 0.25s ease, visibility 0s linear 0.25s;
}

.header.is-island .header__nav-link {
  font-size: 14px;
  /* nav centred on the logo */
  margin-top: calc((var(--mark-h) - 1cap) / 2);
}

.header.is-island .header__nav {
  width: 268px;
  grid-template-columns: repeat(4, auto);
  justify-content: space-between;
  column-gap: 12px;
}

.header.is-island .header__nav-link--lang {
  grid-column: 4;
  margin-left: 14px;
}

.header.is-island .header__nav-link--contact {
  margin-right: 0;
}

@media (prefers-reduced-motion: reduce) {
  .header,
  .header * {
    transition-duration: 0.01s !important;
  }
}

.header__nav-link {
  line-height: 1;               /* trimmed to cap height: its top is the logo's top edge */
  font-size: var(--font-size-nav);
  font-weight: var(--font-weight-semibold);   /* same cut as the name on the left */
  color: var(--color-text-main);
  text-align: right;
  display: block;
}

/* --------------------------------------------------------------------------
   4. HERO
   Columns 2-4: Headline | Columns 5-8: Intro (both pinned on scroll)
   Columns 1-8: Video loop — rises over the text like a curtain
   -------------------------------------------------------------------------- */
.hero {
  position: relative;
  padding-top: var(--space-hero-top);
  margin-bottom: var(--space-hero-bottom);
}

.hero__pinned-content {
  position: sticky;
  top: var(--space-hero-top);
  z-index: 2;
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity;
}

.hero__pinned-content.is-covered {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.hero__header-grid {
  container-type: inline-size;   /* cqw = page content width, as in .contact */
  display: grid;
  grid-template-columns: repeat(var(--grid-columns), 1fr);
  column-gap: var(--grid-gutter);
  align-items: start;
}

.hero__headline-col {
  grid-column: 2 / span 3;
}

.hero__headline {
  /* same size as "Selected works." and "Get in touch." */
  font-size: 2.7cqw;
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-hero);
  color: var(--color-text-main);
  white-space: nowrap;
}

.hero__intro-col {
  /* columns 5-7: ends as far from the right edge as the headline starts from the left */
  grid-column: 5 / span 3;
  /* Intro baseline sits 160px below the headline's first baseline (PDF) */
  margin-top: 190px;
  min-width: 0;
}

.hero__intro {
  font-size: var(--font-size-intro);
  font-weight: var(--font-weight-medium);
  line-height: var(--line-height-intro);
  color: var(--color-text-main);
  overflow-wrap: break-word;
  text-wrap: pretty;
}

.hero__intro + .hero__intro {
  margin-top: 0.6em;            /* paragraph break */
}

/* --- About me: "read more" toggle + expandable panel ---------------------- */
.hero.is-about-open .hero__pinned-content {
  /* an expanded panel is taller than the viewport, so it scrolls normally */
  position: relative;
  top: auto;
}

/* more air between the open bio ("close bio") and the video below it */
.hero.is-about-open .hero__curtain {
  margin-top: calc(var(--space-hero-curtain) + 80px);
}

.hero__more-row {
  display: grid;
  grid-template-columns: repeat(var(--grid-columns), 1fr);
  column-gap: var(--grid-gutter);
  margin-top: var(--space-about-toggle);
}

.about-toggle {
  grid-column: 5 / span 4;
  justify-self: start;
  display: inline-flex;
  align-items: flex-end;
  gap: 18px;
  padding: 4px 0;
  font-size: var(--font-size-nav);
  font-weight: var(--font-weight-regular);
  color: var(--color-text-main);
  transition: opacity var(--transition-fast);
}

.about-toggle:hover {
  opacity: 0.65;
}

.about-toggle:focus-visible {
  outline: 2px solid var(--color-text-main);
  outline-offset: 4px;
}

.about-toggle__arrow {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  transform: rotate(90deg); /* ↘ = read more */
  transition: transform var(--transition-smooth);
}

.about-toggle[aria-expanded="true"] .about-toggle__arrow {
  transform: rotate(0deg); /* ↗ = read less */
}

.about {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows 0.6s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.45s ease;
}

.about.is-open {
  grid-template-rows: 1fr;
  opacity: 1;
}

.about.is-settled .about__inner {
  overflow: visible;
}

.about__inner {
  min-height: 0;
  overflow: hidden;
  display: grid;
  grid-template-columns: repeat(var(--grid-columns), 1fr);
  column-gap: var(--grid-gutter);
  row-gap: 20px;
  align-items: start;
}

.about__photo,
.about__text {
  margin-top: var(--space-about-top);
}

.about__photo {
  grid-column: 2 / span 2;
  grid-row: 1;
  justify-self: start;          /* left edge on the headline's column */
  width: 75%;                   /* a smaller cube than the full two columns */
  aspect-ratio: 1 / 1;
  overflow: hidden;
  background-color: var(--color-paper);
}

/* 3D photo cube ------------------------------------------------------------
   The scene keeps the square grid cell; faces are pushed out by half its
   width (container query units), so the front face sits flush with the grid. */
.about-cube {
  container-type: inline-size;
  overflow: visible;
  background: none;
  perspective: 1600px;
  cursor: grab;
  touch-action: pan-y;          /* vertical page scroll stays native on touch */
  user-select: none;
  -webkit-user-select: none;
}

.about-cube.is-dragging {
  cursor: grabbing;
}

.about-cube:focus-visible {
  outline: 2px solid var(--color-text-main);
  outline-offset: 6px;
}

.about-cube__body {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  will-change: transform;
}

.about-cube__face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background-color: var(--color-paper);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* fine scanlines over the cube's photo faces */
.about-cube__face::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.07) 0 1px, rgba(255, 255, 255, 0) 1px 3px);
  pointer-events: none;
}

.about-cube__face--front  { transform: translateZ(50cqw); }
.about-cube__face--back   { transform: rotateY(180deg) translateZ(50cqw); }
.about-cube__face--right  { transform: rotateY(90deg) translateZ(50cqw); }
.about-cube__face--left   { transform: rotateY(-90deg) translateZ(50cqw); }
.about-cube__face--top    { transform: rotateX(90deg) translateZ(50cqw); }
.about-cube__face--bottom { transform: rotateX(-90deg) translateZ(50cqw); }

.about-cube__face--ink {
  background-color: var(--color-tile);
  color: #ffffff;
}

.about-cube__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
}

.about-cube__img--portrait {
  object-position: 50% 18%;
}

.about-cube__logo {
  width: 78%;
  height: auto;
  pointer-events: none;
}

.about-cube__caption {
  font-size: clamp(18px, 9cqw, 44px);
  /* set like the headlines: SemiBold, sentence case */
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-hero);
  text-align: center;
}

/* bottom face: e-mail + phone, smaller so the address fits the face */
.about-cube__caption--contact {
  font-size: clamp(10px, 7cqw, 34px);
  line-height: 1.4;
}

.about__text {
  grid-column: 5 / span 3;   /* same width as the intro above */
  grid-row: 1;
  font-size: var(--font-size-about);
  font-weight: var(--font-weight-medium);
  line-height: 1.4;
}

.about__social {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  margin-top: 2.6em;  /* clear step down from "Get in touch" */
}

/* social icons — the author's own line icons (assets/some-ikony.ai), inlined so they take currentColor */
.about__social {
  gap: 30px;
  align-items: center;
}

.about__social-link {
  display: inline-flex;
  align-items: center;
  color: var(--color-text-main);
}

.about__social-icon {
  display: block;
  height: 42px;
  width: auto;
}

/* hover: the line icons get bolder instead of fading */
.about__social-icon path {
  stroke-width: 4.89;
  transition: stroke-width var(--transition-fast);
}

.about__social-link:hover,
.about__social-link:focus-visible {
  opacity: 1;
}

.about__social-link:hover .about__social-icon path,
.about__social-link:focus-visible .about__social-icon path {
  stroke-width: 8;
}

.about__social-icon--behance {
  height: 29.1px; /* the Be mark has no frame: same cap height as the framed icons' glyphs */
}

/* "Get in touch" — jumps to the contact section */
.about__contact {
  display: inline-flex;
  align-items: flex-end;
  gap: 14px;
  margin-top: 2.2em;
  font-size: var(--font-size-nav);
  font-weight: var(--font-weight-semibold);
}

.about__contact {
  align-items: center;
}

.about__contact-arrow {
  width: 20px;
  height: 20px;
  transition: transform var(--transition-fast);
}

.about__contact:hover .about__contact-arrow {
  transform: translateX(4px);
}

/* hover: bolder and 20 % larger (scaled from the left edge, so nothing below moves) */
.about__contact {
  transform-origin: 0 50%;
  transition: transform var(--transition-smooth), font-weight var(--transition-fast);
}

.about__contact:hover,
.about__contact:focus-visible {
  opacity: 1;
  font-weight: 700;
  transform: scale(1.2);
}

.about__text p + p {
  margin-top: 1.4em;
}

@media (prefers-reduced-motion: reduce) {
  .about,
  .about-toggle__arrow {
    transition: none;
  }
}

.hero__curtain {
  position: relative;
  z-index: 10;
  margin-top: var(--space-hero-curtain);
  background-color: var(--color-tile);
}

.hero__visual {
  width: 100%;
  aspect-ratio: 1834 / 916;
  background-color: var(--color-tile);
  overflow: hidden;
}

.hero__video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Desktop: on load exactly the top half of the video shows at the bottom of
   the screen; the rest appears on scroll. The text block fills the space above
   it and the free height is split between the top (above the headline) and
   the gap below "more about me". --hero-video-h is measured by script.js; the
   calc() fallback covers the first paint. */
@media (min-width: 1025px) {
  .hero {
    --hero-pad: 120px;            /* minimum clearance below the fixed header */
    padding-top: var(--hero-pad);
  }

  .hero__pinned-content {
    top: var(--hero-pad);
    display: flex;
    flex-direction: column;
    min-height: calc(100svh - var(--hero-pad) - var(--space-hero-curtain)
      - var(--hero-video-h, calc((100vw - 2 * var(--grid-padding-x)) * 916 / 1834)) / 2);
  }

  .hero__header-grid {
    margin-top: auto;
  }

  .hero__more-row {
    /* "more about me" sits close under the text; the free height goes
       above the headline and below the CTA in equal parts */
    margin-top: 36px;
    margin-bottom: auto;
  }
}

/* low laptop screens: a tighter CTA gap keeps exactly half of the video in view */
@media (min-width: 1025px) and (max-height: 840px) {
  .hero__more-row {
    margin-top: 22px;
  }
}

/* --------------------------------------------------------------------------
   5. SELECTED WORKS
   One 4-track grid (each track = 2 master columns + gutter).
   Base cell is square: row height is derived from the container width.
   -------------------------------------------------------------------------- */
.projects {
  position: relative;
  z-index: 10;
  background-color: var(--color-bg);
  margin-bottom: var(--space-section);
  scroll-margin-top: 100px;
}

.projects__header {
  container-type: inline-size;   /* cqw = page content width, as in .contact */
  display: grid;
  grid-template-columns: repeat(var(--grid-columns), 1fr);
  column-gap: var(--grid-gutter);
  margin-bottom: var(--space-works-title);
}

.projects__title {
  grid-column: 2 / span 4;
  /* same size as "Get in touch." */
  font-size: 2.7cqw;
  font-weight: var(--font-weight-semibold);
  line-height: var(--line-height-tight);
  color: var(--color-text-main);
}

/* the spreading letters (script.js §5b) must never push a one-line title onto two lines */
.projects__title,
.contact__title,
.footer__link {
  white-space: nowrap;
}

/* slid in sideways by script.js (§5b), tied to the scroll */
.projects__title,
.contact__title,
.contact__link,
.footer__link,
.contact__logo-wrap {
  will-change: translate;
}

/* keep the off-screen start positions from widening the page (iOS ignores body overflow-x) */
.hero,
.projects__header,
.contact {
  overflow-x: clip;
}

/* lines of the hero headline / intro, created by script.js for the scroll-out */
.hero__line {
  display: block;
  white-space: nowrap;           /* letters spread on the scroll-out; never re-wrap */
  will-change: transform;
}

.hero__more-row {
  will-change: transform;
}

.projects__grid {
  --tracks: 4;
  container-type: inline-size;
  display: grid;
  grid-template-columns: repeat(var(--tracks), 1fr);
  gap: var(--grid-gutter);
  grid-auto-flow: row dense;
}

/* Square base cell — rows are as tall as a track is wide.
   (Container query units resolve against .projects__grid.) */
.project-card {
  --cell: calc((100cqw - (var(--tracks) - 1) * var(--grid-gutter)) / var(--tracks));
}

.project-card {
  min-height: var(--cell);
}

.project-card--tall,
.project-card--big {
  min-height: calc(2 * var(--cell) + var(--grid-gutter));
}

.project-card--wide {
  grid-column: span 2;
}

.project-card--tall {
  grid-row: span 2;
}

.project-card--big {
  grid-column: span 2;
  grid-row: span 2;
}

/* --------------------------------------------------------------------------
   6. PROJECT CARD — label top-left inside the tile, hover darkens the image
   -------------------------------------------------------------------------- */
.project-card {
  position: relative;
  overflow: hidden;
  background-color: var(--color-tile);
  cursor: pointer;
}

.project-card__media {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-smooth), filter var(--transition-smooth), opacity 0.9s ease;
}

/* Next item of a rotating tile fades in on top of the current one */
.project-card__media.is-entering {
  opacity: 0;
}

.project-card__media.is-missing {
  visibility: hidden;
}

/* Soft top shade keeps the white label legible on bright imagery */
.project-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  /* no darkening on hover, only the soft top shade behind the label */
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.32) 0%, rgba(0, 0, 0, 0) 38%);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-smooth), background-color var(--transition-smooth);
}

.project-card__role {
  margin-top: 0.2em;
  font-weight: var(--font-weight-light);
}

.project-card__label {
  position: absolute;
  top: var(--tile-inset-y);
  left: var(--tile-inset-x);
  right: var(--tile-inset-x);
  z-index: 2;
  display: flex;
  flex-direction: column;
  color: #ffffff;
  font-size: var(--font-size-tile);
  font-weight: var(--font-weight-semibold);
  line-height: 1.25;
  pointer-events: none;
  /* Hidden at rest — revealed on hover / keyboard focus */
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity var(--transition-smooth), transform var(--transition-smooth);
}

.project-card:hover .project-card__media,
.project-card:focus-visible .project-card__media {
  transform: scale(1.02);
}

.project-card:hover::after,
.project-card:focus-visible::after {
  opacity: 1;
}

.project-card:hover .project-card__label,
.project-card:focus-visible .project-card__label {
  opacity: 1;
  transform: translateY(0);
}

/* several visuals inside: small stack icon, top right (script.js) */
.project-card__stack {
  position: absolute;
  top: var(--tile-inset-y);
  right: var(--tile-inset-x);
  z-index: 2;
  width: 18px;
  height: 18px;
  color: #ffffff;
  filter: drop-shadow(0 0 3px rgba(0, 0, 0, 0.35));   /* readable on light visuals too */
  opacity: 0.3;                 /* a quiet hint, not a button */
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.project-card__stack svg {
  display: block;
  width: 100%;
  height: 100%;
}

/* gives way to the project label on hover / focus */
.project-card:hover .project-card__stack,
.project-card:focus-visible .project-card__stack {
  opacity: 0;
}

.project-card:focus-visible {
  outline: 2px solid var(--color-text-main);
  outline-offset: 3px;
}

/* --------------------------------------------------------------------------
   7. CONTACT (GET IN TOUCH)
   Frame: column 2 -> right edge of the phone number (195px inset at 1920px)
   No form: big title, then e-mail + phone, social links and the logo
   -------------------------------------------------------------------------- */
.contact {
  position: relative;
  z-index: 10;
  background-color: var(--color-bg);
  scroll-margin-top: 100px;
  container-type: inline-size;
}

.contact__frame {
  /* One master step = 1 column + 1 gutter */
  --step: calc((100cqw - 7 * var(--grid-gutter)) / 8 + var(--grid-gutter));
  margin-left: var(--step);
  margin-right: 10.63cqw;
}

.contact__title {
  /* big, on one line */
  font-size: 2.7cqw;
  font-weight: var(--font-weight-semibold);
  line-height: 0.95;
  letter-spacing: -0.02em;
  --base-ls: -0.02em;
  color: var(--color-text-main);
}

/* E-mail (column 2) + phone (flush right) */
.contact__info {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 16px 40px;
  margin-top: 140px;
}

.contact__link {
  font-size: var(--font-size-contact-lg);
  font-weight: var(--font-weight-medium);
  line-height: 1.1;
  color: var(--color-text-main);
  white-space: nowrap;
}

/* Social links: Instagram left / LinkedIn page-centre / Behance right */
.footer {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 121px;
}

.footer__link {
  font-size: var(--font-size-meta);
  font-weight: var(--font-weight-regular);
  color: var(--color-text-main);
}

.footer__link--linkedin {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

/* Large centred logo above the portrait */
.contact__logo-wrap {
  display: flex;
  justify-content: center;
  margin-top: 170px;
  padding-bottom: 41px;
}

.contact__logo {
  --logo-w: 231px;
}

/* --------------------------------------------------------------------------
   8. OUTRO — QUOTE BOX
   A black band that slides in from the left as it scrolls into view; the
   quote on it starts in a light weight and turns bold letter by letter
   (script.js §6).
   -------------------------------------------------------------------------- */
.outro {
  container-type: inline-size;  /* the quote sizes itself to the band's width */
  position: relative;
  z-index: 10;
  width: 100%;
  --legal-space: 60px;          /* height kept free for the © / company line at the bottom */
  aspect-ratio: 1920 / 400;
  overflow: hidden;
}

.outro__box {
  position: absolute;
  inset: 0;
  background-color: #000000;
  transform: translate3d(var(--outro-x, 0%), 0, 0);
  will-change: transform;
}

.outro__title {
  /* columns 2-7, like the hero: ends as far from the right edge as it starts from the left */
  --quote-w: calc((100cqw - 2 * var(--grid-padding-x) - 7 * var(--grid-gutter)) / 8 * 6 + 5 * var(--grid-gutter));
  position: absolute;
  left: calc(var(--grid-padding-x) + (100cqw - 2 * var(--grid-padding-x) - 7 * var(--grid-gutter)) / 8 + var(--grid-gutter));
  top: calc((100% - var(--legal-space)) / 2);
  transform: translateY(-50%);  /* vertically centred in the band above the legal line */
  z-index: 2;
  width: var(--quote-w);
  margin: 0;
  /* always exactly two lines; --quote-em = width of the longer line in em (+ margin):
     EN "same care … in." ≈ 15.5em, CS "jako krabička … světa." ≈ 21.3em */
  --quote-em: 16.6;
  font-size: min(var(--font-size-hero), calc(var(--quote-w) / var(--quote-em)));
  white-space: nowrap;
  font-weight: var(--font-weight-light);   /* each letter is weighted up by script.js */
  line-height: 1;
  color: #ffffff;
  pointer-events: none;
}

.outro__legal {
  /* the page's 8-column grid inside the box: © under the quote (col 2),
     company details under the hero text (cols 5-7) */
  position: absolute;
  left: 0;
  right: 0;
  bottom: 28px;
  display: grid;
  grid-template-columns: repeat(var(--grid-columns), 1fr);
  column-gap: var(--grid-gutter);
  padding: 0 var(--grid-padding-x);
  font-size: 13px;
  font-weight: var(--font-weight-regular);
  line-height: 1.3;
  color: rgba(255, 255, 255, 0.7);
}

.outro__legal-item {
  margin: 0;
}

.outro__legal-item--copy {
  grid-column: 2 / span 3;
}

.outro__legal-item--info {
  grid-column: 5 / span 3;
  text-align: right;            /* ends as far from the right edge as © starts from the left */
}

.outro__title p {
  margin: 0;
}

html[lang="cs"] .outro__title {
  --quote-em: 22.2;
}

/* one large opening quote mark above the text: chunky blocks with a rounded
   tail, drawn as SVG; takes the text colour via a mask */
.outro__title::before {
  content: "";
  display: block;
  width: 1.106em;
  height: 0.77em;
  margin-bottom: 0.22em;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2092%2064%22%3E%3Cpath%20d%3D%22M0%2064V30C0%2013%2012%202%2030%200V12C22%2014%2018%2020%2018%2026H40V64Z%22/%3E%3Cpath%20d%3D%22M52%2064V30C52%2013%2064%202%2082%200V12C74%2014%2070%2020%2070%2026H92V64Z%22/%3E%3C/svg%3E") no-repeat 0 0 / contain;
  mask: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%2092%2064%22%3E%3Cpath%20d%3D%22M0%2064V30C0%2013%2012%202%2030%200V12C22%2014%2018%2020%2018%2026H40V64Z%22/%3E%3Cpath%20d%3D%22M52%2064V30C52%2013%2064%202%2082%200V12C74%2014%2070%2020%2070%2026H92V64Z%22/%3E%3C/svg%3E") no-repeat 0 0 / contain;
}

/* --------------------------------------------------------------------------
   9. LIGHTBOX MODAL
   -------------------------------------------------------------------------- */
.lightbox {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-smooth), visibility var(--transition-smooth);
}

.lightbox[hidden] {
  display: none;
}

.lightbox.is-open {
  opacity: 1;
  visibility: visible;
}

.lightbox__backdrop {
  position: absolute;
  inset: 0;
  background-color: var(--color-lightbox-backdrop);
  cursor: zoom-out;
}

.lightbox__content {
  position: relative;
  z-index: 2;
  max-width: 92vw;
  max-height: 92vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transform: scale(0.97);
  transition: transform var(--transition-smooth);
}

.lightbox.is-open .lightbox__content {
  /* 'none' (not scale(1)) so the fixed close / arrow buttons stay pinned to the viewport */
  transform: none;
}

.lightbox__close {
  position: fixed;
  top: clamp(16px, 2vw, 48px);
  right: clamp(16px, 2.2vw, 56px);
  color: #ffffff;
  padding: 10px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background-color: rgba(255, 255, 255, 0.08);
  transition: background-color var(--transition-fast), transform var(--transition-fast);
  z-index: 10;
}

.lightbox__close:hover {
  background-color: rgba(255, 255, 255, 0.2);
  transform: scale(1.08);
}

.lightbox__nav {
  position: fixed;
  top: 50%;
  left: 0;
  right: 0;
  transform: translateY(-50%);
  display: flex;
  justify-content: space-between;
  padding: 0 clamp(20px, 2vw, 48px);
  pointer-events: none;
  z-index: 8;
}

.lightbox__nav-btn {
  pointer-events: auto;
  color: #ffffff;
  font-size: clamp(1.5rem, 1.8vw, 2.5rem);
  background-color: rgba(255, 255, 255, 0.08);
  width: clamp(48px, 3.2vw, 76px);
  height: clamp(48px, 3.2vw, 76px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color var(--transition-fast), transform var(--transition-fast);
}

.lightbox__nav-btn:hover {
  background-color: rgba(255, 255, 255, 0.2);
  transform: scale(1.08);
}

.lightbox__image-wrap {
  max-width: 88vw;
  max-height: 64vh;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.7);
  background-color: #0c0c0e;
}

.lightbox__image,
.lightbox__video {
  max-width: 100%;
  max-height: 64vh;
  object-fit: contain;
}

.lightbox__image[hidden],
.lightbox__video[hidden] {
  display: none;
}

.lightbox__content {
  /* as wide as the visual, so title + credits line up with its edges */
  width: fit-content;
  min-width: min(92vw, 560px);
}

/* other views of the project */
.lightbox__thumbs {
  display: flex;
  gap: 8px;
  max-width: 100%;
  margin-top: 14px;
  padding: 2px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.lightbox__thumbs:empty {
  display: none;
}

.lightbox__thumb {
  position: relative;
  flex: 0 0 auto;
  height: 56px;
  aspect-ratio: var(--thumb-ratio, 1);
  padding: 0;
  overflow: hidden;
  background-color: #1a1a1c;
  opacity: 0.45;
  outline: 1px solid transparent;
  transition: opacity var(--transition-fast), outline-color var(--transition-fast);
}

.lightbox__thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.lightbox__thumb:hover,
.lightbox__thumb:focus-visible {
  opacity: 0.8;
}

.lightbox__thumb.is-active {
  opacity: 1;
  outline-color: #ffffff;
}

.lightbox__thumb-play {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 14px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.6);
  pointer-events: none;
}

/* title + credits — kept small and quiet */
.lightbox__info {
  width: 100%;
  margin-top: 18px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px 48px;
  flex-wrap: wrap;
  color: #ffffff;
}

.lightbox__heading {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 15px;
  line-height: 1.35;
  min-width: 0;
}

.lightbox__title {
  font-weight: var(--font-weight-semibold);
}

.lightbox__role {
  font-weight: var(--font-weight-light);
  color: #cfcfd2;
}

.lightbox__counter {
  margin-top: 6px;
  font-size: 12px;
  color: #7d7d82;
  font-variant-numeric: tabular-nums;
}

.lightbox__credits {
  display: grid;
  grid-template-columns: auto auto;
  column-gap: 16px;
  row-gap: 3px;
  font-size: 12.5px;
  line-height: 1.4;
  color: #b9b9bd;
}

.lightbox__credits dt {
  color: #77777c;
  font-weight: var(--font-weight-light);
}

.lightbox__credits dd {
  margin: 0;
}

/* --------------------------------------------------------------------------
   10. RESPONSIVE BREAKPOINTS
   -------------------------------------------------------------------------- */

/* Small laptops (under 1440px): scale the vertical rhythm down a notch */
@media (max-width: 1440px) {
  :root {
    --font-size-hero: 52px;
    --font-size-section: 52px;
    --font-size-contact-lg: 42px;
    --font-size-intro: 23px;
    --font-size-tile: 18px;
    --space-hero-top: 150px;
    --space-hero-curtain: 36px;
    --space-about-toggle: 52px;
    --space-about-top: 90px;
    --font-size-about: 18px;
    --space-hero-bottom: 170px;
    --space-works-title: 96px;
    --space-section: 130px;
    --tile-inset-x: 26px;
    --tile-inset-y: 24px;
  }

  .hero__intro-col {
    margin-top: 160px;
  }
}

/* Tablet (under 1024px) */
@media (max-width: 1024px) {
  :root {
    --font-size-hero: 44px;
    --font-size-section: 44px;
    --font-size-contact-lg: 34px;
    --font-size-intro: 20px;
    --font-size-tile: 16px;
    --font-size-nav: 16px;
    --font-size-meta: 16px;
    --space-hero-top: 130px;
    --space-hero-curtain: 32px;
    --space-about-toggle: 40px;
    --space-about-top: 64px;
    --font-size-about: 17px;
    --space-hero-bottom: 120px;
    --space-works-title: 64px;
    --space-section: 110px;
    --tile-inset-x: 20px;
    --tile-inset-y: 18px;
  }

  .hero__headline-col {
    grid-column: 1 / span 4;
  }

  .hero__intro-col {
    grid-column: 5 / span 4;
    margin-top: 72px;
  }

  .projects__title {
    grid-column: 1 / span 6;
  }

  .about__photo {
    grid-column: 1 / span 3;
  }

  .about__text {
    grid-column: 5 / span 4;
  }

  .projects__grid {
    --tracks: 2;
  }

  .contact__frame {
    margin-left: 0;
    margin-right: 0;
  }

  .contact__info {
    margin-top: 120px;
  }

  .footer {
    margin-top: 90px;
  }

  .contact__logo-wrap {
    margin-top: 120px;
  }

  .contact__logo {
    --logo-w: 180px;
  }

  .outro {
    aspect-ratio: 5 / 2;
  }

  .outro__title {
    --quote-w: calc(100cqw - 2 * var(--grid-padding-x));
    left: var(--grid-padding-x);
  }

  .outro__legal-item--copy {
    grid-column: 1 / span 4;
  }

  .outro__legal-item--info {
    grid-column: 5 / span 4;
  }
}

/* Mobile (under 768px) */
@media (max-width: 768px) {
  :root {
    --font-size-hero: 34px;
    --font-size-section: 34px;
    --font-size-contact-lg: 24px;
    --font-size-intro: 18px;
    --font-size-tile: 15px;
    --font-size-nav: 14px;
    --font-size-meta: 14px;
    --grid-columns: 4;
    --grid-padding-x: 20px;
    --grid-gutter: 14px;
    --space-hero-top: 96px;
    --space-hero-curtain: 24px;
    --space-hero-bottom: 72px;
    --space-about-toggle: 28px;
    --space-about-top: 32px;
    --font-size-about: 16px;
    --space-works-title: 32px;
    --space-section: 80px;
    --tile-inset-x: 12px;
    --tile-inset-y: 11px;
  }

  .header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 18px;
    padding-bottom: 18px;
  }

  .header.is-island {
    top: 10px;
    width: calc(100% - 20px);
    padding: 8px 18px 8px 14px;
  }

  .header.is-island {
    --logo-w: 44px;
  }

  .header.is-island .header__nav {
    width: auto;
  }

  .header.is-island .header__nav-link {
    font-size: 12px;
  }

  .header__brand {
    gap: 10px;
    align-items: center;
  }

  .header {
    --logo-w: 50px;
    align-items: flex-start;
  }

  /* nav centred on the logo */
  .header__nav-link,
  .header.is-island .header__nav-link {
    margin-top: calc((var(--mark-h) - 1cap) / 2);
  }

  .header__nav {
    width: auto;
    display: flex;
    gap: 10px;                    /* four links incl. the language switch */
  }

  .header__nav-link--contact {
    margin-right: 0;
  }

  .header__nav-link.header__nav-link--lang,
  .header.is-island .header__nav-link.header__nav-link--lang {
    margin-top: calc((var(--mark-h) - 1cap) / 2);
    margin-left: 12px;
  }

  .hero__header-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
  }

  .hero__headline {
    white-space: normal;
    font-size: 4.8cqw;
  }

  .hero__headline-col,
  .hero__intro-col {
    width: 100%;
    margin-top: 0;
  }

  .hero__visual {
    aspect-ratio: 4 / 3;
  }

  .hero__more-row,
  .about__inner {
    display: flex;
    flex-direction: column;
  }

  .about__inner {
    gap: 24px;
  }

  /* smaller cube with room around it, so its corners never touch the text while it spins */
  .about__photo {
    width: 62%;
    max-width: 260px;
    margin: 40px 0 48px;   /* left edge on the grid, like the text */
  }

  .about__text {
    margin-top: 0;
  }

  .projects__header {
    display: block;
  }

  /* Two tiles side by side: same square cell system as desktop —
     big = full width square, wide = full width x 1 row, tall = 1 col x 2 rows */
  .projects__grid {
    --tracks: 2;
    --grid-gutter: 8px;
  }

  .project-card__label {
    font-size: 12px;
    line-height: 1.25;
  }

  .project-card__stack {
    top: 10px;
    right: 10px;
    width: 14px;
    height: 14px;
  }

  .contact__title {
    margin-bottom: 0;
    font-size: 4.8cqw;
  }

  .projects__title {
    font-size: 4.8cqw;
  }

  .contact__info {
    flex-direction: column;
    align-items: flex-start;
    margin-top: 72px;
  }

  .contact__link {
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .footer {
    margin-top: 48px;
  }

  .contact__logo-wrap {
    margin-top: 80px;
    padding-bottom: 24px;
  }

  .contact__logo {
    --logo-w: 120px;
  }

  .outro {
    --legal-space: 80px;
    aspect-ratio: 3 / 2;          /* room for the quote and the legal lines */
  }

  .outro__legal {
    bottom: 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 11px;
  }

  .outro__legal-item--info {
    text-align: left;
  }

  .lightbox__nav {
    display: none;
  }
}

/* narrow phones: four nav links + the name must share one row */
@media (max-width: 430px) {
  .header__nav {
    gap: 8px;
  }

  .header__nav-link {
    font-size: 13px;
  }

  /* only the name next to the logo (as in the island), centred on it */
  .header__role {
    display: none;
  }

  .header__name {
    margin-top: calc((var(--mark-h) - 1cap) / 2);
  }
}

@media (max-width: 345px) {
  .header {
    --logo-w: 38px;
  }

  .header__nav {
    gap: 6px;
  }
}

/* --------------------------------------------------------------------------
   11. CURSOR (last, so it wins over the per-component cursor rules)
   The plain arrow everywhere, also over links, buttons and tiles; text
   fields keep the text caret and the bio cube keeps its grab hand.
   -------------------------------------------------------------------------- */
@media (pointer: fine) {
  html,
  a,
  button,
  label,
  .project-card,
  .lightbox__backdrop {
    cursor: default;
  }

  input,
  textarea {
    cursor: text;
  }
}
