/* A phone can stay upright for the entire visit. */
:root { --app-height: 100vh; --browser-guide-height: 0px; }
@supports (height: 100dvh) { :root { --app-height: 100dvh; } }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
#exhibition { height: var(--app-height); }
#entrance, #gallery, #viewer, .reading-page {
  top: var(--browser-guide-height); bottom: auto;
  height: calc(var(--app-height) - var(--browser-guide-height));
}
body.browser-guide-visible { --safe-top: 0px; }
#exhibition:fullscreen > section { top: 0; height: 100%; }
#viewer-content { position: absolute; inset: 0; }

/* One scroll surface keeps reading separate from horizontal photo swipes. */
#viewer.mobile-reading { background: #f3f0e7; color: #263e32; }
#viewer.mobile-reading #viewer-content {
  top: var(--reading-top, 76px); bottom: var(--reading-bottom, 74px);
  overflow-x: hidden; overflow-y: auto; overscroll-behavior-y: contain;
  scrollbar-width: thin; scrollbar-color: #a7b1a1 transparent;
  -webkit-overflow-scrolling: touch; scroll-padding-top: 16px;
}
#viewer.mobile-reading #image-stage {
  position: relative; inset: auto; width: 100%;
  height: var(--reading-photo-height, 42vh);
  background: #122019; touch-action: pan-y;
}
#viewer.mobile-reading.is-infographic #image-stage { touch-action: none; background: #e4e7dc; }
#viewer.mobile-reading.is-video #image-stage { touch-action: auto; }
#viewer.mobile-reading #full-image,
#viewer.mobile-reading #preview-image { object-fit: contain; }
#viewer.mobile-reading .viewer-shade { display: none; }
#viewer.mobile-reading .viewer-header { top: calc(10px + var(--safe-top)); }
#viewer.mobile-reading .viewer-header .glass-button {
  color: #263e32; background: #e4e8dd; border: 0; backdrop-filter: none;
}
#viewer.mobile-reading .viewer-location { text-shadow: none; }
#viewer.mobile-reading #viewer-chapter { font-size: 14px; color: #263e32; }
#viewer.mobile-reading #viewer-count { color: #647461; }
#viewer.mobile-reading:not(.is-infographic) .image-tools { display: none; }
#viewer.mobile-reading.is-infographic .image-tools .glass-button,
#viewer.mobile-reading.is-infographic #zoom-label {
  color: #263e32; background: #e4e8dd; border-color: #263e3222; backdrop-filter: none;
}
#viewer.mobile-reading .caption {
  position: relative; inset: auto; width: 100%; max-width: none;
  max-height: none; margin: 0; padding: 22px 24px 32px;
  background: transparent; border: 0; border-radius: 0; color: #263e32;
  box-shadow: none; text-shadow: none; backdrop-filter: none; overflow: visible;
}
#viewer.mobile-reading .caption::before { display: none; }
#viewer.mobile-reading .caption-heading { align-items: baseline; gap: 4px 12px; }
#viewer.mobile-reading .photo-date { color: #63735f; font-size: 13px; letter-spacing: .05em; }
#viewer.mobile-reading #photo-place { color: #63735f; font-size: 10px; letter-spacing: .055em; }
#viewer.mobile-reading #caption-body {
  max-height: none; overflow: visible; margin-top: 14px; padding: 0;
}
#viewer.mobile-reading #photo-description {
  color: #263e32; font-size: clamp(18px, 4.9vw, 20px); line-height: 1.85;
  word-break: keep-all; overflow-wrap: break-word;
}
#viewer.mobile-reading .caption-original {
  font-size: 13px; color: #526b54; border-color: #526b5466;
  min-height: 44px; margin-top: 18px;
}
#viewer.mobile-reading .viewer-footer {
  background: #f3f0e7f5; border-top: 1px solid #263e3226;
  box-shadow: 0 -5px 18px #233c2908;
}
#viewer.mobile-reading .nav-photo { background: #244a37; color: #fffdf1; }
#viewer.mobile-reading .viewer-secondary .glass-button { color: #354d3b; }
#viewer.mobile-reading #image-loading {
  top: calc(var(--reading-top) + 16px); bottom: auto; font-size: 12px;
  color: #f7f4e9; background: #132e23e6;
}
#viewer.mobile-reading #image-error { color: #fffdf1; }
#viewer.mobile-reading.story-hidden #viewer-content { overflow: hidden; }

