/* The telescope menu: a closed brass telescope on a black page is the Menu button; its draw tubes slide out and carry
   the sections of the site. The shading of every tube is a gradient across it that the script works out from the
   tube's turn, so the light runs round the brass. Lengths and positions come from the script too. */
:root {
  --page: #000000;          /* the page */
  --brass: #b4873a;         /* the brass of the tubes */
  --leather: #4a2c1c;       /* the leather round the body */
  --gilt: #dcb873;          /* the gold lettering on the leather, and the sections beside the tubes on a phone */
  --engrave: #3b2609;       /* the sections engraved on the tubes */
  --ring: #f2d79a;          /* the ring of the focus */
}

* {
  box-sizing: border-box;
}

html {
  touch-action: manipulation;
}

html,
body {
  margin: 0;
  overflow-x: clip;
}

body {
  min-height: 100svh;
  background: var(--page);
  color: var(--gilt);
  font-family: 'Fraunces Variable', Georgia, serif;
  -webkit-font-smoothing: antialiased;
}

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

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

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.stage {
  min-height: 100svh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  padding: 40px 16px;
  /* chiuso, sul telefono, il cannocchiale sta al centro e la sua cornice scende più giù della pagina: non deve
     allungarla */
  overflow-y: clip;
}

/* ---------------------------------------------------------------- the telescope */
/* the room the telescope needs fully drawn out; the script sets its size for the orientation (along the page on a
   computer, down it on a phone) and slides the rig so that the telescope stays centred as it grows */
.scope {
  --cross: 80px;
  position: relative;
  width: 742px;
  height: var(--cross);
}

.scope__rig {
  position: absolute;
  inset: 0;
}

.scope__tubes {
  position: absolute;
  inset: 0;
}

/* ---------------------------------------------------------------- one draw tube */
.tube {
  position: absolute;
  left: 0;
  top: calc(var(--cross) / 2 - var(--d) / 2 - 3px);
  width: calc(var(--len) + var(--eye, 0px));
  height: calc(var(--d) + 6px);
  will-change: transform;
}

