/* Josef Zelinka – řezbář Hanáckého Slovácka
   Static rebuild of the original design (styles/screen.css, 2013), responsive. */

:root {
  --taupe: #787269;      /* header band, menu tile frames */
  --stripe: #6f665d;     /* column stripes, text */
  --beige: #e2e1d4;      /* page */
  --green: #96b552;      /* active menu tile, logo accent */
  --text: #6f665d;
  --muted: #7f7f7f;
  --font: Arial, Helvetica, "Liberation Sans", sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--beige) url(../images/pozadi.jpg) repeat-x 0 0;
}

img { border: 0; max-width: 100%; height: auto; }
a { color: var(--text); }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* ---------- Page frame (desktop = original 1056 px layout) ---------- */

.page {
  display: grid;
  /* side | stripe | content | stripe */
  grid-template-columns: 220px 20px 796px 20px;
  grid-template-rows: 219px auto 1fr auto;
  grid-template-areas:
    "logo   logo   menu    menu"
    "thumbs thumbs content ."
    "thumbs thumbs content ."
    ".      .      footer  .";
  width: 1056px;
  min-height: 100vh;
  margin: 0 auto;
  background: url(../images/pozadi-stranka.jpg) repeat-y 0 0;
}

.logo { grid-area: logo; display: block; width: 240px; height: 219px; }
.logo img { display: block; width: 240px; height: 219px; }

/* ---------- Menu: original 3-state sprites framed in the header band ---------- */

.menu { grid-area: menu; background: url(../images/pozadi.jpg) repeat-x 0 0; }
.menu-toggle { display: none; }

.menu ul {
  display: flex;
  margin: 0;
  padding: 0;
  list-style: none;
}
.menu li {
  border-right: 6px solid var(--taupe);
  border-bottom: 5px solid var(--taupe);
  line-height: 0;
}
.menu li.aktualni { border-color: var(--green); }

.menu a {
  display: block;
  width: 94px;
  height: 190px;
  background: #fff no-repeat 0 0 / 100% 300%;
}
.menu a:hover, .menu a:focus-visible { background-position: 0 50%; }
.menu li.aktualni a { background-position: 0 100%; }
.menu a:focus-visible { outline: 2px solid var(--green); outline-offset: -2px; }

.menu .m-o-mne    { background-image: url(../images/menu-o-mne.jpg); }
.menu .m-plastiky { background-image: url(../images/menu-plastiky.jpg); }
.menu .m-reliefy  { background-image: url(../images/menu-reliefy.jpg); }
.menu .m-becky    { background-image: url(../images/menu-becky.jpg); }
.menu .m-kresby   { background-image: url(../images/menu-kresby.jpg); }
.menu .m-opravy   { background-image: url(../images/menu-opravy-cirkevnich-soch.jpg); }
.menu .m-akce     { background-image: url(../images/menu-akce-pro-verejnost.jpg); }
.menu .m-vystavy  { background-image: url(../images/menu-vystavy-a-dila-na-verejnosti.jpg); }

/* ---------- Content ---------- */

.content { grid-area: content; min-width: 0; padding-bottom: 30px; }

.clanek {
  font-size: .8em;
  line-height: 1.55;
  padding: 30px 60px 0;
}
.clanek h1 { font-size: 1.5em; margin: 0; }
.clanek h2 { font-size: 1.1em; margin: 15px 0 0; }
.clanek p  { text-align: justify; margin: 15px 0 0; hyphens: auto; }
.clanek ul { margin: 15px 0 0 15px; padding-left: 15px; }
.clanek li { text-align: left; }
.clanek a  { color: var(--text); }
.clanek strong a { text-decoration: none; }
.clanek strong a:hover { text-decoration: underline; }

.kolaz { padding: 0 0 0 5px; }
.kolaz img { display: block; }

/* ---------- Footer ---------- */

