:root {
  --bg: #f3eee4;
  --bg-soft: #2d2a26;

  --text: #181614;
  --muted: #6a6258;

  --primary: #1f2a38;
  --accent: #c07a24;
  --menu-text: #f8f1e7;

  --sidebar-width: 250px;
  --header-height: 190px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Arial, Verdana, sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

img {
  max-width: 100%;
  height: auto;
  border: 0;
}

a {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}

a:hover {
  color: var(--accent);
}

/* LAYOUT */

.site-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: var(--header-height) 1fr;
  background: var(--bg);
}

/* TOP */

.top {
  grid-column: 2;
  grid-row: 1;
  display: grid;
  grid-template-columns: 1fr 200px;
  align-items: center;
  background: var(--bg);
  box-shadow: 0 8px 14px -10px rgba(0, 0, 0, 0.35);
  z-index: 1;
}

.title-area {
  padding: 24px 40px;
}

.title-area h1 {
  margin: 0;
  color: var(--primary);
  font-size: 48px;
  line-height: 1.05;
  letter-spacing: -1px;
}

.event-info {
  margin-top: 18px;
  display: flex;
  gap: 24px;
  flex-wrap: wrap;
  color: var(--muted);
  font-weight: 700;
}

.event-info span:first-child,
.event-info span:nth-child(2) {
  color: var(--text);
}
/* extra, delete later propably */
.top-tools {
  padding-right: 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: flex-end;
}

.languages {
  display: flex;
  flex-direction: row;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}

.languages img {
  width: 63px;
  height: 31px;
  display: block;
  border-radius: 3px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

/* SIDEBAR */

.sidebar {
  grid-column: 1;
  grid-row: 1 / 3;
  padding: 24px 28px;
  background: var(--bg-soft);
}

.sidebar-logo {
  display: block;
  margin-bottom: 28px;
}

.sidebar-logo img {
  width: 100%;
  display: block;
}

/* MENU */

.menu-toggle {
  display: none;
}

#menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: center;
}

#menu a {
  position: relative;
  display: inline-block;
  width: fit-content;
  padding: 9px 0;
  color: var(--menu-text);
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

#menu a::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 4px;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.18s ease;
}

#menu a:hover {
  color: var(--accent);
}

#menu a:hover::after {
  transform: scaleX(1);
}

#menu a:first-child {
  color: var(--accent);
}

#menu a.toplist {
  padding: 0;
  line-height: 0;
  color: inherit;
}

#menu a.toplist::after,
#menu a.toplist:hover::after {
  content: none;
  display: none;
}

#menu a.toplist:hover {
  color: inherit;
}

#menu a.toplist img,
#menu a.toplist:hover img {
  display: block;
  transform: none;
  filter: none;
  opacity: 1;
}

/* CONTENT */

.content {
  grid-column: 2;
  grid-row: 2;
  padding: 34px 48px 60px;
  max-width: 100%;
}

.content h2 {
  margin-top: 0;
  color: var(--primary);
  font-size: 34px;
}

.content h3 {
  color: var(--primary);
}

.content p {
  width: auto;
}

.content table {
  width: 100%;
}

.content img {
  border-radius: 4px;
}

/* HOME */

.home-hero {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 44px;
  align-items: start;
  width: 90%;
  max-width: none;
}

.home-intro {
  max-width: none;
}

.home-dates {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  color: var(--muted);
  font-weight: 700;
}

.home-dates strong {
  color: var(--text);
}

.notice {
  margin-top: 28px;
  padding-left: 18px;
  border-left: 4px solid var(--accent);
}

.notice p {
  margin: 0;
}

.hero-photo img {
  width: 100%;
  display: block;
}

.program,
.founder {
  width: 90%;
  max-width: none;
  margin-top: 44px;
}

.founder-with-small-photo {
  width: 90%;
  max-width: 100%;
}

.founder-inline-photo {
  float: right;
  width: 380px;
  margin: 0 0 50px 28px;
  display: block;
}

.founder-inline-photo img {
  width: 100%;
  display: block;
  border-radius: 6px;
}

/* JUBILEUM 25 LET */

.jubilee-viewer {
  width: 90%;
  margin-bottom: 34px;
}

.jubilee-viewer iframe {
  width: 100%;
  max-width: 760px;
  height: 560px;
  display: block;
  border: 0;
  background: white;
  margin-left: auto;
  margin-right: auto;
}

.jubilee-gallery {
  width: 90%;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 18px;
}

.gallery-item {
  display: block;
}

.gallery-item img {
  width: 100%;
  display: block;
  border-radius: 4px;
  transition:
    transform 0.15s ease,
    opacity 0.15s ease;
}

.gallery-item:hover img {
  transform: scale(1.04);
  opacity: 0.85;
}

/* KONTAKT */

.contact-page {
  width: 90%;
  display: grid;
  grid-template-columns: 1fr 260px;
  gap: 44px;
  align-items: start;
}

.contact-text {
  max-width: none;
}

.contact-text h3 {
  margin-top: 0;
}

.contact-photo img {
  width: 230px;
  display: block;
}

