/* Meggy Portfolio – mobile-first, odwzorowanie layoutu z InDesigna */
:root {
  --bg: #ffffff;
  --ink: #111111;
  --muted: #555555;
  --line: #e4e4e4;
  --col: 480px;
  --pad: 7vw;
  --mono: "Andale Mono", "Cousine", "Courier New", monospace;
  --black: "Arial Black", "Archivo Black", "Helvetica Neue", Arial, sans-serif;
}
@media (min-width: 480px) { :root { --pad: 32px; } }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: #f2f2f2; color: var(--ink);
  font-family: var(--mono); font-size: 15px; line-height: 1.45;
}
a { color: inherit; }
img { display: block; max-width: 100%; height: auto; }

.mp-book { max-width: var(--col); margin: 0 auto; background: var(--bg); min-height: 100vh; }

/* pasek górny jak w PDF */
.mp-bar {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px var(--pad); font-size: 11px; letter-spacing: .01em;
  background: rgba(255,255,255,.94); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
}
.mp-bar a { text-decoration: none; }
.mp-bar-right { display: flex; align-items: center; gap: 14px; }
.mp-lang { display: inline-flex; border: 1px solid var(--ink); }
.mp-lang a { padding: 2px 6px; line-height: 1.3; }
.mp-lang a.on { background: var(--ink); color: #fff; }
.mp-bar > span, .mp-bar a { white-space: nowrap; }
.mp-short { display: none; }
@media (max-width: 420px) {
  .mp-bar { padding: 10px 14px; font-size: 10.5px; }
  .mp-bar-right { gap: 10px; }
  .mp-long { display: none; }
  .mp-short { display: inline; }
}

.mp-page { padding: 26px var(--pad) 40px; scroll-margin-top: 40px; }
.mp-page + .mp-page { border-top: 1px solid var(--line); }

.mp-img { margin: 0 0 18px; }
.mp-img a { display: block; }
.mp-img img { display: block; width: 100%; height: auto; } /* Safari: zawsze pełna szerokość kolumny, proporcje z pliku */

.mp-h1, .mp-h2 {
  font-family: var(--black); font-weight: 900; text-align: center;
  margin: 0; line-height: 1.12; letter-spacing: .005em;
}
.mp-h1 { font-size: 28px; }
.mp-h2 { font-size: 22px; }
.mp-h2 + .mp-h2 { margin-top: 2px; }

.mp-meta { margin: 0 0 18px; }
.mp-text p { margin: 0 0 14px; }
.mp-details { margin-top: 14px; white-space: pre-line; }
.mp-details strong { font-weight: normal; }

.mp-link { display: inline-block; margin-top: 8px; text-decoration: none; }
.mp-link:active, .mp-bar a:active { opacity: .5; }

/* spis treści */
.mp-toc h2 { font-family: var(--black); font-size: 22px; text-align: center; margin: 0 0 16px; }
.mp-toc ul { list-style: none; margin: 0; padding: 0; }
.mp-toc li { margin: 0; }
.mp-toc a { display: flex; gap: 10px; padding: 7px 0; text-decoration: none; border-bottom: 1px dotted var(--line); }
.mp-toc .y { font-family: var(--black); margin-top: 14px; padding: 4px 0; }
.mp-toc .c { padding-left: 12px; }
.mp-toc .w { padding-left: 24px; color: var(--muted); font-size: 13px; }
.mp-toc .n { margin-left: auto; color: var(--muted); }
.mp-toc .p { font-size: 14px; }
.mp-toc .p .n { font-size: 12px; text-align: right; }

.mp-foot { text-align: center; font-size: 11px; color: var(--muted); padding: 24px var(--pad) 40px; }

.mp-page { position: relative; }
.mp-page > span[id] { position: absolute; top: 0; }
.mp-shop { margin-top: 14px; }
.mp-print { text-decoration: none; display: inline-block; margin-bottom: 8px; }
.mp-print-one { display: block; margin: 18px 0 0; font-size: .85em; color: var(--muted); }
.mp-sig { display: none; }
/* propozycje */
.mp-note { padding: 26px var(--pad) 22px; font-size: 1.02em; line-height: 1.55; border-bottom: 1px solid var(--line); white-space: normal; }
.mp-note + .mp-page { border-top: 0; }
.mp-sold { display: inline-block; margin: 0 0 12px; padding: 3px 9px; border: 1px solid var(--ink); font-size: .8em; letter-spacing: .08em; text-transform: uppercase; }
.mp-page.is-sold .mp-img img { opacity: .55; }
.mp-price { margin: 12px 0 0; font-family: var(--black); font-size: 1em; }
.mp-admin-price { margin: 10px 0 0; padding: 6px 10px; font-size: .8em; background: #fff6d6; border: 1px dashed #c9a84c; display: inline-block; }
.mp-nr { margin: 10px 0 0; font-size: .8em; color: var(--muted); letter-spacing: .03em; }
@media (min-width: 900px) { .mp-note { max-width: 760px; margin: 0 auto; padding: 48px var(--pad) 40px; border-bottom: 0; } }

/* opis cyklu i opis pracy */
.mp-anchor { height: 0; scroll-margin-top: 40px; }
.mp-cycle { scroll-margin-top: 40px; }
.mp-cycle { padding: 30px var(--pad) 6px; border-top: 1px solid var(--line); }
.mp-cycle .mp-h2 { margin-bottom: 14px; }
.mp-cycle + .mp-page { border-top: 0; }
.mp-desc { margin-top: 14px; font-size: .92em; line-height: 1.55; }
.mp-desc p { margin: 0 0 10px; }
@media (min-width: 900px) { .mp-cycle { max-width: 760px; margin: 0 auto; padding: 56px var(--pad) 0; border-top: 0; } .mp-cycle .mp-h2 { text-align: left; } }

/* moduły pracy */
.mp-mods { margin-top: 16px; }
.mp-mods-h { margin: 0 0 6px; font-size: .8em; color: var(--muted); }
.mp-mods-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; max-width: 300px; }
.mp-mods-grid a { display: block; aspect-ratio: 1 / 1; overflow: hidden; background: #eee; }
.mp-mods-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mp-puzzle { margin-top: 10px; }

/* powiększenie zdjęcia */
.mp-lb { position: fixed; inset: 0; z-index: 100; background: #111; }
.mp-lb[hidden] { display: none; }
.mp-lb-scroll { position: absolute; inset: 0; overflow: auto; -webkit-overflow-scrolling: touch; display: flex; }
.mp-lb-scroll img { margin: auto; max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; cursor: zoom-in; }
.mp-lb.big .mp-lb-scroll img { max-width: none; max-height: none; width: 250%; cursor: zoom-out; flex: none; }

.mp-lb-close {
  position: fixed; top: max(12px, env(safe-area-inset-top)); right: 12px; z-index: 101;
  width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: rgba(255,255,255,.92); color: #111; font: 28px/44px Arial, sans-serif; cursor: pointer; padding: 0;
}
html.mp-lock, html.mp-lock body { overflow: hidden; }
.mp-lb-nav {
  position: fixed; top: 50%; transform: translateY(-50%); z-index: 101;
  width: 44px; height: 44px; border: 0; border-radius: 50%; padding: 0;
  background: rgba(255,255,255,.75); color: #111; font: 30px/42px Arial, sans-serif; cursor: pointer;
}
.mp-lb-nav[hidden], .mp-lb-count[hidden] { display: none; }
.mp-lb-nav:hover { background: rgba(255,255,255,.95); }
.mp-lb-prev { left: 12px; }
.mp-lb-next { right: 12px; }
.mp-lb.big .mp-lb-nav { opacity: .45; }
.mp-lb-count {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: max(14px, env(safe-area-inset-bottom)); z-index: 101;
  color: rgba(255,255,255,.75); font: 13px/1 Arial, sans-serif; letter-spacing: .1em;
  background: rgba(0,0,0,.35); padding: 6px 10px; border-radius: 12px;
}
.mp-zoom { cursor: zoom-in; }
/* wczytywanie pełnego pliku: pierścień, który się wypełnia */
.mp-lb-load {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%,-50%); z-index: 101; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  background: rgba(0,0,0,.55); padding: 18px 20px 14px; border-radius: 14px;
  color: rgba(255,255,255,.85); font: 12px/1 Arial, sans-serif; letter-spacing: .12em; text-transform: uppercase;
}
.mp-lb-load[hidden] { display: none; }
.mp-lb-ring {
  --p: 0%; width: 44px; height: 44px; border-radius: 50%;
  background: conic-gradient(#fff var(--p), rgba(255,255,255,.18) 0);
  -webkit-mask: radial-gradient(circle, transparent 15px, #000 16px); mask: radial-gradient(circle, transparent 15px, #000 16px);
  transition: --p .2s;
}
.mp-lb-ring.spin { animation: mp-spin 1s linear infinite; }
@keyframes mp-spin { to { transform: rotate(360deg); } }
.mp-lb.loading .mp-lb-scroll img { filter: blur(1.5px); }

/* tablet pionowo (iPad): szersza kolumna, większy tekst */
@media (min-width: 600px) and (max-width: 899px) {
  :root { --col: 720px; --pad: 56px; }
  body { font-size: 17px; }
  .mp-bar { font-size: 12px; padding: 14px var(--pad); }
  .mp-page { padding: 44px var(--pad) 56px; }
  .mp-img img { width: 100%; height: auto; max-height: 78vh; object-fit: contain; }
  .mp-h1 { font-size: 34px; }
  .mp-h2 { font-size: 26px; }
}

/* komputer: obraz po lewej, opis po prawej – do pokazania klientowi na ekranie */
@media (min-width: 900px) {
  :root { --col: 1180px; --pad: 56px; }
  body { font-size: 16px; }
  .mp-bar { font-size: 12px; padding: 14px var(--pad); }
  .mp-page { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 56px; align-items: center; padding: 56px var(--pad); min-height: calc(100vh - 46px); }
  .mp-img { margin: 0; text-align: center; }
  .mp-img img { width: 100%; height: auto; max-height: calc(100vh - 160px); object-fit: contain; }
  .mp-h1, .mp-h2 { text-align: left; }
  .mp-h1 { font-size: 36px; }
  .mp-h2 { font-size: 26px; }
  .mp-toc { display: block; min-height: 0; max-width: 640px; margin: 0 auto; }
  .mp-toc h2 { text-align: left; }
  .mp-info { max-width: 460px; }
}

/* drukowanie / „Zapisz jako PDF”: jedna praca na stronę */
@page { size: A4; margin: 14mm; }
@media print {
  html, body { background: #fff; height: auto !important; min-height: 0 !important; }
  body { font-size: 11pt; }
  .mp-book { max-width: none; min-height: 0 !important; }
  .mp-admin-price, .mp-bar, .mp-print, .mp-page.mp-toc, .mp-shop, .mp-lang, .mp-lb { display: none !important; }
  .mp-page { display: block; min-height: 0; padding: 0; border: 0 !important; break-after: page; page-break-after: always; }
  .mp-img img { width: 100%; height: auto; max-height: 175mm; object-fit: contain; }
  article.mp-page { break-inside: avoid; page-break-inside: avoid; }
  #start, .mp-note { break-inside: auto; page-break-inside: auto; }
  .mp-h1, .mp-h2 { text-align: center; }
  .mp-info { max-width: none; }
  .mp-foot { padding: 0; }
  article.mp-page:last-of-type { break-after: auto; page-break-after: auto; }
  #start .mp-img img { max-height: 120mm; }
  #start { font-size: 10pt; }
  /* tylko wybrana praca */
  body.mp-one .mp-page:not(.mp-target), body.mp-one .mp-foot, body.mp-one .mp-note { display: none !important; }
  body.mp-one .mp-target { break-after: auto; page-break-after: auto; }
  body.mp-one .mp-target, body.mp-one .mp-target .mp-info > :last-child { margin-bottom: 0 !important; padding-bottom: 0 !important; }
  .mp-note { padding: 0 0 6mm; font-size: 10pt; border: 0; break-after: avoid; }
  .mp-sig { display: block; margin: 8mm 0 0; font-size: 8pt; color: #555; text-align: center; }
  /* opis cyklu: osobna strona przed pracami cyklu */
  .mp-cycle { padding: 0; border: 0; font-size: 10pt; break-after: page; page-break-after: always; }
  .mp-cycle .mp-h2 { text-align: center; margin-bottom: 8mm; }
  /* każda praca dokładnie na jednej stronie: zdjęcie zmniejsza się, gdy tekstu jest więcej */
  article.mp-page { display: flex !important; flex-direction: column; height: 238mm; overflow: hidden; } /* zapas na marginesy Safari i drukarki */
  article.mp-page .mp-img { flex: 1 1 0; min-height: 70mm; margin: 0 0 5mm; display: flex; align-items: center; justify-content: center; }
  article.mp-page .mp-img a { display: flex; height: 100%; width: 100%; align-items: center; justify-content: center; }
  article.mp-page .mp-img img { height: 100%; width: auto !important; max-width: 100%; max-height: 100% !important; object-fit: contain; }
  article.mp-page .mp-info { flex: 0 0 auto; font-size: 9.5pt; }
  article.mp-page .mp-h2 { font-size: 15pt; }
  .mp-foot { display: none !important; }
  .mp-mods, .mp-wall { display: none !important; }
  .mp-desc { font-size: 9.5pt; }
  .mp-cycle-link { margin-top: 0; }
  .mp-cycle-link::after { content: " " attr(href); font-size: 8pt; color: #555; }
  body.mp-one .mp-cycle { display: none !important; }
}
.mp-wall { display: block; margin-top: 10px; }

/* dyptyk: dwa panele obok siebie, równa wysokość, mały odstęp */
.mp-dyp { display: flex; gap: 4mm; align-items: center; width: 100%; }
.mp-dyp > a { display: block; min-width: 0; }
.mp-img.is-dyp img, .mp-dyp img { width: 100% !important; height: auto !important; max-height: none !important; object-fit: fill; }
@media print {
  article.mp-page .mp-img.is-dyp { display: flex; align-items: center; justify-content: center; }
  article.mp-page .mp-img.is-dyp .mp-dyp { gap: 4mm; align-items: center; width: 100%; }
  article.mp-page .mp-img.is-dyp .mp-dyp > a { height: auto; width: auto; display: block; }
}
@media print {
  /* dyptyk w PDF: zwykły blok (Safari), oba panele na całą szerokość strony */
  article.mp-page .mp-img.is-dyp { display: block !important; }
  article.mp-page .mp-img.is-dyp .mp-dyp { display: flex !important; width: 100% !important; height: 100%; gap: 4mm; align-items: center; justify-content: center; }
  article.mp-page .mp-img.is-dyp .mp-dyp > a { display: block !important; height: auto !important; flex: none !important; }
  article.mp-page .mp-img.is-dyp .mp-dyp img { width: 100% !important; height: auto !important; max-width: 100% !important; max-height: none !important; object-fit: contain; }
}
@media print {
  /* Safari: przy druku potrafi użyć ekranowej szerokości kolumny (480 px) i marginesów – wymuszamy pełną szerokość strony */
  :root { --col: none; --pad: 0px; }
  html body .mp-book { max-width: none !important; width: auto !important; margin: 0 !important; padding: 0 !important; }
  html body article.mp-page { width: auto !important; max-width: none !important; margin: 0 !important; padding: 0 !important; }
  html body article.mp-page .mp-info { max-width: none !important; }
  html body article.mp-page figure.mp-img { margin-left: 0 !important; margin-right: 0 !important; width: 100% !important; }
}

/* obrót panelu tylko w wyświetlaniu (plik w Mediach bez zmian) */
.mp-rot.mp-rot { position: relative; display: block; overflow: hidden; aspect-ratio: var(--ar); }
.mp-rot.mp-rot.mp-rot.mp-rot.mp-rot.mp-rot > img { position: absolute !important; left: 50% !important; top: 50% !important; width: var(--rw) !important; max-width: none !important; height: auto !important; max-height: none !important; transform: translate(-50%, -50%) rotate(var(--rd)); }
@media print { .mp-rot.mp-rot.mp-rot { height: auto !important; aspect-ratio: var(--ar); } }