@media (max-width: 760px), (pointer: coarse), (max-width: 1024px) and (max-height: 600px) {
  /* The joystick and guided walk occupy separate thumb areas. */
  .world-bottom { left: 12px; right: 12px; bottom: 16px; justify-content: flex-end; }
  .world-bottom .movement, .world-bottom .walk-help { display: none; }
  .guided-walk { width: auto; max-width: calc(100% - 150px); flex-direction: column; gap: 8px; }
  .guided-walk > div { display: flex; gap: 5px; }
  .guided-walk .glass-button { padding: 8px 10px; min-height: 46px; font-size: 12px; }
  .guided-walk .primary-button { width: 100%; min-height: 50px; font-size: 14px; padding: 10px; }
  #easel-prev { width: 44px; flex: 0 0 44px; }
  #easel-next { flex: 1; white-space: nowrap; }
  #aim-label { top: calc(50% + 24px); max-width: 86%; }
  .gallery-footer { gap: 4px; }
  .gallery-header { flex-wrap: wrap; }
  #gallery { grid-template-rows: calc(100px + var(--safe-top)) minmax(0, 1fr) calc(50px + var(--safe-bottom)); }
  .gallery-header { display: grid; grid-template-columns: 1fr auto; grid-template-rows: 48px 42px; padding: var(--safe-top) 12px 6px; gap: 0 8px; }
  .gallery-brand .serif { font-size: 18px; }
  .gallery-brand .icon-button { margin-left: -8px; }
  .gallery-header > #open-index { grid-column: 2; grid-row: 1; font-size: 12px; padding: 6px 10px; }
  .gallery-header > #open-index span { font-size: 14px; margin-left: 4px; }
  .region-picker { grid-column: 1 / -1; grid-row: 2; width: 100%; margin: 0; }
  .region-picker select { width: 100%; max-width: none; font-size: 13px; min-height: 38px; height: 38px; padding: 6px 12px; }
  #index-dialog { height: var(--app-height); max-height: var(--app-height); }
  .cover-copy { bottom: calc(66px + var(--safe-bottom)); }
  .cover-copy h1 { font-size: clamp(39px, 10.6vw, 61px); }
  .cover-footer { bottom: calc(18px + var(--safe-bottom)); }
}
@media (max-width: 359px) {
  #viewer.mobile-reading .caption { padding: 20px 20px 28px; }
  .guided-walk { max-width: calc(100% - 135px); gap: 6px; }
  .guided-walk .glass-button { padding: 8px 6px; font-size: 11px; }
  .guided-walk .primary-button { font-size: 13px; }
  #easel-prev { width: 42px; flex-basis: 42px; }
  .viewer-secondary #story-toggle { font-size: 11px; padding: 8px 5px; }
  .cover-copy { left: 20px; right: 20px; }
}
@media (max-height: 600px) and (orientation: portrait) {
  .cover-copy { top: 104px; bottom: auto; }
  .cover-copy .eyebrow { margin-bottom: 10px; }
  .cover-copy h1 { font-size: 36px; }
  .cover-intro { margin: 14px 0; }
}
@media (orientation: landscape) and (max-height: 600px) {
  #gallery { grid-template-rows: calc(54px + var(--safe-top)) minmax(0,1fr) calc(42px + var(--safe-bottom)); }
  .gallery-header { display: flex; flex-wrap: nowrap; padding: var(--safe-top) 14px 0; gap: 12px; }
  .region-picker { margin-left: auto; width: auto; }
  .region-picker select { max-width: 180px; }
  .gallery-brand .serif { font-size: 18px; }
  .guided-walk { max-width: 215px; }
  .guided-walk .primary-button { min-height: 44px; }
  .world-bottom { bottom: 12px; }
}