.footer {
  grid-area: footer;
  padding: 10px 0 8px;
  text-align: center;
  font-size: 11px;
  line-height: 1.6;
  color: var(--muted);
}
.footer a { color: var(--muted); }

/* ---------- Gallery: thumbnails + scroller (left column) ---------- */

.thumbs {
  grid-area: thumbs;
  align-self: start;
  position: sticky;
  top: 0;
  display: flex;
  gap: 2px;
  height: min(calc(100vh - 8px), 650px);
  min-height: 434px;
  padding-top: 1px;
}

.thumbs-list {
  display: grid;
  grid-template-columns: repeat(3, 70px);
  grid-auto-rows: 70px;
  align-content: start;
  gap: 2px 0;
  width: 221px;
  height: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;           /* replaced by the original-style scroller */
}
.thumbs-list::-webkit-scrollbar { display: none; }

.thumbs-list a {
  position: relative;
  display: block;
  width: 70px;
  height: 70px;
  background: #d3d1c3;
}
.thumbs-list img { display: block; width: 70px; height: 70px; object-fit: cover; }
.thumbs-list a:hover img { filter: brightness(1.08); }
.thumbs-list a.is-active::after {
  content: "";
  position: absolute;
  inset: 0;
  box-shadow: inset 0 0 0 2px var(--green);
}
.thumbs-list a:focus-visible { outline: 2px solid var(--green); outline-offset: -2px; }

/* the original scroller: arrows + green position dot on a striped track */
.scroller {
  position: relative;
  flex: 0 0 14px;
  height: 100%;
  background: var(--stripe) url(../images/posuvnik-pozadi.png) repeat-y;
  cursor: pointer;
}
.scroller[hidden] { display: none; }
.scroller button {
  position: absolute;
  left: 0;
  width: 14px;
  height: 17px;
  padding: 0;
  border: 0;
  background: no-repeat center;
  cursor: pointer;
}
.scroller .s-up   { top: 0;    background-image: url(../images/sipka-nahoru.png); }
.scroller .s-down { bottom: 0; background-image: url(../images/sipka-dolu.png); }
.scroller .s-dot {
  position: absolute;
  left: 0;
  top: 17px;
  width: 14px;
  height: 14px;
  background: url(../images/pozicovnik.png) no-repeat center / 14px 14px;
  cursor: grab;
  touch-action: none;
}

/* ---------- Gallery: viewer ---------- */

.galerie-foto {
  position: relative;
  margin: 0;
  padding: 15px 60px 0;
  text-align: center;
  font-size: .8em;
}

.viewer-stage { position: relative; display: inline-block; touch-action: pan-y; }

.viewer-img {
  display: block;
  max-height: 500px;
  width: auto;
  margin: 0 auto 10px;
  cursor: pointer;
  transition: opacity .2s;
}
.viewer-img.is-loading { opacity: .4; }

.viewer-prev, .viewer-next {
  position: absolute;
  top: 80px;
  width: 32px;
  height: 59px;
  padding: 0;
  border: 0;
  background: no-repeat center;
  cursor: pointer;
}
.viewer-prev { left: 20px;  background-image: url(../images/sipka-predchozi.png); }
.viewer-next { right: 20px; background-image: url(../images/sipka-dalsi.png); }
.viewer-prev:hover, .viewer-next:hover { filter: brightness(1.1); }
.viewer-prev[hidden], .viewer-next[hidden] { display: none; }

.viewer-caption { margin: 0; min-height: 1.5em; }
.viewer-count { display: block; margin-top: 4px; font-size: 10px; color: var(--muted); }

/* ---------- Tablet ---------- */

