/* Where Cloth Begins: one full-window picture, the words beside it, nothing else unless asked for.
   Set in Studio Bagru's type and palette (docs/DESIGN.md in the site repo): Fraunces for display, Instrument Sans
   for text and labels, black and iron on paper. Colour lives only in the picture. Hairlines, no shadows. */
:root {
  --paper: #ffffff; --paper-2: #fafaf8; --cloth: #f2f1ec; --ink: #111111; --ink-2: #55534f; --ink-3: #6b6a66;
  --line: #e4e2dc; --line-strong: #c8c5bd;
  --display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --body: "Instrument Sans", "Helvetica Neue", Arial, system-ui, sans-serif;
  --gutter: clamp(1.25rem, 4.5vw, 4.5rem); --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; overscroll-behavior: none; }
body { margin: 0; overflow: hidden; background: var(--paper); color: var(--ink); font: 400 17px/1.6 var(--body); -webkit-font-smoothing: antialiased; }
#stage { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }
body[data-mode='choose'] #stage, body[data-mode='material'] #stage { cursor: grab; }
body.dragging #stage { cursor: grabbing; }
/* drags and pinches on the picture and the words turn, zoom and move the story; only the panels scroll by themselves */
#ui { position: fixed; inset: 0; pointer-events: none; touch-action: none; }
#ui > * { pointer-events: auto; }
button { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }

/* the masthead: the site's own slim bar (wordmark, hairline; the black menu pill sits over its corner), then this
   page's row: where you are, and two controls */
.top { position: absolute; top: 0; left: 0; right: 0; pointer-events: none; }
.bar { display: flex; justify-content: center; align-items: center; min-height: 72px; padding: 0 var(--gutter); background: var(--paper); border-bottom: 1px solid var(--line); pointer-events: auto; }
.bar__brand { display: block; }
.bar__brand img { display: block; width: clamp(11rem, 9rem + 6vw, 14rem); height: auto; }
.sub { display: flex; align-items: center; gap: 8px; padding: 10px var(--gutter); }
.sub > * { pointer-events: auto; }
.crumbs { flex: 1; min-width: 0; display: flex; align-items: baseline; font: 500 12px/1.3 var(--body); color: var(--ink-3); text-transform: uppercase; letter-spacing: .08em; white-space: nowrap; }
.crumbs a { flex: none; text-decoration: none; color: var(--ink-2); }
.crumbs a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: .2em; }
.crumbs a::after { content: '/'; display: inline-block; margin: 0 9px; color: var(--line-strong); }
.crumbs a.title:has(+ #crumbs:empty)::after { content: none; }
#crumbs { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.chip { flex: none; border: 1px solid var(--line-strong); background: var(--paper); border-radius: 999px; padding: 0 14px; min-height: 36px; font: 500 13px/1 var(--body); cursor: pointer; }
.chip:hover, .chip[aria-pressed='true'] { border-color: var(--ink); }

/* the site's menu, as on every page of studiobagru.com (src/components/Header.astro): the black pill with the rosette
   and three lines, opening a white panel from its own corner over a blurred page */
.menu-btn { position: fixed; top: 1rem; right: 1rem; z-index: 60; display: inline-flex; align-items: center; gap: .7rem; min-height: 48px; padding: .5rem .95rem .5rem .6rem; border: 0; border-radius: 999px; background: #000; color: #fff; cursor: pointer; transition: background-color 220ms; }
.menu-btn:hover { background: #262624; }
.menu-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; box-shadow: 0 0 0 4px #000; }
.menu-btn__mark { width: 30px; height: 30px; filter: invert(1); border-radius: 50%; display: block; }
.burger { position: relative; width: 22px; height: 16px; }
.burger span { position: absolute; left: 0; right: 0; height: 2px; background: currentColor; transition: transform 300ms var(--ease-out), opacity 200ms; }
.burger span:nth-child(1) { top: 0; } .burger span:nth-child(2) { top: 7px; } .burger span:nth-child(3) { top: 14px; }
[aria-expanded='true'] .burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
[aria-expanded='true'] .burger span:nth-child(2) { opacity: 0; }
[aria-expanded='true'] .burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }
.menu { position: fixed; inset: 0; z-index: 70; visibility: hidden; transition: visibility 0s linear 380ms; }
.menu.is-open { visibility: visible; transition: none; }
.menu__veil { position: absolute; inset: 0; background: rgba(17, 17, 17, .16); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); opacity: 0; transition: opacity 300ms var(--ease-out); }
.menu.is-open .menu__veil { opacity: 1; }
.menu__panel { position: absolute; top: 1rem; right: 1rem; width: min(27rem, 100vw - 2rem); max-height: calc(100svh - 2rem); overflow-y: auto; padding: 1.25rem 1.25rem 2rem; background: var(--paper); border-radius: 28px; box-shadow: 0 20px 60px rgba(17, 17, 17, .18); transform-origin: top right; transform: scale(.18); opacity: 0; transition: transform 380ms var(--ease-out), opacity 250ms var(--ease-out); }
.menu.is-open .menu__panel { transform: none; opacity: 1; }
.menu__bar { display: flex; justify-content: space-between; align-items: center; }
.menu__bar img { display: block; width: 9.5rem; height: auto; }
.menu__close { display: grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--cloth); color: var(--ink); cursor: pointer; }
.menu__close:hover { background: var(--line); }
.menu__links, .menu__more { list-style: none; padding: 0; }
.menu__links { display: grid; justify-items: center; gap: .15rem; margin: 2rem 0 0; }
.menu__links a { display: inline-block; padding: .2rem .5rem; font: 400 clamp(1.7rem, 1.4rem + 1vw, 2.1rem)/1.2 var(--display); text-decoration: none; }
.menu__links a:hover, .menu a[aria-current='page'] { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: .18em; }
.menu__more { display: flex; flex-wrap: wrap; justify-content: center; gap: .25rem 1.4rem; margin: 1.75rem 0 0; font-size: .92rem; color: var(--ink-2); }
.menu__more a { display: inline-flex; align-items: center; min-height: 36px; text-decoration: none; }
.menu__more a:hover { color: var(--ink); text-decoration: underline; text-underline-offset: .2em; }

