/* Layout: a dark room holding one 16:9 shelf render that always covers the screen; projects open as white,
   magazine-style pages that scroll top to bottom. */
:root {
  --room: #0f0c0a;          /* the dark room, also the loading colour */
  --led: #f3e3cf;           /* tired warm LED light, for text over the shelf */
  --led-dim: #b9a48d;
  --signal: #e8462f;        /* Carlotta red */
  --paper: #ffffff;         /* project pages */
  --ink: #111111;
  --ink-soft: #6b6b68;
  --rule: #e2e2de;
  --slot: #f0f0ed;          /* image placeholders */
  --display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --label: "Barlow Condensed", "Arial Narrow", "Helvetica Neue", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--room); color: var(--led); font: 400 15px/1.5 var(--display); -webkit-font-smoothing: antialiased; }
body.reading { background: var(--paper); color: var(--ink); color-scheme: light; }

/* ---------------------------------------------------------------- the room */
.room { position: fixed; inset: 0; overflow: hidden; background: var(--room); }
.scroller { position: absolute; inset: 0; overflow: hidden; }
.scroller.pan { overflow-x: auto; overflow-y: hidden; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.scroller.pan::-webkit-scrollbar { display: none; }
.stage { position: absolute; left: 0; top: 0; --lum: 1; will-change: transform; }
.lights { position: absolute; inset: 0; filter: brightness(var(--lum)); }
.base { position: absolute; inset: 0; width: 100%; height: 100%; display: block; max-width: none; user-select: none; -webkit-user-drag: none; }
.blur {
  position: absolute; inset: -4%; width: 108%; height: 108%; max-width: none; object-fit: cover;
  filter: blur(18px) brightness(.55) saturate(.8); transform: scale(1.02); transition: opacity 1.1s ease;
  pointer-events: none; z-index: 1;
}
.room.open .blur { opacity: 0; pointer-events: none; }

/* clickable things on the shelf: hit area, white dot, Dock-style name label */
.spot { position: absolute; display: block; outline: none; -webkit-tap-highlight-color: transparent; cursor: pointer; z-index: 3; }
.frames { position: absolute; width: 100%; height: 100%; max-width: none; opacity: 0; pointer-events: none; }
.dot {
  position: absolute; left: 50%; top: var(--doty, 60%); width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px;
  border-radius: 50%; background: #fff; box-shadow: 0 0 6px 1px rgba(255,255,255,.55); transition: opacity .2s;
}
.dot::after {
  content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 1px solid rgba(255,255,255,.6);
  animation: ping 2.6s ease-out infinite;
}
@keyframes ping { 0% { transform: scale(.4); opacity: .9; } 80%, 100% { transform: scale(1.5); opacity: 0; } }
.spot.lit .dot, .spot:focus-visible .dot { opacity: 0; }
.tip {
  position: absolute; left: 50%; bottom: calc(100% + 12px); transform: translate(-50%, 4px); opacity: 0;
  font: 500 13px/1.25 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", "Segoe UI", Roboto, sans-serif;
  letter-spacing: -.005em; color: #f5f5f7; white-space: nowrap; pointer-events: none;
  padding: 4px 10px 5px; border-radius: 7px;
  background: rgba(36, 36, 38, .78); border: 1px solid rgba(255, 255, 255, .16);
  -webkit-backdrop-filter: blur(18px) saturate(1.6); backdrop-filter: blur(18px) saturate(1.6);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .06);
  transition: opacity .16s ease, transform .2s ease;
}
.tip::after {
  content: ""; position: absolute; left: 50%; top: 100%; width: 9px; height: 9px; margin: -5px 0 0 -5px;
  background: rgba(36, 36, 38, .78); border-right: 1px solid rgba(255, 255, 255, .16); border-bottom: 1px solid rgba(255, 255, 255, .16);
  transform: rotate(45deg); border-bottom-right-radius: 2px;
}
.spot.lit .tip, .spot:focus-visible .tip { opacity: 1; transform: translate(-50%, 0); }
.room:not(.open) .spot, .room.menu .spot { visibility: hidden; }

