/* Public pages only. Keep the original desktop layout. */
#site-menu > summary {
  display: none;
}

.photo-grid {
  display: contents;
}

#image > a > img {
  box-sizing: border-box;
  max-width: 100%;
  height: auto;
}

#fadeshow {
  max-width: 100%;
  height: auto !important;
}

#fadeshow .gallerylayer > a {
  display: contents;
}

#fadeshow .gallerylayer img {
  position: absolute;
  inset: 0;
  max-width: 100%;
  max-height: 100%;
  margin: auto !important;
}

/* Fit the legacy guestbook beside the sidebar in a narrow desktop window. */
@media (1024px < width <= 1060px) {
  #content #kniha {
    box-sizing: border-box;
    max-width: 100%;
    left: 0;
  }
}

@media (max-width: 1024px) {
  body {
    height: auto;
    min-height: 100%;
    line-height: 1.5;
    overflow-wrap: anywhere;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
  }

  a:focus-visible,
  button:focus-visible,
  input:focus-visible,
  select:focus-visible,
  summary:focus-visible,
  textarea:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
  }

  #container,
  #container-facepainting,
  #container-trpytive {
    width: 100%;
    background-size: 100% auto;
  }

  /* The banner and its home link scale together from the 960 px artwork. */
  #header {
    height: auto;
    min-height: min(34vw, 320px);
    padding-top: 5.833%;
    box-sizing: border-box;
  }

  #header h1,
  #header h2 {
    position: static;
    width: 85.417%;
    height: auto;
    margin: 0 auto;
  }

  #header h1 a,
  #header h2 a {
    width: 100%;
    height: auto;
    aspect-ratio: 820 / 140;
  }

  #flag {
    position: static;
    float: none;
    display: flex;
    justify-content: flex-end;
    padding: 0.25rem 1rem;
  }

  #left-height {
    display: none;
  }

  #left,
  #content {
    float: none;
    width: auto;
    margin-inline: 1rem;
  }

  #left {
    background: none;
    margin-bottom: 1.25rem;
  }

  #site-menu {
    background: #fcffda;
    border: 1px solid #c9cc9f;
    border-radius: 0.375rem;
  }

  #site-menu > summary {
    display: list-item;
    box-sizing: border-box;
    min-height: 44px;
    font-weight: bold;
    padding: 0.625rem 0.875rem;
    cursor: pointer;
  }

  #site-menu[open] > summary {
    border-bottom: 1px solid #c9cc9f;
  }

  #site-menu nav,
  #site-menu .pr {
    padding-inline: 0.875rem;
  }

  #site-menu nav {
    display: flow-root;
  }

  #left .gallery-menu,
  #left .pr,
  #box-search,
  #cloud,
  .poll-sidebar {
    box-sizing: border-box;
    float: none;
    width: auto;
    max-width: 100%;
    margin: 0;
  }

  #left .pr {
    padding-block: 0.5rem 0.875rem;
  }

  #left .gallery-menu li a,
  #left .instagram a {
    box-sizing: border-box;
    min-height: 44px;
    padding-block: 0.625rem;
  }

  #left .gallery-menu li li a {
    width: auto;
    font-size: 0.9375rem;
    padding-left: 1rem;
  }

  #left .instagram a {
    display: inline-flex;
    align-items: center;
    min-width: 44px;
    margin: 0;
  }

  #content .article,
  #content .lista,
  #content .standart-content,
  #content .blog-content {
    width: auto;
    margin-inline: 0;
  }

  .article p,
  .article li,
  .blog p {
    font-size: 1rem;
    line-height: 1.55;
  }

  .article img {
    box-sizing: border-box;
    max-width: 100%;
    height: auto !important;
  }

  .article iframe,
  .article object,
  .article embed,
  .article video,
  #map_canvas {
    box-sizing: border-box;
    max-width: 100%;
  }

  .article .youtube > :is(iframe, object, embed),
  .article iframe[src*="youtube"] {
    height: auto;
    aspect-ratio: 16 / 9;
  }

  .article :is(.article-vlevo, .article-vpravo) {
    float: none;
    display: block;
    margin-inline: auto;
  }

  .article table {
    display: block;
    max-width: 100%;
    overflow-x: auto;
  }

  .blog-img,
  .blog-text,
  .userlist-img,
  .userlist-text,
  .thumbnail-link-thumblist .thumbnail-link-list-text,
  #links {
    box-sizing: border-box;
    max-width: 100%;
  }

  .blog-text,
  .userlist-text,
  .thumbnail-link-thumblist .thumbnail-link-list-text {
    float: none;
    width: auto;
  }

  .blog-img img,
  .userlist-img img,
  .thumbnail-link img,
  .thumbnail-link-list-img img {
    max-width: 100%;
    height: auto;
  }

  .photo-grid {
    display: grid;
    clear: both;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 8.5rem), 1fr));
    gap: 0.75rem;
    margin-block: 0.875rem;
  }

  .photo-grid:empty {
    display: none;
  }

  #content .thumbnail {
    box-sizing: border-box;
    width: auto;
    height: auto;
    min-width: 0;
  }

  .photo-grid .thumbnail-back {
    margin: 0;
  }

  .thumbnail > a {
    display: grid;
    place-items: center;
    min-height: 44px;
  }

  .photo-grid .thumbnail > a {
    aspect-ratio: 1;
  }

  .thumbnail > a > br {
    display: none;
  }

  .photo-grid .thumbnail > [style] {
    top: auto !important;
  }

  .thumbnail img {
    box-sizing: border-box;
    max-width: 100%;
    max-height: 11rem;
    height: auto;
    margin: 0;
    object-fit: contain;
  }

  #pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.375rem;
    float: none;
    position: static;
  }

  #pagination li {
    float: none;
    position: static;
  }

  #pagination li a,
  #pagination .active,
  #image #sipky a {
    box-sizing: border-box;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    padding-inline: 0.5rem;
  }

  #image > a > img {
    max-width: calc(100% - 2rem);
  }

  #image #info {
    box-sizing: border-box;
    width: min(600px, calc(100% - 2rem));
  }

  #image #info h1 {
    box-sizing: border-box;
  }

  #image #sipky {
    display: flex;
    justify-content: center;
    width: auto;
    height: auto;
    margin: 0.75rem;
  }

  #image #sipky > div {
    flex: 0 1 7.5rem;
    width: auto;
    height: auto;
  }

  .align-center,
  .align-left {
    width: auto;
    position: static;
    margin: 0 1rem;
  }

  .alert-bad,
  .alert-good,
  .alert-info,
  .alert-sql,
  .poll {
    box-sizing: border-box;
    max-width: 100%;
    margin-inline: 0;
  }

  #kniha,
  #vypis,
  .slider-inbox-reply {
    box-sizing: border-box;
    position: static;
    float: none;
    width: min(100%, 40rem);
    margin: 1.5rem auto;
  }

  #image #kniha,
  #image #vypis {
    width: min(calc(100% - 2rem), 40rem);
  }

  #kniha {
    padding: 1rem;
  }

  #content #kniha :is(h4, p, .comment-nadpis, input, textarea) {
    color: #555;
  }

  #content #kniha p {
    font-size: 0.875rem;
  }

  #vypis .post-comment,
  #vypis .post-comment-reply,
  #vypis .postbody-comment {
    box-sizing: border-box;
    width: auto;
    float: none;
    margin-inline: 0;
  }

  #vypis .posttop-comment {
    height: auto;
    overflow: auto;
  }

  #vypis .postimg-comment {
    margin-right: 0.5rem;
  }

  #registrace fieldset,
  #basic-form fieldset,
  #basic-form .registrace-help,
  .form .input-cell,
  .form .input-textarea,
  .form .input-input,
  .form .input-text {
    box-sizing: border-box;
    max-width: 100%;
  }

  #kniha input,
  #kniha textarea,
  .form input,
  .form textarea,
  .form select,
  #box-search input,
  .search-where input,
  .slider-inbox-reply input,
  .slider-inbox-reply textarea {
    box-sizing: border-box;
    max-width: 100%;
    font-size: 1rem;
  }

  #kniha input:not([type="hidden"]),
  #kniha textarea,
  #basic-form input:not([type="hidden"]),
  #box-search input:not([type="hidden"]),
  .search-where .where-submit {
    min-height: 44px;
  }

  #search-box,
  .search-where form {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
  }

  #box-search input.search-input {
    flex: 1 1 9rem;
    margin: 0;
  }

  .search-lista,
  .search-where {
    float: none;
  }

  .search-where label,
  .search-where .where-submit {
    margin: 0;
  }

  body:has(> .eu-cookies) {
    display: flex;
    flex-direction: column;
  }

  .eu-cookies {
    box-sizing: border-box;
    position: sticky;
    bottom: 0;
    margin-top: auto;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 0.25rem 0.75rem;
    padding: 0.625rem 0.875rem;
    font-size: 0.875rem;
    line-height: 1.45;
  }

  .eu-cookies button,
  .eu-cookies a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    margin: 0;
  }

  .eu-cookies button {
    background: #287833;
  }

  #footer {
    box-sizing: border-box;
    height: auto;
    padding: 1.25rem 1rem;
  }

  #slideshow {
    box-sizing: border-box;
    padding: 1rem;
  }

  #fadeshow {
    max-height: calc(100dvh - 2rem);
  }
}

@media (max-width: 540px) {
  #kniha .prvni-sloupec,
  #kniha .druhy-sloupec,
  .slider-inbox-reply .prvni-sloupec-reply,
  .slider-inbox-reply .druhy-sloupec-reply {
    float: none;
    width: 100%;
  }

  #kniha .comment-pole,
  #kniha .comment-pole input,
  #kniha textarea,
  .form .input-input input,
  .form .input-input textarea {
    width: 100%;
  }

  #kniha .comment-bottom {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
  }

  #kniha .comment-smile {
    padding: 0;
  }

  .form .input-text,
  .form .input-input {
    float: none;
    width: 100%;
    text-align: left;
    top: auto;
  }
}