@media (max-width: 1059px) {
  body { background: var(--beige); }

  .page {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto;
    grid-template-areas: "header" "content" "thumbs" "footer";
    width: auto;
    background: var(--beige);
  }

  .header {
    grid-area: header;
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;          /* logo sits on the band's lines */
    justify-content: center;
    gap: 0 24px;
    padding: 0 12px;
    background: #797268 url(../images/pozadi.jpg) repeat-x 0 100%;
  }
  .logo { width: 220px; overflow: hidden; }   /* hides the logo's column stripe */
  .menu { background: none; padding: 12px 0 34px; }
  .menu ul { display: grid; grid-template-columns: repeat(4, 100px); }

  .clanek { padding: 26px 28px 0; }
  .galerie-foto { padding: 18px 12px 0; }
  .viewer-prev { left: -38px; }
  .viewer-next { right: -38px; }
  .viewer-stage { margin: 0 40px; }

  .thumbs {
    position: static;
    height: auto;
    min-height: 0;
    padding: 0 12px 20px;
  }
  .thumbs-list {
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
    grid-auto-rows: auto;
    gap: 3px;
    width: 100%;
    height: auto;
    overflow: visible;
  }
  .thumbs-list a, .thumbs-list img { width: 100%; height: auto; aspect-ratio: 1; }
  .scroller { display: none !important; }
}

/* the desktop grid places header children directly; on narrower screens
   .header becomes a real box */
@media (min-width: 1060px) {
  .header { display: contents; }
}

/* ---------- Phone ---------- */

@media (max-width: 640px) {
  .header { padding: 0; gap: 0; flex-direction: column; align-items: stretch; background: #797268; }
  .logo {
    width: 100%;
    display: flex;
    justify-content: center;
    background: url(../images/pozadi.jpg) repeat-x 0 0 / auto 100%;  /* band scaled with the logo */
  }
  .logo img { width: 176px; height: 176px; object-fit: cover; object-position: 0 0; }

  .menu { width: 100%; padding: 0; }
  .menu ul {
    grid-template-columns: repeat(4, minmax(0, 100px));
    justify-content: center;
    padding: 8px 6px 10px;
  }
  .menu li { border-right-width: 4px; border-bottom-width: 4px; }
  .menu a { width: 100%; height: auto; aspect-ratio: 94 / 190; }

  /* menu folds behind a toggle on inner pages; the home page shows it open */
  .js .menu-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 9px;
    border: 0;
    border-top: 1px solid rgba(255,255,255,.15);
    background: transparent;
    color: #fff;
    font: 13px/1 var(--font);
    letter-spacing: .14em;
    text-transform: uppercase;
    cursor: pointer;
  }
  .menu-toggle .bars,
  .menu-toggle .bars::before,
  .menu-toggle .bars::after {
    content: "";
    position: relative;
    display: block;
    width: 18px;
    height: 2px;
    background: var(--green);
    transition: transform .2s, background .2s;
  }
  .menu-toggle .bars::before { position: absolute; top: -6px; }
  .menu-toggle .bars::after  { position: absolute; top: 6px; }
  .menu-open .menu-toggle .bars { background: transparent; }
  .menu-open .menu-toggle .bars::before { transform: translateY(6px) rotate(45deg); }
  .menu-open .menu-toggle .bars::after  { transform: translateY(-6px) rotate(-45deg); }

  .js .menu ul { display: none; }
  .js.menu-open .menu ul { display: grid; }
  .js .home .menu-toggle { display: none; }
  .js .home .menu ul { display: grid; }

  .clanek { font-size: .9em; padding: 20px 18px 0; }
  .clanek p { text-align: left; }

  .galerie-foto { padding: 12px 0 0; }
  .viewer-stage { margin: 0; }
  .viewer-img { max-height: 72vh; }
  .viewer-prev, .viewer-next { top: 50%; margin-top: -30px; opacity: .85; }
  .viewer-prev { left: 0; }
  .viewer-next { right: 0; }

  .thumbs { padding: 0 8px 18px; }
  .thumbs-list { grid-template-columns: repeat(auto-fill, minmax(62px, 1fr)); gap: 2px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

@media print {
  body, .page { background: none; }
  .menu, .thumbs, .viewer-prev, .viewer-next { display: none; }
  .page { display: block; width: auto; }
}
