@font-face {
  font-family: 'La Belle Aurore';
  src: url('/assets/LaBelleAurore-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

.margin-note-host { position: relative; }

.margin-note {
  position: absolute;
  z-index: 1;
  display: grid;
  place-items: center;
  pointer-events: none;
  color: #28676a;
  visibility: hidden;
  --note-angle: -3deg;
  --note-size: clamp(18px, 2.05vw, 30px);
  --lamp-radius: 73px;
}

.margin-note.is-revealed { visibility: visible; }

.margin-note__word {
  display: block;
  max-width: 100%;
  padding: .08em .17em .13em;
  font: 400 var(--note-size)/1.24 'La Belle Aurore', cursive;
  letter-spacing: normal;
  text-align: center;
  white-space: pre-line;
  transform: rotate(var(--note-angle));
}

.margin-note__drawing {
  display: block;
  width: min(92%, var(--drawing-size, 190px));
  height: 90%;
  overflow: visible;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.14;
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .81;
}

.margin-note--curieux {
  top: calc(100% + 4px);
  left: calc(6px - 6.15%);
  width: clamp(66px, 6.8vw, 112px);
  height: 42px;
  --note-angle: -5deg;
  --note-size: clamp(17px, 1.7vw, 25px);
}

.margin-note--marco,
.margin-note--polo {
  left: 100%;
  height: 50px;
  --note-angle: 4deg;
  --note-size: clamp(16px, 1.65vw, 24px);
}

.margin-note--marco {
  top: 61%;
  width: 6.1%;
  --note-size: clamp(14px, 1.45vw, 21px);
}

.margin-note--polo {
  top: 82%;
  width: 12%;
}

.margin-note--tic-tac-toe {
  inset: 0 4% 0 51%;
  --drawing-size: 350px;
}

.margin-note--tic-tac-toe .margin-note__drawing {
  stroke-width: 1.55;
  transform: rotate(-7deg);
}

.margin-note--gears {
  inset: -7% 0 -7% 44%;
  --lamp-radius: 107px;
}

.gear-scene {
  position: relative;
  display: block;
  width: min(100%, 620px);
  aspect-ratio: 600 / 240;
  transform: scale(1.08);
}

.gear-wheels {
  position: absolute;
  inset: 0;
  transform: scale(1.1);
}

.gear-scene img {
  position: absolute;
  object-fit: contain;
  height: auto;
  aspect-ratio: 1;
  animation: gear-turn linear infinite;
}

.gear-notes {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.gear-notes path {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.35;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  opacity: 0;
}

.gear-notes text {
  fill: currentColor;
  stroke: none;
  font: 400 22px 'La Belle Aurore', cursive;
  letter-spacing: 0;
  opacity: 0;
}

.gear-notes .is-lit path {
  opacity: 1;
  stroke-dashoffset: 0;
  transition: stroke-dashoffset .58s ease-out;
}

.gear-notes .is-lit text {
  opacity: 1;
  animation: gear-note-write .52s .23s ease-out both;
  transform-box: fill-box;
}

@keyframes gear-turn { to { transform: rotate(360deg); } }
@keyframes gear-note-write {
  from { clip-path: inset(-15% 100% -15% -5%); }
  to { clip-path: inset(-15% -5% -15% -5%); }
}

@media (prefers-reduced-motion: reduce) {
  .gear-scene img, .gear-notes .is-lit text { animation: none; }
  .gear-notes .is-lit path { transition: none; }
}

.margin-note--sketch {
  position: relative;
  flex: none;
  margin-top: auto;
  margin-bottom: 14px;
  width: clamp(145px, 17vw, 230px);
  height: 68px;
  --drawing-size: 220px;
}

.margin-note--sketch .margin-note__drawing { stroke-width: 1.65; }

.conviction-details-word { display: inline-block; }

.margin-note--details {
  inset: -.2em auto auto -3.8575em;
  width: 14.0625em;
  height: 9.5em;
}

.margin-note--details .margin-note__drawing {
  width: 100%;
  height: 100%;
  stroke-width: 1.35;
}

.margin-note--zigzag {
  inset: 8px 11% 0 51%;
  --drawing-size: 143px;
}

.margin-note--smile {
  inset: 2px 9% 5px 63%;
  --drawing-size: 152px;
}

.margin-note--smile .margin-note__drawing {
  stroke-width: 1.55;
  transform: rotate(8deg);
}

.margin-note--icitte {
  inset: 0 21% -14% 2%;
  --note-angle: -2deg;
}

#apropos { position: relative; }

.about-discovery {
  display: none;
  position: absolute;
  inset: 54% auto auto 5.5%;
  width: min(25%, 360px);
  height: auto;
  aspect-ratio: 360 / 350;
  transform: translateY(-50%);
  margin: 0;
  color: #28676a;
  --lamp-radius: 107px;
}

[data-design="vintage"] .about-discovery { display: block; }

.telescope-reveal {
  position: absolute;
  inset: 0;
  visibility: hidden;
  mask-image: radial-gradient(circle at var(--light-x, -200px) var(--light-y, -200px),
    #000 0, #000 calc(var(--lamp-radius) - 18px), transparent var(--lamp-radius));
}

.about-discovery:is(.is-revealed, :focus-visible) .telescope-reveal { visibility: visible; }

.telescope-art {
  position: absolute;
  left: 47%;
  top: 6%;
  width: 62%;
  height: 88%;
  transform: translateX(-50%);
}

.telescope-barrel {
  transform-origin: 216px 0;
}

.about-discovery.is-revealed :is(.telescope-barrel, .telescope-front) {
  animation-duration: 2.4s;
  animation-timing-function: ease-in-out;
  animation-iteration-count: infinite;
  animation-direction: alternate;
}

.about-discovery.is-revealed .telescope-barrel { animation-name: telescope-extend; }
.about-discovery.is-revealed .telescope-front { animation-name: telescope-slide; }

@keyframes telescope-extend { to { transform: scaleX(1.324324); } }
@keyframes telescope-slide { to { transform: translateX(24px); } }

.telescope-notes { pointer-events: none; }
.telescope-notes text { font-size: 20px; }
.about-discovery:focus-visible .telescope-notes path { opacity: 1; stroke-dashoffset: 0; }
.about-discovery:focus-visible .telescope-notes text { opacity: 1; }
.about-discovery:focus-visible .telescope-reveal { mask-image: none; }
.about-discovery:focus-visible {
  outline: 1px solid currentColor;
  outline-offset: 6px;
}

@media (max-width: 800px) {
  [data-design="vintage"] .about-discovery { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .about-discovery.is-revealed :is(.telescope-barrel, .telescope-front) { animation: none; }
}

.margin-note--arrow-back {
  inset: 57% -2% 6% 86%;
  --drawing-size: 149px;
}

.adventure-heading #adventures-title.margin-note-host { width: fit-content; }

.margin-note--strike {
  inset: 0 auto 0 calc(100% + 20px);
  width: clamp(78px, 11vw, 145px);
}


.margin-note[data-reveal="stylo"].is-revealed .margin-note__word {
  animation: write-note .72s cubic-bezier(.23, .52, .34, 1) both;
}

.margin-note[data-reveal="stylo"].is-revealed path {
  stroke-dasharray: 1;
  animation: draw-note .44s ease-out var(--stroke-delay) both;
}

.margin-note--details[data-reveal="stylo"].is-revealed path:nth-child(2) {
  animation-delay: 440ms;
}

.margin-note--details[data-reveal="stylo"].is-revealed path:nth-child(3) { animation-delay: 880ms; }

.margin-note--sketch[data-reveal="stylo"].is-revealed path:nth-child(2) { animation-delay: 440ms; }
.margin-note--sketch[data-reveal="stylo"].is-revealed path:nth-child(3) { animation-delay: 880ms; }

.margin-note[data-reveal="lampe"] {
  mask-image: radial-gradient(circle at var(--light-x, -200px) var(--light-y, -200px),
    #000 0, #000 calc(var(--lamp-radius) - 18px), transparent var(--lamp-radius));
}

@keyframes write-note {
  from { clip-path: inset(-8% 100% -8% -3%); }
  to { clip-path: inset(-8% -3% -8% -3%); }
}

@keyframes draw-note {
  from { stroke-dashoffset: 1; }
  to { stroke-dashoffset: 0; }
}

body:has(dialog[open]) .margin-note.is-revealed { visibility: hidden; }

@media (max-width: 1050px) {
  .margin-note--details { display: none; }
  .margin-note--arrow-back { left: 89%; }
  }

@media (max-width: 800px) {
  .margin-note--polo { width: 6.1%; }
  .margin-note--zigzag, .margin-note--smile, .margin-note--strike, .margin-note--arrow-back { display: none; }
  .margin-note--icitte { inset: 0 0 40% 0; }
}

@media (max-width: 700px) {
  .margin-note { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .margin-note[data-reveal="stylo"].is-revealed :is(.margin-note__word, path) { animation: none; }
}


/* Leave the project images and captions clear in the annotated composition. */
[data-design="vintage"] .margin-note--curieux {
  inset: auto auto 0 101%;
  width: min(8.8vw, 110px);
}

.margin-note--dateline-stroke {
  inset: -12px 50% -8px 32%;
  --drawing-size: 162px;
}

.margin-note--margin-circle {
  inset: 23% 101% 42% auto;
  width: min(9vw, 105px);
  --drawing-size: 98px;
}

.margin-note--ink-wave {
  inset: auto auto -21% 101%;
  width: min(9vw, 105px);
  height: clamp(100px, 13vw, 172px);
}

.margin-note--hidden,
.margin-note--check-box {
  left: auto;
  right: 101%;
  width: min(10vw, 108px);
}

.margin-note--hidden { top: 76%; }
.margin-note--check-box { top: 66%; height: 74px; }

.margin-note--keen-eye {
  inset: 3px 10% 0 53%;
  --note-size: clamp(18px, 1.85vw, 27px);
}

[data-design="vintage"] .margin-note--icitte {
  inset: 0 auto -8% 4%;
  width: 22%;
}

.margin-note--found {
  inset: 21% 0 auto auto;
  width: min(8.5vw, 110px);
  height: 42px;
}

.margin-note--compass {
  inset: -38px 18% auto 49%;
  height: 178px;
  --lamp-radius: 107px;
}

.compass-scene {
  position: relative;
  display: block;
  width: min(100%, 310px);
  height: 178px;
}

.compass-instrument {
  position: absolute;
  top: 26px;
  right: 0;
  width: 145px;
  height: 145px;
}

.compass-instrument > :is(img, svg) {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.compass-needle {
  transform-origin: 50% 50%;
  animation: compass-seek-north 7.8s ease-in-out infinite;
  animation-play-state: paused;
}

.compass-instrument > .compass-attachment {
  inset: -27px auto auto 50%;
  width: 27px;
  height: 36px;
  transform: translateX(-50%);
  mix-blend-mode: multiply;
}

.is-revealed .compass-needle { animation-play-state: running; }

.compass-caption {
  position: absolute;
  top: 20px;
  left: 0;
  font: 400 24px/1.24 'La Belle Aurore', cursive;
  white-space: nowrap;
  transform: rotate(-5deg);
}

.compass-caption--detour {
  top: 115px;
  left: 4px;
  font-size: 22px;
  transform: rotate(3deg);
}

.compass-arrow {
  position: absolute;
  left: 84px;
  top: 46px;
  width: 86px;
  height: 67px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.is-revealed .compass-caption { animation: gear-note-write .6s ease-out both; }
.is-revealed .compass-arrow path { animation: draw-note .6s ease-out both; stroke-dasharray: 1; }

@keyframes compass-seek-north {
  0%, 100% { transform: rotate(-8deg); }
  22% { transform: rotate(15deg); }
  43% { transform: rotate(-12deg); }
  61% { transform: rotate(6deg); }
  79% { transform: rotate(-3deg); }
  90% { transform: rotate(2deg); }
}

@media (max-width: 1100px) {
  .margin-note--compass { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .compass-needle, .is-revealed .compass-caption, .is-revealed .compass-arrow path { animation: none; }
}

@media (max-width: 1050px) {
  [data-design="vintage"] .margin-note--curieux {
    left: auto;
    right: 0;
  }

  .margin-note--margin-circle,
  .margin-note--ink-wave,
  .margin-note--hidden,
  .margin-note--check-box,
  .margin-note--found { display: none; }
}

@media (min-width: 1051px) {
  [data-design="vintage"] .margin-note--curieux,
  .margin-note--margin-circle,
  .margin-note--ink-wave,
  .margin-note--hidden,
  .margin-note--check-box {
    width: min(4.4vw, 100px);
  }

  [data-design="vintage"] .margin-note--curieux,
  .margin-note--hidden {
    --note-size: clamp(13px, 1.22vw, 21px);
  }
}

:is(.margin-note--dateline-stroke, .margin-note--margin-circle, .margin-note--ink-wave, .margin-note--check-box) .margin-note__drawing {
  stroke-width: 2.15;
  opacity: .94;
}

:is(.margin-note--margin-circle, .margin-note--ink-wave, .margin-note--check-box) .margin-note__drawing {
  width: 100%;
  stroke-width: 2px;
}

:is(.margin-note--margin-circle, .margin-note--ink-wave, .margin-note--check-box) path {
  vector-effect: non-scaling-stroke;
}
