:root {
  color-scheme: light dark;

  --primary: light-dark(#274c77ff, #5192dd);
  --accent: light-dark(#00abe7ff, #00abe7ff);
  --success: light-dark(#60d394ff, #60d394ff);
  --danger: light-dark(#ee6055ff, #ee6055ff);
  --background: light-dark(#fffdfdff, #fffdfdff);

  --hero-text: light-dark(#000000, #000000);
  --menu-hover-bg: light-dark(#f5f5f5, #77777726);
  --footer-title: light-dark(#1e1e1e, #d7d7d7);
  --footer-contact: light-dark(#383838, #c6c6c6);
  --news-subtitle: light-dark(#383838, #c6c6c6);
  --gallery-title: light-dark(#000000, #ffffff);
  --gallery-title-bg: light-dark(rgba(255, 255, 255, 0.6), rgba(8, 8, 8, 0.6));
  --event-subtitle: light-dark(#383838, #c6c6c6);

  --text-color: light-dark(#000000, #ffffff);
  --background-color: light-dark(#ffffff, #1c1b22);
  --border-line: light-dark(#d9d9d9, #444);
  --link-color: var(--primary);
  --link-hover-color: var(--accent);

  --button-text: light-dark(#ffffff, #ffffff);
  --button-bg: var(--primary);
  --button-hover-text: light-dark(#ffffff, #ffffff);
  --button-hover-bg: var(--accent);

  --sidebar-width: 232px;
}

*,
::before,
::after {
  box-sizing: border-box;
}

html {
  font-family:
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    system-ui,
    Roboto,
    "Helvetica Neue",
    Arial,
    sans-serif,
    Apple Color Emoji,
    "Segoe UI Emoji",
    "Segoe UI Symbol",
    "Noto Color Emoji";
}

body {
  color: var(--text-color);
  background-color: var(--background-color);
  min-height: 100vh;
  max-width: 864px;
  margin: 0 auto;
}

a {
  color: var(--link-color);

  &:hover {
    color: var(--link-hover-color);
  }
}

p {
  text-align: justify;
}

.skip-link {
  position: absolute;
  top: -30px;
}

.skip-link:focus-visible {
  top: 5px;
}

#page-content {
  padding: 0 1rem;
}

.right {
  float: right;
  margin: 0 0 0.4rem 1rem;
}

.left {
  float: left;
  margin: 0 1rem 0.4rem 0;
}

/* Search */

#search-page {
  padding: 2rem 1rem;

  h1 {
    margin-top: 0;
  }
}

#search-form {
  margin-bottom: 1rem;
}

#search-input {
  width: 80%;
  min-width: 160px;
  max-width: 300px;
}

/* Navigation */

.logo-container {
}

#logo-main {
  max-width: 64px;
}

#logo-side {
  max-width: 64px;
}

#main-header {
  clear: both;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  padding: 32px 32px;
  border-bottom: solid 1px var(--border-line);
}

nav ul {
  list-style-type: none;
  display: flex;
  gap: 8px;
  margin: 0;
  padding: 0;

  a {
    display: block;
    color: var(--link-color);
    padding: 8px 12px;
    border-radius: 8px;
    text-decoration: none;
  }

  a:hover {
    background-color: var(--menu-hover-bg);
  }
}

#main-nav {
}

#nav-toggle {
  display: none;
}

#sidebar {
  display: none;

  ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
  }

  a {
    display: block;
    color: var(--link-color);
    padding: 8px 12px;
    border-radius: 8px;
    text-decoration: none;
  }

  a:hover {
    background-color: var(--menu-hover-bg);
  }
}

/* Button */

button,
.button {
  padding: 8px;
  border-radius: 8px;
  border: 0px;
  color: var(--button-text);
  background-color: var(--button-bg);
  text-decoration: none;
  text-align: center;

  &:hover {
    color: var(--button-hover-text);
    background-color: var(--button-hover-bg);
  }
}

/* Footer */

footer {
  clear: both;
  border-top: solid 2px var(--border-line);
  padding: 32px;
  display: flex;
  flex-direction: row;

  a {
    text-decoration: none;
  }
}

#footer_start {
}

#footer_main {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  justify-items: center;
  gap: 20px;
  flex: 1 1 auto;
}

#footer_socials {
  display: flex;
  flex-flow: row wrap;
  gap: 12px;
  align-items: center;
  margin: 12px 0;
  font-size: 1.4rem;
}

.footer_column {
  h1 {
    margin: 0;
    margin-bottom: 24px;
    color: var(--footer-title);
    font-size: 1.6rem;
  }

  ul {
    list-style-type: none;
    margin: 0;
    padding: 0;

    li {
      margin-bottom: 12px;
    }
  }
}

.footer_contact_col {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.footer_contact li {
  margin-bottom: 4px;
  color: var(--footer-contact);
}

/* Home sections */

.home-section {
  padding: 12px;

  .home-section-title {
    margin: 0;
    font-size: 2rem;
  }

  .home-section-footer {
    display: flex;
    flex-direction: row;
    justify-content: flex-end;
  }
}

/* Hero  */

.hero-section {
  position: relative;
  display: block;
  width: 100%;
  max-height: 400px;
  overflow: hidden;
}

.hero-section img {
  width: 100%;
  height: auto;
  display: block;
  filter: opacity(0.7);
  object-fit: cover;
  object-position: center;
}

.hero-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
  color: var(--hero-text);
  z-index: 2;
  font-size: min(1.8rem, 3.3vw);
  font-weight: 500;
  width: 90%;

  p {
    text-align: center;
  }
}

/* News item */

.news-section {
  padding: 12px;
}

.news-section-footer {
}

.news-item {
  border: solid 1px var(--border-line);
  border-radius: 12px;
  padding: 12px;
  /* box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); */
  margin: 20px auto;
  display: flex;
  gap: 16px;

  img {
    flex-shrink: 0;
    width: 120px;
    max-height: 120px;
    object-fit: cover;
  }
}

.news-item-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  text-align: start;

  h1 {
    font-size: 1.6rem;
    font-weight: 600;
    margin: 0 0 8px 0;
    line-height: 1.3;

    a {
      text-decoration: none;
    }
  }

  p {
    font-size: 1.2rem;
    line-height: 1.4;
    margin: 0 0 16px 0;
    flex-grow: 1;
    color: var(--news-subtitle);
  }
}

.news-item-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.news-item-footer.no-button {
  justify-content: flex-end;
}

.news-button {
}

.news-timestamp {
  font-size: 1rem;
}

/* News detail */

.news-detail {
  display: flex;
  flex-direction: column;
  padding: 0.4rem 1rem;

  .news-title {
    margin: 0;
  }

  .news-detail-timestamp {
    color: var(--news-subtitle);
  }

  img {
    margin: 12px 0;
    width: 100%;
    max-height: 480px;
    display: block;
    object-fit: cover;
    object-position: center;
  }
}

/* Gallery preview */

.gallery-section-content {
  display: flex;
  flex-flow: row wrap;
  gap: 12px;
  align-items: center;
  justify-content: center;
  padding: 12px 0;
}

.gallery-item-preview {
  position: relative;

  a {
    text-decoration: none;
  }

  h1 {
    margin: 0;
    font-size: 1.6rem;
    color: var(--gallery-title);
    padding: 8px 12px;

    position: absolute;
    bottom: 1rem;
    width: 100%;
    background-color: var(--gallery-title-bg);
  }

  img {
    display: block;
  }
}

/* Showcase */

.showcase-title {
  text-align: center;
}

.showcase-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  align-items: center;
  gap: 0 12px;
  margin: 12px 0;

  .showcase-side {
    padding: 24px;
  }

  img {
    height: auto;
    width: 100%;
    object-fit: cover;
    object-position: center;
  }
}

.showcase-row:nth-child(even) {
  .showcase-side {
    order: -1;
    padding: 12px;
  }
}

/* Events */

.events-preview-row {
  display: flex;
  flex-flow: row wrap;
  gap: 0.6rem;
  justify-content: space-around;
  margin: 0.8rem 0;
}

.event-item {
  border: solid 1px var(--border-line);
  border-radius: 12px;
  padding: 12px;
  /* box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1); */
  max-width: 268px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;

  h1 {
    font-size: 1.4rem;
    font-weight: 600;
    margin: 0 0 0.4rem 0;
    padding-bottom: 0.4rem;
    line-height: 1.3;
    border-bottom: solid 1px var(--border-line);
    text-align: center;
  }

  .event-item-time {
    margin-bottom: 0.4rem;
    text-align: center;
  }

  h2 {
    font-size: 1.2rem;
    font-weight: 600;
    margin: 0;
    line-height: 1.3;
  }

  a {
    text-decoration: none;
  }

  p {
    line-height: 1.4;
    margin: 0;
    flex-grow: 1;
    color: var(--event-subtitle);
  }

  .button {
    margin-top: 0.4rem;
    width: 100%;
  }
}

@media (max-width: 768px) {
  #main-nav {
    display: none;
  }

  #nav-toggle:checked {
    & ~ #nav-content {
      width: var(--sidebar-width);
      opacity: 1;
    }
  }

  #nav-content {
    opacity: 0;
    overflow: hidden;
    width: 0px;
    transition:
      opacity 0.3s,
      width 0.4s;

    ul {
      width: var(--sidebar-width);

      li {
        border-bottom: solid 1px var(--border-line);
      }

      a {
        padding: 12px 12px;
      }

      a:hover {
        border-radius: 0px;
      }
    }
  }

  label[for="nav-toggle"] {
    padding: 1rem;
    font-size: 2rem;
    text-align: center;
    cursor: pointer;
    background-color: var(--button-bg);
    color: var(--button-text);
    width: fit-content;
    height: 100%;
    float: right;

    display: flex;
    flex-direction: column-reverse;
    justify-content: space-between;

    &:hover {
      background-color: var(--button-hover-bg);
      color: var(--button-hover-text);
    }
  }

  main,
  footer {
    margin-left: 4rem;
  }

  #sidebar {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    background-color: var(--background-color);
    border-right: solid 2px var(--border-line);
    height: 100%;
    z-index: 10;
  }

  #logo-main {
    max-width: 2rem;
  }

  #main-header {
    display: none;
    /* flex-direction: column; */
    /* gap: 16px; */
    /* padding: 16px; */
  }

  nav ul {
    flex-direction: column;
    text-align: center;
    width: 100%;
  }

  #user-menu {
    display: flex;
    gap: 8px;
  }

  .showcase-row {
    grid-template-columns: 1fr;
    gap: 0;
    margin-bottom: 2rem;

    h2 {
      margin-top: 0;
    }
  }

  .showcase-row:nth-child(odd) {
    .showcase-side {
      padding: 12px;
    }
  }

  .showcase-row:nth-child(even) .showcase-side {
    order: 0;
  }

  footer {
    flex-direction: column;
  }

  #footer_start {
    align-self: center;
    margin-bottom: 1rem;
  }

  #footer_main {
    grid-template-columns: 1fr;
    gap: 32px;
  }

  .footer_column {
    width: 100%;
    text-align: center;
  }

  .footer_contact {
    margin-top: 16px;
  }
}

@media (max-width: 480px) {
  .news-item {
    flex-direction: column;
    padding: 16px;
  }

  .news-item-footer {
    justify-content: flex-start;
    gap: 2vw;
  }

  .news-item-footer.no-button {
    justify-content: flex-start;
  }

  .news-image {
    width: 100%;
    height: 150px;
  }
}