/* the beats: one at a time, crossfaded by scroll position, always on clear paper */
#beats { position: absolute; inset: 0; pointer-events: none; }
.beat { position: absolute; left: clamp(20px, 7vw, 128px); top: 50%; transform: translateY(-46%); width: min(540px, 42vw); opacity: 0; visibility: hidden; pointer-events: none; }
.beat.on { visibility: visible; }
/* a soft sheet of paper behind the words, so a picture the reader has zoomed into never runs under them */
.beat::before { content: ''; position: absolute; inset: -36px -56px; z-index: -1; background: var(--paper); opacity: .9; filter: blur(22px); pointer-events: none; }
.stacked .beat::before { content: none; }
.beat.live { pointer-events: auto; }
.beat .eyebrow { font: 500 12px/1.3 var(--body); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); margin: 0 0 16px; }
.beat h1 { font: 400 clamp(54px, 7.2vw, 108px)/.96 var(--display); letter-spacing: -.02em; margin: 0 0 22px; }
.beat h2 { font: 400 clamp(36px, 4.3vw, 60px)/1.04 var(--display); letter-spacing: -.012em; margin: 0 0 20px; }
.beat h1 em, .beat h2 em { font-style: italic; }
.beat p { font-size: clamp(16px, 1.25vw, 18px); color: var(--ink-2); margin: 0 0 14px; max-width: 34em; }
.beat p.big { font: italic 400 clamp(22px, 1.9vw, 28px)/1.32 var(--display); color: var(--ink); }
.beat .meta { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; margin-top: 16px; font-size: 13px; color: var(--ink-3); }
.beat .srcbtn { border: 1px solid var(--line-strong); background: var(--paper); border-radius: 999px; padding: 7px 14px; font: 500 13px/1 var(--body); cursor: pointer; color: var(--ink); }
.beat .srcbtn:hover { border-color: var(--ink); }
sup.cite { line-height: 0; margin-left: 2px; white-space: nowrap; }
.cite button { border: 0; background: none; padding: 6px 3px; margin: -6px 0; font: 600 .72em/1 var(--body); color: var(--ink); cursor: pointer; }
.cite button:hover { text-decoration: underline; }
#sources li.at .inst { text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: .2em; }
.status { font-weight: 600; letter-spacing: .04em; text-transform: uppercase; font-size: 11px; }
.st-CONFIRMED { color: #2f6b4f; } .st-PENDING { color: #8a5a12; } .st-DERIVED { color: var(--ink-2); }
.beat .cta { margin-top: 24px; display: flex; gap: 10px; flex-wrap: wrap; }
.btn { border: 1px solid var(--ink); background: var(--ink); color: var(--paper); border-radius: 999px; padding: 12px 22px; font: 500 15px/1 var(--body); cursor: pointer; text-decoration: none; display: inline-block; }
.btn:hover { background: #262624; }
.btn.ghost { background: var(--paper); color: var(--ink); }
.btn.ghost:hover { background: var(--paper-2); }
.dives { list-style: none; padding: 0; margin: 16px 0 0; display: grid; border-top: 1px solid var(--line); }
.dives li { border-bottom: 1px solid var(--line); }
.dives a, .dives span.d { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 11px 0; text-decoration: none; font-size: 16px; }
.dives a b, .dives span.d b { font: 400 19px/1.25 var(--display); }
.dives a:hover b { text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 4px; }
.dives small { font: 600 11px var(--body); text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; color: var(--ink-3); }
.dives .s-live { color: #2f6b4f; }
.dives .where { display: block; font-size: 13px; color: var(--ink-3); }

/* choosing a material */
#choose { position: absolute; left: 0; right: 0; bottom: max(26px, env(safe-area-inset-bottom)); text-align: center; padding: 0 20px; }
#choose .kind { font: 500 12px/1.3 var(--body); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); margin: 0 0 6px; }
#choose h2 { font: 400 clamp(50px, 7vw, 96px)/1 var(--display); letter-spacing: -.02em; margin: 0 0 8px; }
#choose .from { font: italic 400 19px/1.35 var(--display); color: var(--ink); margin: 0 0 4px; }
#choose .line { font-size: 16px; color: var(--ink-2); margin: 0 auto 18px; max-width: 36em; min-height: 1.6em; }
.choose-actions { display: flex; justify-content: center; align-items: center; gap: 10px; flex-wrap: wrap; }
.nav-step { border: 1px solid var(--line-strong); background: var(--paper); border-radius: 999px; padding: 11px 18px; cursor: pointer; font: 500 14px/1 var(--body); }
.nav-step:hover { border-color: var(--ink); }
.go { border: 1px solid var(--ink); background: var(--ink); color: var(--paper); border-radius: 999px; padding: 12px 24px; font: 500 15px/1 var(--body); cursor: pointer; min-width: 220px; }
.go:hover { background: #262624; }
.dots { display: flex; justify-content: center; gap: 8px; margin-top: 16px; }
.dots button { width: 9px; height: 9px; padding: 0; border-radius: 50%; border: 1px solid var(--ink); background: transparent; cursor: pointer; }
.dots button[aria-selected='true'] { background: var(--ink); }
.dots button.research { border-color: var(--line-strong); }

/* labels on the globe */
#pins { position: absolute; inset: 0; pointer-events: none; }
.pin { position: absolute; transform: translate(12px, -50%); font: 500 13px/1.2 var(--body); white-space: nowrap; padding: 6px 10px; border-radius: 10px; background: rgba(255, 255, 255, .92); border: 1px solid var(--line); opacity: 0; transition: opacity .25s; pointer-events: none; text-decoration: none; color: var(--ink); }
.pin.show { opacity: 1; pointer-events: auto; }
.pin.flip { transform: translate(calc(-100% - 12px), -50%); }
.pin.dive b { font: 400 15px/1.2 var(--display); }
.pin.dive small { display: block; margin-top: 2px; text-transform: uppercase; letter-spacing: .06em; font-size: 10.5px; color: var(--ink-3); }
.pin.dive small.s-live { color: #2f6b4f; }
a.pin.dive:hover { border-color: var(--ink); }

/* sources */
#sources { z-index: 2; touch-action: pan-y; position: absolute; right: 16px; top: 132px; bottom: 16px; width: min(440px, calc(100vw - 32px)); overflow: auto; background: var(--paper-2); border: 1px solid var(--line-strong); border-radius: 10px; padding: 18px 20px; }
#sources h3 { font: 500 12px/1.3 var(--body); letter-spacing: .08em; text-transform: uppercase; margin: 0 0 14px; display: flex; justify-content: space-between; align-items: center; color: var(--ink-2); }
#sources h3 button { border: 1px solid var(--line-strong); background: var(--paper); border-radius: 999px; padding: 6px 12px; cursor: pointer; font: 500 12px var(--body); text-transform: none; letter-spacing: 0; color: var(--ink); }
#sources ol { margin: 0; padding-left: 18px; display: grid; gap: 16px; }
#sources li { font-size: 14.5px; color: var(--ink-2); }
#sources .inst { color: var(--ink); font-weight: 600; }
#sources p, #sources ul { font-size: 14.5px; color: var(--ink-2); margin: 0 0 12px; }
#sources ul { padding-left: 18px; }
#sources q { display: block; font: italic 400 16px/1.45 var(--display); color: var(--ink); margin: 6px 0; quotes: '“' '”'; }
#sources .note { display: block; font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }

/* the picture's own controls: drag turns it and a pinch zooms; these do the same for a mouse or a keyboard */
#view { position: absolute; right: var(--gutter); bottom: max(26px, env(safe-area-inset-bottom)); display: flex; gap: 6px; }
#view button { display: grid; place-items: center; min-width: 44px; height: 44px; padding: 0; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--paper); cursor: pointer; font: 500 13px/1 var(--body); }
#view button.wide { padding: 0 16px; }
#view[hidden], #view button[hidden] { display: none; }
.coarse #view button:not(.wide) { display: none; }       /* fingers pinch; the buttons are for a mouse and a keyboard */
#view button:hover { border-color: var(--ink); }
#view svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
#choose .how { margin: 14px 0 0; font: 500 11px/1.3 var(--body); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }

/* chrome */
#hint { position: absolute; left: 0; right: 0; bottom: max(22px, env(safe-area-inset-bottom)); padding: 0 16px; text-align: center; font: 500 11px/1.3 var(--body); letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); transition: opacity .4s; pointer-events: none; }
#progress { position: absolute; left: 0; right: 0; bottom: 0; height: 2px; pointer-events: none; }
#progress i { display: block; height: 100%; width: 0; background: var(--ink); }
#veil { position: absolute; inset: 0; background: var(--paper); opacity: 0; pointer-events: none; transition: opacity .42s ease; }
#veil.on { opacity: 1; }

/* the text version: the same words and sources, readable without the picture */
#text-version { position: fixed; inset: 0; overflow: auto; background: var(--paper); padding: 150px max(20px, calc((100vw - 44rem) / 2)) 96px; z-index: 5; }
body.reading #ui { z-index: 6; }
body.reading .sub { background: var(--paper); border-bottom: 1px solid var(--line); }
#text-version h1 { font: 400 clamp(44px, 6vw, 64px)/1 var(--display); margin: 0 0 16px; }
#text-version h2 { font: 400 40px/1.08 var(--display); margin: 64px 0 6px; padding-top: 18px; border-top: 2px solid var(--ink); }
#text-version h3 { font: 400 25px/1.2 var(--display); margin: 30px 0 6px; }
#text-version p { color: var(--ink-2); }
#text-version .eb { font: 500 12px var(--body); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2); }
#text-version ol.src { font-size: 14px; color: var(--ink-2); }
#text-version ol.src q { font-style: italic; }
body.reading #ui > :not(.top) { display: none; }
body.reading #stage { visibility: hidden; }
.noscript { padding: 40px; font-size: 20px; }

/* the stacked layout: the picture above, the words below. explorer.js sets .stacked from the window's shape (narrow,
   or taller than 5:4), so a tall window never gets the words laid over the picture, whatever its width; the type
   grows with the width for a tall window that is also wide (a tablet, or a phone asking for the desktop site) */
.stacked .crumbs a { display: none; }
.stacked .crumbs:has(#crumbs:empty) a.title { display: inline; }
.stacked .sub { padding-block: 8px; }
.stacked .beat { left: 0; right: 0; width: auto; top: auto; bottom: 0; transform: none; padding: 56px clamp(18px, 5vw, 64px) max(54px, calc(env(safe-area-inset-bottom) + 42px)); background: linear-gradient(rgba(255, 255, 255, 0), var(--paper) 44px); box-shadow: 0 60px 0 var(--paper); }
.stacked .beat h1 { font-size: clamp(50px, 11vw, 96px); }
.stacked .beat h2 { font-size: clamp(32px, 6vw, 56px); margin-bottom: 12px; }
.stacked .beat p { font-size: clamp(15.5px, 2.5vw, 24px); }
.stacked .beat p.big { font-size: clamp(21px, 3.4vw, 32px); }
.stacked .beat .eyebrow { margin-bottom: 10px; }
.stacked #choose { bottom: max(14px, env(safe-area-inset-bottom)); }
.stacked #choose h2 { font-size: clamp(50px, 9vw, 84px); }
.stacked .go { min-width: 0; }
.stacked #view { top: 132px; bottom: auto; right: 12px; flex-direction: column; }
.stacked #sources { top: auto; height: 64vh; bottom: 10px; right: 10px; width: calc(100vw - 20px); }
/* a short, wide window (a phone on its side): a slimmer bar and smaller type, so the words fit beside the picture */
.short .bar { min-height: 52px; }
.short .bar__brand img { width: 9rem; }
.short .menu-btn { top: 4px; min-height: 44px; padding-block: .35rem; }
.short .sub { padding-block: 4px; }
.short .crumbs a { display: none; }
.short .beat { top: calc(50% + 44px); }
.short .beat .eyebrow { margin-bottom: 6px; font-size: 11px; }
.short .beat h1 { font-size: 40px; margin-bottom: 10px; }
.short .beat h2 { font-size: 26px; margin-bottom: 8px; }
.short .beat p { font-size: 13.5px; line-height: 1.45; margin-bottom: 8px; }
.short .beat p.big { font-size: 18px; }
.short .beat .meta { margin-top: 8px; }
.short .beat .cta { margin-top: 12px; }
.short #choose { bottom: 8px; }
.short #choose h2 { font-size: 38px; margin-bottom: 2px; }
.short #choose .from { font-size: 15px; }
.short #choose .line { font-size: 13.5px; margin-bottom: 8px; min-height: 0; }
.short #choose .how, .short .dots { display: none; }
.short #sources { top: 100px; }
@media (max-width: 640px) { .bar { justify-content: flex-start; } }
@media (prefers-reduced-motion: reduce) { .menu, .menu__veil, .menu__panel, .burger span { transition: none; } .menu__panel { transform: none; } }
