/* =========================================================
   Portfolio pages (portfolio/*.html)
   Loaded after ../css/style.css, which provides the tokens,
   cursors, .container, .footer and .lightbox base styles.
   Breakpoints as in style.css: 640px tablet, 1024px desktop.
   ========================================================= */

body.pf {
  background: var(--bg);
  overflow-x: hidden;
}
:root { --pf-header-h: 64px; }   /* measured by portfolio.js; sticky offsets below build on it */

/* --- language switch: everything tagged lang="cs"/"en" shows for its language only --- */
html[data-lang="cs"] [lang="en"] { display: none !important; }
html[data-lang="en"] [lang="cs"] { display: none !important; }

/* =========================================================
   Header
   ========================================================= */

.pf-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 10, 10, 0.86);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

/* logo on the left spanning two rows; to its right the name (row 1) and the links (row 2) */
.pf-header-inner {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: 1fr auto;
  grid-template-areas:
    "logo brand lang"
    "logo nav   nav";
  align-items: end;             /* text block sits on the logo's baseline (the hooves) */
  gap: 0.2rem 1.25rem;
  padding-block: 1.6rem 1.3rem;
}

@media (max-width: 639px) {
  /* phones: same layout, tighter; the "portfolio" suffix is dropped so the name fits beside CZ/EN */
  .pf-header-inner { column-gap: 1rem; }
  .pf-brand { font-size: 0.9rem; }
  .pf-brand-sub { display: none; }
}

.pf-logo { grid-area: logo; display: block; line-height: 0; }
.pf-logo img {
  /* same size as the footer logo (96px wide); lighter than there */
  width: 96px;
  height: auto;
  filter: invert(1) brightness(1.15);
  opacity: 1;
}

.pf-brand {
  grid-area: brand;
  align-self: end;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pf-brand:hover { text-decoration: none; }
.pf-brand-sub {
  color: var(--fg-muted);
  font-weight: 400;
}

.pf-lang {
  grid-area: lang;
  align-self: end;
  justify-self: end;
  display: flex;
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
}
.pf-lang button {
  padding: 0.35em 0.8em;
  border: 0;
  background: transparent;
  color: var(--fg-muted);
  font: inherit;
  cursor: var(--cursor-hand);
}
.pf-lang button[aria-pressed="true"] {
  background: var(--fg);
  color: var(--bg);
}

.pf-nav {
  grid-area: nav;
  display: flex;
  gap: 1.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
  font-size: 0.95rem;
}
.pf-nav::-webkit-scrollbar { display: none; }
@media (max-width: 1023px) {
  /* hint that the row scrolls: fade out the clipped edge */
  .pf-nav {
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 2.5rem), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 2.5rem), transparent);
    padding-right: 2.5rem;
  }
}
@media (max-width: 639px) {
  /* phones: a single scrollable row hides links behind the fade with no room to reveal
     them — drop the scroll/fade trick here and let the nav take its own full-width row,
     wrapping onto a second line if needed, so every link stays visible without scrolling */
  .pf-header-inner {
    grid-template-areas:
      "logo brand lang"
      "nav  nav   nav";
    row-gap: 0.5rem;
  }
  .pf-nav {
    flex-wrap: wrap;
    row-gap: 0.4rem;
    overflow-x: visible;
    -webkit-mask-image: none;
    mask-image: none;
    padding-right: 0;
  }
}
.pf-nav a {
  display: inline-block;
  padding-block: 0.35em 0;
  line-height: 1.05;            /* baseline right on the logo's bottom edge */
  white-space: nowrap;
  color: var(--fg-muted);
  border-bottom: 1px solid transparent;
}
.pf-nav a:hover { color: var(--fg); text-decoration: none; }
.pf-nav a[aria-current="page"] {
  color: var(--fg);
  border-bottom-color: var(--fg);
}
@media (min-width: 1024px) {
  .pf-header-inner { column-gap: 1.5rem; }
  .pf-brand { font-size: 1.1rem; }
}

/* =========================================================
   Page hero
   ========================================================= */

.pf-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr);   /* let the track shrink below its children's intrinsic width */
  gap: clamp(1.5rem, 4vw, 3rem);
  padding-block: clamp(3rem, 8vw, 6rem) clamp(2rem, 5vw, 4rem);
}
.pf-hero h1 {
  margin: 0 0 0.35em;
  font-size: clamp(2.2rem, 6vw, 4.25rem);
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.05;
}
.pf-hero-sub {
  margin: 0 0 1.5rem;
  color: var(--fg-muted);
  font-size: clamp(1rem, 1.8vw, 1.25rem);
}
.skills--row + .skills--row {
  margin-top: 0.5rem;
}

.pf-hero--center {
  text-align: center;
}
.pf-hero--center .skills {
  justify-content: center;
}
.pf-hero--center .pf-hero-sub {
  margin-bottom: 3rem;
}