.tube__link {
  position: absolute;
  inset: 0;
  display: block;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

.tube__shell {
  position: absolute;
  left: 0;
  top: 3px;
  width: var(--len);
  height: var(--d);
  border-radius: 1.5px;
  background: var(--brass);
  box-shadow: 0 6px 14px -6px rgba(0, 0, 0, 0.9);
}

/* the collar at the mouth of the tube, a little wider, knurled */
.tube__collar {
  position: absolute;
  left: calc(var(--len) - 10px);
  top: 0;
  width: 10px;
  height: calc(var(--d) + 6px);
  border-radius: 2px;
  background: var(--brass);
  box-shadow: -1px 0 0 rgba(0, 0, 0, 0.45), 1px 0 0 rgba(255, 230, 170, 0.25);
}

/* the eyepiece, at the end of the last tube */
.tube__eye {
  position: absolute;
  left: var(--len);
  top: 7px;
  width: 13px;
  height: calc(var(--d) - 8px);
  border-radius: 0 4px 4px 0;
  background: linear-gradient(180deg, #2a2420, #6b5a48 22%, #1b1714 55%, #0c0a09);
  box-shadow: inset -2px 0 0 rgba(255, 255, 255, 0.08);
}

/* the section, engraved: a dark cut with the light catching its lower lip */
.tube__label {
  position: absolute;
  left: 12px;
  top: 3px;
  width: calc(var(--len) - 24px);
  height: var(--d);
  display: grid;
  place-items: center;
  color: var(--engrave);
  font-size: 13.5px;
  font-weight: 640;
  font-variation-settings: 'SOFT' 50, 'WONK' 0;
  letter-spacing: 0.035em;
  line-height: 1;
  white-space: nowrap;
  text-shadow: 0 1px 0 rgba(255, 236, 190, 0.55), 0 -0.5px 0 rgba(40, 20, 0, 0.35);
  pointer-events: none;
  opacity: 0;
}

.tube__link:focus-visible .tube__shell {
  outline: 2px solid var(--ring);
  outline-offset: 5px;
}

html[data-using='pointer'] .tube__link:focus-visible .tube__shell {
  outline: none;
}

/* ---------------------------------------------------------------- the body: the button */
.body {
  position: absolute;
  left: 0;
  top: calc(var(--cross) / 2 - 35px);
  z-index: 20;
  width: var(--blen, 150px);
  height: 70px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--gilt);
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.body__cap,
.body__leather,
.body__collar {
  position: absolute;
}

/* the sunshade at the front: brass, wider than the body */
.body__cap {
  left: 0;
  top: 0;
  width: 16px;
  height: 70px;
  border-radius: 3px;
  background: var(--brass);
  box-shadow: 1px 0 0 rgba(0, 0, 0, 0.5), 0 8px 18px -6px rgba(0, 0, 0, 0.9);
}

/* the leather wrapped round the body, with its grain */
.body__leather {
  left: 15px;
  top: 4px;
  width: calc(var(--blen, 150px) - 27px);
  height: 62px;
  background: var(--leather);
  box-shadow: 0 8px 18px -6px rgba(0, 0, 0, 0.9);
}

.body__leather::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' seed='4'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1.4 0.95'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: 0.32;
  mix-blend-mode: multiply;
}

.body__collar {
  right: 0;
  top: 1px;
  width: 13px;
  height: 68px;
  border-radius: 2px;
  background: var(--brass);
  box-shadow: -1px 0 0 rgba(0, 0, 0, 0.5);
}

/* Menu and Close in gold on the leather */
.body__words {
  position: absolute;
  left: 15px;
  right: 12px;
  top: 4px;
  height: 62px;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.body__word {
  grid-area: 1 / 1;
  font-size: 14px;
  font-weight: 560;
  font-variation-settings: 'SOFT' 100, 'WONK' 0;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding-left: 0.22em;
  text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.7), 0 1px 0 rgba(255, 220, 150, 0.12);
}

.body__word--close {
  opacity: 0;
}

.body:focus-visible .body__leather {
  outline: 2px solid var(--ring);
  outline-offset: 7px;
}

html[data-using='pointer'] .body:focus-visible .body__leather {
  outline: none;
}

/* ---------------------------------------------------------------- on a phone: the telescope hangs down */
.scope.is-v {
  width: 240px;
  height: 436px;
}

.is-v .tube {
  left: calc(var(--axis) - var(--d) / 2 - 3px);
  top: 0;
  width: calc(var(--d) + 6px + 150px);
  height: calc(var(--len) + var(--eye, 0px));
}

.is-v .tube__shell {
  left: 3px;
  top: 0;
  width: var(--d);
  height: var(--len);
  box-shadow: 6px 0 14px -6px rgba(0, 0, 0, 0.9);
}

.is-v .tube__collar {
  left: 0;
  top: calc(var(--len) - 10px);
  width: calc(var(--d) + 6px);
  height: 10px;
  box-shadow: 0 -1px 0 rgba(0, 0, 0, 0.45), 0 1px 0 rgba(255, 230, 170, 0.25);
}

.is-v .tube__eye {
  left: 7px;
  top: var(--len);
  width: calc(var(--d) - 8px);
  height: 13px;
  border-radius: 0 0 4px 4px;
  background: linear-gradient(90deg, #2a2420, #6b5a48 22%, #1b1714 55%, #0c0a09);
}

/* the section beside its tube, in gold, on the black page */
.is-v .tube__label {
  left: calc(var(--d) / 2 + 46px);
  top: 10px;
  width: auto;
  height: calc(var(--len) - 20px);
  place-items: center start;
  color: var(--gilt);
  font-size: 19px;
  font-weight: 480;
  letter-spacing: 0.01em;
  text-shadow: none;
  transition: color 0.25s, translate 0.35s cubic-bezier(0.3, 1.4, 0.5, 1);
}

.is-v .tube__link:focus-visible .tube__label {
  color: #fff1cf;
  translate: 4px 0;
}
@media (hover: hover) {
  .is-v .tube__link:hover .tube__label {
    color: #fff1cf;
    translate: 4px 0;
  }
}

.is-v .body {
  left: calc(var(--axis) - 35px);
  top: 0;
  width: 70px;
  height: var(--blen);
}

.is-v .body__cap {
  width: 70px;
  height: 16px;
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.5), 8px 0 18px -6px rgba(0, 0, 0, 0.9);
}

.is-v .body__leather {
  left: 4px;
  top: 15px;
  width: 62px;
  height: calc(var(--blen) - 27px);
}

.is-v .body__collar {
  left: 1px;
  right: auto;
  top: auto;
  bottom: 0;
  width: 68px;
  height: 13px;
  box-shadow: 0 -1px 0 rgba(0, 0, 0, 0.5);
}

.is-v .body__words {
  left: 4px;
  right: auto;
  top: 15px;
  width: 62px;
  height: calc(var(--blen) - 27px);
}

.is-v .body__word {
  font-size: 11.5px;
  letter-spacing: 0.16em;
  padding-left: 0.16em;
}

@media (prefers-reduced-motion: reduce) {
  .is-v .tube__label {
    transition: color 0.25s;
  }

  .is-v .tube__link:focus-visible .tube__label {
    translate: none;
  }
  @media (hover: hover) {
    .is-v .tube__link:hover .tube__label {
      translate: none;
    }
  }
}
