/* A single continuous map page: intro scrolls away, framed map stays whole. */
.paper-frame {flex:none;min-height:0;}
.map-explore-shell {position:sticky;top:var(--frame-gap);display:flex;flex-direction:column;height:calc(100dvh - 2 * var(--frame-gap));min-height:0;isolation:isolate;background:#fff1d9;}
.map-explore-shell #mapwrap {flex:1 1 0;min-height:0;}
.map-explore-shell .credits {flex:none;max-height:25dvh;overflow:auto;}
.map-explore-shell .map-utility-header {z-index:1300;}
.map-explore-edge {opacity:0;}
body.map-is-exploring > .paper-frame > .paper-frame-edge {opacity:0;}
body.map-is-exploring .map-explore-edge {opacity:1;}
.map-utility-header .toggles {padding-right:calc(var(--gutter) + 48px);}
.map-site-menu {position:absolute;right:8px;top:50%;transform:translateY(-50%);z-index:2;min-width:44px;min-height:44px;border:0;background:transparent;color:#64442e;font:28px/1 Gaegu,cursive;cursor:pointer;}
.map-chapter-menu {position:absolute;right:8px;top:calc(100% + 5px);z-index:1400;width:min(270px,calc(100vw - 60px));max-height:calc(100dvh - 150px);overflow:auto;box-sizing:border-box;padding:10px 14px;border:1px solid #c8a77a;border-radius:8px 12px 9px 6px;background:#fff6e5 url('/assets/cotton-paper.svg');box-shadow:0 5px 16px #51382730;}
.map-chapter-menu[hidden] {display:none;}
.map-chapter-menu :is(a,button) {display:block;box-sizing:border-box;width:100%;padding:11px 9px;min-height:44px;border:0;background:none;text-align:left;text-decoration:none;color:#543b2c;font:16px/1.4 'Playpen Sans',system-ui;cursor:pointer;}
.map-chapter-menu [aria-current=page] {text-decoration:underline;text-underline-offset:5px;}
.map-chapter-menu :is(a,button):hover {background:#ead7b866;}
.map-site-menu:focus-visible,.map-chapter-menu :focus-visible {outline:2px solid #9a713f;outline-offset:2px;}
.map-illustrated-discoveries {position:absolute;right:62px;bottom:12px;width:118px;height:44px;z-index:1050;pointer-events:none;}
.map-illustrated-discoveries button.egg-map-carrot {left:0;right:auto;top:0;bottom:auto;}
.map-illustrated-discoveries button.egg-map-wind {left:auto;right:0;top:0;bottom:auto;}
@media(max-width:560px) {
 .map-utility-header .toggles {padding-right:8px;grid-template-columns:minmax(0,1fr) auto 44px;}
 .map-utility-header .toggles .tags {grid-column:1/-1;}
 .map-utility-header .toggles .langsw {grid-column:2;grid-row:1;}
 .map-site-menu {position:static;grid-column:3;grid-row:1;transform:none;}
 .map-illustrated-discoveries {right:40px;bottom:10px;width:105px;}
}
body.map-is-exploring > .paper-frame > header.notebook {visibility:hidden;}
.map-explore-edge {mask-image:none;}
@media(min-width:561px) and (max-width:850px) {
 .map-utility-header .toggles {display:grid;grid-template-columns:minmax(0,1fr) auto 44px;gap:3px 8px;padding-right:var(--gutter);}
 .map-utility-header .toggles .brush {grid-column:1;grid-row:1;justify-self:start;}
 .map-utility-header .toggles .langsw {grid-column:2;grid-row:1;}
 .map-utility-header .toggles .tags {grid-column:1/-1;grid-row:2;justify-content:center;}
 .map-site-menu {position:static;grid-column:3;grid-row:1;transform:none;}
}
/* Reserve the welcome artwork's space while translated images load. */
.paper-frame > .notebook .notebook-spread {aspect-ratio:1774 / 220;}
.paper-frame > .notebook .reference-masthead {position:absolute;inset:0;width:100%;height:100%;object-fit:contain;}

/* A clean join beneath the painted top edge, with room around the site menu. */
.map-utility-header .toggles {border-top:0;box-shadow:none;}
.map-utility-header .route {left:3%;right:66px;width:calc(97% - 66px);}
.map-site-menu {background:#f8ecd4;border:1px solid #d5b68e;border-radius:10px 12px 9px 11px;}
.map-illustrated-discoveries {right:14px;bottom:14px;width:44px;height:44px;}
#map .legend {position:relative;}
#map .legend .ltoggle {padding-right:32px;}
#map .legend button.egg-map-carrot {left:auto;right:0;top:-4px;bottom:auto;transform:rotate(7deg);z-index:6;}
#map:not(.hide-attrib) .map-illustrated-discoveries {bottom:32px;}

/* Phones retain the readable compact artwork; desktop uses the shallow strip. */
@media(max-width:560px) {
 .paper-frame > .notebook .notebook-spread {aspect-ratio:2172 / 360;}
}

/* Feather only the outer paint edge; the illustration and lettering stay sharp. */
.paper-frame > .notebook .reference-masthead {
 --paint-edge-x:6px; --paint-edge-y:4px;
 border-radius:9px 11px 8px 10px;
 -webkit-mask-image:linear-gradient(to right,transparent,#000 var(--paint-edge-x),#000 calc(100% - var(--paint-edge-x)),transparent),linear-gradient(to bottom,transparent,#000 var(--paint-edge-y),#000 calc(100% - var(--paint-edge-y)),transparent);
 mask-image:linear-gradient(to right,transparent,#000 var(--paint-edge-x),#000 calc(100% - var(--paint-edge-x)),transparent),linear-gradient(to bottom,transparent,#000 var(--paint-edge-y),#000 calc(100% - var(--paint-edge-y)),transparent);
 -webkit-mask-composite:source-in; mask-composite:intersect;
}
.map-explore-shell .credits p {margin:7px 0 0;}
@media(max-width:560px) {
 .paper-frame > .notebook .reference-masthead {--paint-edge-x:3px;--paint-edge-y:2px;border-radius:5px 6px 5px 7px;}
}

/* The hidden introduction must not paint above the map's sticky torn edge. */
body.map-is-exploring > .paper-frame {background:transparent;}

/* Keep the collapsed credit label to a single slim line. */
.map-explore-shell .credits {padding-block:0;line-height:1.1;}
.map-explore-shell .credits summary {line-height:1.1;}
.map-explore-shell .credits details[open] p {line-height:1.6;margin-block:7px;}

/* Let the water meet the inside of the painted frame without a footer gutter. */
.paper-frame .map-explore-shell #mapwrap {padding:0;}

/* Feather the menu's painted backing while keeping controls and popovers crisp. */
.map-explore-shell {background:transparent;}
.map-explore-shell .map-utility-header {
 position:relative;isolation:isolate;background:transparent;border:0;box-shadow:none;
}
.map-explore-shell .map-utility-header::before {
 content:"";position:absolute;inset:-3px -3px -5px;z-index:-1;pointer-events:none;
 background:#f8ecd4 url('/assets/cotton-paper.svg');
 border-radius:16px 19px 9px 12px;
 -webkit-mask-image:linear-gradient(to right,transparent,#000 12px,#000 calc(100% - 12px),transparent),linear-gradient(to bottom,transparent,#000 9px,#000 calc(100% - 8px),transparent);
 mask-image:linear-gradient(to right,transparent,#000 12px,#000 calc(100% - 12px),transparent),linear-gradient(to bottom,transparent,#000 9px,#000 calc(100% - 8px),transparent);
 -webkit-mask-composite:source-in;mask-composite:intersect;
}
.map-explore-shell .map-utility-header .toggles {background:transparent;border:0;box-shadow:none;}
@media(max-width:560px) {
 .map-explore-shell .map-utility-header::before {inset:-2px -2px -4px;border-radius:11px 13px 8px 9px;}
}

/* A quiet watercolor surround echoes the illustrated ocean and sage land. */
html {
 background-color:#f0f5ef;
 background-image:linear-gradient(115deg,#e7f1f580,#faf6eb55 46%,#e6eff580),url('/assets/book-backdrops/faded-warm-wash-v4.svg');
 background-position:center calc(-1 * min(5vw,96px)),top center;
 background-size:100% 100%,1400px 1400px;
 background-repeat:no-repeat,repeat;
}
.paper-frame-edge::before, .paper-frame-edge::after {filter:saturate(.45) brightness(1.08);}
@media(max-width:600px) {html {background-size:100% 100%,900px 900px;}}

/* Sunlight and small city details continue the books' new LA surroundings. */
html {
 background-color:#fbf3e5;
 background-image:url('/assets/book-backdrops/faded-urban-surround-v4-lossless.webp'),url('/assets/book-backdrops/faded-warm-wash-v4.svg');
 background-position:center calc(-1 * min(5vw,96px)),top center;
 background-size:min(100%,1920px) auto,1400px 1400px;
 background-repeat:no-repeat,repeat;
}
@media(max-width:600px) {html {background-size:100% auto,900px 900px;}}

/* Back only the frame's paper ring: scenery stays outside, map stays visible. */
.paper-frame-edge {isolation:isolate;}
.paper-frame-edge > .map-paper-backing {
 position:absolute;inset:0;z-index:-1;box-sizing:border-box;
 border:calc(var(--frame-gap) + 1px) solid #fff1d9;
 clip-path:inset(max(3px,calc(var(--frame-gap) * .27)) round 15px);
 pointer-events:none;
}

@media(max-width:660px) {html {background-size:1100px auto,900px 900px;background-position:center top,top center;}}

/* A fuller welcome banner, with natural proportions and only a small edge crop. */
.paper-frame > .notebook .notebook-spread {aspect-ratio:1774/220;}
.paper-frame > .notebook .reference-masthead {object-fit:contain;object-position:center;}
@media(max-width:560px) {.paper-frame > .notebook .notebook-spread {aspect-ratio:2172/360;}}
/* Clean paper joins beneath the illustrated frame; no dark feathered inner edge. */
.map-explore-shell .map-utility-header::before {inset:0;border-radius:0;-webkit-mask-image:none;mask-image:none;background-color:#fbf2df;}
.langsw .lang-panel {padding:4px;}
.langsw .lang-opt {min-height:32px;padding:3px 9px;line-height:1.3;}
@media(pointer:coarse) {.langsw .lang-opt {min-height:44px;}}
/* Let long native invitations wrap within their own grid cell on narrow phones. */
@media(max-width:560px) {
 .map-utility-header .toggles .brush {min-width:0;max-width:100%;box-sizing:border-box;white-space:normal;overflow-wrap:anywhere;line-height:1.35;padding-inline:6px;transform:none;}
}
/* Match the utility strip to the solid paper ring around it. */
.map-explore-shell .map-utility-header::before {background:#fff1d9;}
/* Native lettering uses complete, self-hosted subsets rather than mixed fallbacks. */
html[data-lang=ja] {--map-menu-font:'Map Menu ja','Hiragino Maru Gothic ProN',sans-serif;--map-menu-size:17px;--map-menu-weight:600;}
html[data-lang=ko] {--map-menu-font:'Map Menu ko','Apple SD Gothic Neo',sans-serif;--map-menu-size:20px;--map-menu-weight:400;}
html[data-lang=zh] {--map-menu-font:'Map Menu zh','PingFang SC',sans-serif;--map-menu-size:17px;--map-menu-weight:400;}
html[data-lang=zh-Hant] {--map-menu-font:'Map Menu zh-Hant','PingFang TC',sans-serif;--map-menu-size:17px;--map-menu-weight:400;}
html:not([data-lang=en]) .hf-illustrated-masthead nav a {font-family:var(--map-menu-font);font-size:var(--map-menu-size);font-weight:var(--map-menu-weight);line-height:1.28;}
html:not([data-lang=en]) .hf-illustrated-masthead .hf-nav-label {line-height:1.28;min-height:46px;text-wrap:balance;word-break:keep-all;}
html:not([data-lang=en]) .hf-illustrated-masthead :is(.hf-menu-button,.hf-menu-button [data-menu-label]) {font-family:var(--map-menu-font);font-size:18px;font-weight:var(--map-menu-weight);}
html:not([data-lang=en]) .map-chapter-menu :is(a,button),html:not([data-lang=en]) .langsw :is(.lang-trigger,.lang-opt) {font-family:var(--map-menu-font);font-size:16px;font-weight:var(--map-menu-weight);line-height:1.4;}
@media(min-width:621px) {
 html:not([data-lang=en]) .hf-illustrated-masthead nav a {display:grid;grid-template-rows:44px 46px;gap:5px;align-content:start;justify-items:center;}
 html:not([data-lang=en]) .hf-illustrated-masthead .hf-nav-label {height:46px;}
 .hf-nav-label .nav-phrase {display:block;white-space:nowrap;}
}
@media(max-width:620px) {
 html:not([data-lang=en]) .hf-illustrated-masthead .hf-nav-label {min-height:0;line-height:1.4;}
 .hf-nav-label .nav-phrase {display:inline;}
 .hf-nav-label .nav-phrase + .nav-phrase::before {content:' ';}
}
@media(min-width:621px) {
 html:not([data-lang=en]) .hf-illustrated-masthead nav a {grid-template-columns:minmax(0,1fr);justify-content:stretch;}
 html:not([data-lang=en]) .hf-illustrated-masthead .hf-nav-art {justify-self:center;align-self:center;margin:0;}
 html:not([data-lang=en]) .hf-illustrated-masthead .hf-nav-label {justify-self:center;}
}
html:not([data-lang=en]) .hf-illustrated-masthead .hf-nav-label {line-height:1.2;}
html[data-lang=ko] .hf-illustrated-masthead .hf-nav-label {line-height:1.05;}
@media(min-width:621px) and (max-width:1050px) {
 html[data-lang=ja] #hf-navigation a:not([data-nav-key=world]) .nav-phrase {display:inline;}
}
@media(max-width:620px) {
 html[data-lang=ja] .hf-nav-label .nav-phrase + .nav-phrase::before {content:'';}
}
/* Native two-line captions must contribute their full height to the masthead. */
@media(min-width:1051px) {
 html:not([data-lang=en]) .map-nav-shell .hf-masthead nav a {
  height:auto;min-height:100px;grid-template-rows:44px minmax(46px,auto);padding-bottom:8px;
 }
 html:not([data-lang=en]) .map-nav-shell .hf-nav-label {height:auto;min-height:46px;}
 html:not([data-lang=en]) .hf-masthead-shell.map-nav-shell {margin-block-end:4px;}
}


/* Original raster frame, with cutout remnants matched to the paper backing. */
body {--frame-gap:26px;}
.paper-frame-edge {--frame-art:url('assets/original-frame-wide-clean-v2.webp');}
.paper-frame-edge::before,.paper-frame-edge::after {filter:none;}
@media(max-width:600px) {
 body {--frame-gap:12px;}
 .paper-frame-edge {--frame-art:url('assets/original-frame-portrait-clean-v2.webp');}
}
/* Let the original peach watercolor stock meet the torn rim, rather than a flat beige mat. */
.paper-frame {background:#fcd6b3 url('assets/watercolor-paper.webp') repeat;}
.paper-frame-edge > .map-paper-backing {
 border-color:transparent;
 border-image:url('assets/watercolor-paper.webp') 10 / calc(var(--frame-gap) + 1px) / 0 stretch;
}
/* Retain the darker original frame with a subtle fade only on the top exterior wash. */
.paper-frame-edge {--frame-art:url('assets/original-frame-wide-top-cloud-v3.webp');}
.paper-frame-edge > .map-paper-backing {clip-path:inset(3% max(3px,calc(var(--frame-gap) * .27)) max(3px,calc(var(--frame-gap) * .27)) round 15px);}
@media(max-width:600px) {
 .paper-frame-edge {--frame-art:url('assets/original-frame-portrait-top-cloud-v3.webp');}
 .paper-frame-edge > .map-paper-backing {clip-path:inset(1.6% max(3px,calc(var(--frame-gap) * .27)) max(3px,calc(var(--frame-gap) * .27)) round 15px);}
}