/* =========================================================
   Overview tiles (portfolio/index.html)
   ========================================================= */

.pf-tiles {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: clamp(14px, 2vw, 24px);
  margin: clamp(5rem, 12vw, 10rem) 0 calc(2 * var(--section-gap));
  padding: 0;
  list-style: none;
}
@media (min-width: 640px) { .pf-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

.pf-tile {
  display: block;
  color: var(--fg);
}
.pf-tile:hover { text-decoration: none; }
/* the image is cut out with the hand-drawn oval from portrait1.psd (its alpha, exported as a PNG) */
.pf-tile-figure {
  min-width: 0;                 /* the 900px image must not set the column's min size */
  aspect-ratio: 1528 / 1632;
  overflow: hidden;
  -webkit-mask: url(../resources/portfolio/blob-mask.png) center / 100% 100% no-repeat;
  mask: url(../resources/portfolio/blob-mask.png) center / 100% 100% no-repeat;
  background: var(--bg-elev);
}
.pf-tile-figure img,
.pf-tile-figure video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.7s ease;
}
.pf-tile:hover img,
.pf-tile:hover video,
.pf-tile:focus-visible img,
.pf-tile:focus-visible video { transform: scale(1.04); }
.pf-tile-body {
  padding: 1rem 0.25rem 0;
  text-align: center;
}
.pf-tile-title {
  margin: 0 0 0.2em;
  font-size: clamp(1.3rem, 2.2vw, 1.7rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.15;
}
.pf-tile-text {
  margin: 0;
  color: var(--fg-muted);
  font-size: 0.95rem;
}
.pf-tile-arrow {
  /* inline (not inline-block) so it never wraps away from the last word */
  margin-left: 0.3em;
  color: var(--fg-muted);
  font-weight: 400;
  transition: color 0.2s ease;
}
.pf-tile:hover .pf-tile-arrow { color: var(--fg); }
/* phones: one tile per row — blob on the left, caption beside it */
@media (max-width: 639px) {
  .pf-tile {
    display: grid;
    grid-template-columns: 42% minmax(0, 1fr);
    align-items: center;
    column-gap: 1.25rem;
  }
  .pf-tile-body { padding: 0; text-align: left; }
}

/* =========================================================
   Section sub-navigation (ilustrace)
   ========================================================= */

.pf-subnav {
  position: sticky;
  top: var(--pf-header-h);
  z-index: 40;
  display: flex;
  gap: 0.5rem;
  margin: 0 0 1rem;
  padding: 0.6rem 0;
  list-style: none;
  overflow-x: auto;
  scrollbar-width: none;
  background: var(--bg);
}
.pf-subnav::-webkit-scrollbar { display: none; }
.pf-subnav a {
  display: inline-block;
  padding: 0.4em 0.9em;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--bg-elev);
  color: var(--fg);
  font-size: 0.9rem;
  white-space: nowrap;
}
.pf-subnav a:hover { text-decoration: none; border-color: var(--fg-muted); }

