/* =========================================================
   RESET
========================================================= */

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

/* =========================================================
   DESIGN TOKENS
========================================================= */

:root {
  --color-bg: #bababa;
  --color-bg2: #d2e4f0;

  --color-text: #4b4039;
  --color-highlight: #b3fa9b;

  --color-sub: #805a5a;
  --color-sub2: #e97645;
  --color-sub3: #0022ff;

  --color-credits: #555;

  --font: "Helvetica Neue", Helvetica, Arial, sans-serif;

  --text-xs: 11px;
  --text-s: 12px;
  --text-m: 14px;
  --text-l: 1rem;

  --gap: 5px;
  --gap-grid: 160px;

  --pad-page: 1rem;
  --pad-nav: 0.5rem 1rem;

  --grid-cols: 4;
  --project-cols: 3;
}

/* =========================================================
   GLOBAL
========================================================= */

::selection {
  background: var(--color-highlight);
}

html,
body {
  font-family: var(--font);
  font-size: var(--text-m);
  font-weight: 400;
  background: var(--color-bg);
  color: var(--color-text);
}

/* =========================================================
   LINKS
========================================================= */

a {
  color: var(--color-text);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* =========================================================
   PAGE LAYOUT
========================================================= */

.page-wrap {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 1rem;
}

main {
  flex: 1;
}

/* =========================================================
   NAVIGATION
========================================================= */

nav {
  position: sticky;
  top: 0px;
  z-index: 100;

  display: flex;
  flex-wrap: nowrap;
  align-items: baseline;
  gap: 2rem;

  padding-bottom: 1rem;

  background: var(--color-bg);
  border-bottom: 1px dotted var(--color-text);
}

.site-name {
  white-space: nowrap;
}

.nav-links {
  line-height: 1.8;
}

.nav-links a {
  display: inline;
}

.nav-links .cat {
  font-size: var(--text-l);
  cursor: pointer;
}

.nav-sub {
  display: none;
}

.nav-sub.open {
  display: inline;
}

.nav-sub a {
  color: var(--color-sub);
}

.nav-sub .nav-sub a {
  font-style: italic;
  color: var(--color-sub2);
}

.nav-links a.active {
  background-color: var(--color-highlight);
}

/* =========================================================
   BUTTONS
========================================================= */

.btn-group {
  margin-left: auto;
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

#shuffle-colors,
#shuffle-grid,
#toggle-grid {
  background: var(--color-bg);
  border: 1px solid var(--color-text);
  color: var(--color-text);
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  font-family: inherit;
  font-size: var(--text-s);
}

#shuffle-colors:hover,
#shuffle-grid:hover,
#toggle-grid:hover {
  border-color: var(--color-highlight);
}

/* =========================================================
   NOTE
========================================================= */

.note {
  position: fixed;
  bottom: 1rem;
  right: 1rem;
  z-index: 999;
  color: var(--color-text);
  padding: 0.25rem 0.5rem;
  font-family: inherit;
  font-size: var(--text-s);
}

/* =========================================================
   IMAGE GRID — grid-styling
========================================================= */

.grid-styling {
  display: flex;
  flex-wrap: wrap;
  gap: var(--gap-grid);
  align-items: flex-start;
}

/* --- figure (pages with captions) --- */

.grid-styling figure {
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  flex-basis: calc(25% - var(--gap));
  display: flex;
  flex-direction: column;
}

/* random sizes */
.grid-styling figure.s {
  flex-basis: 12%;
}
.grid-styling figure.m {
  flex-basis: 20%;
}
.grid-styling figure.l {
  flex-basis: 26%;
}
.grid-styling figure.xl {
  flex-basis: 36%;
}

/* random margins */
.grid-styling figure.gap-s {
  margin: 2px;
}
.grid-styling figure.gap-m {
  margin: 8px;
}
.grid-styling figure.gap-l {
  margin: 20px;
}

