:root {
  --paper: #ece7d7;
  --ink: #11110f;
  --yellow: #fdb913;
  --green: #006a44;
  --red: #c1272d;

  --scarf-rack-width: min(32vw, 430px);
  --scarf-gap: 6px;
  --scarf-top: 14px;
  --scarf-right: 12px;
  --scarf-z: 3000;
}

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

html,
body {
  margin: 0;
  padding: 0;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

img,
video {
  display: block;
  max-width: 100%;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
}

.page-shell {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--paper);
}

.scarf-rack {
  position: fixed;
  top: var(--scarf-top);
  right: var(--scarf-right);
  z-index: var(--scarf-z);

  display: flex;
  flex-direction: column;
  align-items: flex-end;

  gap: var(--scarf-gap);

  width: var(--scarf-rack-width);

  overflow: visible;
}

.scarf-item {
  position: relative;
  display: block;
  flex: 0 0 auto;

  width: 100%;

  height:
    clamp(
      68px,
      calc((100dvh - 82px) / 8),
      106px
    );

  transform-origin: right center;

  transition:
    transform
    220ms
    cubic-bezier(.2, .8, .2, 1);
}

.scarf-item img {
  width: 100%;
  height: 100%;

  object-fit: contain;
  object-position: right center;

  filter:
    drop-shadow(
      0
      2px
      1px
      rgba(17, 17, 15, .06)
    );
}

.scarf-home {
  transform: scale(1.045);
}

@media (hover: hover) and (pointer: fine) {
  .scarf-item:hover {
    z-index: 4;

    transform:
      translateX(-18px)
      rotate(-.5deg)
      scale(1.025);
  }

  .scarf-home:hover {
    transform:
      translateX(-18px)
      rotate(-.5deg)
      scale(1.06);
  }
}

@media (max-width: 1240px) {
  .scarf-rack {
    top:
      calc(
        10px +
        env(safe-area-inset-top)
      );

    left: 0;
    right: 0;

    flex-direction: row;
    align-items: center;

    width: 100%;
    max-width: 100vw;

    gap: 6px;

    padding:
      4px
      calc(18px + env(safe-area-inset-right))
      12px
      calc(18px + env(safe-area-inset-left));

    overflow-x: auto;
    overflow-y: hidden;

    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }

  .scarf-rack::-webkit-scrollbar {
    display: none;
  }

  .scarf-item,
  .scarf-home {
    flex: 0 0 auto;

    width: min(29vw, 290px);
    height: 78px;

    transform: none;
  }

  .scarf-item img {
    width: 100%;
    height: 100%;

    object-fit: contain;
    object-position: center;
  }

  .scarf-item:hover,
  .scarf-home:hover {
    transform: none;
  }
}

@media (max-width: 700px) {
  .scarf-rack {
    gap: 5px;

    padding:
      calc(8px + env(safe-area-inset-top))
      10px
      8px;
  }

  .scarf-item,
  .scarf-home {
    width: min(56vw, 240px);
    height: 68px;
  }
}

/* unfinished pages overlay */

.wip-overlay {
  position: fixed;
  inset: 0;
  z-index: 99999;

  display: flex;
  align-items: center;
  justify-content: center;

  min-height: 100vh;
  min-height: 100dvh;

  padding:
    calc(28px + env(safe-area-inset-top))
    calc(28px + env(safe-area-inset-right))
    calc(28px + env(safe-area-inset-bottom))
    calc(28px + env(safe-area-inset-left));

  overflow: auto;

  background: var(--paper);

  opacity: 0;
  visibility: hidden;
  pointer-events: none;

  transition:
    opacity 160ms ease,
    visibility 160ms ease;
}

.wip-overlay.is-visible {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.wip-inner {
  width: min(92vw, 700px);

  display: flex;
  flex-direction: column;
  align-items: center;
}

.wip-header {
  position: relative;
  z-index: 2;

  width: min(69vh, 680px, 88vw);

  display: flex;
  align-items: stretch;

  background: var(--paper);

  border: 1px solid rgba(17, 17, 15, .46);
}

.wip-text {
  flex: 1 1 auto;
  min-width: 0;

  margin: 0;

  padding:
    14px
    19px
    15px;

  color: var(--ink);

  font-size:
    clamp(
      19px,
      1.65vw,
      26px
    );

  font-weight: 700;
  line-height: 1;
  letter-spacing: -.045em;
}

.wip-close {
  flex: 0 0 52px;

  width: 52px;

  margin: 0;
  padding: 0;

  border: 0;
  border-left: 1px solid rgba(17, 17, 15, .46);

  background: transparent;
  color: var(--ink);

  font-family: Helvetica, Arial, sans-serif;

  font-size: 34px;
  line-height: 1;

  cursor: pointer;
}

@media (hover: hover) and (pointer: fine) {
  .wip-close:hover {
    background: var(--ink);
    color: var(--paper);
  }
}

.collage-stage {
  position: relative;

  width: min(69vh, 680px, 88vw);
  aspect-ratio: 1 / 1;

  overflow: hidden;

  opacity: 0;

  transition:
    opacity
    900ms
    ease;
}

.collage-stage.is-revealed {
  opacity: 1;
}

.horse {
  position: absolute;
  inset: 0;

  width: 100%;
  height: 100%;

  object-fit: cover;

  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
}

@media (max-width: 700px) {
  .wip-overlay {
    padding:
      calc(18px + env(safe-area-inset-top))
      calc(12px + env(safe-area-inset-right))
      calc(18px + env(safe-area-inset-bottom))
      calc(12px + env(safe-area-inset-left));
  }

  .wip-inner {
    width: 94vw;
  }

  .wip-header,
  .collage-stage {
    width: min(82vh, 94vw);
  }

  .wip-text {
    padding: 12px 13px;
    font-size: 17px;
  }

  .wip-close {
    flex-basis: 47px;
    width: 47px;
    font-size: 31px;
  }
}