.contact-small-image {
  width: 140px;
  display: block;
  margin-top: 24px;
}

/* REFERENCE */

.reference-page {
  width: 90%;
}

.reference-page p {
  max-width: none;
}

.reference-page hr {
  width: 100%;
  margin: 30px 0;
  border: 0;
  border-top: 1px solid rgba(22, 33, 62, 0.22);
}

.reference-poem {
  text-align: center;
  margin-top: 36px;
}

.highlight-red {
  color: red;
}

/* VÝSLEDKY */

.results-page {
  width: 90%;
}

.results-table-wrap {
  width: 100%;
  overflow-x: auto;
}

.results-table-wrap table {
  width: 100%;
  margin-left: auto;
  margin-right: auto;
  border-collapse: separate;
  border-spacing: 0;
}

.results-table-wrap tbody {
  display: block;
  width: 100%;
}

.results-table-wrap tr {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

.results-table-wrap tr:has(h5) {
  display: block;
  margin: 34px 0 8px;
}

.results-table-wrap tr:has(h5) th,
.results-table-wrap tr:has(h5) td {
  display: block;
  padding: 0;
  background: transparent;
}

.results-table-wrap h5 {
  margin: 0;
  color: var(--primary);
  font-size: 26px;
  text-align: center;
}

.results-table-wrap th,
.results-table-wrap td {
  vertical-align: top;
  text-align: center;
}

.results-table-wrap th {
  padding: 10px 18px;
  color: var(--primary);
  font-size: 17px;
}

.results-table-wrap td {
  padding: 18px 22px;
  background: rgba(255, 255, 255, 0.45);
  border-radius: 6px;
}

.results-table-wrap a {
  display: inline-block;
  margin: 3px 0;
  line-height: 1.45;
  text-align: center;
}

/* 2 turnusy */
.results-table-wrap tr:has(> :nth-child(2):last-child):not(:has(h5)) {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* 1 turnus */
.results-table-wrap tr:has(> :first-child:last-child):not(:has(h5)) {
  display: block;
}

.results-table-wrap tr:has(> :first-child:last-child):not(:has(h5)) td,
.results-table-wrap tr:has(> :first-child:last-child):not(:has(h5)) th {
  display: block;
  width: 100%;
}

/* PARTIE */

.games-page {
  width: 90%;
}

.games-page h3 {
  margin-top: 0;
}

.games-viewer {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 42px;
  align-items: start;
  margin-top: 24px;
}

.games-board,
.games-info {
  background: rgba(255, 255, 255, 0.45);
  padding: 22px;
  border-radius: 6px;
}

#GameBoard {
  margin-top: 18px;
}

#GameButtons {
  margin-top: 18px;
  text-align: center;
}

.games-info p {
  margin-top: 0;
}

.label {
  color: var(--primary);
  font-weight: 700;
}

#GameText {
  margin-top: 18px;
  line-height: 1.65;
}

.games-page hr {
  margin: 42px 0;
  border: 0;
  border-top: 1px solid rgba(22, 33, 62, 0.22);
}

.pgn-downloads h3 {
  margin-top: 0;
}

.pgn-links {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
}

.pgn-links a,
.pgn-archive a {
  display: block;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.45);
  border-radius: 6px;
}

.pgn-links a:hover,
.pgn-archive a:hover {
  background: rgba(255, 255, 255, 0.8);
}

.pgn-archive {
  margin-top: 34px;
}

/* FOTOGALERIE */

.photo-page {
  width: 90%;
}

.photo-year {
  margin-bottom: 70px;
}

.photo-viewer {
  margin-bottom: 24px;
  text-align: center;
}

.photo-viewer iframe {
  max-width: 100%;
  display: block;
  margin: 0 auto;
  border: 0;
  background: white;
}

.photo-year h5 {
  margin: 0 0 10px;
  color: var(--primary);
  font-size: 26px;
  text-align: center;
}

.photo-credit {
  text-align: center;
  color: var(--muted);
  font-weight: 700;
}

.photo-gallery {
  margin-top: 22px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 18px;
}

.photo-gallery a {
  display: block;
}

.photo-gallery img {
  width: 100%;
  display: block;
  border-radius: 4px;
  transition:
    transform 0.15s ease,
    opacity 0.15s ease;
}

.photo-gallery a:hover img {
  transform: scale(1.04);
  opacity: 0.85;
}

/* HIGHLIGHT LINK - Contact */

.highlight-link {
  display: inline-block;
  padding: 8px 14px;
  color: var(--primary);
  background: rgba(255, 255, 255, 0.45);
  border-left: 4px solid var(--accent);
  border-radius: 4px;
  font-weight: 700;
}

.highlight-link:hover {
  color: var(--accent);
  background: rgba(255, 255, 255, 0.75);
}

/*//////////////
   RESPONSIVE 
//////////////*/