.pf-section { scroll-margin-top: calc(var(--pf-header-h) + 0.5rem); }
.pf-section-head {
  padding: clamp(2rem, 5vw, 4rem) 0 0.5rem;
}
.pf-section-head h2 {
  margin: 0 0 0.3em;
  font-size: clamp(1.8rem, 4vw, 2.75rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.pf-section-head p {
  max-width: 60ch;
  margin: 0;
  color: var(--fg-muted);
  font-size: 1.05rem;
}

/* =========================================================
   Project cards (same markup/classes as the homepage showcase:
   .grid / .card in css/style.css) + the full-detail modal below.
   ========================================================= */

.pf-cards {
  margin: clamp(1.5rem, 4vw, 2.5rem) 0 clamp(2.5rem, 6vw, 5rem);
}
.pf-cards .card { cursor: var(--cursor-hand); }
.pf-cards .card:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
.pf-cards .card-tag { white-space: normal; }
.pf-cards .card-title + .card-tag { margin-bottom: 1.6em; }
.pf-cards .card-text {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pf-cards .card-text--full {
  display: block;
  -webkit-line-clamp: unset;
  overflow: visible;
}

.pf-kicker {
  margin: 0 0 0.6em;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.pf-title {
  margin: 0 0 0.6em;
  font-size: clamp(1.5rem, 2.8vw, 2.1rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.pf-text {
  font-size: clamp(1rem, 1.3vw, 1.08rem);
  line-height: 1.65;
}
.pf-text p { margin: 0 0 1em; }
.pf-text p:last-child { margin-bottom: 0; }

.pf-credits {
  display: grid;
  grid-template-columns: fit-content(40%) minmax(0, 1fr);
  gap: 0.3em 1em;
  margin: 1.5rem 0 0;
  font-size: 0.9rem;
  line-height: 1.45;
}
.pf-credits dt { color: var(--fg-muted); }
.pf-credits dd { margin: 0; }

.pf-btn {
  display: inline-block;
  margin-top: 1.5rem;
  padding: 0.55em 1.1em;
  border: 1px solid var(--fg-muted);
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--fg);
  transition: background 0.2s ease, color 0.2s ease;
}
.pf-btn:hover,
.pf-btn:focus-visible {
  background: var(--fg);
  color: var(--bg);
  text-decoration: none;
}
.pf-btn::after { content: " ↗"; }

/* --- click-to-load YouTube --- */
.pf-yt {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  cursor: var(--cursor-hand);
}
.pf-yt img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.85;
  transition: opacity 0.2s ease;
}
.pf-yt:hover img { opacity: 1; }
.pf-yt::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 68px;
  height: 68px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(0, 0, 0, 0.55) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23fff'><path d='M8 5v14l11-7z'/></svg>") center / 30px no-repeat;
}
.pf-yt-label {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0.6rem 0.9rem;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.7));
  color: #fff;
  font-size: 0.8rem;
  text-align: left;
}
.pf-yt-frame {
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 8px;
  background: #000;
}

/* =========================================================
   About
   ========================================================= */

.pf-about {
  display: grid;
  gap: clamp(2rem, 5vw, 4rem);
  padding-block: clamp(3rem, 8vw, 6rem) var(--section-gap);
}
@media (min-width: 1024px) {
  .pf-about { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
}
.pf-about-photos {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-content: start;
}
@media (min-width: 640px) and (max-width: 1023px) {
  .pf-about-photos { grid-template-columns: 1fr 1fr; align-items: start; }
}
.pf-about-photos figure {
  margin: 0;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--bg-elev);
}
.pf-about-photos img { width: 100%; height: 100%; object-fit: cover; }

.pf-about h1 {
  margin: 0 0 0.25em;
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.pf-about-role { margin: 0 0 2rem; color: var(--fg-muted); font-size: clamp(1rem, 1.8vw, 1.25rem); }
.pf-about-text { font-size: clamp(1.05rem, 1.6vw, 1.2rem); line-height: 1.7; }
.pf-about-text p { margin: 0 0 1.2em; }

.pf-contact {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.4em 1.25em;
  margin: 2.5rem 0 0;
  font-size: 0.95rem;
}
.pf-contact dt { color: var(--fg-muted); }
.pf-contact dd { margin: 0; }

/* =========================================================
   Lightbox (extends .lightbox from style.css)
   ========================================================= */

.pf-lb-body {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  width: 100%;
  height: 100%;
  min-height: 0;
}
@media (min-width: 1024px) {
  .pf-lb-body { flex-direction: row; gap: 2rem; }
  .pf-lb-figure { flex: 3 1 0; }
  .pf-lb-info { flex: 2 1 0; max-width: 460px; }
}

.pf-lb-figure {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
}
.pf-lb-figure img,
.pf-lb-figure .lightbox-video {
  max-width: 100%;
  max-height: min(70vh, 640px);
  width: auto;
  height: auto;
  object-fit: contain;
  user-select: none;
  -webkit-user-select: none;
}
@media (min-width: 1024px) {
  .pf-lb-figure img,
  .pf-lb-figure .lightbox-video { max-height: 80vh; }
}
.pf-lb-figure .pf-yt { width: 100%; }

.pf-lb-count {
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%);
  padding: 0.2em 0.7em;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.pf-lb-info {
  overflow-y: auto;
  min-height: 0;
  max-height: 40vh;
  padding: 0 0.25rem;
  color: var(--fg);
}
@media (min-width: 1024px) { .pf-lb-info { max-height: none; } }
.pf-lb-info .pf-title { margin-top: 0; }

.pf-lb-arrow {
  position: absolute;
  top: 50%;
  width: 48px;
  height: 48px;
  transform: translateY(-50%);
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1) no-repeat center / 22px;
  color: var(--fg);
  cursor: var(--cursor-hand);
  transition: background 0.2s ease;
}
.pf-lb-arrow:hover { background-color: rgba(255, 255, 255, 0.22); }
.pf-lb-arrow--prev { left: 8px; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M15 18l-6-6 6-6'/></svg>"); }
.pf-lb-arrow--next { right: 8px; background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23fff' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><path d='M9 18l6-6-6-6'/></svg>"); }
.pf-lb.is-single .pf-lb-arrow { display: none; }
@media (max-width: 639px) {
  .pf-lb-arrow { width: 40px; height: 40px; background-size: 18px; }
}

/* footer sits at the bottom of the portfolio pages as on the CV */
.pf .footer { margin-top: var(--section-gap); }
