/*
Theme Name: Musioł Archiwum
Theme URI: https://www.jacekmusiol.net
Author: Jacek Musioł
Description: Jasna galeria dla archiwum zdjęć z podróży: lata zamiast stronicowania, duże zdjęcia i panoramy na całą szerokość.
Version: 1.0.0
Requires at least: 6.4
Requires PHP: 7.4
Text Domain: musiol-archiwum
*/

/* Układ: biała ściana galerii. Archiwum ułożone latami, zdjęcia w równych rzędach, panoramy na całą szerokość. */
:root {
  --wall: #ffffff;
  --soft: #f1f3f3;
  --ink: #14191c;
  --muted: #5a666b;
  --line: #dde2e3;
  /* kolory znakowania szlaków PTTK */
  --trail-red: #d11f2a;
  --trail-blue: #1c5fb8;
  --trail-green: #1e8a4c;
  --trail-yellow: #f2c200;
  --trail-black: #14191c;
  --display: "Bricolage Grotesque", "Helvetica Neue", Arial, sans-serif;
  --body: "Instrument Sans", "Helvetica Neue", Arial, sans-serif;
  --gutter: max(16px, min(4vw, 56px));
  --row: 250px;
  --measure: 68ch;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--wall); color: var(--ink); font: 400 17px/1.6 var(--body); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
img, video { display: block; max-width: 100%; height: auto; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
:focus-visible { outline: 2px solid var(--trail-blue); outline-offset: 2px; }
[hidden] { display: none !important; }

.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--wall); padding: 8px 14px; z-index: 20; }
.skip:focus { left: 8px; }

/* Nagłówek */
.top { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px 24px; padding: 18px var(--gutter); padding-left: max(var(--gutter), env(safe-area-inset-left, 0px)); padding-right: max(var(--gutter), env(safe-area-inset-right, 0px)); }
.brand { font-weight: 600; white-space: nowrap; text-decoration: none; }
.top-menu, .foot-menu { list-style: none; display: flex; flex-wrap: wrap; gap: 4px clamp(12px, 2vw, 22px); margin: 0; padding: 0; }
.top-menu a { color: var(--muted); font-weight: 500; text-decoration: none; }
.top-menu a:hover, .top-menu .current-menu-item a { color: var(--ink); }

/* Strona główna */
.mast { padding: 8px var(--gutter) 26px; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 300px); gap: 24px 40px; align-items: end; }
.mast h1 { margin: 0; font: 500 clamp(58px, 12.4vw, 196px)/.88 var(--display); letter-spacing: -.045em; }
.mast p { margin: 0 0 8px; color: var(--muted); text-wrap: pretty; }
.mast strong { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

.pano { position: relative; overflow-x: auto; scrollbar-width: none; cursor: grab; background: var(--soft); touch-action: pan-x pan-y; }
.pano::-webkit-scrollbar { display: none; }
.pano.dragging { cursor: grabbing; }
.pano img { height: clamp(250px, 42vw, 620px); width: auto; max-width: none; user-select: none; -webkit-user-drag: none; }
.pano-note { display: flex; justify-content: space-between; gap: 4px 16px; flex-wrap: wrap; padding: 10px var(--gutter) 0; font-size: 14px; color: var(--muted); }
.pano-note a { color: var(--ink); font-weight: 500; text-decoration: none; }
.pano-note a:hover { color: var(--trail-red); }

.bar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; background: var(--wall); border-bottom: 1px solid var(--line); margin-top: 44px; }
.bar-in { display: flex; gap: 28px; justify-content: space-between; align-items: center; padding-block: 10px; padding-inline: var(--gutter); overflow-x: auto; scrollbar-width: none; }
.bar-in::-webkit-scrollbar { display: none; }
.chips, .years { display: flex; gap: 4px; flex: none; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; font-weight: 500; font-size: 14px; white-space: nowrap; }
.chip:hover { background: var(--soft); }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--wall); }
.chip small { font-size: 12px; opacity: .62; font-variant-numeric: tabular-nums; }
.years a { padding: 6px 7px; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; text-decoration: none; }
.years a:hover { color: var(--trail-red); }