@media (max-width: 1150px) {
  :root {
    --header-height: auto;
  }

  body {
    font-size: clamp(20px, 2.5vw, 24px);
  }

  .site-layout {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto auto auto;
  }

  .sidebar {
    display: contents;
  }

  .sidebar-logo {
    grid-column: 1;
    grid-row: 1;
    width: clamp(120px, 30vw, 275px);
    margin: clamp(14px, 2vw, 22px) auto clamp(8px, 1.5vw, 14px);
    display: block;
    z-index: 2;
  }

  .top {
    grid-column: 1;
    grid-row: 2;
    grid-template-columns: 1fr;
    gap: clamp(14px, 2.4vw, 24px);
    padding: clamp(16px, 2.4vw, 26px) clamp(18px, 4vw, 40px)
      clamp(22px, 3.2vw, 34px);
    text-align: center;
  }

  .title-area {
    padding: 0;
  }

  .title-area h1 {
    font-size: clamp(32px, 5.5vw, 44px);
    letter-spacing: -0.5px;
  }

  .event-info {
    justify-content: center;
    gap: clamp(8px, 1.8vw, 18px) clamp(14px, 3vw, 28px);
  }

  .top-tools {
    padding-right: 0;
    align-items: center;
  }

  .languages {
    justify-content: center;
  }

  .languages img {
    width: clamp(48px, 7vw, 63px);
    height: auto;
  }

  .menu-toggle {
    grid-column: 1;
    grid-row: 3;
    justify-self: center;
    display: inline-block;
    margin: 18px auto 0;
    padding: 10px 18px;
    color: var(--primary);
    background: transparent;
    border: 0;
    border-radius: 24px;
    box-shadow: inset 0 0 0 2px var(--primary);
    font: inherit;
    font-weight: 700;
    line-height: 1.2;
    cursor: pointer;
  }

  #menu {
    grid-column: 1;
    grid-row: 4;
    width: 100%;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transform: translateY(-8px);
    margin-top: 0;
    padding: 0 clamp(18px, 4vw, 40px);
    background: var(--bg-soft);
    flex-direction: column;
    align-items: center;
    gap: 3px;
    transition:
      max-height 0.28s ease,
      opacity 0.2s ease,
      transform 0.2s ease,
      margin-top 0.2s ease,
      padding-top 0.2s ease,
      padding-bottom 0.2s ease;
  }

  #menu.is-open {
    max-height: 100%;
    opacity: 1;
    transform: translateY(0);
    margin-top: clamp(10px, 1.5vw, 14px);
    padding-top: clamp(16px, 2.4vw, 22px);
    padding-bottom: clamp(20px, 3vw, 28px);
  }

  #menu a {
    padding: clamp(6px, 1vw, 9px) 0;
    font-size: clamp(18px, 2.3vw, 21px);
  }

  #menu a.toplist {
    display: none;
  }

  .content {
    grid-column: 1;
    grid-row: 5;
    padding: clamp(26px, 4vw, 40px) clamp(18px, 4vw, 48px)
      clamp(44px, 6vw, 64px);
  }

  .content h2 {
    font-size: clamp(30px, 5vw, 36px);
    text-align: center;
  }

  .home-hero,
  .program,
  .founder,
  .jubilee-viewer,
  .jubilee-gallery,
  .contact-page,
  .reference-page,
  .results-page,
  .games-page,
  .photo-page {
    width: 100%;
  }

  .home-hero {
    grid-template-columns: 1fr;
    gap: clamp(24px, 4vw, 44px);
  }

  .hero-photo {
    max-width: min(420px, 100%);
    margin: 0 auto;
  }

  .founder-with-photo {
    grid-template-columns: 1fr;
  }

  .founder-inline-photo {
    display: none;
  }

  .notice {
    margin-top: clamp(22px, 3vw, 30px);
  }

  .contact-page {
    grid-template-columns: 1fr;
    gap: clamp(28px, 4vw, 44px);
  }

  .contact-photo {
    order: -1;
    text-align: center;
  }

  .contact-photo img {
    margin: 0 auto;
  }

  .games-viewer {
    grid-template-columns: 1fr;
    gap: clamp(22px, 3vw, 28px);
  }

  .games-board,
  .games-info {
    padding: clamp(16px, 3vw, 22px);
    overflow-x: auto;
  }

  .games-board {
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
  }

  .pgn-links {
    grid-template-columns: repeat(auto-fill, minmax(min(160px, 100%), 1fr));
  }

  .photo-gallery,
  .jubilee-gallery {
    grid-template-columns: repeat(
      auto-fill,
      minmax(clamp(82px, 14vw, 110px), 1fr)
    );
    gap: clamp(12px, 2vw, 18px);
  }

  .photo-viewer iframe,
  .jubilee-viewer iframe {
    width: 100%;
  }
}

/* 560 */

@media (max-width: 560px) {
  .event-info,
  .home-dates {
    flex-direction: column;
    gap: 4px;
  }

  .results-table-wrap tr {
    grid-template-columns: 1fr;
  }

  .results-table-wrap tr:has(> :nth-child(2):last-child):not(:has(h5)) {
    grid-template-columns: 1fr;
  }

  .results-table-wrap th,
  .results-table-wrap td {
    padding: 14px 16px;
  }

  .games-viewer {
    overflow-x: visible;
  }

  .games-board,
  .games-info,
  #GameText {
    overflow-x: auto;
  }
}
