/* All tunable values live in config.css — edit there. */

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

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: "Cutive Mono", ui-monospace, Menlo, Monaco, "Courier New", monospace;
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
}

.site-header {
  padding: var(--header-padding);
  position: relative;
  z-index: 2;
}

.logo {
  display: inline-block;
  font-size: var(--logo-size);
  color: var(--fg);
  text-decoration: none;
  line-height: 1;
}

.stage {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.stack {
  position: relative;
  width: var(--card-width);
  height: var(--card-height);
  transform-style: preserve-3d;
  transform:
    translate(var(--stack-shift-x), var(--stack-shift-y))
    rotateX(var(--tilt-x))
    rotateY(var(--tilt-y))
    rotateZ(var(--tilt-z))
    translateZ(calc((var(--card-count) - 1) * var(--card-gap) / 2));
  will-change: transform;
}

.card {
  position: absolute;
  inset: 0;
  transform:
    translateY(var(--lift-y, 0px))
    translateZ(calc(
      0px
      - var(--i) * var(--card-gap)
      + var(--offset-sign, 0) * var(--spread-amount)
    ));
  transition: transform var(--spread-speed) cubic-bezier(0.2, 0.8, 0.2, 1);
  background: hsl(
    calc(var(--card-hue-start) * 1deg + var(--i) * var(--card-hue-step) * 1deg)
    var(--card-saturation)
    var(--card-lightness)
  );
  box-shadow: 0 0 0 1px var(--card-edge);
  overflow: hidden;
  cursor: pointer;
}

.card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.card-close {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  background: rgba(255, 255, 255, 0.92);
  color: #111;
  font: 22px/1 inherit;
  font-family: inherit;
  cursor: pointer;
  display: none;
  z-index: 1;
}

.card.is-selected .card-close {
  display: block;
}

/* A card that leads to a live page opens it instead of the image viewer, so it
   has to say so — otherwise the second click goes somewhere unannounced. */
.card[data-link].is-selected::after {
  content: "open ↗";
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 3px 8px;
  background: rgba(255, 255, 255, 0.92);
  color: #111;
  font-size: 11px;
  letter-spacing: 0.04em;
  z-index: 1;
}

.foreground {
  position: fixed;
  inset: 0;
  background: var(--foreground-overlay);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: var(--foreground-bottom-margin);
  z-index: 10;
}

.foreground[hidden] {
  display: none;
}

.foreground-side {
  position: absolute;
  left: 100%;
  bottom: 0;
  margin-left: var(--foreground-gap);
  width: var(--foreground-info-width);
  display: flex;
  flex-direction: column;
  gap: var(--foreground-side-gap);
}

.foreground-info {
  color: var(--fg);
  font-size: 14px;
  line-height: 1.55;
}

.foreground-thumbs {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--foreground-thumb-gap);
}

.foreground-thumb {
  cursor: pointer;
  line-height: 0;
  aspect-ratio: 1 / 1;
  outline: 1px solid var(--card-edge);
}

.foreground-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.foreground-info h2 {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 500;
}

.foreground-info p {
  margin: 0 0 8px;
}

.foreground-meta {
  color: #777;
  font-size: 12px;
  margin-top: 16px !important;
}

.foreground-frame {
  position: relative;
  background: hsl(
    calc(var(--card-hue-start) * 1deg + var(--i, 0) * var(--card-hue-step) * 1deg)
    var(--card-saturation)
    var(--card-lightness)
  );
  box-shadow: 0 0 0 1px var(--card-edge);
}

/* Fallback dimensions when there's no image (placeholder cards). */
.foreground-frame:not(:has(.foreground-img:not([hidden]))) {
  width: var(--foreground-size);
  height: calc(var(--foreground-size) * var(--card-height) / var(--card-width));
}

.foreground-img {
  display: block;
  max-width: var(--locked-width, var(--foreground-size));
  max-height: var(--foreground-max-height);
}

.foreground-img[hidden] {
  display: none;
}

.foreground-close {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 26px;
  height: 26px;
  padding: 0;
  border: none;
  background: rgba(255, 255, 255, 0.92);
  color: #111;
  font: 22px/1 inherit;
  font-family: inherit;
  cursor: pointer;
}

.categories {
  position: absolute;
  top: var(--categories-top);
  right: var(--categories-right);
  text-align: right;
  font-size: var(--categories-size);
  color: var(--categories-color);
  z-index: 2;
}

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

.categories li {
  line-height: 1.55;
  cursor: pointer;
  transition: color 200ms;
}

.categories li:hover {
  color: var(--fg);
}

.categories li.is-active {
  color: var(--fg);
  font-weight: 500;
}