/* A portrait photograph and its story can share a short, wide screen. */
@media (orientation: landscape) and (max-height: 600px) {
  #viewer.mobile-wide-orientation.is-portrait:not(.story-hidden) #image-stage {
    inset: calc(65px + var(--safe-top)) 0 calc(72px + var(--safe-bottom)) 43%;
  }
  #viewer.mobile-wide-orientation.is-portrait:not(.story-hidden) .caption {
    top: calc(65px + var(--safe-top)); bottom: calc(76px + var(--safe-bottom));
    left: max(12px, env(safe-area-inset-left)); width: calc(43% - 24px);
    max-width: none; max-height: none; padding: 12px 14px; overflow: auto;
  }
  #viewer.mobile-wide-orientation.is-portrait #caption-body { max-height: none; overflow: visible; }
  #viewer.mobile-wide-orientation.is-portrait #photo-description { font-size: 18px; line-height: 1.75; }
}

/* Mobile exhibition refinement: reading, grouped food, and a separate detail view. */
#viewer.mobile-reading #photo-description { font-size: clamp(12px, 3.27vw, 13.333px); line-height: 1.85; }
#viewer.mobile-reading .caption { padding: 18px 22px 24px; }
#viewer.mobile-reading #caption-body { margin-top: 10px; }
#viewer.mobile-reading.story-hidden #viewer-content { overflow-y: auto; }
#photo-focus { position: absolute; z-index: 2; right: 10px; bottom: 10px; display: grid; place-items: center; width: 44px; height: 44px; min-height: 44px; padding: 0; color: #fffdf2; background: #17291da6; border: 0; border-radius: 50%; opacity: 0; pointer-events: none; transition: opacity .15s; }
#photo-focus svg { display: block; }
#photo-focus:focus-visible { opacity: 1; pointer-events: auto; }
@media (hover: hover) and (pointer: fine) {
  #image-stage:hover #photo-focus { opacity: 1; pointer-events: auto; }
}
#food-panel { touch-action: pan-y; width: min(100%, 860px); margin: auto; padding: 16px 16px 0; }
#food-progress { margin: 0 0 14px; font-size: 13px; color: #526750; }
#food-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.food-card { position: relative; display: grid; place-items: center; min-width: 0; width: 100%; aspect-ratio: 3 / 4; padding: 0; overflow: hidden; background: #17241b; border-radius: 4px; }
.food-card img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: contain; }
.food-name { position: absolute; z-index: 2; left: 0; right: 0; bottom: 0; padding: 28px 12px 12px; color: #fff; background: linear-gradient(transparent, #08180fea); text-align: left; font-size: 13px; line-height: 1.5; pointer-events: none; }
.food-hint { font-size: 11px; margin: 12px 0 18px; color: #64725f; }
#viewer.is-food, #viewer.is-reading-info { background: #f3f0e7; color: #263e32; }
#viewer.is-food .viewer-shade, #viewer.is-reading-info .viewer-shade { display: none; }
#viewer.is-food .viewer-header .glass-button, #viewer.is-reading-info .viewer-header .glass-button { color: #263e32; background: #e4e8dd; backdrop-filter: none; }
#viewer.is-food .viewer-location, #viewer.is-reading-info .viewer-location { text-shadow: none; color: #263e32; }
#viewer.is-food #viewer-count, #viewer.is-reading-info #viewer-count { text-shadow: none; color: #647461; }
#viewer.is-reading-info .image-tools, #viewer.is-food .image-tools { display: none; }
#viewer.is-food:not(.mobile-reading) #viewer-content, #viewer.is-reading-info:not(.mobile-reading) #viewer-content { top: 86px; bottom: 100px; overflow: auto; }
#viewer.is-food:not(.mobile-reading) #food-grid { max-width: 640px; margin: auto; }
#viewer.is-food .viewer-footer, #viewer.is-reading-info .viewer-footer { background: #f3f0e7; }
#viewer.is-food .viewer-secondary .glass-button, #viewer.is-reading-info .viewer-secondary .glass-button { color: #354d3b; }
#info-reading { max-width: 720px; margin: auto; padding: 24px 24px 12px; color: #263e32; }
#info-reading h1 { font-size: clamp(25px, 6.6vw, 34px); line-height: 1.4; letter-spacing: -.04em; margin: 0 0 28px; word-break: keep-all; }
#info-reading section { padding: 18px 0; border-top: 1px solid #294b3729; }
#info-reading h2 { font-size: 16px; line-height: 1.6; margin: 0 0 10px; word-break: keep-all; }
#info-reading p, #info-reading li { font-size: 14px; line-height: 1.85; word-break: keep-all; overflow-wrap: break-word; white-space: pre-line; }
#info-reading ul { padding-left: 20px; }
#info-reading li + li { margin-top: 7px; }
.info-original { min-height: 44px; margin: 20px 0 8px; padding: 10px 14px; color: #294b37; background: #e4e8db; border: 1px solid #294b3729; border-radius: 6px; font-size: 13px; }
#focus-close { position: absolute; z-index: 8; right: max(14px, env(safe-area-inset-right)); top: calc(12px + var(--safe-top)); min-height: 44px; background: #193025e8; color: #fffef1; }
#focus-help { position: absolute; z-index: 5; bottom: calc(18px + var(--safe-bottom)); left: 15px; right: 15px; text-align: center; font-size: 11px; color: #f5f1e3; pointer-events: none; text-shadow: 0 1px 5px #000; }
#viewer.is-focused { background: #101b14; }
#viewer.is-focused .viewer-header, #viewer.is-focused .viewer-footer, #viewer.is-focused .viewer-shade,
#viewer.is-focused #caption, #viewer.is-focused #food-panel, #viewer.is-focused #info-reading,
#viewer.is-focused #photo-focus { display: none !important; }
#viewer.is-focused #viewer-content { inset: 0; overflow: hidden; }
#viewer.is-focused #image-stage { position: absolute; inset: 0; width: 100%; height: 100%; background: #101b14; touch-action: none; cursor: zoom-in; }
#viewer.is-focused #full-image, #viewer.is-focused #preview-image { object-fit: contain; }
#viewer.is-focused.is-zoomed #image-stage { cursor: grab; }
#viewer.is-focused .image-tools, #viewer.mobile-reading.is-focused .image-tools { display: flex; z-index: 8; top: calc(12px + var(--safe-top)); bottom: auto; left: max(14px, env(safe-area-inset-left)); right: auto; }
#viewer.is-focused .image-tools .glass-button, #viewer.is-focused #zoom-label { min-height: 44px; background: #193025e8; color: #fffef1; border: 1px solid #fff3; }
#viewer.is-focused #fit-toggle, #viewer.is-focused #fullscreen { display: none; }
#viewer.is-focused #food-name { bottom: calc(45px + var(--safe-bottom)); padding: 24px; }
#viewer.is-focused #image-loading { top: 50%; }
#viewer.is-focused.is-zoomed #focus-help { display: none; }
#index-shortcuts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding: 20px 24px 0; }
#index-shortcuts button { display: grid; grid-template-columns: 1fr auto; gap: 7px; min-height: 80px; padding: 14px; background: #e7ead7; color: #243f2e; border-radius: 6px; font-size: 14px; text-align: left; }
#index-shortcuts small { grid-column: 1; font-size: 11px; color: #50664c; }
#index-shortcuts span { grid-column: 2; grid-row: 1 / 3; align-self: center; font-size: 22px; }
#ending-title:focus:not(:focus-visible), #index-title:focus:not(:focus-visible) { outline: none; }
.intro-start { margin: 22px 0 30px; }
@media (max-width: 760px), (pointer: coarse), (max-width: 1024px) and (max-height: 600px) {
  #gallery { grid-template-rows: calc(62px + var(--safe-top)) minmax(0, 1fr) calc(32px + var(--safe-bottom)); }
  .gallery-header { display: flex; flex-wrap: nowrap; justify-content: space-between; padding: var(--safe-top) 12px 0; gap: 6px; }
  .gallery-header .region-picker { display: none; }
  .gallery-brand .serif { font-size: 16px; white-space: nowrap; }
  .gallery-header > #open-index { font-size: 12px; min-height: 44px; padding: 7px 9px; color: #243f2e; background: #e8ebdf; border-radius: 6px; }
  .gallery-header > #open-index #forest-city { font-size: 12px; margin: 0; }
  .gallery-footer { padding: 0 12px var(--safe-bottom); }
  #viewer.mobile-wide-orientation #photo-description { font-size: 13px; line-height: 1.75; }
  #index-shortcuts { padding: 16px 16px 0; gap: 8px; }
  #index-shortcuts button { padding: 12px; font-size: 13px; }
  #info-reading { padding: 20px 22px 12px; }
}
@media (orientation: landscape) and (max-height: 600px) {
  #viewer.is-food:not(.is-focused) #food-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); max-width: 860px; }
}
#viewer.is-mobile-view #fullscreen { display: none; }
#viewer.mobile-wide-orientation #photo-focus { top: calc(64px + var(--safe-top)); bottom: auto; }


/* Quiet, single-line mobile controls; the full 44px tap targets remain. */
#viewer.is-mobile-view .viewer-header {
  top: var(--safe-top); left: max(10px, env(safe-area-inset-left)); right: max(10px, env(safe-area-inset-right));
  height: 44px; grid-template-columns: 80px minmax(0, 1fr) 44px; gap: 4px;
}
#viewer.is-mobile-view .viewer-header .glass-button,
#viewer.is-mobile-view .viewer-header #close-viewer {
  min-height: 44px; height: 44px; padding: 0 4px; border: 0; border-radius: 0;
  background: transparent; box-shadow: none; backdrop-filter: none; font-size: 11px; line-height: 1;
}
#viewer.is-mobile-view .viewer-location { flex-direction: row; align-items: center; gap: 7px; line-height: 1; }
#viewer.is-mobile-view #viewer-chapter { font-size: 12px; font-weight: 400; min-width: 0; }
#viewer.is-mobile-view #viewer-count { flex-shrink: 0; font-size: 10px; letter-spacing: 0; }
#viewer.is-mobile-view .viewer-footer {
  padding: 0 max(8px, env(safe-area-inset-right)) var(--safe-bottom) max(8px, env(safe-area-inset-left));
  grid-template-columns: 56px minmax(0, 1fr) 56px; gap: 4px; box-shadow: none; backdrop-filter: none;
  border-top: 1px solid #ffffff18;
}
#viewer.is-mobile-view .viewer-footer .nav-photo {
  width: 56px; height: 44px; min-height: 44px; padding: 0 4px; gap: 5px;
  border: 0; border-radius: 0; background: transparent; color: #f5f1e8; font-size: 11px;
}
#viewer.is-mobile-view .nav-photo span[aria-hidden] { font-size: 15px; }
#viewer.is-mobile-view .viewer-secondary { gap: 6px; }
#viewer.is-mobile-view .viewer-secondary .glass-button {
  min-height: 44px; height: 44px; padding: 0 5px; background: transparent; border: 0; border-radius: 0;
  font-size: 11px; line-height: 1; box-shadow: none;
}
#viewer.mobile-reading .viewer-footer { background: #f3f0e7; border-top-color: #263e321a; }
#viewer.mobile-reading .viewer-footer .nav-photo,
#viewer.is-mobile-view.is-food .viewer-footer .nav-photo,
#viewer.is-mobile-view.is-reading-info .viewer-footer .nav-photo { color: #354d3b; }
#viewer.is-mobile-view .image-tools { top: calc(44px + var(--safe-top)); }
#viewer.mobile-wide-orientation #photo-focus { top: calc(48px + var(--safe-top)); bottom: auto; }
#viewer.is-mobile-view.is-focused .image-tools { top: calc(12px + var(--safe-top)); }
#viewer.is-mobile-view #viewer-content { touch-action: pan-y; }
#viewer.is-mobile-view.is-focused #viewer-content { touch-action: none; }
@media (max-width: 760px), (pointer: coarse) {
  .intro-content { margin-top: 24px; }
  .intro-content > .intro-text { margin-top: 0; }
}