.grid-styling figure img {
  display: block;
  width: 100%;
  flex: 1;
  min-height: 0;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border: 1px solid var(--color-text);
  cursor:
    url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32'><text y='24' font-size='20' fill='%230022ff'>❀</text></svg>")
      16 16,
    auto;
}

.grid-styling figure img:hover {
  border-color: var(--color-highlight);
}

.grid-styling figure img.zoomed {
  transform: scale(3);
}

/* caption */
.grid-styling figcaption {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0.5rem;
  font-size: var(--text-s);
  color: var(--color-text);
  background: var(--color-bg);
  border: 1px dotted var(--color-text);
  opacity: 0;
  transform: translateY(100%);
  pointer-events: none;
}

.grid-styling figure:hover figcaption {
  opacity: 1;
  transform: translateY(0);
}

/* --- img-wrap (pages without captions) --- */

.img-wrap {
  position: relative;
  overflow: hidden;
  flex-shrink: 0;
  flex-basis: calc(25% - var(--gap));
}

/* random sizes */
.img-wrap.s {
  flex-basis: 12%;
}
.img-wrap.m {
  flex-basis: 22%;
}
.img-wrap.l {
  flex-basis: 34%;
}
.img-wrap.xl {
  flex-basis: 46%;
}

/* random margins */
.img-wrap.gap-s {
  margin: 2px;
}
.img-wrap.gap-m {
  margin: 8px;
}
.img-wrap.gap-l {
  margin: 20px;
}

.img-wrap img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: cover;
  border: 1px solid var(--color-text);
  cursor:
    url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='32' height='32'><text y='24' font-size='20' fill='%230022ff'>❀</text></svg>")
      16 16,
    auto;
  transform: scale(1);
  transform-origin: center center;
  will-change: transform;
}

.img-wrap img.zoomed {
  transform: scale(3);
}

.img-wrap img:hover {
  border-color: var(--color-highlight);
}

/* =========================================================
   UNIFORM GRID
========================================================= */

.grid-styling.uniform-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

/* override random sizes/margins in grid mode */
.grid-styling.uniform-grid figure,
.grid-styling.uniform-grid .img-wrap {
  flex-basis: auto;
  margin: 0;
}

/* =========================================================
   TEXT PAGES
========================================================= */

.text-page {
  max-width: 600px;
  padding-top: 1rem;
}

.text-page p {
  padding-bottom: 1rem;
}

.credits {
  font-size: var(--text-s);
  color: var(--color-highlight);
}

.about-main {
  display: flex;
  flex-direction: row;
  gap: 2rem;
}

.list-services {
  list-style: none;
  min-width: 200px;
}

/* =========================================================
   HOMEPAGE
========================================================= */

.homepage-img img {
  display: block;
  padding-top: 5rem;
  margin-left: auto;
  margin-right: auto;
  width: 100%;
}

/* =========================================================
   RESPONSIVE
========================================================= */

/* tablet */
@media (max-width: 1000px) {
  
  body {
    margin-bottom: 6rem;
  }

  .grid-styling {
    gap: var(--gap);
  }

  .grid-styling figure,
  .img-wrap {
    flex-basis: calc(50% - var(--gap)) !important;
  }

  .grid-styling figcaption {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
  }
}

/* mobile */
@media (max-width: 600px) {

  body {
    margin-bottom: 6rem;
  }

  .nav-links {
    margin-top: 10px;
  }

  .grid-styling {
    gap: var(--gap);
  }

  .grid-styling figure,
  .img-wrap {
    flex-basis: 100% !important;
    margin: 0 0 var(--gap) 0 !important;
  }

  .grid-styling figcaption {
    position: static;
    opacity: 1;
    transform: none;
    pointer-events: auto;
    border-top: none;
  }

  .btn-group {
    position: fixed;
    bottom: 2rem;
    right: 1rem;
    margin-left: 0;
    z-index: 999;
  }

  .note {
    bottom: 4rem;
  }

  .about-main {
    flex-wrap: wrap;
  }
}