/*
 * sachamorzy.com, NESTJS-PLAN N5. Loaded after bootstrap.min.css and sachamorzy.css (the old
 * css/style.css, unchanged):
 *   1. what the old css/overload.php (dark pages) and css/overload_perf.php (light pages) wrote
 *      into every page, from the settings: the fonts and the page style's colours now arrive as
 *      CSS variables on .page-style (apps/web/src/components/sachamorzy.tsx);
 *   2. styles for the new markup (logo outside <h1>, links inside the tiles, js/functions.js);
 *   3. the minor fixes of sachamorzy.com SPEC section 10 (phones, keyboard focus, images).
 */

/* ---------------- 1. Settings (was css/overload.php and css/overload_perf.php) ---------------- */
.page-style {
  min-height: 100vh;
  background-color: var(--bg);
  color: var(--text);
}
/* FONT 1 */
#main-contact,
.subcategory-list-item,
.list-projects .list-group-item p,
.project-second-title,
.project-content,
.scrollTop,
.typo1 {
  font-family: var(--font1);
}
/* FONT 2 */
.list-projects .list-group-item h2,
.project-title,
.list-proj-item,
.list-proj-item a,
.typo2 {
  font-family: var(--font2);
}
/* FONT 3 */
.sidebar-nav .panel-group .first-heading .panel-title a,
.typo3 {
  font-family: var(--font3);
}
/* COLOR 1 */
.list-projects .list-group-item h2,
.project-title,
#contact-mail,
#contact-phone,
.project-content .contact {
  color: var(--c1) !important;
}
/* COLOR 2 */
.list-proj-item,
.list-proj-item a,
.subcategory-list-item,
.list-projects .list-group-item p,
.project-second-title,
.project-content,
.scrollTop,
.list-videos .typo1 {
  color: var(--c2) !important;
}
/* COLOR 3 */
.list-proj-item a:hover,
.list-proj-item a.active,
.subcategory-list-item:hover,
.subcategory-list-item.active,
.list-projects .list-group-item:hover p,
.scrollTop:hover,
.scrollTop:focus {
  color: var(--c3) !important;
}

/* ---------------- 2. New markup ---------------- */
/* The logo is no longer a heading (one <h1> per page); it keeps the old <h1>'s line box. */
header .site-logo {
  margin: 0;
  font-size: 36px;
  line-height: 1.1;
}
.sidebar-nav .panel-title {
  display: block;
}
/* The tile's link is inside the tile now (the old <a> around <li> was invalid HTML). */
.list-projects .list-group-item > a {
  display: block;
  color: inherit;
  text-decoration: none;
}
/* The tiles of a row get the same height (was js/functions.js). */
.list-projects {
  display: flex;
  flex-wrap: wrap;
  column-gap: 4px;
}
/* Texts that were <p> and are blocks of HTML now keep the paragraph's spacing. */
.project-content,
.list-videos .video-description {
  margin: 0 0 10px;
}
.aspect-ratio iframe {
  border: 0;
}
/* "Back to top" is a link now. */
.scrollTop:hover,
.scrollTop:focus {
  text-decoration: none;
}
html {
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}

/* ---------------- 3. Fixes (SPEC section 10) ---------------- */
/* A thumbnail that isn't square is cropped instead of stretched. */
.list-group-item img {
  object-fit: cover;
}
/* A visible focus ring for keyboard users. */
a:focus-visible,
button:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}
@media (max-width: 767px) {
  #main-logo {
    max-width: 100%;
    height: auto;
  }
  /* The six tabs wrap on 2 rows instead of making every page scroll sideways. */
  .panel-group.table-display {
    display: flex;
    flex-wrap: wrap;
  }
  .panel-group.table-display a {
    display: block;
    flex: 1 1 auto;
    width: auto;
    font-size: 16px;
  }
  .panel-group.table-display .panel-heading {
    padding: 8px 6px;
  }
  /* Two tiles per row, as wide as the screen allows (was one 218 px tile per row). */
  .list-projects {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 12px;
  }
  .list-projects .list-group-item {
    padding: 0;
  }
  .list-projects .list-group-item img {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
  }
  .list-projects .list-group-item h2 {
    max-width: none;
    margin: 10px 0 4px;
    font-size: 15px;
  }
  .list-projects .list-group-item p {
    width: auto;
    margin: 0;
    font-size: 15px;
  }
}