/* laptop screen: the EarnAbroad logo animation, mapped onto the rendered screen */
.screen { position: absolute; left: 0; top: 0; transform-origin: 0 0; opacity: 0; pointer-events: none; overflow: hidden; transition: opacity .3s ease; z-index: 2; }
.screen.on { opacity: 1; transition-duration: .12s; }
.scr-bg { position: absolute; inset: 0; background: radial-gradient(60% 65% at 50% 50%, #34271f 0%, #1e1916 70%); }
.scr-logo { position: absolute; left: 20%; top: 38%; width: 60%; }
.scr-logo svg { width: 100%; height: auto; display: block; overflow: visible; }
.screen .ea-square, .screen .ea-plane, .screen .ea-word { transform-box: fill-box; transform-origin: 50% 50%; }
.screen.on .ea-square { animation: ea-pop .6s cubic-bezier(.2,.9,.25,1.25) both; }
.screen.on .ea-plane { animation: ea-fly .8s cubic-bezier(.2,.8,.2,1) .22s both; }
.screen.on .ea-trail { stroke-dashoffset: 0; animation: ea-trail .9s ease-out .3s both; }
.screen.on .ea-word { animation: ea-word .7s cubic-bezier(.2,.8,.2,1) .55s both; }
.screen.on .scr-logo::after {
  content: ""; position: absolute; top: -10%; bottom: -10%; left: -30%; width: 22%;
  background: linear-gradient(100deg, transparent, rgba(255, 248, 240, .22), transparent);
  animation: ea-sheen 1.1s ease-in-out 1.25s both;
}
@keyframes ea-pop { 0% { transform: scale(.55); opacity: 0; } 60% { opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
@keyframes ea-fly { 0% { transform: translate(-46%, 46%) rotate(-18deg) scale(.7); opacity: 0; } 100% { transform: none; opacity: 1; } }
@keyframes ea-trail { 0% { opacity: 0; } 100% { opacity: 1; } }
@keyframes ea-word { 0% { clip-path: inset(0 100% 0 0); transform: translateX(-2%); opacity: .2; } 100% { clip-path: inset(0 0 0 0); transform: none; opacity: 1; } }
@keyframes ea-sheen { 0% { left: -30%; opacity: 0; } 20% { opacity: 1; } 100% { left: 110%; opacity: 0; } }

/* Explore menu, bottom left, working like drakerelated.com */
.explore { position: fixed; inset: 0; z-index: 6; pointer-events: none; font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; color: #fff; }
.ex-btn, .ex-mark {
  position: fixed; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); padding: 0 10px;
  font: 600 16px/24px "Helvetica Neue", Helvetica, Arial, sans-serif; color: #fff; background: transparent; border: 0;
  pointer-events: auto; transition: opacity .3s ease-in-out; text-shadow: 0 1px 8px rgba(0, 0, 0, .35);
}
.ex-btn { left: calc(24px + env(safe-area-inset-left, 0px)); cursor: pointer; }
.ex-btn:hover { opacity: .75; }
.ex-mark { right: calc(24px + env(safe-area-inset-right, 0px)); pointer-events: none; }
.ex-list {
  position: fixed; inset: 0; display: flex; align-items: flex-end; justify-content: flex-start;
  padding: 112px 24px calc(80px + env(safe-area-inset-bottom, 0px)) calc(24px + env(safe-area-inset-left, 0px));
  opacity: 0; visibility: hidden; transition: opacity .35s ease-in-out, visibility .35s ease-in-out;
}
.explore.open .ex-list { opacity: 1; visibility: visible; pointer-events: auto; }
.ex-list ul { list-style: none; margin: 0; padding: 0; }
.ex-list li {
  font: 700 24px/1.25 "Helvetica Neue", Helvetica, Arial, sans-serif; opacity: 0; visibility: hidden; transform: translateX(-10px);
  transition-property: opacity, visibility, transform; transition-duration: 1s; transition-timing-function: cubic-bezier(.4, 0, .2, 1);
}
.explore:not(.open) .ex-list li { transition-delay: 0s !important; transition-duration: .3s; }
.explore.open .ex-list li { opacity: 1; visibility: visible; transform: none; }
.ex-list a { color: #fff; text-decoration: none; }
.ex-list a:hover { opacity: .7; }
.room.open.menu .blur { opacity: 1; filter: blur(22px) brightness(.62) saturate(.85); transition: opacity .5s ease-in-out; }
.room.menu .stage { transition: filter .7s ease-in-out; }

/* the gust: sketch pages and a curtain's shadow */
.gust { position: absolute; inset: 0; z-index: 2; pointer-events: none; perspective: 1400px; overflow: hidden; }
.sheet { position: absolute; left: 0; top: 0; transform-style: preserve-3d; will-change: transform; --lit: .8; }
.strip {
  position: absolute; top: 0; transform-style: preserve-3d; transform-origin: 0 50%; backface-visibility: visible;
  background-color: #fbfbf9; filter: brightness(var(--lit)) sepia(.18) saturate(1.1);
}
.strip .strip { transform-origin: 0 50%; }
.sheet-shadow {
  position: absolute; left: 0; top: 0; background: rgba(0, 0, 0, .5); border-radius: 4px; filter: blur(16px);
  opacity: .35; will-change: transform;
}
.curtain {
  position: absolute; top: -5%; bottom: -5%; right: -4%; width: 26%; z-index: 1; pointer-events: none; opacity: 0;
  background: repeating-linear-gradient(90deg, rgba(0,0,0,0) 0, rgba(0,0,0,.65) 46px, rgba(0,0,0,0) 104px, rgba(0,0,0,.4) 150px, rgba(0,0,0,0) 196px);
  -webkit-mask-image: linear-gradient(to left, #000 0%, rgba(0,0,0,.7) 55%, transparent 100%); mask-image: linear-gradient(to left, #000 0%, rgba(0,0,0,.7) 55%, transparent 100%);
  filter: blur(14px); mix-blend-mode: multiply; transform-origin: 100% 0;
}
.curtain.sway { animation: curtain-sway 7.5s ease-in-out both; }
@keyframes curtain-sway {
  0% { opacity: 0; transform: skewX(0deg) translateX(0); }
  15% { opacity: .55; transform: skewX(-7deg) translateX(-3%); }
  35% { opacity: .5; transform: skewX(4deg) translateX(-6%); }
  55% { opacity: .45; transform: skewX(-5deg) translateX(-2%); }
  80% { opacity: .25; transform: skewX(2deg) translateX(0); }
  100% { opacity: 0; transform: none; }
}

/* ---------------------------------------------------------------- gate */
.gate {
  position: fixed; inset: 0; display: grid; place-items: center; z-index: 4;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  transition: opacity .5s ease;
}
.gate.leaving { opacity: 0; pointer-events: none; }
.gate-box { width: min(340px, 100%); display: grid; gap: 14px; }
.gate input {
  width: 100%; font: 400 17px/1.3 var(--display); letter-spacing: .02em; color: var(--led);
  background: rgba(15, 12, 10, .35); border: 0; border-bottom: 1px solid rgba(243, 227, 207, .45);
  padding: 12px 4px; outline: none; border-radius: 0;
}
.gate input::placeholder { color: var(--led-dim); }
.gate input:focus { border-bottom-color: var(--led); }
.gate input#code { text-transform: uppercase; font-family: var(--mono); letter-spacing: .12em; }
.gate input#code::placeholder { text-transform: none; font-family: var(--display); letter-spacing: .02em; }
.gate-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.gate .msg { font-size: 13px; color: var(--led-dim); min-width: 0; }
.gate .msg.err { color: #ff9b85; }
.go {
  flex: none; width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(243, 227, 207, .55);
  background: transparent; color: var(--led); font-size: 20px; line-height: 1; cursor: pointer;
}
.go:hover, .go:focus-visible { background: var(--led); color: #1a120c; outline: none; }
.go:disabled { opacity: .4; cursor: default; }

/* ---------------------------------------------------------------- fades */
.fade { position: fixed; inset: 0; z-index: 9; pointer-events: none; opacity: 0; background: var(--room); transition: opacity .28s ease; }
.fade.white { background: var(--paper); }
.fade.on { opacity: 1; }
/* logo intro: a full-screen canvas between a project click and its page */
.intro { position: fixed; inset: 0; width: 100%; height: 100%; display: block; z-index: 10; background: #000; opacity: 0; pointer-events: none; transition: opacity .28s ease; }
.intro.on { opacity: 1; pointer-events: auto; cursor: pointer; }
.intro.out { transition-duration: .25s; }
.intro.out.pen { transition-duration: .32s; transition-timing-function: cubic-bezier(.4, 0, .6, 1); }

/* ---------------------------------------------------------------- project pages */
.project { min-height: 100%; background: var(--paper); color: var(--ink); position: relative; z-index: 2; overflow-x: clip; }
.p-bar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 3; background: rgba(255,255,255,.92); backdrop-filter: blur(6px);
  display: flex; justify-content: space-between; align-items: center; gap: 16px; border-bottom: 1px solid var(--rule);
  padding-block: 14px; padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px));
  font: 500 12px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase;
}
.p-bar a { color: var(--ink); text-decoration: none; }
.p-bar a:hover { text-decoration: underline; text-underline-offset: 3px; }
.p-bar .p-pdf, .p-end .p-pdf { color: var(--ink); }
.p-wrap { max-width: 1320px; margin: 0 auto; padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px)); }
.p-cover { padding-block: clamp(56px, 12vw, 160px) clamp(32px, 6vw, 72px); display: grid; gap: 14px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* the folder's first page: the cover, as a sheet of paper filling the first screen */
.p-coverpage { min-height: calc(100vh - 48px); display: grid; place-items: center; padding-block: clamp(24px, 5vh, 56px); }
.p-sheet {
  margin: 0; aspect-ratio: var(--r); width: min(100%, calc((100vh - 48px - 2 * clamp(24px, 5vh, 56px)) * var(--r)));
  max-width: 100%; background: var(--slot); display: grid; place-items: center; overflow: hidden;
  box-shadow: 0 1px 2px rgba(0,0,0,.08), 0 14px 40px rgba(0,0,0,.12);
}
@media (max-aspect-ratio: 1/1) { .p-coverpage { min-height: auto; padding-block: 28px 8px; } }
.p-sheet img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* a whole folder: its pages one under the other, wide enough to read the body text */
.p-pages { display: grid; justify-items: center; gap: clamp(20px, 3.5vw, 48px); padding-block: clamp(24px, 5vh, 56px) 0; }
.p-pages .p-sheet { width: min(100%, 880px); }
.p-pages + .p-end { padding-block: clamp(48px, 7vw, 96px) 48px; max-width: 880px; margin-inline: auto; }
@media (max-width: 640px) { .p-pages { gap: 14px; padding-block: 16px 0; } }
.p-sheet .lbl { font: 400 12px/1.2 var(--mono); color: var(--ink-soft); }
.p-title {
  font: 200 clamp(56px, 13vw, 190px)/.86 var(--display); font-stretch: 125%; font-style: italic;
  letter-spacing: -.01em; margin: 0; text-wrap: balance;
}
.p-sub { font: 500 13px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--ink-soft); }
.chapter { padding-block: clamp(56px, 9vw, 120px) 0; display: grid; gap: clamp(20px, 3vw, 36px); }
.ch-head { display: grid; grid-template-columns: minmax(48px, 8%) 1fr auto; align-items: baseline; gap: 12px; border-top: 1px solid var(--ink); padding-top: 14px; }
.ch-num { font: 500 13px/1 var(--mono); font-variant-numeric: tabular-nums; }
.ch-title { font: 500 clamp(28px, 4.6vw, 64px)/1 var(--display); font-stretch: 112%; margin: 0; text-wrap: balance; min-width: 0; }
.ch-tag { font: 500 11px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--signal); border: 1px solid currentColor; padding: 5px 7px; border-radius: 3px; }
.slot {
  position: relative; width: 100%; max-width: 100%; background: var(--slot); border: 1px solid var(--rule);
  display: grid; place-items: center; overflow: hidden;
}
.slot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.slot .lbl { font: 400 12px/1.2 var(--mono); color: var(--ink-soft); letter-spacing: .04em; text-align: center; padding: 8px; }
.bleed { width: 100vw; max-width: none; margin-left: calc(50% - 50vw); border-left: 0; border-right: 0; }
.pair { display: grid; grid-template-columns: 1fr 1fr; gap: clamp(12px, 2vw, 24px); }
.grid { display: grid; grid-template-columns: repeat(var(--n, 3), 1fr); gap: clamp(12px, 2vw, 24px); }
.spec { width: 100%; max-width: 760px; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.spec th, .spec td { text-align: left; padding: 14px 0; border-bottom: 1px solid var(--rule); vertical-align: baseline; }
.spec th { font: 500 12px/1.2 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-soft); width: 40%; padding-right: 16px; }
.spec td { font: 400 clamp(18px, 2.2vw, 26px)/1.2 var(--display); font-stretch: 110%; }
.p-end { padding-block: clamp(80px, 12vw, 160px) 48px; display: flex; justify-content: space-between; gap: 16px; font: 500 12px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.p-end a { color: var(--ink); }
.p-end [data-top] { margin-left: auto; }
.p-bar .p-back { font: 400 20px/1 var(--display); padding: 2px 10px 2px 0; text-decoration: none; }
.p-bar .p-back:hover { text-decoration: none; opacity: .6; }
.p-empty { padding-block: 40px; font: 400 13px/1.4 var(--mono); color: var(--ink-soft); }
@media (max-width: 640px) {
  .pair { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(2, 1fr); }
  .ch-head { grid-template-columns: 40px 1fr; }
  .ch-tag { grid-column: 2; justify-self: start; }
}
:focus-visible { outline: 2px solid var(--signal); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) {
  .dot::after { animation: none; }
  .tip, .blur, .fade, .gate, .screen, .ex-list, .ex-list li { transition: none; }
  .screen.on * { animation: none !important; }
}
