
/* Four mid-page chapters on the same coastal workbench.
   Keep decoration off the carousel's track, snap items, and focus targets. */
.editorial-training {
  margin-top: 3rem;
  padding-top: 2.25rem;
  border-top: 1px solid #e1d5bb;
  scroll-margin-top: calc(env(safe-area-inset-top) + 6rem);
}
.editorial-session-section {
  background-color: #e4ede3;
  background-image: repeating-linear-gradient(0deg, transparent 0 25px, #54756312 25px 26px);
}
.editorial-project-section {
  background-color: #dcece8;
  background-image:
    repeating-radial-gradient(ellipse at 96% 120%, transparent 0 27px, #43766b19 28px 29px, transparent 30px 39px),
    linear-gradient(110deg, #eeeee1, transparent 68%);
}
.editorial-life-section {
  background-color: #f8e9cc;
  background-image: radial-gradient(ellipse at top right, #f4d8a659, transparent 63%);
}
[data-editorial-rail] {
  --paper-depth: 0;
  min-width: 0;
}
@media (prefers-reduced-motion: no-preference) {
  html:not([data-decorative-motion='paused']) [data-editorial-rail]:not(:focus-within) {
    --paper-depth: var(--editorial-drift, 0);
  }
}

/* A stack of workshop cards. The coloured stock fans out from the tape. */
[data-editorial-rail='deck'] .editorial-sheet {
  margin: 0.65rem 0.28rem 0.4rem;
  height: calc(100% - 1.05rem);
  border-radius: 0.8rem;
  border-color: #bfac8a;
  background: #fffaf0;
  box-shadow:
    calc(3px + 5px * var(--paper-depth)) 3px 0 #e4c671,
    calc(-3px - 5px * var(--paper-depth)) 6px 0 #bbd2bc,
    0 10px 15px -9px #69503376;
}
[data-editorial-rail='deck'] .editorial-sheet::before {
  position: absolute;
  z-index: 1;
  top: -0.4rem;
  left: 50%;
  width: 3.5rem;
  height: 0.9rem;
  transform: translateX(-50%) rotate(calc(-4deg + 12deg * var(--paper-depth)));
  background: repeating-linear-gradient(90deg, #e7cb8ccd 0 2px, #f3e2b7e3 2px 3px);
  border: 1px solid #c5a87c8c;
  clip-path: polygon(0 0, 99% 3%, 95% 20%, 100% 39%, 96% 54%, 100% 96%, 1% 100%, 3% 71%, 0 45%, 3% 25%);
  pointer-events: none;
  content: '';
}
[data-editorial-rail='deck'] .editorial-art {
  border-radius: 0.48rem;
  background: #f1e5cd;
}
[data-editorial-rail='deck'] .editorial-art img {
  transform: perspective(700px) translateY(calc(7px * var(--paper-depth))) rotateX(calc(-17deg * var(--paper-depth)))
    rotateZ(calc(-4deg * var(--paper-depth)));
}

/* A ring-bound notebook. Only the illustrated page opens, never the text or controls. */
[data-editorial-rail='notebook'] .editorial-sheet {
  margin: 0.15rem 0.25rem 0.55rem 0.65rem;
  height: calc(100% - 0.7rem);
  padding-inline-start: clamp(1.2rem, 3vw, 1.55rem);
  border: 1px solid #9baf99;
  border-radius: 0.45rem 0.9rem 0.95rem 0.4rem;
  background: linear-gradient(90deg, #e5e0cb, #fdf9ec 8%, #fdf9ec 96%, #eae4d0);
  box-shadow:
    -3px 3px 0 #68806c,
    2px 3px 0 #f6edda,
    3px 5px 0 #93a48d,
    0 10px 16px -10px #47624e8a;
}
[data-editorial-rail='notebook'] .editorial-sheet::before {
  position: absolute;
  z-index: 1;
  inset: 0.8rem auto 0.8rem -0.52rem;
  width: 0.87rem;
  background: radial-gradient(ellipse 7px 3px at 8px 5px, transparent 53%, #9b7c48 62%, #645844 86%, transparent 100%)
    0 0 / 100% 1.85rem repeat-y;
  pointer-events: none;
  content: '';
}
[data-editorial-rail='notebook'] .editorial-sheet::after {
  position: absolute;
  inset: 1.15rem -0.28rem auto auto;
  width: 0.38rem;
  height: 1.1rem;
  border-radius: 0 0.16rem 0.16rem 0;
  background: #b87553;
  box-shadow: 0 1.32rem 0 #d1ad58, 0 2.64rem 0 #7d9e86;
  pointer-events: none;
  content: '';
}
[data-editorial-rail='notebook'] .editorial-art {
  border: 4px solid #fffdf4;
  border-radius: 0.3rem;
  background: #ddd5bf;
  box-shadow: 0 0 0 1px #cbc0a8, 1px 3px 6px -3px #665136;
}
[data-editorial-rail='notebook'] .editorial-art img {
  transform-origin: 9% 50%;
  transform: perspective(730px) rotateY(calc(-42deg * var(--paper-depth)));
}

/* Workshop atlas: mapped paper, a concertina silhouette, and shaded folds on the same cover. */
[data-editorial-rail='atlas'] .editorial-sheet {
  margin: 0.1rem 0.1rem 0.6rem;
  height: calc(100% - 0.7rem);
  border: 1px solid #9bb4a7;
  border-radius: 0.35rem;
  background: #fffaf0;
  box-shadow: 2px 3px 0 #e8e1cc, 3px 5px 0 #a3bba9, 0 12px 18px -12px #3b6c668a;
}
[data-editorial-rail='atlas'] .editorial-art {
  border-radius: 0.2rem;
  background-color: #e7ebe0;
  background-image:
    repeating-linear-gradient(0deg, transparent 0 11px, #6d98831c 11px 12px),
    repeating-linear-gradient(90deg, transparent 0 11px, #6d98831c 11px 12px);
}
/* Postmarks and a surfboard sticker from home. The Kelpie art is the site's existing GIF/still. */
[data-editorial-rail='postcards'] .editorial-sheet {
  position: relative;
  width: calc(100% - 0.5rem);
  height: calc(100% - 0.45rem);
  margin: 0.1rem 0.25rem 0.35rem;
  padding-top: 1.25rem;
  border-color: #c7ac83;
  border-radius: 0.45rem;
  background: #fff8e6;
  box-shadow: 2px 3px 0 #ddc8a4, 0 12px 16px -12px #87613f;
}
[data-editorial-rail='postcards'] .editorial-sheet::before {
  position: absolute;
  inset: 0 0 auto;
  height: 0.28rem;
  background: repeating-linear-gradient(130deg, #b15a49 0 10px, transparent 10px 17px, #557e84 17px 27px, transparent 27px 34px);
  border-radius: 0.45rem 0.45rem 0 0;
  opacity: 0.75;
  pointer-events: none;
  content: '';
}
.editorial-post-image {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  min-width: 0;
  border: 1px solid #d1b68f;
  border-radius: 0.25rem;
  background-color: #f7ead0;
}
.editorial-post-image img {
  max-width: 100%;
  transform: perspective(720px) rotateY(calc(23deg * var(--paper-depth)))
    rotateZ(calc(6deg * var(--paper-depth)));
  transform-origin: 70% 75%;
}
.editorial-post-coast {
  background: #dce9df url('/images/robot/cinematic-coast.webp') center / cover no-repeat;
}
.editorial-post-coast img {
  justify-self: end;
  margin-right: clamp(0.45rem, 2.5vw, 1.55rem);
  max-width: 70%;
  object-position: bottom;
  transform: perspective(690px) translateY(calc(-14px * var(--paper-depth))) rotateY(calc(22deg * var(--paper-depth)))
    rotateZ(calc(16deg * var(--paper-depth)));
  filter: drop-shadow(2px 4px 2px #5847256e);
}
.editorial-postmark {
  position: absolute;
  top: -0.55rem;
  right: -0.42rem;
  display: grid;
  width: 2.45rem;
  height: 2.45rem;
  place-items: center;
  transform: rotate(15deg);
  border: 2px dashed #916245;
  border-radius: 50%;
  color: #916245;
  background: #fff2cb;
  box-shadow: 0 0 0 2px #fff2cb, 0 0 0 3px #b7966e;
  font-size: 1.1rem;
  pointer-events: none;
}

/* Each display changes its selected content; sheets animate only around explicit navigation. */
.paper-browser {
  min-width: 0;
  outline-offset: 0.35rem;
}
.paper-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: clamp(1.1rem, 4vw, 2.6rem);
}
.paper-stage,
.paper-index {
  min-width: 0;
}
.paper-stage {
  --paper-card-width: min(100%, 32rem);
  width: 100%;
  max-width: 36rem;
  margin-inline: auto;
}
.paper-window {
  position: relative;
  isolation: isolate;
  touch-action: pan-y pinch-zoom;
  perspective: 1050px;
  width: var(--paper-card-width);
  margin-inline: auto;
}
.paper-window .editorial-sheet {
  margin-inline: 0;
  min-width: 0;
}
.paper-window .editorial-art {
  aspect-ratio: 16 / 9;
}
.paper-face {
  position: relative;
  min-width: 0;
  will-change: auto;
}
.paper-face article {
  margin-inline: 0;
}
.paper-face button:focus-visible {
  z-index: 1;
}
.paper-ghost {
  display: none;
  position: absolute;
  z-index: 4;
  inset: 0;
  height: max-content;
  pointer-events: none;
  margin: 0.4rem 0;
  padding: clamp(0.65rem, 3vw, 1.25rem);
  color: #182d3a;
  background: #fdf8ed;
  border: 1px solid #b3a389;
  border-radius: 0.55rem;
  box-shadow: 0 8px 24px #2f332b44;
  transform-style: preserve-3d;
}
.paper-ghost img {
  width: 100%;
  aspect-ratio: 16 / 9;
  height: auto;
  object-fit: cover;
}
.paper-ghost span {
  display: block;
  margin: 0.75rem 0 0.35rem;
  font-size: clamp(1.05rem, 3vw, 1.4rem);
  font-weight: 750;
}
.paper-browser-controls {
  display: grid;
  grid-template-columns: max-content minmax(2rem, 1fr) max-content;
  align-items: center;
  width: var(--paper-card-width);
  margin: 0.9rem auto 0;
  gap: 0.45rem;
}
.paper-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.35rem clamp(0.42rem, 2vw, 0.85rem);
  gap: 0.4rem;
  color: #182d3a;
  border: 1px solid #aca997;
  border-radius: 30px;
  background: #fff9ea;
  font-size: 0.8rem;
  font-weight: 750;
  white-space: nowrap;
}
.paper-step[aria-disabled='true'] {
  cursor: default;
  background: #eee8d8;
  color: #5e6662;
}
.paper-step:focus-visible,
.paper-index-button:focus-visible,
.paper-pin:focus-visible {
  outline: 3px solid #a9422c;
  outline-offset: 2px;
}
.paper-status {
  margin: 0;
  color: #385055;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}
.paper-index-label,
.paper-map-label {
  margin: 0 0 0.55rem;
  color: #395854;
  font-size: 0.69rem;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: 0.13em;
}
.paper-index-button {
  display: flex;
  position: relative;
  align-items: center;
  width: 100%;
  min-height: 44px;
  margin-top: 0.22rem;
  padding: 0.25rem 0.55rem;
  gap: 0.6rem;
  border: 1px solid transparent;
  border-radius: 0.36rem;
  color: #273c42;
  background: #fffcf2c9;
  text-align: left;
  font-size: 0.88rem;
  line-height: 1.2;
  font-weight: 680;
}
.paper-index-button[aria-current='true'] {
  background: #fff2cd;
  border-color: #ad946c;
  color: #182d3a;
  font-weight: 850;
}
.paper-index-button:hover,
.paper-step:not([aria-disabled='true']):hover {
  border-color: #a9422c;
}
.paper-number {
  flex: 0 0 auto;
  font-variant-numeric: tabular-nums;
}
.paper-index .paper-number {
  color: #865137;
  font-size: 0.72rem;
  letter-spacing: 0.025em;
}
[data-editorial-rail='deck'] .paper-index-button {
  background: #e9e6cc;
  border-color: #bfad8a;
  box-shadow: 0 3px 5px #42382525;
  transform-origin: left center;
  transform: rotate(-2.4deg);
}
[data-editorial-rail='deck'] .paper-index-button:nth-child(3) {
  transform: rotate(1.5deg);
  background: #d8e8d8;
}
[data-editorial-rail='deck'] .paper-index-button:nth-child(4) {
  transform: rotate(-0.7deg);
  background: #f4e3bb;
}
[data-editorial-rail='deck'] .paper-index-button[aria-current='true'] {
  transform: rotate(0deg);
  background: #ffe5a0;
  border-color: #a47140;
}
[data-editorial-rail='deck'] .paper-window::before,
[data-editorial-rail='deck'] .paper-window::after {
  position: absolute;
  z-index: -1;
  inset: 0.8rem clamp(0.35rem, 2vw, 0.85rem) 0.5rem;
  background: #bdd7c3;
  border: 1px solid #9ab6a2;
  border-radius: 0.8rem;
  box-shadow: 3px 5px 9px #31342124;
  transform: translateY(0.25rem) rotate(calc(3.2deg - 2.2deg * var(--paper-depth)));
  pointer-events: none;
  content: '';
}
[data-editorial-rail='deck'] .paper-window::after {
  background: #f5d78b;
  border-color: #cbb378;
  transform: translateY(0.12rem) rotate(calc(-3.2deg + 2.2deg * var(--paper-depth)));
}
[data-editorial-rail='notebook'] .paper-index {
  padding: 0.8rem;
  border: 1px solid #a9ac92;
  border-radius: 0.58rem 0.32rem 0.32rem 0.58rem;
  background: repeating-linear-gradient(0deg, #f9f4e4 0 24px, #e7e2d0 24px 25px);
  box-shadow: -3px 3px 0 #68826f, 4px 5px 0 #9ca88b;
}
[data-editorial-rail='notebook'] .paper-ghost {
  min-height: min(100%, 19rem);
  background: linear-gradient(90deg, #d5c498, #fff7e0 8%, #fdf8ed 95%, #d0c6a8);
  transform-origin: 0 50%;
  backface-visibility: visible;
}
[data-editorial-rail='notebook'] .paper-window[data-direction='back'] .paper-ghost {
  transform-origin: 100% 50%;
}
.paper-map-side {
  max-width: 50rem;
  min-width: 0;
  margin: 0;
  padding: clamp(0.38rem, 2.2vw, 1rem);
  border: 1px solid #9eaa91;
  border-radius: 0.58rem;
  background: #fff5da;
  box-shadow: 2px 5px 0 #c9c3a7, 0 18px 30px -20px #466c61;
}
.paper-map-label {
  display: flex;
  justify-content: space-between;
  margin: 0.3rem 0.25rem 0.65rem;
}
.paper-map {
  position: relative;
  isolation: isolate;
  width: 100%;
  min-height: 224px;
  aspect-ratio: 1.65;
  perspective: 800px;
}
.paper-map-folds,
.paper-pins {
  position: absolute;
  inset: 0;
}
.paper-map-folds {
  display: flex;
  transform-style: preserve-3d;
  background: #c4d4bf;
}
.paper-map-folds i {
  position: relative;
  display: block;
  width: 33.33334%;
  flex: 0 0 33.33334%;
  background: url('/images/editorial/project-atlas.svg') left center / 300% 100% no-repeat;
  transform-origin: left;
  transform: rotateY(calc(-41deg * var(--paper-depth)));
  box-shadow: 0 6px 16px -7px #304a42;
}
.paper-map-folds i:nth-child(2) {
  background-position: center;
  transform-origin: center;
  transform: rotateY(calc(39deg * var(--paper-depth)));
}
.paper-map-folds i:nth-child(3) {
  background-position: right;
  transform: translateX(calc(-12px * var(--paper-depth))) rotateY(calc(-38deg * var(--paper-depth)));
}
.paper-map-folds i::after {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #39483c59, transparent 18%, transparent 87%, #fff4c37d);
  pointer-events: none;
  content: '';
}
.paper-pin {
  position: absolute;
  display: grid;
  width: max(2.35rem, 44px);
  height: max(2.35rem, 44px);
  place-items: center;
  transform: translate(-50%, -55%);
  padding: 0;
  color: #18363a;
  background: transparent;
  font-size: 0.7rem;
  font-weight: 850;
  z-index: 1;
}
.paper-pin::before {
  position: absolute;
  z-index: -1;
  width: 1.9rem;
  height: 1.9rem;
  transform: rotate(-45deg);
  border-radius: 50% 50% 50% 13%;
  border: 1px solid #4c6457;
  background: #fdf0c8;
  box-shadow: -2px 3px 6px #243c4055;
  pointer-events: none;
  content: '';
}
.paper-pin[aria-current='true'],
.paper-pin:hover {
  color: #fff;
  z-index: 2;
}
.paper-pin[aria-current='true']::before,
.paper-pin:hover::before {
  background: #aa4833;
  border-color: #863a2a;
}
.paper-map-hint {
  margin: 0.65rem 0.25rem 0.25rem;
  color: #405753;
  font-size: 0.8rem;
}
@media (min-width: 780px) {
  .paper-layout {
    grid-template-columns: minmax(11rem, 0.7fr) minmax(0, 1.3fr);
    max-width: 66rem;
    margin-inline: auto;
  }
  [data-editorial-rail='atlas'] .paper-layout {
    grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr);
  }
  .paper-index {
    margin-top: 0.7rem;
  }
  [data-editorial-rail='deck'] .paper-index-button {
    margin-top: -0.03rem;
    min-height: 4.2rem;
  }
  [data-editorial-rail='notebook'] .paper-index-button {
    min-height: 3rem;
  }
}
@media (max-width: 779px) {
  [data-editorial-rail='atlas'] .paper-layout {
    gap: 0.85rem;
  }
  .paper-window {
    --paper-card-width: calc(100% - 0.6rem);
  }
  .paper-index {
    width: calc(100% - 0.6rem);
    max-width: 34rem;
    margin-inline: auto;
  }
}
@media (prefers-reduced-motion: no-preference) {
  html:not([data-decorative-motion='paused']) .paper-face[data-turn='true'] {
    animation: paper-place 480ms cubic-bezier(.18,.75,.26,1) both;
  }
  html:not([data-decorative-motion='paused']) .paper-ghost {
    display: block;
    animation: paper-deal-out 500ms cubic-bezier(.4,.08,.28,1) both;
  }
  html:not([data-decorative-motion='paused']) .paper-window[data-direction='back'] {
    --paper-sign: -1;
  }
  html:not([data-decorative-motion='paused']) [data-editorial-rail='notebook'] .paper-ghost {
    animation: paper-turn-page 600ms cubic-bezier(.46,.05,.28,1) both;
  }
  html:not([data-decorative-motion='paused']) [data-editorial-rail='atlas'] .paper-ghost {
    animation: paper-fold-away 480ms cubic-bezier(.42,.04,.3,1) both;
  }
  @keyframes paper-place {
    from { transform: translate3d(calc(9px * var(--paper-sign, 1)),10px,-26px) rotateX(-4deg); }
    to { transform: translate3d(0,0,0); }
  }
  @keyframes paper-deal-out {
    0% { opacity: 1; transform: translate3d(0,0,28px); }
    55% { opacity: .7; }
    100% { opacity: 0; transform: translate3d(calc(-10% * var(--paper-sign, 1)),-42px,80px) rotateZ(calc(-10deg * var(--paper-sign, 1))); }
  }
  @keyframes paper-turn-page {
    0% { opacity: 1; transform: rotateY(0); }
    58% { opacity: .74; }
    100% { opacity: 0; transform: rotateY(calc(-102deg * var(--paper-sign, 1))); }
  }
  @keyframes paper-fold-away {
    0% { opacity: 1; transform: rotateY(0) scaleX(1); }
    70% { opacity: .45; }
    100% { opacity: 0; transform: translate3d(calc(-32px * var(--paper-sign, 1)),0,-34px) rotateY(calc(28deg * var(--paper-sign, 1))) scaleX(.72); }
  }
}

/* On a phone the contents can tuck away so the turned page stays close. */
.paper-book-contents summary,
.paper-map-key summary {
  min-height: 44px;
  padding: 0.65rem 0.3rem;
  color: #2d4346;
  font-size: 0.85rem;
  font-weight: 780;
}
.paper-map-key {
  margin: 0.25rem 0.25rem 0;
  border-top: 1px solid #c9bd9d;
}
.paper-map-current {
  display: none;
}
@media (min-width: 780px) {
  [data-editorial-rail='notebook'] .paper-layout {
    gap: 0.8rem;
    padding: 0.9rem;
    border: 4px solid #637d66;
    border-radius: 0.7rem 1rem 1rem 0.7rem;
    background: linear-gradient(90deg, #e1dcc6 0, #fbf4df 32.9%, #ccc4a5 34.1%, #f1e9d0 35.4%, #fbf7e7 39%, #e3dcc2 100%);
    box-shadow: 5px 7px 0 -2px #a4b29c, 0 20px 26px -21px #344f44;
  }
  [data-editorial-rail='notebook'] .paper-index {
    border-color: transparent;
    margin: 0;
    box-shadow: none;
    background: transparent;
  }
}
@media (max-width: 779px) {
  .paper-map-current {
    display: flex;
    flex-wrap: wrap;
    gap: 0.1rem 1rem;
    align-items: baseline;
    justify-content: space-between;
    margin: 0 0.25rem 0.3rem;
    font-size: 0.82rem;
    font-weight: 780;
  }
  .paper-map-current a {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    color: #31565b;
    text-decoration: underline;
  }
  .paper-window {
    scroll-margin-top: calc(env(safe-area-inset-top) + 6rem);
  }
}

/* Clip decorative travel, not the scroll region or the neighbouring sections. */
.paper-stage {
  overflow: clip;
  overflow-clip-margin: 9px;
}