/* Original infographic images stay visible; their transcription is available to
   screen readers without replacing the exhibition's graphic composition. */
#info-reading.infographic-transcript {
  position: absolute !important; width: 1px !important; height: 1px !important;
  margin: -1px !important; padding: 0 !important; border: 0 !important;
  clip: rect(0, 0, 0, 0) !important; clip-path: inset(50%) !important;
  overflow: hidden !important; white-space: nowrap !important;
}
/* Phones enlarge images with two fingers. Remove the zoom toolbar rather than
   reserving an empty row above the artwork. The close button remains separate. */
#viewer.is-mobile-view .image-tools,
#viewer.is-mobile-view.is-focused .image-tools { display: none; }
#viewer.mobile-wide-orientation.is-infographic:not(.is-focused) #image-stage {
  inset: calc(44px + var(--safe-top)) 0 calc(44px + var(--safe-bottom));
}

/* Food details form a single vertical scroll, with the name on the photograph
   and the author's note below it. The underlying food page keeps its position. */
#focus-food-note {
  width: min(100%, 680px); margin: 0 auto; padding: 20px 24px calc(32px + var(--safe-bottom));
  color: #e7eadf; font-size: 13.333px; line-height: 1.85; white-space: pre-line;
  word-break: keep-all; overflow-wrap: break-word; touch-action: pan-y;
}
#viewer.is-focused.has-food-note #viewer-content {
  top: 0; bottom: 0; overflow-x: hidden; overflow-y: auto; overscroll-behavior-y: contain;
  touch-action: pan-y; -webkit-overflow-scrolling: touch;
}
#viewer.is-focused.has-food-note #image-stage {
  position: relative; inset: auto; width: 100%; height: var(--focus-photo-height, 65vh);
  margin-top: calc(62px + var(--safe-top)); touch-action: none;
}
#viewer.is-focused.has-food-note #food-name { bottom: 0; padding: 30px 22px 14px; }
#viewer.is-focused.has-food-note #focus-help { display: none; }
#viewer.is-mobile-view #focus-food-note { font-size: clamp(12px, 3.27vw, 13.333px); padding-left: 22px; padding-right: 22px; }
#viewer.is-focused.has-food-note #image-loading { top: calc(74px + var(--safe-top)); }
#viewer.is-focused.has-food-note #image-error { top: calc(74px + var(--safe-top)); bottom: auto; }
@media (orientation: landscape) and (max-height: 600px) {
  #viewer.is-focused.has-food-note #image-stage { margin-top: calc(52px + var(--safe-top)); }
}

/* Anchor food names to the actual contained image in either orientation. */
#viewer.is-focused #image-stage > #food-name {
  left: var(--food-name-inline-inset, 0px); right: var(--food-name-inline-inset, 0px);
  bottom: var(--food-name-bottom-inset, 0px); padding: 28px 12px 12px;
}
#viewer.is-focused.is-zoomed #food-name { display: none; }