/* Znak szlaku: biały, kolor, biały */
.mark { display: inline-block; flex: none; width: 18px; height: 12px; border: 1px solid var(--line); background: linear-gradient(#fff 33%, var(--c, var(--ink)) 33% 67%, #fff 67%); }
.mark-red { --c: var(--trail-red); }
.mark-blue { --c: var(--trail-blue); }
.mark-green { --c: var(--trail-green); }
.mark-yellow { --c: var(--trail-yellow); }
.mark-black { --c: var(--trail-black); }
.chip[aria-pressed="true"] .mark { border-color: transparent; }

.year { display: grid; grid-template-columns: 172px minmax(0, 1fr); gap: 28px; padding: 44px var(--gutter) 12px; scroll-margin-top: 52px; }
.year h2 { margin: 0; font: 500 64px/1 var(--display); letter-spacing: -.04em; position: sticky; top: 74px; align-self: start; font-variant-numeric: tabular-nums; }
.year h2 small { display: block; margin-top: 8px; font: 400 14px/1.3 var(--body); letter-spacing: 0; color: var(--muted); }

/* Równe rzędy zdjęć */
.rows { display: flex; flex-wrap: wrap; gap: 26px 10px; }
.rows::after { content: ""; flex: 1000000 1 0; }
.tile { --r: 1.5; flex: calc(var(--r) * 100) 1 calc(var(--r) * var(--row)); min-width: 0; display: block; text-decoration: none; color: inherit; }
.tile.wide { flex: 1 1 100%; }
.tile .ph { display: block; aspect-ratio: var(--r); width: 100%; background: var(--soft); overflow: hidden; }
.tile img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s cubic-bezier(.2, .7, .2, 1); }
.tile:hover img { transform: scale(1.025); }
.tile.wide:hover img { transform: none; }
.tile b { display: block; margin-top: 9px; font-weight: 500; line-height: 1.3; text-wrap: pretty; }
.tile:hover b { color: var(--trail-red); }
.meta { display: flex; align-items: center; flex-wrap: wrap; gap: 3px 8px; margin-top: 3px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.also { margin: 26px 0 0; padding-top: 12px; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); }
.also a { color: var(--ink); text-decoration-color: var(--line); text-underline-offset: 3px; }
.also a:hover { color: var(--trail-red); }

/* Nagłówki archiwów i stron */
.page-head { padding: 16px var(--gutter) 12px; max-width: 1000px; }
.page-head h1 { margin: 0; font: 500 clamp(40px, 7vw, 104px)/.96 var(--display); letter-spacing: -.035em; text-wrap: balance; }
.page-head p { color: var(--muted); }
.empty, .page-links-list { padding: 24px var(--gutter); }
.page-links-list h2 { font: 500 28px/1.1 var(--display); letter-spacing: -.02em; }

/* Wpis */
.trip { padding-bottom: 32px; }
.back { display: inline-block; margin: 6px var(--gutter) 22px; font-weight: 500; color: var(--muted); text-decoration: none; }
.back:hover { color: var(--ink); }
.trip > h1 { margin: 0; padding-inline: var(--gutter); max-width: calc(22ch + 2 * var(--gutter)); font: 500 clamp(40px, 7vw, 104px)/.96 var(--display); letter-spacing: -.035em; text-wrap: balance; }
.page-view > h1 { max-width: none; padding-top: 8px; }
.trip > .meta { padding-inline: var(--gutter); margin-top: 16px; font-size: 15px; gap: 4px 14px; }
a.lead, .pano.lead { display: block; margin: 28px 0 0; background: var(--soft); }
a.lead img { width: 100%; max-height: 84vh; object-fit: contain; margin-inline: auto; cursor: zoom-in; }

.entry { padding: 40px var(--gutter) 8px; }
.entry > * { max-width: var(--measure); }
.entry > .rows, .entry > .fig-wide, .entry > figure, .entry > hr, .entry > .musiol-col-row, .entry > .ngg-albumoverview, .entry > .musiol-tabs, .entry > p:has(> .video), .entry > .wp-block-image { max-width: none; }
.entry > p.intro { font: 400 clamp(20px, 2.2vw, 26px)/1.35 var(--display); letter-spacing: -.01em; }
.entry p { text-wrap: pretty; }
.entry a:not(.tile):not(.musiol-legacy-button) { text-underline-offset: 3px; }
.entry a[data-shot] { cursor: zoom-in; }
.entry h2, .entry h3 { font-family: var(--display); font-weight: 500; letter-spacing: -.015em; line-height: 1.15; }
.entry ul, .entry ol { padding-left: 1.2em; }
.entry .rows { margin-block: 28px; }
.entry iframe:not(.video) { max-width: 100%; border: 0; display: block; }

.shots { gap: 8px; }
.shots .tile { cursor: zoom-in; }
.tile .cap { display: block; margin-top: 6px; font-size: 13px; line-height: 1.35; color: var(--muted); }

/* Zdjęcia w tekście */
figure { margin: 26px 0; }
figure.wp-caption { width: auto !important; }
figure img { margin: 0; }
figcaption, .wp-caption-text { margin-top: 6px; font-size: 13px; color: var(--muted); }
.fig-wide { margin-inline: calc(var(--gutter) * -1); }
.fig-wide img { width: 100%; height: auto; }
.fig-wide figcaption { padding-inline: var(--gutter); }
.aligncenter { margin-inline: auto; }
.alignleft { float: left; margin: 4px 22px 14px 0; }
.alignright { float: right; margin: 4px 0 14px 22px; }
.video { display: block; width: 100%; max-width: 900px; aspect-ratio: 16 / 9; border: 0; background: var(--soft); margin-block: 20px; }
center { display: block; }

/* Stare elementy stron galerii */
.musiol-legacy-divider { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
.musiol-col-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 28px 24px; margin-block: 16px; }
.musiol-col-row > * { min-width: 0; }
.musiol-col-row img { width: 100%; height: auto; }
.musiol-legacy-button { display: inline-block; margin-top: 10px; padding: 8px 16px; border: 1px solid var(--ink); border-radius: 999px; font-weight: 500; text-decoration: none; }
.musiol-legacy-button:hover { background: var(--ink); color: var(--wall); }
.musiol-tab-title { margin-top: 0; }
.musiol-siblings-list, .musiol-siblings-list ul { list-style: none; padding-left: 0; }
.musiol-siblings-list ul { padding-left: 1.2em; }
.ngg-breadcrumbs { list-style: none; padding: 0; color: var(--muted); font-size: 14px; }
.ngg-albumoverview { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 28px 18px; }
.ngg-album img { width: 100%; height: auto; }
.ngg-albumtitle { font: 500 20px/1.2 var(--display); order: 2; margin-top: 8px; }
.ngg-albumtitle a { text-decoration: none; }
.ngg-album { display: flex; flex-direction: column; }
.ngg-albumcontent { display: contents; }
.ngg-thumbnail { order: 1; }
.ngg-description { order: 3; font-size: 14px; color: var(--muted); }
.ngg-description p { margin: 4px 0 0; }

/* Koniec wpisu */
.trip-foot { padding: 20px var(--gutter) 0; font-size: 14px; color: var(--muted); }
.trip-foot a { color: var(--ink); text-underline-offset: 3px; }
.published { margin: 0; }
.related { padding: 36px var(--gutter) 0; }
.related h2, .comments h2 { margin: 0 0 16px; font: 500 28px/1.1 var(--display); letter-spacing: -.02em; }
.pager { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 52px; padding: 22px var(--gutter) 0; border-top: 1px solid var(--line); }
.pager a { display: block; min-width: 0; text-decoration: none; }
.pager a:last-child { text-align: right; }
.pager a:only-child { grid-column: 2; }
.pager small { display: block; color: var(--muted); font-size: 13px; }
.pager span { font: 500 clamp(18px, 2.6vw, 30px)/1.1 var(--display); letter-spacing: -.015em; }
.pager a:hover span { color: var(--trail-red); }
.comments { padding: 40px var(--gutter) 0; max-width: calc(var(--measure) + 2 * var(--gutter)); font-size: 15px; }
.comment-list { padding-left: 1.2em; }
.comment-list li { margin-bottom: 14px; overflow-wrap: anywhere; }
.comment-meta, .comment-metadata { font-size: 13px; color: var(--muted); }
.search-form { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.search-field, .comments input[type="text"], .comments input[type="email"], .comments input[type="url"], .comments textarea { width: 100%; max-width: 420px; padding: 9px 12px; border: 1px solid var(--line); font: inherit; background: var(--wall); color: var(--ink); }
.search-submit, .comments input[type="submit"] { padding: 9px 16px; border: 1px solid var(--ink); border-radius: 999px; background: var(--wall); color: var(--ink); font: inherit; font-weight: 500; cursor: pointer; }
.search-submit:hover, .comments input[type="submit"]:hover { background: var(--ink); color: var(--wall); }

/* Podgląd zdjęcia */
dialog { position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none; margin: 0; border: 0; padding: 0; background: var(--wall); color: var(--ink); }
.lb { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; height: 100%; }
.lb-top, .lb-bot { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px var(--gutter); font-size: 14px; }
.lb-top button { font-weight: 500; }
.lb-stage { position: relative; display: flex; align-items: center; justify-content: center; min-height: 0; overflow: auto; padding-inline: var(--gutter); }
.lb-stage img { max-height: 100%; width: auto; object-fit: contain; }
.lb-stage.is-wide { justify-content: flex-start; padding: 0; }
.lb-stage.is-wide img { height: 100%; max-height: 100%; max-width: none; }
.lb-bot { color: var(--muted); }
.lb-nav { display: flex; gap: 6px; flex: none; }
.lb-nav button { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%; color: var(--ink); font-size: 18px; }
.lb-nav button:hover { background: var(--ink); color: var(--wall); }

/* Stopka */
.foot { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 16px 40px; margin-top: 64px; padding: 26px var(--gutter) 44px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }
.foot strong { color: var(--ink); font-weight: 600; }
.foot p { margin: 4px 0 0; }
.foot a { text-decoration: none; }
.foot a:hover { color: var(--ink); }
.social { display: flex; gap: 14px; }

@media (max-width: 860px) {
  :root { --row: 150px; }
  body { font-size: 16px; }
  .mast { grid-template-columns: minmax(0, 1fr); }
  .mast p { max-width: 46ch; }
  .year { grid-template-columns: minmax(0, 1fr); gap: 14px; padding-top: 34px; }
  .year h2 { position: static; font-size: 48px; }
  .year h2 small { display: inline; margin-left: 10px; }
  .bar { margin-top: 28px; }
  .bar-in { padding-block: 8px; }
  .rows { gap: 20px 8px; }
  .shots { gap: 6px; }
  .alignleft, .alignright { float: none; margin: 0 0 14px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .tile img { transition: none; }
}
